/* ============================================================
   BASE — reset, typography, root surface + grain texture
   ============================================================ */

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

/* The `hidden` attribute must always win, even over author display rules
   like `.gate{display:grid}` (author styles otherwise beat the UA sheet). */
[hidden] { display: none !important; }

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

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  /* Subtle organic warmth: two soft radial pools + paper grain.
     Grain is an inline SVG (no extra request) at low opacity so the
     surface reads as tactile rather than flat/sterile. */
  background-image:
    radial-gradient(900px 600px at 78% -5%, rgba(240, 169, 59, 0.06), transparent 60%),
    radial-gradient(800px 600px at 0% 30%, rgba(124, 80, 40, 0.05), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  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.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg, video { display: block; max-width: 100%; height: auto; }
img { font-style: italic; color: var(--muted-2); } /* graceful alt while loading */

/* Lucide swaps each <i data-lucide> for an <svg class="lucide …">, keeping
   the class. Tag-based `i {}` rules no longer match, so set a sane default
   here (low specificity → component class rules still override it). */
.lucide { width: 1.1em; height: 1.1em; flex-shrink: 0; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
ul { list-style: none; padding: 0; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--text);
  /* balance keeps headlines from breaking into ragged/orphan lines */
  text-wrap: balance;
}
h1 { font-weight: 900; }

/* pretty prevents single-word last lines (orphans) in body copy */
p, li, figcaption, summary, .hero__deck, .estep__sub, .estep__body { text-wrap: pretty; }

em { font-style: italic; }
s { color: var(--muted-2); }

::selection { background: var(--gold); color: #1a1208; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--card-raised); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  top: 8px;
  background: var(--gold);
  color: #1a1208;
  font-weight: 700;
  padding: 0.6rem 1.2rem;
  border-radius: var(--r-sm);
  z-index: 2000;
  transition: transform var(--t) var(--ease);
}
.skip-link:focus { transform: translateX(-50%) translateY(0); }

/* Honor users who don't want motion */
@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;
  }
}
