/* ==========================================================================
   base.css — reset, element defaults, typography, shared primitives.
   Depends on: tokens.css
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

/* Offset in-page anchors so the sticky header never covers a heading. */
html { scroll-padding-top: calc(var(--header-h) + var(--space-4)); }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100svh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-med) var(--ease-out),
              color var(--dur-med) var(--ease-out);
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* --- Typography ----------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out),
              text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-accent); text-decoration-color: currentColor; }

::selection {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

/* --- Focus ---------------------------------------------------------------
   One visible focus ring for the whole site. Never remove it without
   replacing it — keyboard users navigate by this alone.
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* --- Layout primitives ---------------------------------------------------- */

/* Centered page container with responsive gutters. */
.container {
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Constrain body copy to a readable measure. */
.measure { max-width: var(--width-text); }

/* Standard vertical rhythm for a full-width band of content. */
.section { padding-block: var(--section-y); }

/* Small caps-style label used above section headings. */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --- Utilities ------------------------------------------------------------ */

/* Available to screen readers, invisible on screen. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Keyboard-only escape hatch past the nav, first element in <body>. */
.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-modal);
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--color-on-accent);
}

/* --- Buttons -------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.button:active { transform: translateY(1px); }

.button--primary {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}
.button--primary:hover {
  background-color: var(--color-accent-hover);
  color: var(--color-on-accent);
}

.button--ghost {
  background-color: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}
.button--ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* A logo or glyph sitting before a button's label. .button is already an
   inline-flex row with a gap, so this only has to size the SVG: em units so
   it tracks the label, and flex:none so a long label cannot squash it. */
.button__icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

/* --- Motion preference ----------------------------------------------------
   Honour the OS "reduce motion" setting globally. Scroll-driven reveals in
   js/modules/ check this too, so content still appears without animating.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
