:root {
  --bg: #000;
  --ink: #f4efe9;
  --dim: #8c8378;
  --accent: #d8b9a0;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --thai: "Noto Serif Thai", "Cormorant Garamond", "Sarabun", serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { position: fixed; inset: 0; }

/* ---------- Particles ---------- */
#particles {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Vignette ---------- */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 100%);
}

/* ---------- Gate / Preload ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8vw;
  gap: 1.6rem;
  background: #000;
  transition: opacity 1.4s ease;
}
.overlay.hide { opacity: 0; pointer-events: none; }
#gate { z-index: 40; }

.gate-title {
  font-size: clamp(2.4rem, 8vw, 5rem);
  letter-spacing: 0.18em;
  font-weight: 300;
  color: var(--ink);
}
.gate-sub {
  font-family: var(--sans);
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
}

.pass-input {
  margin-top: 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--dim);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.4rem;
  letter-spacing: 0.6em;
  text-align: center;
  padding: 0.6rem 0.4rem;
  width: min(280px, 70vw);
  outline: none;
}
.pass-input::placeholder { color: #4a463f; letter-spacing: 0.3em; }
.pass-error {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: #c96a5a;
  letter-spacing: 0.1em;
  min-height: 1.2em;
  opacity: 0;
  transition: opacity .3s;
}
.pass-error.show { opacity: 1; }

/* Entry sequence text */
.entry-line {
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  font-weight: 300;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.6s ease, transform 1.6s ease;
}
.entry-line.in { opacity: 1; transform: none; }

.btn {
  margin-top: 2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(216,185,160,0.5);
  padding: 1rem 3rem;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.2s ease, transform 1.2s ease,
              background .4s ease, color .4s ease, border-color .4s;
}
.btn.in { opacity: 1; transform: none; }
.btn:hover { background: var(--accent); color: #1a120c; border-color: var(--accent); }

/* ---------- Stage ---------- */
#stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10vw;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.scene.visible { opacity: 1; }

/* photo layer */
.scene .photo {
  position: absolute;
  inset: 0;
  background-size: contain;      /* show the whole photo, never crop */
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  transition: opacity 2.2s ease;
  z-index: 0;
}
.scene.visible .photo { opacity: 0.9; animation: kenburns 15s ease-out forwards; }
.scene .photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15), rgba(0,0,0,0.55));
}
/* gentle "settle" — starts a touch large, ends perfectly uncropped */
@keyframes kenburns {
  from { transform: scale(1.035); }
  to   { transform: scale(1.0); }
}

.scene .content {
  position: relative;
  z-index: 2;
  max-width: 900px;
}

.line {
  font-size: clamp(1.5rem, 4.6vw, 2.7rem);
  font-weight: 300;
  line-height: 1.55;
  margin: 0.35em 0;
  opacity: 0;
  transform: translateY(14px);
  filter: blur(6px);
  transition: opacity 1.5s ease, transform 1.5s ease, filter 1.5s ease;
}
.line.in { opacity: 1; transform: none; filter: blur(0); }

/* Thai (main) + faint English subtitle */
.th {
  display: block;
  font-family: var(--thai);
  line-height: 1.4;
}
.en {
  display: block;
  font-family: var(--sans);
  font-size: 0.4em;
  letter-spacing: 0.14em;
  font-weight: 300;
  color: var(--dim);
  opacity: 0.42;
  margin-top: 0.5em;
}

.scene.grand .line { font-size: clamp(2rem, 7vw, 4rem); letter-spacing: 0.02em; }
.scene.finale .line { font-size: clamp(2.4rem, 9vw, 5rem); font-weight: 300; }
.scene.killshot .line:first-child {
  font-size: clamp(2.6rem, 10vw, 5.6rem);
}
.scene.killshot .line:first-child .th { color: var(--accent); }

/* word reveal */
.word {
  font-size: clamp(2.2rem, 9vw, 5rem);
  font-weight: 300;
  letter-spacing: 0.04em;
}

/* date */
.date-main {
  font-size: clamp(2rem, 8vw, 4.4rem);
  letter-spacing: 0.08em;
  color: var(--accent);
}

/* letter */
.scene.letter { align-items: center; }
.letter-block {
  position: relative;
  z-index: 2;
  max-width: 760px;
  text-align: center;
}
.letter-line {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  line-height: 1.9;
  font-weight: 300;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.4s ease, transform 1.4s ease;
}
.letter-line.in { opacity: 1; transform: none; }

/* montage / collage */
.montage {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
.m-card {
  position: absolute;
  padding: 0.6vw;
  background: #f7f3ee;
  border-radius: 3px;
  box-shadow: 0 14px 44px rgba(0,0,0,0.65);
  opacity: 0;
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2,.8,.25,1);
  will-change: transform, opacity;
}
.m-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 34vh;
  object-fit: contain;      /* never crop screenshots / photos */
  border-radius: 2px;
}
.m-card.in { opacity: 1; }
@media (max-width: 640px) {
  .m-card { padding: 2vw; }
  .m-card img { max-height: 42vh; }
}

/* act label */
.act-label {
  position: fixed;
  top: 7vh;
  left: 0; right: 0;
  z-index: 12;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--dim);
  opacity: 0;
  transition: opacity 1.4s ease;
  pointer-events: none;
}
.act-label.in { opacity: 0.7; }

/* audio + hint controls */
.hint {
  position: fixed;
  bottom: 5vh;
  left: 0; right: 0;
  z-index: 14;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
  opacity: 0;
  transition: opacity 1s ease;
  pointer-events: none;
}
.hint.in { opacity: 0.5; }

.mute-btn {
  position: fixed;
  top: 4vh; right: 5vw;
  z-index: 16;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(140,131,120,0.4);
  background: rgba(0,0,0,0.3);
  color: var(--dim);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 1rem;
  display: none;
  align-items: center;
  justify-content: center;
  transition: color .3s, border-color .3s;
}
.mute-btn:hover { color: var(--ink); border-color: var(--accent); }
.mute-btn.show { display: flex; }

/* progress bar */
.progress {
  position: fixed;
  bottom: 0; left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, transparent, var(--accent));
  z-index: 16;
  opacity: 0;
  transition: width .6s ease, opacity 1s;
}
.progress.show { opacity: 0.6; }

/* final video message CTA */
.finale-cta {
  position: fixed;
  bottom: 14vh;
  left: 0; right: 0;
  z-index: 18;
  text-align: center;
  opacity: 0;
  transition: opacity 2s ease;
  pointer-events: none;
}
.finale-cta.show { opacity: 1; pointer-events: auto; }

/* fullscreen video overlay */
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
}
.video-overlay.show { opacity: 1; pointer-events: auto; }
.video-overlay video {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  background: #000;
}

@media (max-width: 640px) {
  .scene { padding: 12vw 8vw; }
}
