/* ─────────────────────────────────────────────────────────────
   Rose Garden · visual language
   deep greens, warm whites, a breath of bordeaux, golden light
   ───────────────────────────────────────────────────────────── */
:root {
  --ink: #040605;
  --cream: #f3ead8;
  --cream-dim: rgba(243, 234, 216, 0.72);
  --gold: #d9b779;
  --gold-soft: rgba(217, 183, 121, 0.35);
  --bordeaux: #7d1424;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Jost', 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --lb: max(0px, calc((100vh - 100vw / 2.39) / 2));
}

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

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body.is-locked { overflow: hidden; height: 100%; touch-action: none; }

::selection { background: rgba(125, 20, 36, 0.6); color: var(--cream); }

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100%;
  display: block;
  z-index: 0;
}

/* Mobile cinema uses the same rendered garden, decoded by the video player. */
.is-cinema #scene { display: none; }
.cinema { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; background: var(--ink); }
.cinema__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0; transition: opacity 0.65s ease; }
.cinema__video.is-visible { opacity: 1; }
@media (orientation: landscape) { .cinema__video { object-fit: contain; } }
.cinema::after { content: ''; position: absolute; inset: -64px; background: url('../assets/cinema/grain.svg') repeat; opacity: 0.035; pointer-events: none; animation: cinema-grain 0.7s steps(4) infinite; }
@keyframes cinema-grain { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(24px, -18px); } 50% { transform: translate(-14px, 28px); } 75% { transform: translate(32px, 12px); } }
.cinema__petals { position: absolute; inset: 0; opacity: 0; transition: opacity 2s ease; }
.cinema__petals.is-raining { opacity: 1; }
.cinema__petals i, .cinema__burst {
  position: absolute; display: block; width: var(--size, 12px); height: calc(var(--size, 12px) * 1.35);
  border-radius: 70% 20% 65% 30%; background: radial-gradient(ellipse at 35% 30%, #bd4254, #7a1027 65%, #430b18);
  box-shadow: inset 1px 1px 2px #ed9a7933;
}
.cinema__petals i { left: var(--x); top: -5vh; animation: cinema-petal var(--duration) var(--delay) linear infinite; animation-play-state: paused; }
.cinema__petals.is-raining i { animation-play-state: running; }
@keyframes cinema-petal {
  0% { transform: translate3d(-15px, -5vh, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.85; }
  85% { opacity: 0.65; }
  100% { transform: translate3d(65px, 110vh, 0) rotate(300deg); opacity: 0; }
}

/* ── Veil & letterbox ─────────────────────────────────────── */
.veil {
  position: fixed; inset: 0; z-index: 20;
  background: var(--ink);
  pointer-events: none;
}

.letterbox {
  position: fixed; left: 0; right: 0; z-index: 15;
  height: var(--lb);
  background: #000;
  pointer-events: none;
  transition: transform 2.6s var(--ease);
}
.letterbox--top { top: 0; transform: translateY(-100%); }
.letterbox--bottom { bottom: 0; transform: translateY(100%); }
.is-letterboxed .letterbox { transform: translateY(0); }
@media (orientation: portrait) { :root { --lb: 7vh; } }

/* ── Gate ─────────────────────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 50% 60%, rgba(40, 52, 30, 0.35), transparent 60%),
    radial-gradient(ellipse at 50% 50%, #070a07, #020302 75%);
  text-align: center;
  padding: 2rem;
}
.gate__inner { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; animation: gateIn 2.4s var(--ease) both; }
@keyframes gateIn { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.gate__eyebrow {
  margin: 0;
  font-family: var(--sans); font-weight: 300;
  font-size: 0.72rem; letter-spacing: 0.55em; text-transform: uppercase;
  color: var(--gold); opacity: 0.8;
}
.gate__title {
  margin: 0;
  font-weight: 300; font-style: italic;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  letter-spacing: 0.01em;
  color: var(--cream);
}
.gate__progress { width: min(240px, 50vw); height: 1px; background: rgba(243, 234, 216, 0.12); overflow: hidden; }
.gate__progress span { display: block; height: 100%; background: linear-gradient(90deg, transparent, var(--gold)); transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease); }
.gate__enter {
  position: relative;
  margin-top: 0.6rem;
  padding: 1rem 2.4rem;
  background: none;
  border: 1px solid rgba(217, 183, 121, 0.18);
  border-radius: 999px;
  color: var(--cream-dim);
  font-family: var(--sans); font-weight: 300;
  font-size: 0.74rem; letter-spacing: 0.42em; text-transform: uppercase;
  cursor: default;
  transition: all 1.2s var(--ease);
}
.gate__enter.is-ready { cursor: pointer; color: var(--cream); border-color: rgba(217, 183, 121, 0.5); animation: breathe 3.6s ease-in-out infinite; }
.gate__enter.is-ready:hover { background: rgba(217, 183, 121, 0.08); box-shadow: 0 0 40px rgba(217, 183, 121, 0.18); }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 rgba(217, 183, 121, 0); } 50% { box-shadow: 0 0 34px rgba(217, 183, 121, 0.16); } }
.gate__hint { margin: 0; font-family: var(--sans); font-weight: 200; font-size: 0.72rem; letter-spacing: 0.2em; color: rgba(243, 234, 216, 0.4); }

/* ── Credit (opening title) ──────────────────────────────── */
.credit {
  position: fixed; left: 0; right: 0; z-index: 16;
  bottom: calc(var(--lb) + 7vh);
  text-align: center;
  font-family: var(--sans); font-weight: 200;
  font-size: clamp(0.62rem, 1.1vw, 0.8rem);
  letter-spacing: 0.6em; text-transform: uppercase;
  color: var(--cream);
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
}

/* ── Hero message ─────────────────────────────────────────── */
#experience { position: relative; z-index: 5; }
.hero { position: relative; height: 100vh; height: 100svh; }
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(3, 5, 3, 0.62) 0%, rgba(3, 5, 3, 0.25) 38%, transparent 62%);
  opacity: 0; transition: opacity 4s var(--ease);
  pointer-events: none;
}
.has-message .hero::before { opacity: 1; }

.hero__message {
  position: absolute;
  left: clamp(1.5rem, 7vw, 8rem);
  top: 50%;
  transform: translateY(-50%);
  max-width: min(36rem, 46vw);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
}
.msg { margin: 0; }
.msg .w { display: inline-block; overflow: visible; }
.msg .w > span { display: inline-block; opacity: 0; will-change: transform, opacity, filter; }
.msg--1 {
  font-weight: 300; font-style: italic;
  font-size: clamp(1.7rem, 3.1vw, 3rem);
  line-height: 1.22;
  color: var(--cream);
}
.msg--2 {
  margin-top: 1.4rem;
  font-weight: 300;
  font-size: clamp(1.15rem, 1.75vw, 1.6rem);
  line-height: 1.45;
  color: var(--cream-dim);
}
.msg__rule {
  width: 4.5rem; height: 1px; margin: 2.2rem 0 1.6rem;
  background: linear-gradient(90deg, var(--gold), transparent);
  transform-origin: left; opacity: 0;
}
.msg--whisper {
  font-style: italic; font-weight: 400;
  font-size: clamp(1rem, 1.35vw, 1.22rem);
  color: var(--gold);
  letter-spacing: 0.01em;
}
.msg--name {
  margin-top: 0.5rem;
  display: flex; align-items: center; gap: 0.6em; flex-wrap: wrap;
  font-weight: 400; font-style: italic;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: 0.005em;
  color: #f7ecd6;
}
.heart { width: 0.42em; height: 0.42em; flex: none; opacity: 0; }
.heart path { fill: rgba(125, 20, 36, 0.85); stroke: var(--gold); stroke-width: 1.2; }
.msg--name .heart { animation: beat 2.8s ease-in-out infinite 16s; }
@keyframes beat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.12); } 24% { transform: scale(1); } 36% { transform: scale(1.08); } 48% { transform: scale(1); } }

.scroll-hint {
  position: absolute; left: 50%; bottom: 4.5vh; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  opacity: 0;
  font-family: var(--sans); font-weight: 300;
  font-size: 0.66rem; letter-spacing: 0.5em; text-transform: uppercase;
  color: var(--cream-dim);
}
.scroll-hint i { width: 1px; height: 48px; background: linear-gradient(var(--gold), transparent); animation: drip 2.8s var(--ease) infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ── Story ────────────────────────────────────────────────── */
.story { position: relative; }
.chapter {
  min-height: 130vh;
  display: flex; align-items: center;
  padding: 18vh clamp(1.2rem, 7vw, 8rem);
}
.chapter--right { justify-content: flex-end; }
.chapter--center { justify-content: center; text-align: center; }
.panel {
  position: relative;
  width: min(34rem, 100%);
  padding: clamp(1.8rem, 3.5vw, 3.2rem);
  background: linear-gradient(160deg, rgba(10, 14, 9, 0.62), rgba(8, 10, 7, 0.42));
  border: 1px solid rgba(217, 183, 121, 0.12);
  border-radius: 2px;
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35);
}
.panel--wide { width: min(58rem, 100%); }
.eyebrow {
  margin: 0 0 1rem;
  font-family: var(--sans); font-weight: 300;
  font-size: 0.68rem; letter-spacing: 0.5em; text-transform: uppercase;
  color: var(--gold);
}
.chapter__title {
  margin: 0 0 0.6rem;
  font-weight: 300; font-style: italic;
  font-size: clamp(2rem, 3.6vw, 3.2rem);
  line-height: 1.12;
}
.chapter__date {
  margin: 0 0 1.6rem;
  font-family: var(--sans); font-weight: 200;
  font-size: 0.72rem; letter-spacing: 0.32em;
  color: rgba(243, 234, 216, 0.5);
}
.chapter__text { font-size: clamp(1.1rem, 1.5vw, 1.32rem); line-height: 1.65; color: var(--cream-dim); margin: 1.4rem 0 0; }

.photo { margin: 0; }
.photo__frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #0c100b;
  outline: 1px solid rgba(217, 183, 121, 0.18);
  outline-offset: 6px;
}
.photo__frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo--landscape .photo__frame { aspect-ratio: 1536 / 1153; }
.photo--landscape img { object-fit: contain; }
.photo--portrait .photo__frame { aspect-ratio: 3 / 4; }
/* Frame the supplied video stills inside their black letterbox borders. */
.photo--still .photo__frame { aspect-ratio: 828 / 1486; }
.memory__photos { margin: 2rem 0; }
.memory__photos--pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 3vw, 2rem); padding-bottom: 1.5rem; }
.memory__photos--pair .photo:nth-child(2) { margin-top: 2.5rem; }
.panel--pair { width: min(42rem, 100%); }
.memory__quote { margin: 2rem 0 0; padding: 1.4rem 0 0; border-top: 1px solid rgba(217, 183, 121, 0.24); color: var(--gold); font-style: italic; font-size: clamp(1.3rem, 2vw, 1.65rem); line-height: 1.5; }
.interlude { max-width: 42rem; text-shadow: 0 3px 30px #000; }
.interlude__text { font-size: clamp(2.5rem, 6vw, 5rem); line-height: 1.15; font-style: italic; margin: 1.8rem 0; }
.interlude__note { color: var(--cream-dim); font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.6; }
.letter .chapter__title { margin-bottom: 1.8rem; }
.photo__placeholder {
  position: absolute; inset: 0;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  color: rgba(217, 183, 121, 0.45);
  background: radial-gradient(ellipse at 50% 40%, rgba(60, 70, 40, 0.25), transparent 70%);
}
.photo__placeholder span { font-family: var(--sans); font-weight: 200; font-size: 0.62rem; letter-spacing: 0.2em; color: rgba(243, 234, 216, 0.3); }
.photo__art { width: 38%; }
.photo__frame.is-empty .photo__placeholder { display: flex; }
.photo figcaption { margin-top: 1.1rem; font-style: italic; color: rgba(243, 234, 216, 0.55); font-size: 1rem; }

.moments { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(1.5rem, 3vw, 3rem); margin-top: 2rem; }
.moment:nth-child(even) { margin-top: 4rem; }
.moment .photo__frame { aspect-ratio: 4 / 3; }
.moment .chapter__date { margin: 1.4rem 0 0.4rem; }
.moment h3 { margin: 0 0 0.4rem; font-weight: 400; font-style: italic; font-size: 1.5rem; }
.moment p { margin: 0; line-height: 1.6; color: var(--cream-dim); font-size: 1.08rem; }

.future { list-style: none; padding: 0; margin: 2rem 0 0; }
.future li {
  display: flex; gap: 1.4rem; align-items: baseline;
  padding: 1.1rem 0;
  border-top: 1px solid rgba(217, 183, 121, 0.12);
  font-size: clamp(1.1rem, 1.5vw, 1.32rem); line-height: 1.5;
}
.future li span { font-family: var(--sans); font-weight: 200; font-size: 0.72rem; letter-spacing: 0.2em; color: var(--gold); }

.counter { text-shadow: 0 4px 40px rgba(0, 0, 0, 0.6); }
.counter__num {
  margin: 0;
  font-weight: 300;
  font-size: clamp(5rem, 16vw, 12rem);
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  background: linear-gradient(180deg, #fbf3e2, #d9b779);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.counter__unit { margin: 0.4rem 0 1.4rem; font-style: italic; font-size: clamp(1.6rem, 3vw, 2.4rem); }
.counter__note { margin: 0; font-style: italic; color: var(--cream-dim); font-size: 1.2rem; }

.letter .letter__p { font-size: clamp(1.12rem, 1.5vw, 1.34rem); line-height: 1.75; color: var(--cream-dim); margin: 0 0 1.2rem; }
.letter__closing { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em; margin: 2.2rem 0 0.4rem; font-style: italic; font-size: clamp(1.8rem, 3vw, 2.6rem); }
.letter__closing .heart { opacity: 1; width: 0.5em; height: 0.5em; }
.letter__sig { margin: 0; font-style: italic; color: var(--gold); font-size: 1.3rem; }
.replay {
  margin-top: 2.6rem;
  padding: 0.95rem 2rem;
  background: none;
  border: 1px solid rgba(217, 183, 121, 0.4);
  border-radius: 999px;
  color: var(--cream);
  font-family: var(--sans); font-weight: 300;
  font-size: 0.7rem; letter-spacing: 0.4em; text-transform: uppercase;
  cursor: pointer;
  transition: all 0.8s var(--ease);
}
.replay:hover { background: rgba(217, 183, 121, 0.1); box-shadow: 0 0 40px rgba(217, 183, 121, 0.15); }

/* ── Sound toggle ─────────────────────────────────────────── */
.sound-toggle {
  position: fixed; right: clamp(1rem, 3vw, 2.2rem); bottom: clamp(1rem, 3vw, 2.2rem); z-index: 12;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  background: rgba(8, 10, 7, 0.35);
  border: 1px solid rgba(217, 183, 121, 0.25);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  backdrop-filter: blur(8px);
}
.sound-toggle i { width: 2px; height: 14px; background: var(--gold); border-radius: 1px; animation: eq 1.4s ease-in-out infinite; transform-origin: bottom; }
.sound-toggle i:nth-child(2) { animation-delay: -0.4s; }
.sound-toggle i:nth-child(3) { animation-delay: -0.8s; }
.sound-toggle i:nth-child(4) { animation-delay: -1.1s; }
.sound-toggle.is-muted i { animation: none; transform: scaleY(0.2); }
@keyframes eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }

.debug {
  display: none;
  position: fixed; left: 8px; top: 8px; z-index: 99;
  margin: 0; padding: 6px 8px;
  max-width: 90vw; white-space: pre-wrap;
  font: 11px/1.4 monospace; color: #9f9; background: rgba(0, 0, 0, 0.6);
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 760px), (orientation: portrait) {
  :root { --lb: 7svh; }
  .hero::before { background: linear-gradient(0deg, rgba(3, 5, 3, 0.78) 0%, rgba(3, 5, 3, 0.35) 42%, transparent 62%); }
  .hero__message {
    left: 0; right: 0; top: auto; bottom: 11vh;
    transform: none;
    max-width: none;
    padding: 0 1.6rem;
    text-align: center;
  }
  .msg--1 { font-size: clamp(1.45rem, 6.4vw, 2rem); }
  .msg--2 { margin-top: 0.9rem; font-size: clamp(1.02rem, 4.2vw, 1.25rem); }
  .msg__rule { margin: 1.3rem auto 1rem; background: linear-gradient(90deg, transparent, var(--gold), transparent); transform-origin: center; }
  .msg--whisper { font-size: 0.98rem; }
  .msg--name { justify-content: center; font-size: clamp(2.1rem, 10vw, 2.9rem); }
  .scroll-hint { bottom: 3vh; }
  .chapter { min-height: 115vh; padding: 14vh 1.1rem; justify-content: center; }
  .panel {
    padding: 1.7rem 1.4rem;
    background: linear-gradient(160deg, rgba(10, 14, 9, 0.28), rgba(8, 10, 7, 0.20));
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 2px 12px rgba(0, 0, 0, 0.75);
  }
  .chapter__text, .letter .letter__p { color: rgba(255, 248, 234, 0.96); }
  .photo figcaption, .chapter__date { color: rgba(243, 234, 216, 0.85); }
  .moments { grid-template-columns: 1fr; }
  .moment:nth-child(even) { margin-top: 0; }
}

.sound-toggle {
  bottom: max(clamp(1rem, 3vw, 2.2rem), env(safe-area-inset-bottom));
  right: max(clamp(1rem, 3vw, 2.2rem), env(safe-area-inset-right));
}

@media (prefers-reduced-motion: reduce) {
  .cinema::after { animation: none; }
  .gate__enter.is-ready, .scroll-hint i, .sound-toggle i, .msg--name .heart { animation: none; }
}
