/* ==========================================================================
   BASE — reset, typography, layout primitives, utilities.
   Mobile-first. Consumes tokens only.
   ========================================================================== */

/* ---- Modern reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--weight-regular);
  line-height: var(--lh-base);
  font-feature-settings: "cv05" 1, "ss01" 1; /* Inter: nicer 'a','l' */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
img { font-style: italic; color: var(--c-faint); } /* graceful alt text */

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

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

/* ---- Headings — Fraunces, optical, tightened ---------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  font-optical-sizing: auto;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-tight); letter-spacing: var(--tracking-display); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-xl); }

p { text-wrap: pretty; }
p + p { margin-top: var(--space-md); }

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-fast) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}

strong, b { font-weight: var(--weight-semibold); }
em, i { font-style: italic; }

::selection { background: var(--c-brand); color: #fff; }

/* ---- Accessible focus — brand ring, never the default blue --------------- */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-xs);
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: var(--z-modal);
  background: var(--c-ink); color: #fff; padding: var(--space-sm) var(--space-md);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---- Layout primitives --------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--text { max-width: var(--container-text); }

.section { padding-block: var(--section-y); }
.section--alt { background: var(--bg-alt); }
.section--ink {
  background: var(--c-surface-ink);
  color: var(--c-paper);
}
.section--ink h1, .section--ink h2, .section--ink h3, .section--ink h4 { color: #fff; }
.section--tight { padding-block: var(--space-2xl); }

/* Sacred near-black, full-bleed authority moments */
.section--sacred {
  background: var(--c-sacred);
  color: var(--c-on-sacred);
}
.section--sacred h1, .section--sacred h2, .section--sacred h3, .section--sacred h4 { color: #fff; }
.section--sacred .lede { color: var(--c-on-sacred-mut); }
.section--sacred .overline { color: var(--c-gold-soft); }
.section--sacred .muted { color: var(--c-on-sacred-mut); }

/* Stack & cluster helpers */
.stack > * + * { margin-top: var(--space-md); }
.stack-lg > * + * { margin-top: var(--space-lg); }
.cluster {
  display: flex; flex-wrap: wrap;
  gap: var(--space-sm); align-items: center;
}

/* Responsive grid */
.grid { display: grid; gap: var(--space-lg); }
@media (min-width: 640px)  { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 640px) and (max-width: 899px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Typographic utilities ---------------------------------------------- */
.overline {
  font-family: var(--font-sans);
  font-size: var(--fs-overline);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--c-brand);              /* AA on warm paper (~10:1) */
  display: inline-flex; align-items: center; gap: var(--space-xs);
}
.section--ink .overline { color: var(--c-gold-soft); }
.overline::before {
  content: ""; width: 18px; height: 1px; background: currentColor; opacity: .8;
}
.overline--center::before { display: none; }

.lede {
  font-size: var(--fs-lg);
  line-height: var(--lh-relaxed);
  color: var(--text-soft);
  max-width: 56ch;
}
.muted { color: var(--text-muted); }
.measure { max-width: var(--container-text); }
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* Editorial accent: italic serif emphasis inside headings */
.accent-serif { font-style: italic; font-weight: var(--weight-regular); }
.accent-gold { color: var(--c-gold); }

/* Sacred signals -------------------------------------------------------- */
/* Devanagari / Sanskrit accent line — reverent, gold, spacious */
.devanagari {
  font-family: var(--font-display);
  color: var(--c-gold-ink);          /* AA on light; deeper brass */
  font-size: var(--fs-lg);
  letter-spacing: 0.05em;
  font-weight: var(--weight-regular);
}
/* Engraved section numeral used inside eyebrows, e.g. "— 04" */
.numeral {
  font-feature-settings: "lnum" 1, "tnum" 1;
  color: var(--c-gold-ink);          /* AA on light */
}
/* On sacred/dark surfaces, gold accents switch to the lighter, legible tone */
.section--sacred .numeral,
.section--ink .numeral { color: var(--c-gold-soft); }
.section--sacred .devanagari,
.section--ink .devanagari { color: var(--c-gold-soft); }
/* Lineage seal — small engraved credential mark */
.seal {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-meta); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; color: var(--c-muted);
}
.seal::before, .seal::after { content: ""; width: 20px; height: 1px; background: var(--c-gold); opacity: .7; }
.seal--solo::after { display: none; }

/* Visually hidden (a11y) */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Hairline divider */
.hr { height: 1px; background: var(--border); border: 0; }

/* ---- Scroll-reveal (progressive enhancement; JS adds .is-in) ------------ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }
/* If JS is disabled, never hide content */
.no-js .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
