/* base.css: skeleton reset + primitives. House-level; NEVER edit per site (spec §2). No layout, no components (site.css).
   Literals: breakpoints 48em (tablet+) / 64em (desktop+) only; any other literal needs an
   `@allow-literal: reason` comment on the preceding line (grep-audit, else BLOCKER).
   No `!important` anywhere (spec §12). 
   Full rationale: skeleton/SKELETON.md, "CSS comment rationale". */

/* --- Reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: var(--scheme);
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol {
  margin: 0;
}

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

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

/* img width+height attrs (spec §7); keeps the ratio when one axis is constrained. */
img {
  height: auto;
}

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

button {
  background: none;
  border: 0;
  cursor: pointer;
}

table {
  border-collapse: collapse;
}

/* [hidden] must win over component display values; doubled attribute = (0,2,0), no !important (spec §12).
   Never set `display` on a hideable element from specificity (0,2,0)+. */
[hidden][hidden] {
  display: none;
}

/* --- Document defaults ---------------------------------------------------- */

body {
  background-color: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: var(--font-weight-body);
  line-height: var(--leading-body);
  /* @allow-literal: full-viewport floor is structural, not a design value */
  min-height: 100vh;
}

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

/* Apply the declared scale (P7). */
h2 {
  font-size: var(--text-h2);
}

h3 {
  font-size: var(--text-h3);
}

p {
  text-wrap: pretty;
}

/* Reading measure, zero specificity (§7.3, P4). */
:where(main) :where(p, li, blockquote, dd) {
  max-width: var(--layout-measure);
}

strong, b {
  font-weight: var(--font-weight-body-strong);
}

a {
  color: inherit;
}

hr {
  border: 0;
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
}

::selection {
  background-color: var(--color-selection-bg);
  color: var(--color-selection-ink);
}

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

/* Focus ring on every interactive element (spec §8); never remove without an equal replacement.
   Every dark band must re-point outline-color at --color-focus-on-band (WCAG 1.4.11). */
:focus-visible {
  outline: var(--border-thick) var(--border-style) var(--color-focus);
  outline-offset: var(--space-3xs);
  border-radius: var(--radius-sm);
}

/* Skip link: first focusable, off-screen until focused. */
.skip-link {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: var(--layout-tap-min);
  z-index: var(--z-skip-link);
  inset-inline-start: var(--space-sm);
  inset-block-start: var(--space-sm);
  padding: var(--space-2xs) var(--space-sm);
  background-color: var(--color-accent);
  color: var(--color-accent-ink);
  font-weight: var(--font-weight-body-strong);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  /* @allow-literal: the standard visually-hidden clip box is not a design value */
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Touch-target floor (spec §8); other interactive elements opt in with data-tap. */
button,
select,
summary,
input[type='submit'],
input[type='button'],
[data-tap] {
  min-height: var(--layout-tap-min);
}

/* --- Reveal system (base states) --- data-reveal-ready on <html> (main.js) is the only arm; JS off = nothing hidden.
   Below-the-fold only, never the hero/LCP (spec §7). */

[data-reveal-ready] [data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-shift));
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
  transition-delay: calc(var(--reveal-stagger) * var(--reveal-index, 0));
}

[data-reveal-ready] [data-reveal][data-revealed] {
  opacity: 1;
  transform: none;
}

/* --- Reduced motion kill switch (spec §8, no exceptions) --- duration tokens collapse at :root; main.js also skips the observer. */

@media (prefers-reduced-motion: reduce) {
  :root {
    /* @allow-literal: a duration token must resolve to a real time value */
    --duration-fast: 0.01ms;
    --duration-base: 0.01ms;
    --duration-slow: 0.01ms;
    --reveal-shift: 0;
  }

  html {
    scroll-behavior: auto;
  }

  [data-reveal-ready] [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
    transition-delay: 0s;
  }
}
