/*
 * Base styles: document, typography, links, focus, code. Only var(--…) from tokens.css (no raw values).
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-family);
  font-size: 100%;
  line-height: var(--leading-md);
  color: var(--color-text-primary);
  background: var(--pe-surface-page);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: var(--text-md);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
  background: var(--pe-surface-page);
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--spacing-lg);
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semibold);
}

h1 {
  font-size: var(--display-xs);
  line-height: var(--leading-xl);
}

h2 {
  font-size: var(--text-xl);
  line-height: var(--leading-lg);
}

h3 {
  font-size: var(--text-lg);
  line-height: var(--leading-md);
}

p {
  margin: 0 0 var(--spacing-lg);
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--pe-link);
  text-decoration: underline;
  text-underline-offset: var(--pe-underline-offset);
}

a:hover {
  color: var(--pe-link-hover);
}

:focus-visible {
  outline: var(--pe-focus-width) solid var(--color-border-brand);
  outline-offset: var(--pe-focus-offset);
}

code,
pre,
kbd,
samp {
  font-family: var(--font-family-mono);
  font-size: var(--text-sm);
}

code {
  overflow-wrap: break-word;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0 0 var(--spacing-lg);
  padding-inline-start: var(--spacing-3xl);
}

hr {
  border: 0;
  border-top: var(--pe-border-width) solid var(--color-border-secondary);
  margin: var(--spacing-3xl) 0;
}

img,
svg {
  vertical-align: middle;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: var(--pe-border-width);
  height: var(--pe-border-width);
  margin: calc(var(--pe-border-width) * -1);
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--spacing-xl);
  inset-block-start: var(--spacing-xl);
  z-index: var(--pe-z-toast);
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.muted {
  color: var(--color-text-tertiary);
}

.small {
  font-size: var(--text-sm);
}

.mono {
  font-family: var(--font-family-mono);
}

.truncate {
  max-width: var(--pe-truncate-max);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
