/* ============================================================
   Warm & sentimental. Cream, dusty rose, Instrument Serif.
   You shouldn't need to touch this file — edit config.js.
   ============================================================ */

:root {
  --cream:      #FDF8F3;
  --cream-deep: #F6EDE3;
  --ink:        #2A2320;
  --ink-soft:   #6B5F58;
  --ink-faint:  #A2938A;
  --rose:       #C4746E;
  --rose-deep:  #9E574F;
  --rose-wash:  #F2E0DA;
  --line:       #E6D9CD;

  /* Instrument Serif has no Hangul. Nanum Myeongjo catches Korean characters so
     민주 renders as a proper serif instead of falling back to a system sans. */
  --serif: "Instrument Serif", "Nanum Myeongjo", "Iowan Old Style", Georgia, serif;
  --sans:  "Inter", "Nanum Myeongjo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --measure: 34rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The UA's [hidden] rule is display:none, but any element we also give an
   explicit display to (.gate is display:grid) would beat it and stay visible.
   This keeps the hidden attribute authoritative everywhere. */
[hidden] { display: none !important; }

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

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Paper grain — the thing that makes it feel warm instead of flat */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  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='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.28'/%3E%3C/svg%3E");
}

.wrap { width: min(64rem, 100% - 2.5rem); margin-inline: auto; }
.wrap--narrow { width: min(var(--measure), 100% - 2.5rem); }

.display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.eyebrow, .kicker {
  font-size: 0.73rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rose);
  font-weight: 500;
}

.section-head { margin-bottom: 4.5rem; }
.section-sub { color: var(--ink-soft); margin-top: 0.9rem; font-size: 1.02rem; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.85rem 1.9rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  cursor: pointer;
  transition: all 0.35s var(--ease);
  background: transparent;
  color: var(--rose-deep);
}
.btn:hover { background: var(--rose); color: var(--cream); }
.btn--solid { background: var(--rose); color: var(--cream); }
.btn--solid:hover { background: var(--rose-deep); border-color: var(--rose-deep); }
.btn--ghost { border-color: var(--line); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--rose); background: var(--rose); color: var(--cream); }

.btn--open {
  margin-top: 2.75rem;
  padding: 1.05rem 3rem;
  font-size: 1rem;
  background: var(--rose);
  color: var(--cream);
  box-shadow: 0 0.75rem 2.5rem -0.75rem rgba(158, 87, 79, 0.55);
  animation: breathe 3.2s ease-in-out infinite;
}
.btn--open:hover { background: var(--rose-deep); border-color: var(--rose-deep); animation-play-state: paused; }

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.035); }
}

/* ============================================================
   ACT ONE — THE GATE
   ============================================================ */
.gate {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 6rem 1.5rem;
  background:
    radial-gradient(120% 90% at 50% 0%, #FFFDFB 0%, var(--cream) 45%, var(--cream-deep) 100%);
}
.gate__inner { max-width: 40rem; }

.gate__name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.2rem, 13vw, 7rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 1.1rem 0 3.25rem;
}

/* Hangul doesn't want the tight Latin tracking, and Nanum Myeongjo sits
   optically smaller than Instrument Serif at the same size.
   NOTE: never put a bare `font-size: Xem` on .hangul — `em` resolves against
   the PARENT, which would wipe out the clamp() on .gate__name entirely. */
.hangul { letter-spacing: 0; }
.gate__name.hangul { font-size: clamp(3rem, 12vw, 6.4rem); }
em.hangul { font-size: 0.94em; }   /* inline: parent is the <h2>, so em is correct here */

.countdown {
  display: flex;
  justify-content: center;
  gap: clamp(1.25rem, 6vw, 3.25rem);
}
.unit { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.unit__num {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 8vw, 3.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.unit__label {
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.gate__note {
  margin-top: 3rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 26rem;
  margin-inline: auto;
}

.scroll-cue {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
}
.scroll-cue span {
  display: block;
  width: 1px;
  height: 3.5rem;
  background: linear-gradient(var(--rose), transparent);
  animation: drop 2.2s ease-in-out infinite;
}
@keyframes drop {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  100% { transform: scaleY(1); transform-origin: bottom; opacity: 0; }
}

/* Curtain-lift when she taps "Open it" */
.gate.is-lifting {
  animation: lift 1.15s var(--ease) forwards;
}
@keyframes lift {
  to { opacity: 0; transform: translateY(-3.5rem) scale(1.03); }
}

/* ============================================================
   ACT TWO — THE REVEAL
   ============================================================ */
main { position: relative; z-index: 2; }

.reveal { padding: clamp(6rem, 16vh, 10rem) 0 clamp(5rem, 12vh, 8rem); }
.reveal .display { margin-bottom: 2.75rem; }
.reveal .display em { font-style: italic; color: var(--rose); }

.letter p {
  margin-bottom: 1.5rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.85;
}
.letter p:last-child { margin-bottom: 0; }

.signoff {
  margin-top: 2.5rem;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-style: italic;
  color: var(--rose-deep);
}

.video {
  margin-top: 4rem;
  border-radius: 1.1rem;
  overflow: hidden;
  background: var(--cream-deep);
  box-shadow: 0 1.5rem 3.5rem -1.25rem rgba(42, 35, 32, 0.22);
}
.video video { display: block; width: 100%; height: auto; }
.video figcaption {
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--ink-faint);
  background: var(--cream-deep);
}

.plan {
  margin-top: 4rem;
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: linear-gradient(160deg, var(--rose-wash), var(--cream));
}
.plan__headline {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  line-height: 1.15;
  margin: 0.75rem 0 1rem;
}
.plan__details { color: var(--ink-soft); }

/* ============================================================
   THE CAROUSEL
   Infinite both directions. Slides are absolutely positioned and
   placed by their signed distance from centre, so there are no
   clones and no seam when it wraps.
   ============================================================ */
.gallery { padding: clamp(4rem, 10vh, 7rem) 0 clamp(5rem, 12vh, 8rem); overflow: hidden; }
.section-head--center { text-align: center; margin-bottom: 3rem; }

.car {
  position: relative;
  width: 100%;
  /* Room for the centre slide plus a slice of its neighbours. */
  height: clamp(24rem, 62vh, 34rem);
}

.car__stage {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: pan-y;          /* let vertical scroll through, we own horizontal */
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
.car__stage.is-dragging { cursor: grabbing; }
.car__stage:focus-visible { outline: 1px solid var(--rose); outline-offset: 0.75rem; border-radius: 1rem; }

.car__slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(14rem, 36vw, 19rem);
  /* 9 of the 13 photos are exactly 2:3, so this frames them with no crop at all. */
  aspect-ratio: 2 / 3;
  margin: 0;
  border-radius: 0.875rem;
  overflow: hidden;
  background: var(--cream-deep);
  box-shadow: 0 1.5rem 3.5rem -1.5rem rgba(42, 35, 32, 0.45);
  transform-origin: center;
  will-change: transform, opacity;
  transition: transform 0.62s var(--ease), opacity 0.62s var(--ease);
  pointer-events: none;
}
.car__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* mixed portrait/landscape/narrow all frame cleanly */
  display: block;
  filter: saturate(0.92) contrast(1.02) sepia(0.06);
  -webkit-user-drag: none;
}

/* Neighbours are clickable so she can tap to bring one to centre. */
.car__slide.is-side { pointer-events: auto; cursor: pointer; }
.car__slide.is-center { pointer-events: auto; }

/* While dragging, kill the transition so slides track the finger. */
.car__stage.is-dragging .car__slide { transition: none; }

.car__nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: -1.375rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(253, 248, 243, 0.85);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.car__nav:hover { border-color: var(--rose); background: var(--cream); }
.car__nav--prev { left: clamp(0.75rem, 4vw, 3rem); }
.car__nav--next { right: clamp(0.75rem, 4vw, 3rem); }
/* Chevrons drawn with a rotated border — no icon font needed. */
.car__nav::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-top: 1.5px solid var(--rose-deep);
  border-right: 1.5px solid var(--rose-deep);
}
.car__nav--next::before { transform: translate(-65%, -50%) rotate(45deg); }
.car__nav--prev::before { transform: translate(-35%, -50%) rotate(-135deg); }

.car__caption {
  margin: 2rem auto 0;
  max-width: 28rem;
  padding: 0 1.5rem;
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  min-height: 1.7rem;
  transition: opacity 0.3s var(--ease);
}

.car__dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}
.car__dot {
  width: 0.375rem;
  height: 0.375rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  transition: background 0.35s var(--ease), transform 0.35s var(--ease);
}
.car__dot.is-on { background: var(--rose); transform: scale(1.5); }

@media (max-width: 40rem) {
  .car { height: 60vh; }
  .car__slide { width: 58vw; }
  .car__nav { display: none; }   /* swipe is the interaction on mobile */
}

/* ============================================================
   ACT THREE — THE STORY
   ============================================================ */
.story { padding: clamp(5rem, 12vh, 8rem) 0; }

.timeline { list-style: none; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 0.4375rem;
  width: 1px;
  background: linear-gradient(transparent, var(--line) 8%, var(--line) 92%, transparent);
}

.ms {
  position: relative;
  padding: 0 0 clamp(4rem, 9vh, 6rem) 2.75rem;
}
.ms:last-child { padding-bottom: 0; }
.ms::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 50%;
  background: var(--cream);
  border: 1px solid var(--rose);
  transition: background 0.5s var(--ease) 0.2s;
}
.ms.is-in::before { background: var(--rose); }

.ms__date {
  font-size: 0.73rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose);
  font-weight: 500;
}
.ms__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.2;
  margin: 0.5rem 0 0.85rem;
}
.ms__body { color: var(--ink-soft); max-width: var(--measure); }

.ms__photo {
  margin-top: 1.75rem;
  max-width: 30rem;
  border-radius: 0.875rem;
  overflow: hidden;
  background: var(--cream-deep);
  box-shadow: 0 1.25rem 3rem -1.25rem rgba(42, 35, 32, 0.28);
}
.ms__photo img {
  display: block;
  width: 100%;
  height: auto;
  filter: saturate(0.92) contrast(1.02) sepia(0.06);
}

/* Labeled placeholder so the shell looks intentional before photos exist */
.ph {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--line);
  border-radius: 0.875rem;
  background: var(--cream-deep);
  color: var(--ink-faint);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 1rem;
}

/* Scroll-in animation */
.fade { opacity: 0; transform: translateY(1.75rem); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.fade.is-in { opacity: 1; transform: none; }

/* ============================================================
   ACT FOUR — THE GAME
   ============================================================ */
.quiz { padding: clamp(5rem, 12vh, 8rem) 0; background: var(--cream-deep); }

.quiz__card {
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--cream);
}
.quiz__meta { margin-bottom: 1.75rem; }
.quiz__meta span {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.quiz__bar { margin-top: 0.6rem; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.quiz__bar i { display: block; height: 100%; width: 0; background: var(--rose); transition: width 0.5s var(--ease); }

.quiz__q {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3.6vw, 1.85rem);
  line-height: 1.3;
  margin-bottom: 1.75rem;
}

.quiz__options { display: grid; gap: 0.65rem; }
.opt {
  text-align: left;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.opt:hover:not(:disabled) { border-color: var(--rose); background: var(--rose-wash); }
.opt:disabled { cursor: default; }
.opt.is-right { border-color: var(--rose); background: var(--rose-wash); color: var(--rose-deep); font-weight: 500; }
.opt.is-wrong { opacity: 0.45; text-decoration: line-through; }

.quiz__reply {
  margin-top: 1.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rose);
  color: var(--ink-soft);
  font-style: italic;
}
#quiz-next { margin-top: 1.75rem; }

.quiz__result { text-align: center; padding: 3rem 0 0; }
.quiz__score {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1;
  color: var(--rose);
}
.quiz__verdict { margin: 1.25rem auto 2rem; color: var(--ink-soft); max-width: 28rem; }

/* ============================================================
   THE VAULT
   ============================================================ */
.vault { padding: clamp(5rem, 12vh, 8rem) 0; text-align: center; }
.vault__hint { color: var(--ink-faint); font-size: 0.98rem; margin-bottom: 1.75rem; }

.vault__form { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }
.vault__input {
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  text-align: center;
  width: 13rem;
  transition: border-color 0.3s var(--ease);
}
.vault__input:focus { outline: none; border-color: var(--rose); }
.vault__error { margin-top: 1rem; color: var(--rose-deep); font-size: 0.9rem; }

.vault__form.is-shaking { animation: shake 0.45s ease; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  30%, 70% { transform: translateX(4px); }
  50%      { transform: translateX(-4px); }
}

.vault__open { text-align: left; }
.vault__open .display { margin-bottom: 2rem; }
.vault__photo {
  margin-top: 2.5rem;
  border-radius: 0.875rem;
  overflow: hidden;
  box-shadow: 0 1.25rem 3rem -1.25rem rgba(42, 35, 32, 0.28);
}
.vault__photo img { display: block; width: 100%; height: auto; filter: saturate(0.92) sepia(0.06); }

/* ---------- Footer ---------- */
.footer {
  padding: 4rem 0 5rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}

/* ---------- Music toggle ---------- */
.music {
  position: fixed;
  z-index: 10;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.1rem 0.6rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(253, 248, 243, 0.9);
  backdrop-filter: blur(10px);
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.3s var(--ease);
}
.music:hover { border-color: var(--rose); }
.music__icon { display: flex; align-items: flex-end; gap: 2px; height: 0.75rem; }
.music__icon i { display: block; width: 2px; height: 30%; background: var(--rose); border-radius: 1px; }
.music.is-playing .music__icon i { animation: eq 0.9s ease-in-out infinite; }
.music.is-playing .music__icon i:nth-child(2) { animation-delay: 0.15s; }
.music.is-playing .music__icon i:nth-child(3) { animation-delay: 0.3s; }
@keyframes eq {
  0%, 100% { height: 30%; }
  50%      { height: 100%; }
}

/* ---------- Responsive ---------- */
@media (max-width: 40rem) {
  body { font-size: 16px; }
  .quiz__card, .plan { padding: 1.75rem; }
  .countdown { gap: 1.1rem; }
  .music__label { display: none; }
  .music { padding: 0.7rem; }
}

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