/* Magna Luna — the feminine front door.
   Nocturnal-feminine: deep indigo + plum, warm gold + rose + pearl.
   No obsidian, no pyramid, no martial red. Mobile-first. CSS transforms only. */

:root {
  --ml-night:  #0b0d23;
  --ml-night2: #141033;
  --ml-plum:   #2a1840;
  --ml-gold:   #e8c074;
  --ml-rose:   #e9b8c4;
  --ml-pearl:  #f4ecdd;
  --ml-ink:    #efe9f6;
  --ml-soft:   rgba(239,233,246,0.66);
  --ml-line:   rgba(232,192,116,0.28);
  --ml-display: 'Cinzel', Georgia, serif;
  --ml-body:    'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--ml-body);
  color: var(--ml-ink);
  background: var(--ml-night);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Living cosmic background (WebGL nebula). Sits behind the hero photo, and
   shows through where the photo masks out (the reading section). */
#ml-cosmos {
  position: fixed; inset: 0; z-index: -2;
  width: 100%; height: 100%; display: block;
  pointer-events: none;
}

/* Starfield fallback behind everything (works even if cosmos/hero fail) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(1.5px 1.5px at 18% 22%, rgba(255,255,255,.9), transparent),
    radial-gradient(1.5px 1.5px at 67% 14%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.2px 1.2px at 41% 61%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.8px 1.8px at 82% 47%, rgba(255,240,210,.8), transparent),
    radial-gradient(1.2px 1.2px at 29% 83%, rgba(255,255,255,.5), transparent),
    radial-gradient(circle at 50% -10%, var(--ml-plum), var(--ml-night2) 45%, var(--ml-night) 80%);
}

/* ── Hero ─────────────────────────────────────────────── */
.ml-hero {
  position: relative;
  min-height: 100svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 8vh 22px 12vh;
  transition: transform .9s cubic-bezier(.22,.61,.36,1), opacity .9s ease;
}
.ml-hero__img {
  position: fixed; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  opacity: 0; transition: opacity 1.4s ease;
  /* fade the photo out toward the bottom so the living cosmos shows through
     in the reading section while the hero keeps the night-sky photograph */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 78%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 78%);
}
.ml-hero__img.loaded { opacity: .92; }
/* dark veil so text always reads over any image */
.ml-hero::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(11,13,35,.25) 0%, rgba(11,13,35,.05) 38%, rgba(11,13,35,.78) 100%);
}

.ml-greeter {
  font-size: 1.02rem; letter-spacing: .02em;
  color: var(--ml-soft); font-style: italic;
  margin: 0 auto 26px; max-width: 30ch;
  display: flex; align-items: center; gap: 10px; justify-content: center;
}
.ml-greeter__orb {
  width: 34px; height: 34px; border-radius: 50%;
  background: #2a1840 url('/images/magna-luna/magna-luna-selah-orb.webp') center/cover;
  box-shadow: 0 0 18px 4px rgba(233,184,196,.5);
  flex: 0 0 auto;
  animation: ml-breathe 5.5s ease-in-out infinite;
}
@keyframes ml-breathe { 0%,100%{ transform: scale(1); opacity:.9 } 50%{ transform: scale(1.12); opacity:1 } }

.ml-wordmark {
  font-family: var(--ml-display);
  font-weight: 600; letter-spacing: .14em;
  font-size: clamp(2.4rem, 11vw, 4.4rem);
  margin: 0 0 .15em;
  color: var(--ml-pearl);
  text-shadow: 0 2px 40px rgba(232,192,116,.35);
}
.ml-wordmark em { font-style: normal; color: var(--ml-gold); }
.ml-tagline {
  font-size: clamp(1.15rem, 4.6vw, 1.6rem);
  color: var(--ml-ink); margin: 0 0 .4em; font-weight: 500;
}
.ml-subline {
  font-size: clamp(.95rem, 3.4vw, 1.1rem);
  color: var(--ml-soft); margin: 0 auto 34px; max-width: 34ch; font-style: italic;
}

/* ── Form ─────────────────────────────────────────────── */
.ml-form { width: 100%; max-width: 380px; margin: 0 auto; }
.ml-field { margin-bottom: 14px; text-align: left; }
.ml-field label {
  display: block; font-family: var(--ml-display);
  font-size: .62rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ml-gold); margin: 0 0 7px 4px; opacity: .85;
}
.ml-field input {
  width: 100%; padding: 15px 18px;
  background: rgba(20,16,51,.5);
  /* soft, feathered edge — no hard hairline rectangle */
  border: 1px solid rgba(232,192,116,.14); border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(244,236,221,.05), 0 2px 20px rgba(11,13,35,.28);
  color: var(--ml-ink); font-family: var(--ml-body); font-size: 1.15rem;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.ml-field input::placeholder { color: rgba(239,233,246,.34); }
.ml-field input:focus {
  outline: none; border-color: rgba(232,192,116,.5);
  background: rgba(20,16,51,.6);
  box-shadow: inset 0 1px 0 rgba(244,236,221,.06), 0 0 0 4px rgba(232,192,116,.12), 0 2px 24px rgba(11,13,35,.3);
}
.ml-optional { font-size: .55rem; color: var(--ml-soft); opacity:.7; letter-spacing:.1em; }

.ml-btn {
  width: 100%; margin-top: 8px; padding: 15px 24px;
  font-family: var(--ml-display); font-size: .82rem; letter-spacing: .18em; text-transform: uppercase;
  color: #1a1226; border: none; border-radius: 40px; cursor: pointer;
  background: linear-gradient(120deg, var(--ml-rose), var(--ml-gold));
  box-shadow: 0 8px 30px rgba(232,192,116,.32);
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.ml-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 38px rgba(232,192,116,.42); }
.ml-btn:active { transform: translateY(0); }
.ml-btn[disabled] { opacity: .5; cursor: default; transform: none; box-shadow: none; }

/* ── Scroll cue — pulls people down into the lineage (the page's best content) */
.ml-scrollcue {
  position: absolute; left: 50%; bottom: 3.2vh; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-decoration: none;
  /* transition-driven fade (NOT animation) so the retire rule below can win —
     an animation with forwards-fill would pin opacity and ignore .ml-scrolled */
  opacity: 0; transition: opacity .8s ease;
}
body.ml-anim .ml-scrollcue { opacity: 1; transition-delay: 1.2s; }
.ml-scrollcue__text {
  font-family: var(--ml-display); font-size: .58rem; letter-spacing: .24em;
  text-transform: uppercase; color: var(--ml-gold); opacity: .82;
}
.ml-scrollcue__chev {
  width: 15px; height: 15px;
  border-right: 1.5px solid var(--ml-gold); border-bottom: 1.5px solid var(--ml-gold);
  transform: rotate(45deg); opacity: .7;
  animation: ml-cuebob 2.2s ease-in-out infinite;
}
@keyframes ml-cuebob {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50%      { transform: rotate(45deg) translate(3px, 3px); }
}
/* the cue retires the moment the user scrolls or opens a reading */
body.ml-scrolled .ml-scrollcue, body.ml-read .ml-scrollcue { opacity: 0; transition-delay: 0s; pointer-events: none; }
/* short viewports (iPhone SE, landscape): the centered form fills the hero, so
   the bottom cue would crowd it — drop it there, the lineage is still a scroll away */
@media (max-height: 720px) { .ml-scrollcue { display: none; } }

/* ── Reading ──────────────────────────────────────────── */
.ml-reading {
  max-width: 640px; margin: 0 auto; padding: 4vh 26px 6vh;
  display: none;
}
/* the hero recedes like a veil parting as the reading rises */
.ml-hero { will-change: transform, opacity, filter; }
body.ml-read .ml-hero {
  transform: scale(.965) translateY(-3vh);
  opacity: .32; filter: blur(2px);
}
body.ml-read .ml-reading { display: block; }
/* the reading head fades + rises in when a reading opens */
body.ml-read .ml-reading__head { animation: ml-headrise 1s cubic-bezier(.22,.61,.36,1) both; }
@keyframes ml-headrise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.ml-reading__head { text-align: center; margin-bottom: 38px; }
.ml-reading__name {
  font-family: var(--ml-display); font-size: clamp(1.6rem,7vw,2.4rem);
  color: var(--ml-pearl); letter-spacing:.06em; margin: 0 0 6px;
}
.ml-reading__axis {
  font-size: 1.05rem; color: var(--ml-gold); font-style: italic; letter-spacing:.03em;
}
.ml-mv { margin: 0 0 26px; }
/* movements UNFOLD as you descend — scroll-revealed, not all at once.
   Gated on body.ml-anim so reduced-motion / JS-off shows them all. */
body.ml-anim .ml-mv {
  opacity: 0; transform: translateY(18px);
  transition: opacity .85s ease, transform .85s cubic-bezier(.22,.61,.36,1);
}
body.ml-anim .ml-mv.in { opacity: 1; transform: none; }
.ml-mv__title {
  font-family: var(--ml-display); font-size: .66rem; letter-spacing:.24em;
  text-transform: uppercase; color: var(--ml-gold); opacity:.8; margin: 0 0 8px;
}
.ml-mv__text {
  font-size: 1.32rem; line-height: 1.62; color: var(--ml-ink); margin: 0;
}
.ml-mv__text::first-letter { } /* hook for drop-cap if desired */
.ml-mv[data-mv="settle"] .ml-mv__text { color: var(--ml-pearl); font-style: italic; }

/* ── Share + CTA ──────────────────────────────────────── */
.ml-actions { text-align: center; margin-top: 30px; }
.ml-share-btn {
  background: transparent; color: var(--ml-rose);
  border: 1px solid rgba(232,192,116,.16); border-radius: 40px;
  box-shadow: inset 0 1px 0 rgba(244,236,221,.05);
  padding: 12px 26px; font-family: var(--ml-display); font-size: .68rem;
  letter-spacing: .18em; text-transform: uppercase; cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.ml-share-btn:hover { background: rgba(233,184,196,.12); color: var(--ml-pearl); border-color: rgba(232,192,116,.3); }

.ml-cta {
  margin: 46px auto 0; max-width: 460px; text-align: center;
  padding: 34px 30px; border-radius: 28px;
  background: linear-gradient(160deg, rgba(42,24,64,.55), rgba(20,16,51,.38));
  /* feathered edge: faint border + soft drop + inner highlight, so it floats
     instead of drawing a hard rectangle */
  border: 1px solid rgba(232,192,116,.12);
  box-shadow: 0 24px 70px -30px rgba(11,13,35,.85), inset 0 1px 0 rgba(244,236,221,.06);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ml-cta__lead { font-size: 1.2rem; color: var(--ml-ink); margin: 0 0 4px; }
.ml-cta__sub  { font-size: .98rem; color: var(--ml-soft); font-style: italic; margin: 0 0 18px; }
.ml-cta__by   { font-size: .82rem; color: var(--ml-gold); margin: 0 0 16px; letter-spacing:.04em; }
.ml-cta a.ml-btn { display: inline-block; width: auto; padding: 13px 34px; text-decoration: none; }

/* ── Footer — the floor the page lands on (no more abyss) ─────────
   The nebula settles into a deep band so the experience has a ground,
   a waxing-moon seal closes it, and the lunar cycle ties back to the
   erased-and-returning lineage above. */
.ml-footer {
  position: relative;
  margin-top: 2vh;
  padding: 66px 24px 60px;
  text-align: center;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(20,16,51,.55) 40%,
    rgba(11,13,35,.94) 100%);
}
/* horizon hairline — the line where nebula meets ground */
.ml-footer::before {
  content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: min(440px, 74vw); height: 1px;
  background: linear-gradient(90deg, transparent, var(--ml-line), transparent);
}
.ml-footer__seal { margin: 0 0 22px; line-height: 0; }
.ml-footer__moon {
  display: inline-block; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, var(--ml-pearl), var(--ml-gold) 72%, rgba(232,192,116,.25));
  /* the inset shadow carves a waxing crescent out of the disc */
  box-shadow: 0 0 24px 5px rgba(232,192,116,.38), inset -8px -3px 11px rgba(11,13,35,.6);
  animation: ml-breathe 6.5s ease-in-out infinite;
}
.ml-footer__line {
  font-family: var(--ml-body); font-style: italic;
  font-size: clamp(1.05rem, 4vw, 1.34rem); line-height: 1.6;
  color: var(--ml-ink); max-width: 30ch; margin: 0 auto 28px;
}
.ml-footer__line span { color: var(--ml-rose); }
.ml-footer__nav {
  display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: center;
  margin: 0 0 26px;
}
.ml-footer__nav a {
  font-family: var(--ml-display); font-size: .64rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ml-gold); text-decoration: none;
  opacity: .82; transition: opacity .2s ease, color .2s ease;
}
.ml-footer__nav a:hover { opacity: 1; color: var(--ml-pearl); }
.ml-footer__fine {
  font-size: .82rem; line-height: 1.55; letter-spacing: .02em;
  color: rgba(239,233,246,.42); max-width: 44ch; margin: 0 auto;
}
.ml-footer__fine a {
  color: rgba(239,233,246,.62); text-decoration: none;
  border-bottom: 1px solid rgba(239,233,246,.22);
}

canvas#ml-card-canvas { display: none; }

/* Latent "Listen" pill slot (the player styles the button itself) */
.ml-latent-slot {
  position: fixed; top: 16px; right: 16px; z-index: 40;
}
/* soft legibility backdrop so the reading reads cleanly over the live cosmos */
.ml-reading { position: relative; }
.ml-reading::before {
  content: ""; position: absolute; inset: -2vh -4vw; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 80% at 50% 38%, rgba(11,13,35,.55), rgba(11,13,35,.18) 60%, transparent 85%);
}

/* ── The name + the lineage ───────────────────────────── */
.ml-lore { max-width: 620px; margin: 0 auto; padding: 2vh 26px 7vh; position: relative; }
.ml-lore::before {
  content: ""; position: absolute; inset: -1vh -4vw; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 70% at 50% 30%, rgba(11,13,35,.62), rgba(11,13,35,.2) 60%, transparent 86%);
}
.ml-lore__kicker {
  font-family: var(--ml-display); font-size: .7rem; letter-spacing: .26em;
  text-transform: uppercase; color: var(--ml-gold); text-align: center; margin: 0 0 18px; opacity: .9;
}
.ml-lore__lead {
  font-size: 1.18rem; line-height: 1.66; color: var(--ml-ink);
  text-align: center; margin: 0 auto 40px; max-width: 46ch;
}
.ml-lore__lead em { color: var(--ml-rose); font-style: italic; }
.ml-lineage { list-style: none; margin: 0; padding: 0; position: relative; }
/* the continuous thread: a dim full-height track + a gold fill that illuminates
   DOWNWARD as you scroll — height is driven by JS via --ml-fill */
.ml-lineage::before, .ml-lineage::after {
  content: ""; position: absolute; left: 0; width: 2px; border-radius: 2px; pointer-events: none;
}
.ml-lineage::before { top: 4px; bottom: 4px; background: var(--ml-line); }
.ml-lineage::after {
  top: 4px; height: var(--ml-fill, 0px);
  background: linear-gradient(180deg, var(--ml-gold), var(--ml-rose));
  box-shadow: 0 0 12px rgba(232,192,116,.55);
  transition: height .28s linear;
}
.ml-lineage li { position: relative; padding: 0 0 26px 22px; margin: 0; }
.ml-lineage li::before {
  content: ""; position: absolute; left: -5px; top: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ml-gold); box-shadow: 0 0 10px 2px rgba(232,192,116,.5);
}
.ml-lin__who { display: block; font-family: var(--ml-display); font-size: 1.12rem; color: var(--ml-pearl); letter-spacing: .04em; }
.ml-lin__when { display: block; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ml-gold); opacity: .7; margin: 3px 0 7px; }
.ml-lin__what { display: block; font-size: 1.06rem; line-height: 1.55; color: var(--ml-soft); }
.ml-lin__what em, .ml-lore__close em { color: var(--ml-rose); font-style: italic; }
.ml-lore__close {
  font-size: 1.16rem; line-height: 1.62; color: var(--ml-ink); font-style: italic;
  text-align: center; margin: 34px auto 0; max-width: 44ch;
}
/* the lineage recedes once a reading is open, so the reading stays the focus */
body.ml-read .ml-lore { display: none; }

/* ── Scroll-reveal — the timeline BUILDS as you descend ───
   Gated on body.ml-anim (added by JS) so the page is fully visible if JS fails
   or prefers-reduced-motion is set. Each figure fades + rises as it enters; its
   gold node pops in, so the thread draws itself node by node. */
body.ml-anim .ml-reveal,
body.ml-anim .ml-lineage li {
  opacity: 0; transform: translateY(26px);
  transition: opacity .85s ease, transform .85s cubic-bezier(.22,.61,.36,1);
}
body.ml-anim .ml-reveal.in,
body.ml-anim .ml-lineage li.in { opacity: 1; transform: none; }
body.ml-anim .ml-lineage li.in::before { animation: ml-nodepop .75s cubic-bezier(.22,.61,.36,1) both; }
@keyframes ml-nodepop {
  0%   { transform: scale(0);   box-shadow: 0 0 0 0 rgba(232,192,116,0); }
  55%  { transform: scale(1.6); box-shadow: 0 0 16px 5px rgba(232,192,116,.7); }
  100% { transform: scale(1);   box-shadow: 0 0 10px 2px rgba(232,192,116,.5); }
}

@media (prefers-reduced-motion: reduce) {
  .ml-hero, .ml-hero__img, .ml-greeter__orb, .ml-mv, .ml-reveal, .ml-lineage li,
  .ml-scrollcue, .ml-scrollcue__chev, .ml-footer__moon { transition: none !important; animation: none !important; opacity: 1 !important; transform: none !important; }
  .ml-scrollcue { transform: translateX(-50%) !important; }
}
@media (min-width: 760px) {
  .ml-mv__text { font-size: 1.42rem; }
}

/* ── Selah's door → the Reader's room (time-warp) ──────────────────────
   The greeter becomes a live door ONLY for a Reader (js adds .is-door when a
   reader context exists). A cold visitor sees the plain greeter. */
.ml-greeter.is-door { cursor: pointer; transition: transform .3s ease, color .3s ease; }
.ml-greeter.is-door:hover { transform: translateY(-1px); color: var(--ml-pearl); }
.ml-greeter.is-door .ml-greeter__orb { box-shadow: 0 0 26px 6px rgba(233,184,196,.7); }
.ml-greeter__door {
  display: block; margin-top: 6px; font-style: normal;
  font-family: var(--ml-display); font-size: .58rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ml-gold); opacity: 0; transition: opacity .4s ease;
}
/* A Reader always sees the door at rest (no hover required — and touch has no hover);
   a cold visitor keeps the plain greeter (base opacity:0, no .is-door). */
.ml-greeter.is-door .ml-greeter__door { opacity: .62; }
.ml-greeter.is-door:hover .ml-greeter__door, .ml-greeter.is-door:focus-visible .ml-greeter__door { opacity: 1; }

/* the warp: bloom out from Selah, then the page rushes forward + dissolves */
.ml-warp {
  position: fixed; z-index: 90; left: 50%; top: 26%;
  width: 40px; height: 40px; border-radius: 50%; pointer-events: none;
  transform: translate(-50%, -50%) scale(0); opacity: 0;
  background: radial-gradient(circle, rgba(244,236,221,.98) 0%, rgba(233,184,196,.9) 30%, rgba(232,192,116,.5) 55%, rgba(42,24,64,0) 72%);
}
body.ml-warping .ml-warp { animation: ml-warp-bloom .95s cubic-bezier(.5,.02,.6,1) forwards; }
body.ml-warping .ml-hero, body.ml-warping .ml-lore, body.ml-warping .ml-reading, body.ml-warping .ml-footer {
  animation: ml-warp-rush .95s cubic-bezier(.5,.02,.7,1) forwards;
}
@keyframes ml-warp-bloom {
  0%   { transform: translate(-50%,-50%) scale(0); opacity: .2; }
  55%  { opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(46); opacity: 1; }
}
@keyframes ml-warp-rush {
  0%   { transform: scale(1); opacity: 1; filter: blur(0); }
  100% { transform: scale(1.35); opacity: 0; filter: blur(6px); }
}
@media (prefers-reduced-motion: reduce) {
  body.ml-warping .ml-warp, body.ml-warping .ml-hero, body.ml-warping .ml-lore,
  body.ml-warping .ml-reading, body.ml-warping .ml-footer { animation: none !important; }
}
