:root {
  --cream: #f4ecd8;
  --cream-2: #ece0c2;
  --paper: #fbf6ea;
  --ink: #3f362a;
  --ink-soft: #6b5f4e;
  --teal: #4f7d78;
  --teal-deep: #345754;
  --gold: #c99a53;
  --rust: #b0654a;
  --shadow: rgba(63, 54, 42, 0.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Nunito', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}


/* film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 998;
  box-shadow: inset 0 0 18vw rgba(63,54,42,0.18);
}

/* ---------- GATE ---------- */
#gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, var(--cream-2), var(--cream) 70%);
  transition: opacity 1.4s ease, visibility 1.4s ease;
}
#gate.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.gate-inner {
  text-align: center;
  padding: 2rem;
}
.gate-eyebrow {
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  color: var(--teal-deep);
  margin: 0 0 0.2rem;
}
.gate-title {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(3.5rem, 14vw, 7rem);
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.gate-sub {
  font-size: 1rem;
  color: var(--ink-soft);
  margin: 0.4rem 0 2.2rem;
  letter-spacing: 0.04em;
}
#beginBtn {
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--teal);
  color: var(--paper);
  border: none;
  padding: 0.95rem 2.4rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--shadow);
  transition: transform 0.25s ease, background 0.25s ease;
}
#beginBtn:hover { transform: translateY(-2px); background: var(--teal-deep); }
#beginBtn:active { transform: translateY(0); }
.gate-hint {
  margin-top: 1.6rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  opacity: 0.75;
}

/* ---------- CONTROLS ---------- */
#controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 500;
  display: flex;
  gap: 0.5rem;
}
#controls button {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(63,54,42,0.15);
  background: rgba(251, 246, 234, 0.85);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--shadow);
}
#controls button.off { opacity: 0.45; }

/* ---------- MAIN ---------- */
#scroller { position: relative; z-index: 1; }

.opening {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.opening-kicker {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--rust);
  margin: 0 0 0.3rem;
}
.opening-title {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(3rem, 12vw, 6rem);
  margin: 0;
}
.opening-sub {
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-top: 1rem;
}
.scroll-cue {
  margin-top: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.scroll-cue span {
  width: 1px;
  height: 3.2rem;
  background: linear-gradient(var(--ink-soft), transparent);
  animation: pulseDown 2s infinite;
}
.scroll-cue p {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin: 0;
}
@keyframes pulseDown {
  0% { opacity: 0.2; transform: translateY(-6px); }
  50% { opacity: 1; }
  100% { opacity: 0.2; transform: translateY(6px); }
}

/* ---------- REEL / SCRAPBOOK ---------- */
#reel, #reel-2 {
  max-width: 900px;
  margin: 0 auto;
  padding: 4vh 5vw 10vh;
}

.gap-card {
  max-width: 320px;
  margin: 2vh auto 9vh;
  padding: 0 1rem;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  color: var(--ink-soft);
  opacity: 0.85;
  position: relative;
}
.gap-card::before,
.gap-card::after {
  content: "";
  display: block;
  width: 2.4rem;
  height: 1px;
  background: var(--ink-soft);
  opacity: 0.4;
  margin: 0.6rem auto;
}

.card {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 640px;
  margin: 0 auto 9vh;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.card.in-view {
  opacity: 1;
  transform: translateY(0);
}
.card:nth-child(4n+1) { --r: -3.2deg; flex-direction: row; margin-left: 2vw; margin-right: auto; }
.card:nth-child(4n+2) { --r: 2.6deg; flex-direction: row-reverse; margin-left: auto; margin-right: 2vw; }
.card:nth-child(4n+3) { --r: -1.6deg; flex-direction: row; margin-left: 0; margin-right: auto; }
.card:nth-child(4n+4) { --r: 3deg; flex-direction: row-reverse; margin-left: auto; margin-right: 0; }

.card:nth-child(4n+1) .caption, .card:nth-child(4n+3) .caption { text-align: left; }
.card:nth-child(4n+2) .caption, .card:nth-child(4n+4) .caption { text-align: right; }

.polaroid {
  position: relative;
  flex-shrink: 0;
  width: min(52vw, 260px);
  background: var(--paper);
  padding: 0.7rem 0.7rem 2.2rem;
  border-radius: 3px;
  box-shadow: 0 14px 30px var(--shadow), 0 2px 6px rgba(63,54,42,0.12);
  transform: rotate(var(--r, 0deg));
}

.polaroid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  filter: sepia(0.12) saturate(1.08) contrast(1.02);
}
.polaroid .tape {
  position: absolute;
  top: -0.7rem;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 4.2rem;
  height: 1.5rem;
  background: rgba(201, 154, 83, 0.35);
  box-shadow: 0 2px 4px rgba(63,54,42,0.15);
}
.polaroid .date {
  position: absolute;
  bottom: 0.6rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

.caption {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: 'Caveat', cursive;
  font-size: clamp(1.15rem, 3.6vw, 1.5rem);
  line-height: 1.3;
  color: var(--ink-soft);
}

/* ---------- VIDEO MOMENT ---------- */
#video-moment {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6vh 5vw 10vh;
}
.video-label {
  font-family: 'Caveat', cursive;
  font-size: 1.5rem;
  color: var(--rust);
  margin-bottom: 1rem;
}
.moment-video {
  width: min(80vw, 380px);
  border-radius: 4px;
  box-shadow: 0 16px 34px var(--shadow);
  background: var(--paper);
  padding: 0.6rem;
}

/* ---------- LETTER ---------- */
#letter {
  display: flex;
  justify-content: center;
  padding: 8vh 5vw 12vh;
}
.letter-card {
  max-width: 620px;
  width: 100%;
  background: var(--paper);
  border-radius: 4px;
  padding: clamp(1.8rem, 5vw, 3.4rem);
  box-shadow: 0 20px 50px var(--shadow);
  transform: rotate(-0.6deg);
  position: relative;
}
.letter-card::before {
  content: "";
  position: absolute;
  top: -0.8rem;
  left: 2.4rem;
  width: 4.6rem;
  height: 1.6rem;
  background: rgba(79, 125, 120, 0.28);
  transform: rotate(-3deg);
}
.letter-heading {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 2.2rem;
  margin: 0 0 1.2rem;
  color: var(--teal-deep);
}
.letter-body {
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--ink);
}
.letter-body p { margin: 0 0 1.1rem; }
.letter-sign {
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  color: var(--rust);
  margin: 1.6rem 0 0;
  text-align: right;
}

/* ---------- CLOSING ---------- */
.closing {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem 8rem;
}
.closing-line {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  margin: 0;
}
.closing-sub {
  color: var(--ink-soft);
  margin-top: 0.6rem;
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
}

@media (min-width: 700px) {
  .polaroid { width: 280px; }
}
