/* ============================================================
   stefanietong — styles
   tokens · reset · layout · components · scenes
   ============================================================ */

:root {
  /* color */
  --bg:       #fdf2ef;
  --bg-2:     #f9dfe0;
  --bg-3:     #f3c7ce;
  --ink:      #3a2a2e;
  --ink-soft: #7a5560;
  --accent:   #d96b86;
  --accent-2: #c84a7a;
  --paper:    #fffaf7;

  /* type */
  --display: "Fraunces", Georgia, serif;
  --body:    "Inter", system-ui, sans-serif;

  /* opacity scale */
  --op-faint: 0.18;
  --op-soft:  0.35;
  --op-bold:  0.7;

  /* radii */
  --r-sm:   4px;
  --r-md:   12px;
  --r-lg:   18px;
  --r-pill: 999px;

  /* timing */
  --stagger-step:    90ms;
  --transition-fast: 200ms;
  --transition-slow: 700ms;
}

/* ===== password gate ===== */

#gate {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

#gate.hidden { display: none; }

.gate-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  max-width: 340px;
  width: 100%;
}

.gate-msg {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1.1;
  color: var(--ink);
  text-wrap: balance;
}

.gate-input {
  font-family: var(--body);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  background: none;
  border: none;
  border-bottom: 1.5px solid var(--accent-2);
  border-radius: 0;
  padding: 8px 0;
  width: 100%;
  outline: none;
  caret-color: var(--accent-2);
}

.gate-input::placeholder { color: var(--ink-soft); opacity: 0.55; }

.gate-error {
  font-family: var(--body);
  font-size: 12px;
  color: var(--accent-2);
  min-height: 1em;
  letter-spacing: 0.04em;
}

/* ===== lightbox ===== */

#lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(30, 14, 18, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

#lb.open {
  opacity: 1;
  pointer-events: auto;
}

.lb-img {
  max-width: 80vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--r-md);
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  transform: scale(0.94);
  transition: transform 280ms ease;
  display: block;
  background: var(--paper);
}

#lb.open .lb-img { transform: scale(1); }

.lb-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.lb-close:hover { background: rgba(255,255,255,0.24); }

.photo-slot img { cursor: pointer; }

/* ===== reset ===== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  height: 100%;
  overflow-y: scroll;
}
html.no-snap { scroll-snap-type: none; }
html::-webkit-scrollbar { width: 0; background: transparent; }
html { scrollbar-width: none; }

body { height: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== layout: scenes ===== */

.scene {
  scroll-snap-align: start;
  /* deliberately no scroll-snap-stop: always — see refactor notes */
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  padding: 8vh 28px env(safe-area-inset-bottom, 8vh);
  padding-bottom: max(8vh, env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.scene.bg-2 { background: var(--bg-2); }
.scene.bg-3 { background: var(--bg-3); }

.scene > .inner {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ===== typography ===== */

.line {
  font-family: var(--display);
  font-weight: 300;
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-size: clamp(38px, 10.5vw, 64px);
  color: var(--ink);
  text-wrap: balance;
}
.line .hl { color: var(--accent-2); }

.caption {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 32ch;
  text-wrap: pretty;
}

.tiny {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ===== entrance animation ===== */

.scene .stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--transition-slow) ease, transform var(--transition-slow) ease;
  transition-delay: calc(var(--i, 0) * var(--stagger-step));
}
.scene.active .stagger > * {
  opacity: 1;
  transform: none;
}

/* ===== decorative layers ===== */

.layer {
  position: absolute;
  pointer-events: none;
  will-change: transform;
}

.blob {
  border-radius: 50%;
  filter: blur(1px);
  opacity: var(--op-bold);
}

/* generic halo — sized/positioned via custom properties */
.halo {
  position: absolute;
  width: var(--halo-size, 60vw);
  height: var(--halo-size, 60vw);
  max-width: var(--halo-max, 320px);
  max-height: var(--halo-max, 320px);
  border-radius: 50%;
  background: radial-gradient(circle at center,
    color-mix(in srgb, var(--halo-color, var(--accent-2)) var(--halo-strength, 22%), transparent) 0%,
    transparent 70%);
  opacity: var(--op-bold);
  pointer-events: none;
}

/* ===== buttons ===== */

.btn {
  font-family: var(--body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.btn:hover,
.btn:active,
.btn[aria-pressed="true"] {
  background: var(--accent-2);
  color: var(--paper);
}

.btn[data-state="error"],
.btn[data-state="error"]:hover {
  background: none;
  border-color: var(--ink-soft);
  color: var(--ink-soft);
  cursor: not-allowed;
}

.btn--music {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
}
.btn--music .music-icon { font-size: 14px; letter-spacing: 0; }

.btn--again {
  margin-top: 16px;
  padding: 14px 22px;
  align-self: flex-start;
}

/* ===== photo slot ===== */

.photo-slot {
  --ps-aspect: 4 / 5;
  --ps-max-h: 38vh;
  --ps-max-w: 100%;
  --ps-radius: var(--r-lg);
  --ps-rotate: 0deg;

  position: relative;
  width: 100%;
  max-width: var(--ps-max-w);
  margin: 0 auto;
  aspect-ratio: var(--ps-aspect);
  max-height: var(--ps-max-h);
  border-radius: var(--ps-radius);
  transform: rotate(var(--ps-rotate));
  overflow: hidden;
  background: color-mix(in srgb, var(--accent) 22%, var(--paper));
  box-shadow: 0 18px 40px color-mix(in srgb, var(--ink) 12%, transparent);
}

/* placeholder shown only when slot has no <img> */
.photo-slot:not(:has(img))::before,
.photo-slot.polaroid > .inner-img:not(:has(img))::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--ink) 8%, transparent) 0 2px,
    transparent 2px 14px
  );
  pointer-events: none;
}
.photo-slot:not(:has(img))::after,
.photo-slot.polaroid > .inner-img:not(:has(img))::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  opacity: 0.9;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--ink) 10%, transparent);
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-slot.circle { --ps-aspect: 1/1; --ps-max-h: 34vh; --ps-max-w: 80%; --ps-radius: 50%; }
.photo-slot.wide   { --ps-aspect: 5/4; --ps-max-h: 32vh; }
.photo-slot.tall   { --ps-aspect: 3/4; --ps-max-h: 40vh; }

/* polaroid: outer is the paper frame, inner-img holds the actual image area */
.photo-slot.polaroid {
  --ps-radius: var(--r-sm);
  --ps-rotate: -3.5deg;
  --ps-max-w: 78%;
  --ps-max-h: 36vh;
  background: var(--paper);
  padding: 6px 14px 32px;
  box-shadow: 0 22px 40px color-mix(in srgb, var(--ink) 18%, transparent);
}
.photo-slot.polaroid > .inner-img {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent) 22%, var(--paper));
}
.photo-slot.polaroid > .inner-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.polaroid-caption {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
}

/* ===== progress dots ===== */

.dots {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dots button {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: var(--ink-soft);
  opacity: 0.35;
  padding: 0;
  cursor: pointer;
  transition: all 250ms;
}
.dots button.active {
  background: var(--accent-2);
  opacity: 1;
  transform: scale(1.5);
}

/* ============================================================
   Scenes
   Each block contains only what's unique to that scene:
   decorative layers + per-scene layout overrides.
   ============================================================ */

/* ----- s1 : HI ----- */
#s1 .hi {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(52px, 16vw, 88px);
  line-height: 0.95;
  color: var(--ink);
}
#s1 .hi .name { color: var(--accent-2); }
#s1 .note {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  max-width: 34ch;
}
#s1 .note .em {
  font-family: var(--display);
  font-style: italic;
  color: var(--accent-2);
}
#s1 .scroll-cue {
  position: absolute;
  bottom: max(32px, env(safe-area-inset-bottom, 32px));
  right: 28px;
  font-family: var(--body);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent-2);
  opacity: 0.8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#s1 .scroll-cue .tick {
  width: 1px;
  height: 28px;
  background: currentColor;
  animation: tick 2s ease-in-out infinite;
  transform-origin: top;
}
/* pause the cue once user has left s1 */
#s1:not(.active) .scroll-cue .tick { animation-play-state: paused; }

@keyframes tick {
  0%, 100% { transform: scaleY(0.3); opacity: 0.3; }
  50%      { transform: scaleY(1);   opacity: 1; }
}

#s1 .blob-1 {
  width: 60vw; height: 60vw;
  max-width: 320px; max-height: 320px;
  top: -8%; right: -18%;
  background: var(--bg-3);
  opacity: var(--op-bold);
}
#s1 .blob-2 {
  width: 40vw; height: 40vw;
  max-width: 220px; max-height: 220px;
  bottom: 12%; left: -14%;
  background: var(--accent);
  opacity: var(--op-soft);
}

/* ----- s2 : ACCEPTED ----- */
#s2 .hearts {
  position: absolute;
  top: 12%; right: 8%;
  font-family: var(--display);
  font-style: italic;
  color: var(--accent-2);
  font-size: 72px;
  line-height: 1;
  opacity: 0.15;
}
#s2 .blob-1 {
  width: 70vw; height: 70vw;
  max-width: 360px; max-height: 360px;
  bottom: -22%; left: -20%;
  background: var(--accent);
  opacity: var(--op-faint);
}

/* ----- s2b : CHOSEN ----- */
#s2b .ampersand {
  position: absolute;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  color: var(--accent-2);
  opacity: var(--op-faint);
  font-size: clamp(140px, 32vw, 220px);
  line-height: 1;
  top: -6%; right: -4%;
  transform: rotate(-8deg);
}
#s2b .halo {
  bottom: -14%; left: -16%;
}

/* ----- s3 : ATHLETIC ----- */
#s3 .sparkle {
  position: absolute;
  font-family: var(--display);
  font-style: italic;
  color: var(--accent-2);
  opacity: var(--op-soft);
  line-height: 1;
}
#s3 .sparkle.sp1 { top: 10%;    left: 8%;   font-size: 44px; transform: rotate(-8deg); }
#s3 .sparkle.sp2 { top: 22%;    right: 12%; font-size: 28px; transform: rotate(14deg); opacity: 0.25; }
#s3 .sparkle.sp3 { bottom: 18%; left: 14%;  font-size: 36px; transform: rotate(6deg);  opacity: 0.3; }
#s3 .sparkle.sp4 { bottom: 10%; right: 18%; font-size: 22px; transform: rotate(-12deg); opacity: 0.22; }
#s3 .halo {
  top: -18%; right: -24%;
  --halo-size: 70vw;
  --halo-max: 380px;
  --halo-color: var(--accent);
  --halo-strength: 30%;
}
#s3 .photo-slot { order: 2; margin-top: 14px; }
#s3 .photo-slot img { object-position: center 10%; }
#s3 .line    { order: 0; }
#s3 .caption { order: 1; margin-top: 14px; }

/* ----- s7 : STYLISH ----- */
#s7 {
  justify-content: center;
  align-items: center;
  text-align: center;
}
#s7 > .inner { align-items: center; }
#s7 .star {
  position: absolute;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  opacity: 0.2;
  font-size: 120px;
  line-height: 1;
}
#s7 .star-1 { top: 14%;    left: 10%;  transform: rotate(-18deg); }
#s7 .star-2 { bottom: 14%; right: 10%; transform: rotate(22deg); }

/* ----- s3c : CAPABLE / RESPECTED ----- */
#s3c .dollar {
  position: absolute;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}
#s3c .dollar.d1 { top: 10%;    left: 8%;   font-size: 56px; opacity: 0.25; transform: rotate(-12deg); }
#s3c .dollar.d2 { top: 28%;    right: 14%; font-size: 36px; opacity: 0.20; transform: rotate(8deg); }
#s3c .dollar.d3 { bottom: 22%; left: 12%;  font-size: 44px; opacity: 0.22; transform: rotate(6deg); }
#s3c .dollar.d4 { bottom: 12%; right: 10%; font-size: 28px; opacity: 0.30; transform: rotate(-8deg); }

/* ----- s3c : richbish receipt — show full image, don't crop ----- */
#s3c .photo-slot img { object-fit: contain; background: transparent; }

/* ----- s4 : HOT ----- */
/* photo uses dome-shaped border via inline --ps-radius; nothing else scene-specific */

/* ----- s5 : MAGNETIC (grid layout) ----- */
#s5 > .inner {
  display: grid;
  grid-template-columns: 1fr 168px;
  gap: 8px 20px;
  align-items: center;
}
#s5 .photo-slot {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  max-width: 100%;
  max-height: 168px;
}
#s5 .line    { grid-column: 1; grid-row: 1; }
#s5 .caption { grid-column: 1; grid-row: 2; }
@media (min-width: 420px) {
  #s5 > .inner    { grid-template-columns: 1fr 216px; }
  #s5 .photo-slot { max-height: 216px; }
}

/* ----- s5b : LOVE TO GIVE ----- */
#s5b .halo {
  top: -10%; right: -14%;
  --halo-color: var(--accent);
  --halo-strength: 28%;
}
#s5b .heart {
  position: absolute;
  bottom: 14%; left: 8%;
  font-family: var(--display);
  font-style: italic;
  color: var(--accent-2);
  font-size: 64px;
  line-height: 1;
  opacity: 0.22;
  transform: rotate(-10deg);
}
@media (min-width: 601px) {
  #s5b .photo-slot { --ps-max-h: 46vh; }
}

/* ----- s6 : KIND / CARING (polaroid + bar chart deco) ----- */
#s6 > .inner { gap: 32px; align-items: flex-start; }
#s6 .photo-slot.polaroid { --ps-aspect: 1/1; }

@media (max-width: 600px) {
  #s6 { padding-left: 8px; padding-right: 8px; }
  #s6 > .inner { max-width: 100%; }
  #s6 .photo-slot.polaroid { --ps-aspect: 19/20; }
}

#s6 .bars {
  position: absolute;
  bottom: 14%; right: 7%;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  opacity: var(--op-soft);
}
#s6 .bars span {
  width: 10px;
  background: var(--accent-2);
  border-radius: 2px;
  display: block;
}

/* ----- s3b : AMBITIOUS / BREADWINNER ----- */
#s3b .grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right,  color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--ink) 6%, transparent) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.6;
}
#s3b .arrow-up {
  position: absolute;
  top: 12%; right: 10%;
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: 90px;
  color: var(--accent-2);
  opacity: 0.28;
  line-height: 1;
  transform: rotate(-12deg);
}

/* ----- s7b : LAUGHTER / FUN ----- */
#s7b .confetti { position: absolute; inset: 0; }
#s7b .confetti span {
  position: absolute;
  display: block;
  border-radius: 50%;
}
#s7b .confetti .c1 { top: 8%;    left: 10%;  width: 10px; height: 10px; background: var(--accent);   opacity: 0.7; }
#s7b .confetti .c2 { top: 14%;   right: 14%; width: 14px; height: 14px; background: var(--accent-2); opacity: 0.5; }
#s7b .confetti .c3 { top: 32%;   left: 18%;  width: 6px;  height: 6px;  background: var(--accent-2); opacity: 0.6; }
#s7b .confetti .c4 { bottom: 26%; right: 8%; width: 12px; height: 12px; background: var(--accent);   opacity: 0.55; }
#s7b .confetti .c5 { bottom: 12%; left: 14%; width: 8px;  height: 8px;  background: var(--accent-2); opacity: 0.45; }
#s7b .confetti .c6 { bottom: 34%; left: 42%; width: 5px;  height: 5px;  background: var(--accent);   opacity: 0.6; }

/* ----- s8 : CLOSING ----- */
#s8 { justify-content: center; }
#s8 .quote {
  font-family: var(--display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.15;
  color: var(--ink);
  max-width: 22ch;
}
#s8 .quote .q { color: var(--accent-2); }
#s8 .sig {
  margin-top: 12px;
  font-family: var(--body);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
#s8 .sig::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--accent-2);
}
