/* ==========================================================================
   Ophelia — the shared design system for all nine worlds.

   Every world is the same architecture wearing a different light. Nothing in
   this file names a world; each page sets ~20 custom properties in its head and
   the whole system re-tunes around them. That is the only way nine sites stay
   one site.

   The rules the design keeps:
     · The accent is a LIGHT, not a fill. It glows, rules, and underlines; it
       almost never becomes a background. Filled accent appears on exactly one
       element per page — the primary action.
     · Space is the luxury. Sections breathe at 8–14rem. Nothing is crowded.
     · Motion is slow and eased, never bouncy. 700–1200ms, cubic-bezier out.
     · Type contrast carries the drama: a 100px display face against 17px prose.
   ========================================================================== */

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

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

body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
  padding: 0;
}

ul, ol { list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Tokens ──────────────────────────────────────────────────────────────── */

:root {
  /* Overridden per world in each page's head. These are only a safe fallback. */
  --ink:        #EDECF2;
  --ink-soft:   #B9BAC6;
  --ink-muted:  #7E8090;
  --accent:     #C8A24E;
  --accent-2:   #A4283A;
  --accent-3:   #34A67B;
  --glass:      rgba(20, 22, 30, .58);
  --glass-edge: rgba(200, 162, 78, .30);
  --sky:        linear-gradient(180deg, #05060A 0%, #0B0D14 44%, #14161E 100%);
  --on-accent:  #14100C;
  --display:    Georgia, 'Times New Roman', serif;
  --signature:  var(--display);

  /* A body face that is quiet enough to disappear and warm enough to read for
     an hour. Loaded from the system so no page ever waits on a webfont for its
     prose — only the signature display face is fetched. */
  --body: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua',
          Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Vertical rhythm. One scale, used everywhere. */
  --gap-xs: .5rem;
  --gap-s:  1rem;
  --gap-m:  2rem;
  --gap-l:  4rem;
  --gap-xl: 7rem;
  --gap-2xl: 11rem;

  --measure: 34rem;          /* prose column — ~68 characters */
  --shell: 74rem;            /* the widest anything gets */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --slow: 900ms;
}

/* ── Page ────────────────────────────────────────────────────────────────── */

body {
  background: var(--sky);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, .96rem + .2vw, 1.0625rem);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Film grain. A single tiled SVG turbulence, blended so it sits *in* the image
   rather than on top of it — the difference between "textured" and "dirty". */
body::before {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: 0;
  pointer-events: none;
  opacity: .038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Vignette — the corners fall away, so the centre reads as lit. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 38%,
              transparent 42%, rgba(0, 0, 0, .30) 100%);
}

.light body::after {
  background: radial-gradient(120% 90% at 50% 38%,
              transparent 46%, rgba(40, 44, 60, .14) 100%);
}

/* Every layer of real content floats above the grain and vignette. */
main, header, footer { position: relative; z-index: 1; }

/* The particle field, painted by ophelia.js.
   Must stay `fixed` with `inset: 0` — a canvas with no width/height attribute
   and no layout size falls back to its intrinsic 300×150, which puts the whole
   world's weather in the top-left corner of the page. */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.35em; }

section { padding-block: var(--gap-xl); }
section.tight { padding-block: var(--gap-l); }

/* ── Type ────────────────────────────────────────────────────────────────── */

/* The eyebrow: small caps, wide tracking, the accent as ink. Every section
   opens with one, which is most of what makes the pages feel edited. */
.eyebrow {
  font-family: var(--ui);
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: var(--gap-s);
}

.eyebrow::before {
  content: '';
  width: 1.6rem;
  height: 1px;
  background: currentColor;
  opacity: .8;
  flex: none;
}

.eyebrow.centred { justify-content: center; }
.eyebrow.centred::after {
  content: '';
  width: 1.6rem;
  height: 1px;
  background: currentColor;
  opacity: .8;
}

/* The display face. Fluid from phone to desktop, tight-leaded, and lit from
   behind by the world's accent. */
.display {
  font-family: var(--signature);
  font-weight: 400;
  line-height: .96;
  letter-spacing: -.005em;
  text-wrap: balance;
  text-shadow: 0 0 44px var(--glow, transparent);
}

h1.display { font-size: clamp(3rem, 1.6rem + 6.4vw, 7rem); }
h2.display { font-size: clamp(2.1rem, 1.4rem + 3.1vw, 3.9rem); }
h3.display { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }

/* Six of the nine signatures are scripts with long descenders and tall
   ascenders. At .96 they collide with whatever follows — set once here rather
   than nudged per world, and given real space beneath. */
h2.display, h3.display { line-height: 1.14; }
h2.display + *, h3.display + * { margin-top: .85rem; }

/* Worlds whose signature is a trial cut watermark spaces and punctuation, so
   they may only ever set a single word. The generator adds this class and the
   headline falls back to the body serif, letterspaced up to feel deliberate. */
.display.unsafe-signature {
  font-family: var(--display);
  letter-spacing: .01em;
}

/* Two worlds are authored in caps (Royal's court stamp). */
.caps { text-transform: uppercase; letter-spacing: .06em; }

.lede {
  font-size: clamp(1.125rem, 1.02rem + .5vw, 1.375rem);
  line-height: 1.62;
  color: var(--ink-soft);
  max-width: 32rem;
  text-wrap: pretty;
}

.muted { color: var(--ink-muted); }
.soft  { color: var(--ink-soft); }
.small { font-size: .8125rem; line-height: 1.65; }

em, .italic { font-style: italic; }

/* A drop cap opens the long-form pages. Sized to exactly three lines. */
.dropcap::first-letter {
  float: left;
  font-family: var(--signature);
  font-size: 4.1em;
  line-height: .78;
  padding: .06em .12em 0 0;
  color: var(--accent);
}

/* A line of verse or a whispered aside — set apart by air, not by a box. */
.whisper {
  font-family: var(--signature);
  font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.9rem);
  line-height: 1.45;
  color: var(--ink);
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 0 34px var(--glow, transparent);
}

.whisper.unsafe-signature { font-family: var(--display); font-style: italic; }

/* ── Ornaments ───────────────────────────────────────────────────────────── */

/* A hairline with a lozenge at its centre. The one recurring flourish; it
   closes every major section so the page has punctuation. */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-block: var(--gap-l);
  color: var(--accent);
  opacity: .7;
}

.ornament::before, .ornament::after {
  content: '';
  height: 1px;
  width: min(9rem, 22vw);
  background: linear-gradient(90deg, transparent, currentColor);
}

.ornament::after { background: linear-gradient(270deg, transparent, currentColor); }

.ornament i {
  width: 7px;
  height: 7px;
  background: currentColor;
  transform: rotate(45deg);
  flex: none;
}

.rule {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg,
              var(--accent) 0%, transparent 62%);
  opacity: .42;
}

/* ── Glass ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 20px;
  padding: clamp(1.5rem, 1rem + 2vw, 2.6rem);
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
}

/* The card that carries the offer. One per page, and it is allowed to glow. */
.card.lit {
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent),
              0 30px 90px -50px var(--accent);
}

.grid {
  display: grid;
  gap: clamp(1rem, .6rem + 1.6vw, 1.6rem);
}

@media (min-width: 46rem) {
  .grid.two   { grid-template-columns: repeat(2, 1fr); }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
}

/* ── Actions ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--ui);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 1.05rem 1.9rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  color: var(--ink);
  cursor: pointer;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  transition: background var(--slow) var(--ease),
              border-color 420ms var(--ease),
              transform 420ms var(--ease),
              box-shadow 420ms var(--ease);
}

.btn:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 18px 50px -26px var(--accent);
}

.btn.primary:hover {
  box-shadow: 0 26px 66px -26px var(--accent);
  background: color-mix(in srgb, var(--accent) 88%, white);
}

.btn.quiet {
  background: transparent;
  border-color: color-mix(in srgb, var(--ink) 22%, transparent);
  color: var(--ink-soft);
}

.btn.quiet:hover { border-color: var(--accent); color: var(--ink); }

.btn svg { width: 1em; height: 1em; flex: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem;
  align-items: center;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: color-mix(in srgb, var(--glass) 70%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 500ms var(--ease),
              background 500ms var(--ease);
}

.masthead.stuck {
  border-bottom-color: var(--glass-edge);
  background: var(--glass);
}

.masthead .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-s);
  padding-block: .95rem;
}

.wordmark {
  font-family: var(--signature);
  font-size: 1.45rem;
  letter-spacing: .01em;
  line-height: 1;
}

.wordmark.unsafe-signature { font-family: var(--display); }

.nav {
  display: flex;
  gap: 1.6rem;
  font-family: var(--ui);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.nav a { position: relative; padding-block: .3rem; transition: color 400ms var(--ease); }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }

.nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%; bottom: 0;
  height: 1px;
  background: var(--accent);
  transition: right 500ms var(--ease);
}

.nav a:hover::after, .nav a[aria-current]::after { right: 0; }

@media (max-width: 44rem) { .nav { display: none; } }

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  min-height: 100svh;
  display: grid;
  align-content: center;
  /* The masthead is sticky and ~4rem tall, so the top pad only has to clear it
     and then give the type room to breathe — 11rem on top of centred content
     pushed everything into the lower third and left a dead sky above it. */
  padding-block: var(--gap-l) var(--gap-xl);
  position: relative;
  isolation: isolate;
}

/* ── The light in a world's sky ──────────────────────────────────────────────
   Two kinds, because the nine worlds do not all have a *body* in the sky.

   Six have only light — winter daylight, candlelight in a court, the glow off
   a storm. Those get `.skyglow`: an enormous, very soft ellipse anchored off
   the top edge, so light appears to spill into the page rather than a disc
   sitting in it. Painted with a wide multi-stop gradient and no hard edge; a
   single radial-gradient disc reads as a coloured blob, which is exactly what
   it looked like before.

   Three have an actual celestial body that *is* the world's motif — Rogue's
   blood moon, Daemon's eclipse, Malice's amethyst moon. Those get `.disc`:
   small, defined, and high, with a halo around it. */

.skyglow, .disc {
  position: absolute;
  pointer-events: none;
  z-index: -1;
  animation: breathe 16s var(--ease) infinite;
}

.skyglow {
  width: min(150vw, 1500px);
  height: min(78vw, 780px);
  top: min(-34vw, -300px);
  left: 50%;
  translate: -50% 0;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
  background: radial-gradient(ellipse at center,
              var(--glow-core) 0%,
              var(--glow-mid) 38%,
              transparent 68%);
}

.disc {
  width: clamp(150px, 20vw, 290px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(.5px);
  background: radial-gradient(circle at 42% 38%,
              var(--glow-core) 0%, var(--glow-mid) 62%, var(--glow-edge) 100%);
  box-shadow: 0 0 90px 30px var(--halo), 0 0 220px 90px var(--halo);
}

/* Daemon's sun is eclipsed: a dark disc with a burning rim, so the halo does
   all the lighting and the body itself takes light *out* of the page. */
.disc.eclipse {
  background: radial-gradient(circle, #080503 0%, #080503 66%, transparent 71%);
  box-shadow: 0 0 0 2px var(--halo), 0 0 120px 24px var(--halo),
              0 0 300px 120px var(--halo), inset 0 0 50px rgba(0, 0, 0, .95);
}

@keyframes breathe {
  0%, 100% { opacity: var(--breathe-lo, .82); }
  50%      { opacity: var(--breathe-hi, 1); }
}

.skyglow { --breathe-lo: .44; --breathe-hi: .62; }

.hero-kicker {
  font-family: var(--ui);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.6rem;
}

.hero .lede { margin-top: 1.9rem; }
.hero .actions { margin-top: 2.8rem; }

/* The scroll cue — a hairline that fills and empties, forever. */
.scroll-cue {
  position: absolute;
  bottom: 2.4rem;
  left: 50%;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: .8rem;
  font-family: var(--ui);
  font-size: .56rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.scroll-cue span {
  display: block;
  width: 1px;
  height: 3.4rem;
  background: linear-gradient(180deg, var(--accent), transparent);
  transform-origin: top;
  animation: fall 2.8s var(--ease) infinite;
}

@keyframes fall {
  0%      { transform: scaleY(0); opacity: 0; }
  30%     { opacity: 1; }
  100%    { transform: scaleY(1); opacity: 0; }
}

/* ── Numbered steps ──────────────────────────────────────────────────────── */

.steps { counter-reset: step; }

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.4rem;
  padding-block: 1.8rem;
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
}

.step:first-child { border-top: 0; }

.step::before {
  counter-increment: step;
  content: counter(step, upper-roman);
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: .1em;
  color: var(--accent);
  padding-top: .3rem;
  min-width: 2.2rem;
}

.step h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: .4rem; }

/* ── The offering table ──────────────────────────────────────────────────── */

.tier {
  display: grid;
  gap: .9rem;
  padding: clamp(1.4rem, 1rem + 1.6vw, 2.2rem);
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background: color-mix(in srgb, var(--glass) 60%, transparent);
  transition: border-color 600ms var(--ease), transform 600ms var(--ease);
}

.tier:hover { border-color: var(--glass-edge); transform: translateY(-3px); }

.tier.featured {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--glass));
}

.tier .price {
  font-family: var(--display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--accent);
}

.tier .price small {
  display: block;
  font-family: var(--ui);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: .55rem;
}

.tier ul { display: grid; gap: .55rem; }

.tier li {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: .6rem;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.tier li::before {
  content: '';
  width: 5px; height: 5px;
  margin-top: .62em;
  background: var(--accent);
  transform: rotate(45deg);
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.field { display: grid; gap: .5rem; margin-bottom: 1.3rem; }

.field label {
  font-family: var(--ui);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.field input, .field textarea, .field select {
  width: 100%;
  padding: .95rem 1.05rem;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent);
  background: color-mix(in srgb, var(--glass) 80%, transparent);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  transition: border-color 400ms var(--ease), box-shadow 400ms var(--ease);
}

.field textarea { min-height: 11rem; resize: vertical; line-height: 1.7; }

.field input:focus, .field textarea:focus, .field select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field .hint { font-size: .78rem; color: var(--ink-muted); }

.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .8rem;
  align-items: start;
  font-size: .84rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-block: 1.4rem;
}

.consent input { margin-top: .35em; accent-color: var(--accent); width: 1rem; height: 1rem; }

/* ── Notices ─────────────────────────────────────────────────────────────── */

.notice {
  border-left: 2px solid var(--accent);
  padding: .2rem 0 .2rem 1.2rem;
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.68;
}

.sent {
  display: none;
  text-align: center;
  padding-block: var(--gap-m);
}

.sent.show { display: block; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  padding-block: var(--gap-l) var(--gap-m);
  margin-top: var(--gap-xl);
  font-size: .8rem;
  color: var(--ink-muted);
}

footer .shell { display: grid; gap: var(--gap-m); }

.footer-worlds {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.4rem;
  font-family: var(--ui);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.footer-worlds a { color: var(--ink-muted); transition: color 400ms var(--ease); }
.footer-worlds a:hover { color: var(--accent); }
.footer-worlds a[aria-current] { color: var(--ink); }

.footer-legal { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; }
.footer-legal a:hover { color: var(--accent); }

/* ── Reveal on scroll ────────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1100ms var(--ease), transform 1100ms var(--ease);
}

.reveal.in { opacity: 1; transform: none; }

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .atmosphere { display: none; }
}

/* ── Print — the Art Book and story should print beautifully ─────────────── */

@media print {
  body { background: #fff; color: #111; }
  body::before, body::after, .atmosphere, .masthead, .scroll-cue, .actions { display: none; }
  .card { border: 1px solid #ccc; background: none; backdrop-filter: none; }
  section { padding-block: 2rem; break-inside: avoid; }
}

/* Art Book plates */
.plate-swatches { display: flex; gap: .5rem; margin-block: .2rem .6rem; }
.plate-swatches i {
  width: 16px; height: 16px; border-radius: 50%;
  box-shadow: 0 0 14px -2px currentColor;
  border: 1px solid rgba(255,255,255,.18);
}
/* Legal tables */
table { width: 100%; border-collapse: collapse; margin-block: 1.4rem; font-size: .875rem; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); vertical-align: top; }
th { font-family: var(--ui); font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
td { color: var(--ink-soft); }
code { font-size: .85em; padding: .1em .35em; border-radius: 4px; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: .18em; }
/* An unfilled legal placeholder — loud on purpose, so it cannot be published
   by accident. gen_site.py wraps every «TOKEN» left in the markdown in one. */
mark.todo {
  background: #F5C518; color: #1A1206; font-family: var(--ui);
  font-size: .78em; font-weight: 700; letter-spacing: .06em;
  padding: .1em .45em; border-radius: 4px;
}
