@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;500;600;700;900&family=Inter:wght@400;500;600&family=Caveat:wght@500;700&display=swap');

:root {
  --sage: #a0b085;
  --moss: #698667;
  --pine: #365649;
  --ink: #2a3338;
  --ink-deep: #1c2226;
  --cream: #f4efe1;
  --cream-dim: #e5ddc7;
  --highlight: #dbe7c4;
  --gold: #c9a66b;
  --font-display: 'Noto Serif KR', serif;
  --font-body: 'Inter', sans-serif;
  --font-hand: 'Caveat', cursive;
  --letterbox: 6.5vh;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  overflow-x: hidden;
  line-height: 1.5;
}

::selection {
  background: var(--sage);
  color: var(--ink-deep);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--ink-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2rem;
  transition: opacity 1.1s ease, visibility 1.1s ease;
}

.gate.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-eyebrow {
  font-family: var(--font-body);
  letter-spacing: 0.45em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: var(--sage);
}

.gate-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--cream);
  text-align: center;
  padding: 0 1.5rem;
}

.gate-button {
  border: 1px solid var(--sage);
  background: transparent;
  color: var(--cream);
  font-family: var(--font-body);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 1.1rem 2.4rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  transition: background 0.4s ease, color 0.4s ease, transform 0.3s ease;
}

.gate-button svg {
  width: 14px;
  height: 14px;
  fill: var(--sage);
  transition: fill 0.4s ease;
}

.gate-button:hover {
  background: var(--sage);
  color: var(--ink-deep);
  transform: scale(1.03);
}

.gate-button:hover svg {
  fill: var(--ink-deep);
}

.gate-hint {
  font-size: 0.7rem;
  color: var(--moss);
  letter-spacing: 0.08em;
}

.letterbox-top,
.letterbox-bottom {
  position: fixed;
  left: 0;
  right: 0;
  height: var(--letterbox);
  background: var(--ink-deep);
  z-index: 400;
  pointer-events: none;
}

.letterbox-top { top: 0; }
.letterbox-bottom { bottom: 0; }

.reel {
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  padding: var(--letterbox) 0;
  position: relative;
}

.hero {
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(160, 176, 133, 0.18), transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-deep) 100%);
  padding: 6rem 1.5rem;
}

.hero-eyebrow {
  font-family: var(--font-body);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--sage);
  margin-bottom: 1.6rem;
}

.hero-kr {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--moss);
  margin-bottom: 0.8rem;
  letter-spacing: 0.08em;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  color: var(--cream-dim);
  letter-spacing: 0.05em;
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(3.4rem, 12vw, 8.5rem);
  line-height: 0.95;
  background: linear-gradient(180deg, var(--cream) 0%, var(--sage) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0.6rem 0 1.8rem;
}

.hero-line {
  width: 60px;
  height: 1px;
  background: var(--moss);
  margin: 0 auto 1.8rem;
}

.hero-tagline {
  font-family: var(--font-hand);
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  color: var(--sage);
  max-width: 32rem;
}

.hero-scroll {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--moss);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

.hero-scroll svg {
  width: 14px;
  height: 14px;
  fill: var(--moss);
  animation: floatDown 1.8s ease-in-out infinite;
}

@keyframes floatDown {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(8px); opacity: 1; }
}

.chapter-head {
  text-align: center;
  padding: 0 1.5rem;
  margin-bottom: 4rem;
}

.chapter-eyebrow {
  font-family: var(--font-body);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 0.65rem;
  color: var(--gold);
  margin-bottom: 1rem;
}

.chapter-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.4rem);
  color: var(--cream);
}

.chapter-sub {
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--sage);
  margin-top: 0.6rem;
}

.gallery {
  background: var(--ink-deep);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1.6rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.8rem 2rem;
}

.card {
  background: var(--cream);
  padding: 0.6rem 0.6rem 2.2rem;
  border-radius: 2px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  position: relative;
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  opacity: 0;
  translate: 0 24px;
}

.card.in-view {
  animation: cardIn 0.7s ease forwards;
}

@keyframes cardIn {
  to { opacity: 1; translate: 0 0; }
}

.card:hover {
  transform: rotate(0deg) scale(1.04) translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: 5;
}

.card-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, var(--sage), var(--pine));
}

.card-missing {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.4rem;
  background: linear-gradient(135deg, var(--sage), var(--pine));
  color: var(--cream);
}

.card-missing svg {
  width: 26px;
  height: 26px;
  fill: var(--cream);
  opacity: 0.8;
}

.card-missing span {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
}

.card-caption {
  position: absolute;
  bottom: 0.7rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--ink);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(28, 34, 38, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding: 2rem;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(88vw, 720px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: calc(var(--letterbox) + 1.2rem);
  right: 1.8rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--cream-dim);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close svg {
  width: 14px;
  height: 14px;
  fill: var(--cream);
}

.message-chapter {
  background: var(--ink-deep);
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 6rem 1.5rem;
}

.message-stage {
  width: 100%;
  max-width: 780px;
  height: 44vh;
  height: calc(var(--vh, 1vh) * 44);
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
}

.message-lines {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.3rem;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.message-line {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.8rem);
  color: var(--cream-dim);
  opacity: 0.18;
  transition: opacity 0.5s ease, transform 0.5s ease, color 0.5s ease;
  transform: scale(0.94);
  text-align: center;
  padding: 0 1rem;
}

.message-line.active {
  opacity: 1;
  color: var(--highlight);
  transform: scale(1.06);
  text-shadow: 0 0 24px rgba(219, 231, 196, 0.35);
}

.message-line.spoken {
  opacity: 0.1;
}

.player {
  margin-top: 3.5rem;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  background: rgba(244, 239, 225, 0.06);
  border: 1px solid rgba(244, 239, 225, 0.14);
  padding: 1rem 1.6rem;
  border-radius: 999px;
}

.player-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--sage);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.player-btn:hover {
  transform: scale(1.08);
}

.player-btn svg {
  width: 15px;
  height: 15px;
  fill: var(--ink-deep);
}

.player-track {
  width: clamp(140px, 30vw, 260px);
  height: 3px;
  background: rgba(244, 239, 225, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.player-progress {
  height: 100%;
  width: 0%;
  background: var(--sage);
  border-radius: 999px;
}

.player-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--moss);
  white-space: nowrap;
}

.verses {
  background: var(--ink);
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem;
  gap: 3rem;
}

.verse-card {
  max-width: 640px;
  text-align: center;
  border-top: 1px solid var(--moss);
  border-bottom: 1px solid var(--moss);
  padding: 2.4rem 1rem;
  opacity: 0;
  translate: 0 20px;
}

.verse-card.in-view {
  animation: cardIn 0.9s ease forwards;
}

.verse-text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: var(--cream);
  line-height: 1.6;
}

.verse-ref {
  margin-top: 1.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.credits {
  background: var(--ink-deep);
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2.4rem;
  padding: 6rem 1.5rem;
}

.credits-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  color: var(--cream);
}

.credits-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.credits-role {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--moss);
}

.credits-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--sage);
}

.credits-heart {
  width: 22px;
  height: 22px;
  fill: var(--sage);
}

.credits-thanks {
  font-family: var(--font-hand);
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  color: var(--cream);
  max-width: 24rem;
}

.credits-foot {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--cream-dim);
  max-width: 26rem;
}

.ost-bar {
  position: fixed;
  left: 1.4rem;
  bottom: calc(var(--letterbox) + 1.2rem);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: rgba(28, 34, 38, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(244, 239, 225, 0.15);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  opacity: 0;
  translate: -12px 0;
  transition: opacity 0.6s ease, translate 0.6s ease;
}

.ost-bar.visible {
  opacity: 1;
  translate: 0 0;
}

.ost-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--sage);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ost-toggle svg {
  width: 12px;
  height: 12px;
  fill: var(--ink-deep);
}

.ost-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ost-title {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--cream);
  font-weight: 600;
}

.ost-artist {
  font-size: 0.62rem;
  color: var(--moss);
  letter-spacing: 0.05em;
}

.ost-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-left: 0.2rem;
}

.ost-bars span {
  width: 2.5px;
  background: var(--sage);
  border-radius: 2px;
  height: 4px;
  animation: none;
}

.ost-bar.playing .ost-bars span {
  animation: bounce 1s ease-in-out infinite;
}

.ost-bars span:nth-child(1) { animation-delay: 0s; }
.ost-bars span:nth-child(2) { animation-delay: 0.15s; }
.ost-bars span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 100% { height: 4px; }
  50% { height: 13px; }
}

#yt-mount {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  bottom: 0;
  left: 0;
}

@media (max-width: 640px) {
  :root { --letterbox: 3.2vh; }

  .ost-bar {
    left: 0.7rem;
    bottom: calc(var(--letterbox) + 0.9rem + env(safe-area-inset-bottom, 0px));
    padding: 0.5rem 0.85rem;
    gap: 0.6rem;
  }

  .ost-title { font-size: 0.65rem; }
  .ost-artist { font-size: 0.58rem; }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
    padding: 0 1.1rem 1.5rem;
  }

  .card { padding: 0.4rem 0.4rem 1.8rem; }
  .card-caption { font-size: 0.95rem; bottom: 0.5rem; }

  .hero { padding: 5rem 1.2rem; }
  .hero-scroll { bottom: 1.6rem; }

  .chapter-head { margin-bottom: 2.6rem; }

  .message-chapter { padding: 4.5rem 1rem; }
  .message-stage { height: 52vh; height: calc(var(--vh, 1vh) * 52); }
  .message-line { font-size: 1.05rem; padding: 0 0.4rem; }

  .player {
    margin-top: 2.2rem;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 0.85rem 1.1rem;
    gap: 0.9rem;
    width: 100%;
    max-width: 320px;
  }

  .player-track { width: clamp(90px, 32vw, 160px); }
  .player-label { font-size: 0.6rem; }

  .verses { padding: 4.5rem 1.2rem; gap: 2.2rem; }
  .verse-card { padding: 1.8rem 0.8rem; }

  .credits { padding: 4.5rem 1.2rem; gap: 1.8rem; }

  .lightbox-close {
    top: calc(var(--letterbox) + 0.8rem + env(safe-area-inset-top, 0px));
    right: 1.2rem;
  }

  .gate { padding: 0 1.2rem; }
  .gate-button { padding: 1rem 2rem; }
}

@media (max-width: 380px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .message-line { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
