/* ==========================================================================
   BASE — reset, element defaults, layout primitives.
   Every value here reads from tokens.css. No literals below this line.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: var(--weight-body);
  line-height: var(--lh-body);
  letter-spacing: var(--track-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

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

p, li, dd { text-wrap: pretty; }

/* ---- Headings ---------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--lh-heading);
  letter-spacing: var(--track-display);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); line-height: var(--lh-tight); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
h5 { font-size: var(--step-0); }
h6 { font-size: var(--step--1); letter-spacing: var(--track-caps); text-transform: uppercase; }

/* ---- Links ------------------------------------------------------------- */

a {
  color: var(--c-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}

a:hover { color: var(--c-accent-hover); }

/* ---- Focus ------------------------------------------------------------- */
/* One ring, everywhere, always visible. Do not remove this. */

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Selection --------------------------------------------------------- */

::selection {
  background: var(--c-accent-soft);
  color: var(--c-ink);
}

/* ---- Code -------------------------------------------------------------- */

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

pre {
  background: var(--c-bg-sunken);
  border: var(--border-w) solid var(--c-line);
  border-radius: var(--radius-md);
  padding: var(--s-4);
  overflow-x: auto;
}

pre code { font-size: inherit; background: none; padding: 0; border: none; }

code {
  background: var(--c-bg-sunken);
  border: var(--border-w) solid var(--c-line);
  border-radius: var(--radius-sm);
  padding: 0.12em 0.36em;
}

/* ---- Rules ------------------------------------------------------------- */

hr {
  border: none;
  border-top: var(--border-w) solid var(--c-line);
  margin-block: var(--s-6);
}

/* ==========================================================================
   LAYOUT PRIMITIVES
   ========================================================================== */

/* Page shell: centred, gutter-aware. */
.shell {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Narrow shell for running text. */
.shell--text { max-width: var(--measure); }

/* Vertical rhythm: children of a .stack get consistent spacing between them.
   Override the gap per instance with a style attribute or a modifier. */
.stack           { display: flex; flex-direction: column; gap: var(--s-4); }
.stack--tight    { gap: var(--s-2); }
.stack--loose    { gap: var(--s-6); }
.stack--section  { gap: var(--s-8); }

/* Horizontal cluster that wraps. */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

.cluster--between { justify-content: space-between; }
.cluster--end     { justify-content: flex-end; }

/* Responsive grid without media queries. */
.grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: repeat(auto-fit, minmax(min(var(--col-min), 100%), 1fr));
}

/* Section padding — applied to <section> wrappers only, so it can't collide
   with component padding. */
.band { padding-block: var(--s-8); }
.band--sunken { background: var(--c-bg-sunken); }

/* ---- Text helpers ------------------------------------------------------ */

.measure   { max-width: var(--measure); }
.t-soft    { color: var(--c-ink-soft); }
.t-faint   { color: var(--c-ink-faint); }
.t-mono    { font-family: var(--font-mono); }
.t-small   { font-size: var(--step--1); }
.t-lead    { font-size: var(--step-1); color: var(--c-ink-soft); line-height: var(--lh-body); }

/* Eyebrow: a small caps label above a heading. Use it when the label carries
   real information (a category, a status), not as decoration. */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--c-ink-faint);
}

/* ---- Accessibility ----------------------------------------------------- */

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

.skip-link {
  position: absolute;
  left: var(--s-3);
  top: calc(-1 * var(--s-9));
  z-index: 100;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}

.skip-link:focus { top: var(--s-3); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
