/* ==========================================================================
   base.css — modern reset, element defaults, parchment ground, focus,
   reduced-motion guard. (PLAN §6.1 step 2)
   ========================================================================== */

/* --- Reset ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;   /* prevent iOS text inflation */
  text-size-adjust: 100%;
  /* Sticky-header offset for anchor jumps (PLAN §14.5 SF-4). */
  scroll-padding-top: var(--wf-header-h);
}

/* Smooth-scroll only when motion is welcome (PLAN §3.4 / §10.1). */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--step-0);          /* >=16px body (iOS no-zoom) */
  line-height: 1.6;
  color: var(--c-sepia);
  background-color: var(--c-parchment);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Slightly tighter line-height on phones for a more compact read (body stays
   >=16px so iOS still won't zoom form fields). */
@media (max-width: 40rem) {
  body { line-height: 1.5; }
}

/* --- Parchment grain (PLAN §6.4) ------------------------------------------
   One CSS feTurbulence overlay, no asset, no per-section image. Fixed to the
   viewport via a sticky pseudo-layer (NOT background-attachment:fixed, which
   janks on mobile). Decorative; sits behind content and ignores pointer. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* subtle inline SVG noise; ~0.04 alpha so it reads as paper tooth, not dirt */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

img, svg, picture, video { display: block; max-width: 100%; height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: none; }

a { color: var(--c-terracotta-dk); text-underline-offset: 0.15em; }
a:hover { color: var(--c-burgundy); }

ul, ol { padding-inline-start: 1.25em; }

:root { color-scheme: light; }

/* --- Focus visibility (BRIEF §8) ------------------------------------------
   2px ring + offset using --c-focus on light surfaces. Components placed on
   terracotta/dark fills override to --c-focus-on-dark (PLAN §14.5 SF-6). */
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Remove default outline only where :focus-visible is supported. */
:focus:not(:focus-visible) { outline: none; }

/* --- Reduced-motion global guard (PLAN §10.1) ------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Hide elements the i18n/JS layer reveals progressively. */
[hidden] { display: none !important; }
