/* =============================================================
   DARK REALMS — Base: reset, typography, layout, atmosphere, motifs
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* The hidden attribute always wins over a component's own display (filters hide grid and flex rows with it). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background-color: var(--ink-1000);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

/* ---- Global atmosphere: layered deep-space nebula behind everything ---- */
body::before {
  content: "";
  position: fixed; inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 800px at 78% -8%, rgba(139,108,240,0.16), transparent 60%),
    radial-gradient(1000px 700px at 8% 12%, rgba(79,110,220,0.12), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(139,108,240,0.10), transparent 60%),
    linear-gradient(180deg, #06060d 0%, #050509 40%, #07060e 100%);
}
/* Fine grain / vignette */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 30%, transparent 55%, rgba(0,0,0,0.55) 100%);
  mix-blend-mode: multiply;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--arcane); text-decoration: none; transition: color var(--dur-1) var(--ease); }
a:hover { color: var(--arcane-bright); }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
:focus-visible { outline: 2px solid var(--arcane); outline-offset: 3px; border-radius: 2px; }

/* ---- Headings ---- */
h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--bone);
  line-height: 1.08;
  letter-spacing: 0.01em;
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p { text-wrap: pretty; }
strong { color: var(--silver); font-weight: 600; }

/* ---- Layout primitives ---- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2.5rem); }
.wrap-narrow { max-width: 900px; }
.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(3rem, 2rem + 4vw, 5rem); }
.measure { max-width: var(--maxw-text); }
.center { text-align: center; margin-inline: auto; }
.stack > * + * { margin-top: var(--sp-4); }
.grid { display: grid; gap: clamp(1rem, 2vw, 1.75rem); }

/* ---- Eyebrow / kicker ---- */
.eyebrow {
  font-family: var(--font-display);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--violet-bright);
  display: inline-flex; align-items: center; gap: 0.7em;
}
.eyebrow--muted { color: var(--muted); }
.eyebrow .spark { color: var(--violet); flex: none; }

/* ---- Section heading block ---- */
.head { max-width: 62ch; }
.head--center { margin-inline: auto; text-align: center; }
.head h2 { margin-top: 0.6rem; }
.head .lead { margin-top: 1rem; color: var(--muted); font-size: var(--fs-lead); font-family: var(--font-serif); }

/* ---- Lead / prose ---- */
.lead { font-size: var(--fs-lead); color: var(--silver); }
.prose { font-family: var(--font-serif); font-size: 1.18rem; line-height: 1.75; color: var(--silver); }
.prose p + p { margin-top: 1.1rem; }
.prose--lg { font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem); }

/* ---- Divider with centred diamond ---- */
.rule { display: flex; align-items: center; gap: 1rem; color: var(--violet); }
.rule::before, .rule::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.rule .spark { flex: none; }

/* ---- The four-point sparkle (shared motif) ---- */
.spark { width: 0.85em; height: 0.85em; display: inline-block; }

/* ---- Reveal-on-scroll (only hidden when JS is present) ---- */
html.js .reveal { opacity: 0; transform: translateY(24px); }
.reveal { transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
html.js .reveal.in, .reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---- Utility ---- */
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nowrap { white-space: nowrap; }
.skip-link {
  position: absolute; left: 1rem; top: -60px; z-index: var(--z-top);
  background: var(--ink-800); color: var(--bone); padding: 0.6rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  transition: top var(--dur-2) var(--ease);
}
.skip-link:focus { top: 1rem; }
