/* Base: reset, typography, layout, section themes */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink-deep);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  letter-spacing: 0;
  font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
/* Fixed warm backdrop, as on the live site */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background: var(--backdrop);
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
blockquote, figure { margin: 0; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
::selection { background: var(--selection); color: var(--ink); }
:lang(hi), :lang(ta) { line-height: 1.75; letter-spacing: 0; text-transform: none; }
.label :lang(hi), .label :lang(ta) { line-height: 1; font-weight: 600; }

/* Focus */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; border-radius: 6px; }
.on-dark :focus-visible, [data-theme="dark"] :focus-visible { outline-color: var(--gold); }

/* Skip link */
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 1000;
  background: var(--cream); color: var(--ink); padding: 10px 18px; border-radius: var(--r-pill);
  font-weight: 700; font-size: var(--fs-button); letter-spacing: 0.05em; text-transform: uppercase;
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: 12px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Layout */
.container { width: 100%; max-width: calc(var(--w-wide) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); position: relative; z-index: 2; }
.container--std { max-width: calc(var(--w-std) + 2 * var(--gutter)); }
.container--read { max-width: calc(var(--w-read) + 2 * var(--gutter)); }
.grid-2 { display: grid; gap: var(--s-6); }
.grid-3 { display: grid; gap: var(--s-5); }
.grid-4 { display: grid; gap: var(--s-5); }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-7); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.stack > * + * { margin-top: var(--s-4); }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* Sections and themes */
main { display: block; position: relative; }
.section { position: relative; padding-block: var(--section-y); isolation: isolate; overflow-x: clip; }
html { overflow-x: clip; }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.theme-cream { background: rgba(250, 246, 240, 0.97); color: var(--ink); }
.theme-sand { background: rgba(241, 234, 224, 0.97); color: var(--ink); }
.theme-white { background: var(--white); color: var(--ink); }
.theme-ink, .theme-deep { color: var(--on-dark); }
.theme-ink { background: rgba(38, 38, 38, 0.9); }
.theme-deep { background: transparent; }
.theme-ink .muted, .theme-deep .muted { color: var(--on-dark-2); }

/* Typography */
.h-display, .h-1, .h-2, .h-3 { font-family: var(--font-display); font-weight: 400; color: inherit; text-wrap: balance; }
.h-display { font-size: var(--fs-display); line-height: 1.02; letter-spacing: -0.02em; }
.h-1 { font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -0.018em; }
.h-2 { font-size: var(--fs-h2); line-height: 1.08; letter-spacing: -0.014em; }
.h-3 { font-size: var(--fs-h3); line-height: 1.2; letter-spacing: -0.006em; }
.h-4 { font-family: var(--font-sans); font-size: 1.0625rem; line-height: 1.35; font-weight: 700; letter-spacing: -0.005em; }
.h-display em, .h-1 em, .h-2 em { font-style: normal; color: var(--bronze); }
.on-dark { color: var(--on-dark); }
.theme-ink em, .theme-deep em, .on-dark em { color: var(--gold); }
.lead { font-size: var(--fs-lead); line-height: 1.6; color: var(--text-2); max-width: 62ch; text-wrap: pretty; }
.theme-ink .lead, .theme-deep .lead, .on-dark .lead { color: var(--on-dark-2); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.serif { font-family: var(--font-serif); font-weight: 400; letter-spacing: 0; }
.quote { font-family: var(--font-serif); font-size: clamp(1.375rem, 1.1rem + 1vw, 2rem); line-height: 1.3; letter-spacing: -0.005em; text-wrap: balance; color: var(--bronze-700); }
.theme-ink .quote, .theme-deep .quote, .on-dark .quote { color: var(--gold); }
.measure { max-width: 64ch; }

/* Labels */
.label {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: var(--fs-label); font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
}
.theme-ink .label, .theme-deep .label, .on-dark .label { color: var(--on-dark-2); }
.label--rules::before, .label--rules::after { content: ""; width: 28px; height: 1px; background: var(--gold); transform-origin: center; }
.label--bronze { color: var(--bronze); }
.chapter { display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-5); }
.chapter__num { font-variant-numeric: tabular-nums; }
.section-head { max-width: 760px; margin-bottom: clamp(36px, 4vw, 64px); }
.section-head.center { margin-inline: auto; }
.section-head .h-2 + .lead { margin-top: var(--s-5); }
.section-head .h-2 + p, .section-head .h-1 + p { margin-top: var(--s-5); }
.section-head.center .lead { margin-inline: auto; }

/* Ghost words — huge, faint background type (live-site motif) */
.ghost {
  position: absolute; z-index: 0; pointer-events: none; user-select: none;
  font-family: var(--font-display); font-weight: 400; line-height: 0.85; letter-spacing: -0.03em;
  font-size: clamp(7rem, 22vw, 22rem); white-space: nowrap;
  color: currentColor; opacity: 0.05;
}
.ghost[lang="hi"], .ghost[lang="ta"] { font-weight: 600; letter-spacing: 0; line-height: 1.15; }

/* Utilities */
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: revert; } .hide-desktop { display: none; } }
[hidden] { display: none !important; }
.icon { width: 1.25em; height: 1.25em; width: round(nearest, 1.25em, 1px); height: round(nearest, 1.25em, 1px); flex: none; stroke: currentColor; fill: none; stroke-width: 1.75px; stroke-linecap: round; stroke-linejoin: round; shape-rendering: geometricPrecision; overflow: visible; }
.icon--lg { width: 28px; height: 28px; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
