/* ═══════════════════════════════════════════════
   NEHA → AHEN
   ═══════════════════════════════════════════════ */

:root {
  --ink:        #08040d;
  --plum:       #1a0a24;
  --plum-soft:  #2a1038;
  --rose:       #ff6f9c;
  --rose-deep:  #c23f6b;
  --gold:       #ffd9a0;
  --cream:      #fdeef4;
  --muted:      rgba(253, 238, 244, 0.58);
  --line:       rgba(255, 214, 226, 0.16);
  --glass:      rgba(255, 226, 236, 0.045);

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stage-pad: clamp(1.25rem, 5vw, 3rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.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;
}

/* ─── progress ─── */
.progress {
  position: fixed; inset: 0 0 auto 0; height: 2px;
  background: rgba(255, 214, 226, 0.08); z-index: 90;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--rose-deep), var(--rose), var(--gold));
  transition: width 0.25s linear;
}

/* ─── atmosphere / parallax backdrop ─── */
.atmosphere { position: fixed; inset: 0; z-index: -1; overflow: hidden; }

.atmosphere::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(120% 80% at 50% 0%,   #2c0f3a 0%, transparent 60%),
    radial-gradient(100% 90% at 10% 100%, #3a0f2c 0%, transparent 55%),
    linear-gradient(180deg, var(--ink), var(--plum) 55%, var(--ink));
}

.glow {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.42;
  will-change: transform;
}
.glow-a { width: 46vw; height: 46vw; left: -8vw;  top: 8vh;  background: radial-gradient(circle, #ff4f86, transparent 68%); }
.glow-b { width: 38vw; height: 38vw; right: -6vw; top: 42vh; background: radial-gradient(circle, #8a4dff, transparent 68%); opacity: 0.34; }
.glow-c { width: 32vw; height: 32vw; left: 32vw;  bottom: -8vh; background: radial-gradient(circle, #ffb36b, transparent 70%); opacity: 0.22; }

#petals { position: absolute; inset: 0; width: 100%; height: 100%; }

.grain {
  position: absolute; inset: 0; opacity: 0.05; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── sound toggle ─── */
.sound-toggle {
  position: fixed; top: 1.1rem; right: 1.1rem; z-index: 95;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(20, 8, 28, 0.55);
  color: var(--muted); font-size: 0.95rem; cursor: pointer;
  backdrop-filter: blur(8px);
  transition: color 0.3s, border-color 0.3s, transform 0.3s;
}
.sound-toggle:hover { transform: scale(1.08); border-color: var(--rose); }
.sound-toggle[aria-pressed="true"] { color: var(--rose); border-color: var(--rose); }

/* ═══ chapters ═══ */
.chapter {
  min-height: 100svh;
  display: none;
  place-items: center;
  padding: clamp(4rem, 12vh, 8rem) var(--stage-pad);
  position: relative;
}
.chapter.is-open { display: grid; }

.stage {
  width: 100%; max-width: 640px; text-align: center;
  animation: rise 1s var(--ease) both;
}
.stage-wide { max-width: 880px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

.eyebrow {
  font-size: 0.7rem; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 1.6rem;
}

.title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  line-height: 1.12; margin: 0 0 0.7rem;
}

.sub { color: var(--muted); font-size: 0.98rem; margin: 0 auto 2.6rem; max-width: 46ch; }
.hint { color: rgba(253, 238, 244, 0.34); font-size: 0.78rem; letter-spacing: 0.06em; margin-top: 1.5rem; }

/* ─── chapter 1: the name wall ─── */
.namewall {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(4.2rem, 21vw, 12rem);
  line-height: 0.92; letter-spacing: 0.08em;
  margin: 0 0 2rem; display: flex; justify-content: center;
  will-change: transform;
}
.namewall .glyph {
  display: inline-block;
  background: linear-gradient(175deg, var(--cream) 20%, var(--rose) 70%, var(--rose-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: glyphIn 1.4s var(--ease) both, breathe 7s ease-in-out infinite;
  text-shadow: 0 0 70px rgba(255, 111, 156, 0.28);
}
.namewall .glyph:nth-child(1) { animation-delay: 0.1s, 0s; }
.namewall .glyph:nth-child(2) { animation-delay: 0.25s, 0.6s; }
.namewall .glyph:nth-child(3) { animation-delay: 0.4s, 1.2s; }
.namewall .glyph:nth-child(4) { animation-delay: 0.55s, 1.8s; }

@keyframes glyphIn {
  from { opacity: 0; transform: translateY(40px) rotateX(50deg); filter: blur(10px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.lede {
  font-family: var(--serif); font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  color: rgba(253, 238, 244, 0.82); margin: 0 auto 2.4rem; max-width: 34ch;
}
.lede em { color: var(--rose); font-style: italic; }

.scroll-cue {
  position: absolute; bottom: 2.2rem; left: 50%; width: 1px; height: 44px;
  background: linear-gradient(var(--rose), transparent);
  animation: cue 2.4s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { opacity: 0.15; transform: translateY(0) scaleY(0.6); }
  50%      { opacity: 0.7;  transform: translateY(8px) scaleY(1); }
}

/* ─── buttons ─── */
.btn {
  font-family: var(--sans); font-size: 0.9rem; font-weight: 400;
  letter-spacing: 0.09em; text-transform: lowercase;
  padding: 0.85rem 2rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); color: var(--cream);
  transition: transform 0.35s var(--ease), background 0.35s, border-color 0.35s, box-shadow 0.35s, opacity 0.4s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); border-color: var(--rose); box-shadow: 0 10px 34px rgba(255, 111, 156, 0.18); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.btn-primary {
  background: linear-gradient(120deg, var(--rose-deep), var(--rose));
  border-color: transparent; color: #200311; font-weight: 500;
  box-shadow: 0 12px 40px rgba(255, 111, 156, 0.22);
}
.btn-primary:hover { box-shadow: 0 16px 50px rgba(255, 111, 156, 0.34); }

.btn-ghost { background: transparent; }

.btn.is-locked {
  opacity: 0; pointer-events: none; transform: translateY(10px);
  height: 0; padding: 0; margin: 0; border: 0; overflow: hidden;
}
.btn.is-unlocked {
  opacity: 1; pointer-events: auto; height: auto;
  padding: 0.85rem 2rem; border: 1px solid transparent;
  animation: rise 0.7s var(--ease) both;
}

/* ─── chapter 2: clues ─── */
.clues {
  display: grid; gap: 0.9rem; margin-bottom: 2.2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.clue {
  all: unset; cursor: pointer; perspective: 1000px;
  min-height: 190px; display: block;
  -webkit-tap-highlight-color: transparent;
}
.clue-inner {
  position: relative; display: block; width: 100%; height: 190px;
  transform-style: preserve-3d;
  transition: transform 0.85s var(--ease);
}
.clue.is-flipped .clue-inner { transform: rotateY(180deg); }

.clue-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 0.55rem; padding: 1.3rem; border-radius: 18px;
  border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(10px);
  font-size: 0.85rem; line-height: 1.55; color: var(--muted);
}
.clue-front { background: linear-gradient(160deg, rgba(255,111,156,0.1), rgba(138,77,255,0.06)); }
.clue:hover .clue-front { border-color: var(--rose); }
.clue-num {
  font-family: var(--serif); font-size: 2.6rem; color: var(--rose);
  letter-spacing: 0.1em; opacity: 0.85;
}
.clue-back { transform: rotateY(180deg); text-align: center; }
.clue-back strong {
  display: block; font-family: var(--serif); font-size: 1.15rem;
  font-weight: 500; color: var(--cream); letter-spacing: 0.01em;
}

/* ─── chapter 3: quiz ─── */
.quiz {
  position: relative; min-height: 260px; margin-bottom: 0.5rem;
  transition: min-height 0.5s var(--ease);
}
.quiz.is-done { min-height: 0; }
.q { display: none; }
.q.is-active { display: block; animation: rise 0.6s var(--ease) both; }
.q h3 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1.25rem, 3.4vw, 1.7rem); margin: 0 0 1.6rem;
}
.opts { display: grid; gap: 0.6rem; }
.opts button {
  font-family: var(--sans); font-size: 0.92rem; color: var(--cream);
  padding: 0.95rem 1.4rem; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass);
  text-align: left; transition: all 0.3s var(--ease);
}
.opts button:hover {
  border-color: var(--rose); background: rgba(255, 111, 156, 0.1);
  transform: translateX(5px);
}
.opts button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.reply {
  font-family: var(--serif); font-style: italic;
  font-size: 1.08rem; color: var(--gold);
  min-height: 3.4em; margin: 1.6rem auto 1.4rem; max-width: 40ch;
  opacity: 0; transition: opacity 0.5s;
}
.reply.is-visible { opacity: 1; }

/* ─── chapter 4: meters ─── */
.meters { display: grid; gap: 1.15rem; margin-bottom: 2rem; text-align: left; }
.meter {
  display: grid; grid-template-columns: 1fr auto;
  grid-template-areas: "label val" "track track";
  gap: 0.4rem 1rem; align-items: center;
}
.meter-label { grid-area: label; font-size: 0.88rem; color: var(--muted); }
.meter-val {
  grid-area: val; font-size: 0.82rem; letter-spacing: 0.08em;
  color: var(--rose); font-variant-numeric: tabular-nums;
}
.meter-track {
  grid-area: track; height: 5px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 214, 226, 0.09);
}
.meter-fill {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--rose-deep), var(--rose));
  transition: width 1.3s var(--ease);
}
.meter-total .meter-label { color: var(--cream); font-size: 0.98rem; }
.meter-total .meter-fill { background: linear-gradient(90deg, var(--rose), var(--gold)); }
.meter-total .meter-val { color: var(--gold); font-size: 0.95rem; }

.verdict {
  font-family: var(--serif); font-style: italic; font-size: 1.1rem;
  color: var(--gold); min-height: 2.6em; margin-bottom: 1.4rem;
  opacity: 0; transition: opacity 0.6s;
}
.verdict.is-visible { opacity: 1; }

/* ─── chapter 5: tiles ─── */
.tiles {
  display: flex; justify-content: center; gap: clamp(0.5rem, 2vw, 1rem);
  margin: 2.4rem 0; flex-wrap: nowrap;
}
.tile {
  --size: clamp(64px, 17vw, 108px);
  width: var(--size); height: var(--size);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: calc(var(--size) * 0.5); font-weight: 500;
  border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255,111,156,0.14), rgba(138,77,255,0.07));
  backdrop-filter: blur(10px);
  transition: transform 0.9s var(--ease), border-color 0.6s, box-shadow 0.6s, color 0.6s;
  will-change: transform;
}
.tiles.is-solved .tile {
  border-color: rgba(255, 217, 160, 0.5); color: var(--gold);
  box-shadow: 0 0 46px rgba(255, 217, 160, 0.22);
}

.reveal {
  opacity: 0; visibility: hidden; transition: opacity 0.8s 0.4s;
  margin-bottom: 2rem;
}
.reveal.is-visible { opacity: 1; visibility: visible; }
.reveal-line {
  font-family: var(--serif); font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  margin: 0.5rem 0; color: rgba(253, 238, 244, 0.85);
  animation: rise 0.9s var(--ease) both;
}
.reveal.is-visible .delay-1 { animation-delay: 0.9s; }
.reveal.is-visible .delay-2 { animation-delay: 1.7s; }
.reveal-line strong { color: var(--rose); font-weight: 500; }

/* ─── chapter 6: application ─── */
.form {
  position: relative; text-align: left;
  padding: clamp(1.4rem, 4vw, 2.4rem); border-radius: 22px;
  border: 1px solid var(--line); background: var(--glass);
  backdrop-filter: blur(12px); margin-bottom: 2rem;
}
.field { margin-bottom: 1.3rem; border: 0; padding: 0; }
.field label, .field legend, .field-title {
  display: block; font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem; padding: 0;
}
/* the note is read-only prose: a box, not a textarea, so it never clips */
.note-box {
  margin: 0; font-size: 0.94rem; line-height: 1.6;
  color: rgba(253, 238, 244, 0.68);
  padding: 0.75rem 0.95rem; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(10, 4, 16, 0.45);
}
.field input, .field select, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 0.94rem; font-weight: 300;
  color: var(--cream); padding: 0.75rem 0.95rem; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(10, 4, 16, 0.45);
  resize: none; transition: border-color 0.3s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--rose);
}
.field input[readonly], .field textarea[readonly] { color: rgba(253, 238, 244, 0.68); }
.field select option { background: var(--plum); color: var(--cream); }

.checks { display: grid; gap: 0.5rem; }
.field .checks .check {
  display: flex; align-items: flex-start; gap: 0.65rem;
  font-size: 0.9rem; letter-spacing: 0; text-transform: none;
  color: rgba(253, 238, 244, 0.8); margin: 0;
}
/* painted by us, so disabled boxes still look deliberate rather than greyed out */
.field .checks .check input {
  appearance: none; -webkit-appearance: none;
  width: 17px; height: 17px; flex: none; margin: 0.3rem 0 0; padding: 0;
  display: grid; place-items: center; opacity: 1;
  border-radius: 5px; border: 1px solid var(--line);
  background: rgba(10, 4, 16, 0.5);
}
.field .checks .check input:checked {
  background: var(--rose); border-color: var(--rose);
}
.field .checks .check input:checked::after {
  content: "\2713"; color: #200311; font-size: 11px; line-height: 1; font-weight: 600;
}
.check input:not(:checked) + span { color: rgba(253, 238, 244, 0.38); text-decoration: line-through; }

.stamp {
  position: absolute; bottom: 7%; right: 5%;
  font-family: var(--sans); font-weight: 500; font-size: clamp(1.6rem, 5vw, 2.6rem);
  letter-spacing: 0.2em; color: var(--rose);
  border: 4px solid var(--rose); border-radius: 12px;
  padding: 0.35rem 1rem; opacity: 0; pointer-events: none;
  transform: rotate(-14deg) scale(2.6);
  transition: opacity 0.25s, transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.stamp.is-stamped { opacity: 0.88; transform: rotate(-14deg) scale(1); }
.form.is-approved input, .form.is-approved select, .form.is-approved .note-box { opacity: 0.55; }

/* ─── chapter 7: timeline ─── */
.timeline {
  list-style: none; padding: 0; margin: 0 0 2.4rem;
  text-align: left; position: relative;
}
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px;
  background: linear-gradient(var(--rose-deep), var(--rose), transparent);
  opacity: 0.4;
}
.event {
  position: relative; padding: 0 0 1.6rem 2.4rem;
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.event.is-in { opacity: 1; transform: none; }
.event::before {
  content: ""; position: absolute; left: 0; top: 0.55rem;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--rose); background: var(--ink);
  box-shadow: 0 0 0 4px rgba(255, 111, 156, 0.1);
}
.event .when {
  display: block; font-size: 0.68rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.2rem;
}
.event p {
  margin: 0; font-family: var(--serif);
  font-size: clamp(1.05rem, 2.5vw, 1.35rem); color: rgba(253, 238, 244, 0.88);
}
.event.is-final::before { background: var(--rose); box-shadow: 0 0 22px var(--rose); }
.event.is-final p { color: var(--gold); }

/* ─── chapter 8: the ask ─── */
.chapter-ask .stage { max-width: 720px; }
.ask {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.2rem, 8vw, 4.4rem); line-height: 1.08;
  margin: 0 0 0.9rem;
  background: linear-gradient(170deg, var(--cream), var(--rose) 75%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 90px rgba(255, 111, 156, 0.22);
}
.answers {
  display: flex; justify-content: center; align-items: center;
  gap: 1.1rem; flex-wrap: wrap;
  min-height: 220px; position: relative;
}
.btn-yes {
  background: linear-gradient(120deg, var(--rose-deep), var(--rose));
  border-color: transparent; color: #200311; font-weight: 500;
  font-size: 1rem; padding: 1rem 2.6rem;
  box-shadow: 0 12px 44px rgba(255, 111, 156, 0.3);
  transition: transform 0.5s var(--ease), box-shadow 0.5s, font-size 0.5s, padding 0.5s;
  will-change: transform;
}
.btn-no {
  position: relative;
  transition: transform 0.32s var(--ease), opacity 0.4s, font-size 0.4s, padding 0.4s;
  will-change: transform;
}
.btn-no.is-fleeing { position: fixed; z-index: 60; margin: 0; }
.btn-no.is-away { opacity: 0; pointer-events: none; }

/* ─── chapter 9: yes ─── */
.chapter-yes .stage { max-width: 640px; }
.yes-title {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.4rem, 9vw, 4.6rem); line-height: 1.05; margin: 0 0 1.4rem;
}
.yes-title span {
  font-style: italic; font-weight: 500;
  background: linear-gradient(120deg, var(--rose), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.yes-body { color: rgba(253, 238, 244, 0.8); font-size: 1.02rem; margin-bottom: 2rem; }
.signoff { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--gold); margin-bottom: 2.4rem; }
.signoff strong { font-style: normal; font-weight: 500; }

/* ─── responsive ─── */
@media (max-width: 560px) {
  .clues { grid-template-columns: 1fr 1fr; }
  .clue, .clue-inner { min-height: 170px; height: 170px; }
  .clue-back { font-size: 0.78rem; padding: 0.9rem; }
  .clue-back strong { font-size: 1rem; }
  .stamp { right: 50%; transform: translateX(50%) rotate(-14deg) scale(2.6); }
  .stamp.is-stamped { transform: translateX(50%) rotate(-14deg) scale(1); }
  .answers { min-height: 260px; }
}

/* ─── reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.12s !important;
  }
  .glow { display: none; }
}
