:root {
  --ink: #0b1430;
  --snow: #f4f8ff;
  --ice: #cfe0ff;
  --accent: #ff5a36;
  --gold: #ffc66b;
  --night: #060b1d;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;
  --gutter: max(20px, env(safe-area-inset-left));
  --vh: 1svh;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { background: var(--night); }
body {
  color: var(--snow);
  font-family: var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- fixed layers ---------- */
#sky { position: fixed; inset: 0; z-index: 0; }
.sky-layer { position: absolute; inset: 0; opacity: 0; }
.sky-night { opacity: 1; background: radial-gradient(120% 70% at 70% 15%, #1b2a5c 0%, #0b1433 45%, #050914 100%); }
.sky-dawn  { background: linear-gradient(180deg, #2b3f7d 0%, #8a8fc4 40%, #f6c1b0 75%, #ffe3c4 100%); }
.sky-day   { background: linear-gradient(180deg, #2f7fe0 0%, #73b5f5 45%, #cfe8ff 80%, #eef6ff 100%); }
.sky-dusk  { background: linear-gradient(180deg, #1c2457 0%, #6a3f7d 35%, #e2706a 68%, #ffc27a 100%); }
#snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }

main { position: relative; z-index: 1; }
.scene { position: relative; width: 100%; }
.pin { position: relative; height: 100svh; width: 100%; overflow: hidden; }

/* ---------- type ---------- */
.display {
  font-family: var(--serif);
  font-weight: 650;
  font-variation-settings: "opsz" 144;
  line-height: .95;
  letter-spacing: -.02em;
  white-space: pre-line;
}
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; }
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .25em;
  text-transform: uppercase;
  opacity: .8;
}
.lede { font-size: 17px; line-height: 1.45; opacity: .85; max-width: 30ch; }

/* ---------- 1. peak ---------- */
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.moon {
  position: absolute; top: 9%; right: 14%;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #fffdf3 0%, #f3ecd2 55%, #d8cfae 100%);
  box-shadow: 0 0 40px 10px rgba(255, 248, 220, .25), 0 0 140px 40px rgba(160, 190, 255, .15);
}
.range { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; }
.range g { will-change: transform; }
.peak-copy {
  position: absolute; left: var(--gutter); right: var(--gutter); top: 20svh;
  display: flex; flex-direction: column; gap: 14px;
}
.peak-copy .display { font-size: clamp(44px, 12.5vw, 120px); hyphens: manual; text-shadow: 0 4px 40px rgba(0,0,0,.4); }
.scroll-hint {
  position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--ink);
}
.scroll-hint i {
  width: 2px; height: 34px; background: linear-gradient(var(--ink), transparent);
  animation: drip 1.8s ease-in-out infinite; transform-origin: top;
}
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- 2. clouds ---------- */
.cloud-bank { position: absolute; inset: -20% -30%; pointer-events: none; z-index: 3; }
.cloud {
  position: absolute; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.95), rgba(255,255,255,.75) 55%, rgba(255,255,255,0));
  filter: blur(6px);
  will-change: transform, opacity;
}
.clouds-copy {
  position: absolute; left: var(--gutter); right: var(--gutter); top: 16svh; z-index: 4;
  display: flex; flex-direction: column; gap: 18px;
}
.cl-line { font-size: clamp(28px, 8vw, 54px); line-height: 1.1; color: var(--ink); text-shadow: 0 0 18px rgba(255,255,255,.9), 0 0 40px rgba(255,255,255,.8); }
.cl-2 { text-align: right; }
.map-wrap {
  position: absolute; left: 0; right: 0; bottom: 12svh; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
}
#pisteMap { width: 100%; max-width: 640px; height: auto; overflow: visible; }
.map-label {
  margin-top: -6px; text-align: center; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
}
.map-label strong { font-family: var(--serif); font-size: 34px; font-weight: 700; letter-spacing: -.01em; }
.map-label span { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; }
.cl-3 {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 4svh; z-index: 4;
  text-align: center; color: var(--ink); text-shadow: none; font-size: clamp(22px, 6vw, 36px);
}

/* ---------- 3. memories ---------- */
#memories { padding: 18svh var(--gutter) 30svh; min-height: 100svh; }
.day-range { position: absolute; top: 0; height: 100svh; opacity: .9; }
.mem-head { position: relative; color: var(--ink); margin-bottom: 8svh; }
.mem-head .display { font-size: clamp(42px, 12vw, 84px); margin-bottom: 14px; }
.mem-head .lede { opacity: .75; }
.polaroids {
  position: relative;
  display: grid; grid-template-columns: 1fr; gap: 9svh;
  padding: 0 6px;
}
.polaroid {
  position: relative; background: #fffdf8; color: #1a1a1a;
  padding: 12px 12px 0; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.15), 0 18px 40px -10px rgba(20,40,90,.45);
  width: min(82%, 380px);
  will-change: transform, opacity;
}
.polaroid:nth-child(odd)  { justify-self: start; }
.polaroid:nth-child(even) { justify-self: end; }
.polaroid .frame { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: #dfe8f5; }
.polaroid img, .polaroid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid figcaption {
  font-family: "Fraunces", serif; font-style: italic; font-size: 19px; line-height: 1.2;
  padding: 14px 4px 18px; text-align: center; min-height: 64px;
}
.polaroid .tape {
  position: absolute; top: -12px; left: 50%; width: 90px; height: 26px; transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 238, 190, .75); box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.polaroid .badge {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-family: var(--mono); font-size: 10px; letter-spacing: .15em; padding: 4px 7px; border-radius: 99px;
  background: rgba(0,0,0,.55); color: #fff;
}
.placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background:
    radial-gradient(60% 50% at 30% 20%, rgba(255,255,255,.9), transparent),
    linear-gradient(160deg, #bcd4f2 0%, #e9f1fb 55%, #ffffff 100%);
  color: #6a83a8; font-family: var(--mono); font-size: 12px; letter-spacing: .15em; text-transform: uppercase;
}
.placeholder svg { width: 64px; height: 40px; opacity: .55; }

/* ---------- 4. kicker ---------- */
#kicker .pin { background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(238,246,255,.9) 40%, #f4f8ff 100%); }
.buildup {
  position: absolute; left: var(--gutter); right: var(--gutter); top: 9svh; z-index: 3;
  font-size: clamp(28px, 8vw, 52px); color: var(--ink); line-height: 1.1;
}
.park { position: absolute; inset: 0; z-index: 1; }
#parkSvg { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; height: 100%; overflow: visible; }
.words { position: absolute; inset: 0; pointer-events: none; }
.word {
  position: absolute; font-family: var(--serif); font-weight: 800; font-style: italic;
  font-size: clamp(36px, 11vw, 80px); color: var(--accent); letter-spacing: -.02em;
  text-shadow: 3px 3px 0 var(--ink);
  opacity: 0;
}
.gift {
  position: absolute; left: var(--gutter); right: var(--gutter); top: 50%; z-index: 5;
  transform: translateY(-50%);
  padding: 30px 24px 28px; border-radius: 22px;
  background: rgba(11, 20, 48, .92);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px -20px rgba(11,20,48,.6);
  text-align: center; opacity: 0; visibility: hidden;
}
.gift .eyebrow { color: var(--gold); margin-bottom: 14px; }
.gift-title { font-size: clamp(36px, 10.5vw, 64px); margin-bottom: 18px; }
.gift-body { font-size: 16px; line-height: 1.5; opacity: .85; max-width: 34ch; margin: 0 auto; }
.burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.burst i {
  position: absolute; width: 8px; height: 8px; border-radius: 2px; left: -4px; top: -4px;
}

/* ---------- 5. ticket ---------- */
#ticket {
  min-height: 140svh; padding: 16svh var(--gutter) max(14svh, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8svh;
}
.dusk-range { position: absolute; top: auto; bottom: 0; height: 100svh; }
.ticket-wrap { position: relative; display: flex; flex-direction: column; align-items: center; perspective: 900px; }
.lanyard { width: 14px; height: 90px; background: repeating-linear-gradient(180deg, var(--accent) 0 10px, #d84422 10px 20px); border-radius: 0 0 4px 4px; margin-bottom: -16px; }
.ticket {
  position: relative; width: min(86vw, 360px);
  background: linear-gradient(160deg, #ffffff 0%, #eef3fb 100%);
  color: var(--ink); border-radius: 18px; overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,.2), 0 40px 80px -24px rgba(10,15,40,.7);
  transform-style: preserve-3d;
}
.t-hole { position: absolute; top: 12px; left: 50%; width: 46px; height: 10px; margin-left: -23px; background: #1c2457; border-radius: 99px; box-shadow: inset 0 2px 3px rgba(0,0,0,.4); }
.t-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent); color: #fff; padding: 36px 20px 16px;
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase;
}
.t-logo { width: 40px; height: 24px; color: #fff; }
.t-logo path:last-child { fill: var(--accent); }
.t-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.t-row { display: flex; flex-direction: column; gap: 2px; border-bottom: 1px dashed #c6d1e4; padding-bottom: 12px; }
.t-row label { font-family: var(--mono); font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: #6b7a99; }
.t-row b { font-family: var(--serif); font-size: 30px; font-weight: 650; line-height: 1.1; }
.t-barcode {
  height: 56px; margin: 0 20px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 7px, transparent 7px 8px, var(--ink) 8px 9px, transparent 9px 13px);
}
.t-fine { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: #6b7a99; padding: 12px 20px 20px; text-align: center; }
.t-shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.75) 45%, transparent 60%);
  transform: translateX(-120%);
}
.closing { position: relative; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.closing-line { font-size: clamp(24px, 6.6vw, 40px); line-height: 1.18; max-width: 20ch; text-shadow: 0 2px 30px rgba(30,20,60,.4); }
.signoff { font-family: var(--mono); font-size: 13px; letter-spacing: .25em; text-transform: uppercase; }

/* =========================================================
   UNFOLDED (wide inner screen): panorama / two-column layout
   Toggled by main.js via <html class="wide">
   ========================================================= */
.wide { --gutter: max(48px, env(safe-area-inset-left)); }
.wide .peak-copy { top: 16svh; right: 45%; }
.wide .peak-copy .display { font-size: clamp(56px, 7vw, 110px); }
.wide .moon { width: 84px; height: 84px; right: 22%; }

.wide .clouds-copy { right: 52%; top: 22svh; }
.wide .cl-2 { text-align: left; }
.wide .cl-line { font-size: clamp(34px, 4.6vw, 60px); }
.wide .map-wrap { left: 44%; right: 2%; top: 10svh; bottom: 10svh; justify-content: center; }
.wide #pisteMap { max-width: none; max-height: 70svh; }
.wide .cl-3 { left: var(--gutter); right: 52%; bottom: 18svh; text-align: left; font-size: clamp(26px, 3.4vw, 42px); }

.wide #memories { padding-top: 14svh; }
.wide .mem-head { max-width: 60%; }
.wide .mem-head .display { font-size: clamp(54px, 7vw, 96px); }
.wide .polaroids { grid-template-columns: repeat(3, 1fr); gap: 7svh 4vw; padding: 0 2vw; }
.wide .polaroid { width: 100%; justify-self: stretch !important; }
.wide .polaroid:nth-child(3n+2) { margin-top: 12svh; }
.wide .polaroid:nth-child(3n+3) { margin-top: 5svh; }

.wide .buildup { right: 50%; top: 12svh; font-size: clamp(32px, 4.4vw, 58px); }
.wide #parkSvg { left: -8%; transform: none; width: 100%; }
.wide .gift { left: auto; right: var(--gutter); width: min(44%, 520px); text-align: left; padding: 40px 36px; }
.wide .gift-body { margin: 0; }
.wide .gift-title { font-size: clamp(40px, 5vw, 70px); }

.wide #ticket { flex-direction: row; justify-content: center; align-items: center; gap: 7vw; min-height: 120svh; }
.wide .closing { align-items: flex-start; text-align: left; }
.wide .closing-line { font-size: clamp(30px, 3.4vw, 48px); }

@media (prefers-reduced-motion: reduce) {
  .scroll-hint i { animation: none; }
}

.t-row:last-child { border-bottom: 0; }
.t-fine:empty, .t-fine[style*="none"] { display: none; }
.t-barcode { margin-bottom: 20px; }
