:root {
  --bg: #fbf8f2;
  --paper: rgba(255, 255, 255, .86);
  --paper-warm: #fffaf2;
  --ink: #30302d;
  --muted: #76736d;
  --line: rgba(67, 58, 48, .1);
  --warm: #8b6651;
  --soft: #f2ece3;
  --shadow: 0 18px 42px rgba(57, 45, 34, .08);
  --shadow-soft: 0 10px 28px rgba(57, 45, 34, .055);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --app-height: 100vh;
}

* { box-sizing: border-box; }
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  letter-spacing: 0;
  overscroll-behavior: none;
}
button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
img,
video { max-width: 100%; display: block; }

.slide-viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: var(--app-height);
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, .96), rgba(251, 248, 242, 0) 34rem),
    var(--bg);
}
.slide-track {
  width: 100%;
  height: 100vh;
  height: var(--app-height);
  min-height: 100svh;
  transform: translate3d(0, 0, 0);
  transition: transform 880ms var(--ease);
  will-change: transform;
}
.slide-track.no-transition { transition: none; }
.slide {
  width: 100%;
  height: 100vh;
  height: var(--app-height);
  min-height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(66px + env(safe-area-inset-bottom));
}
.slide-inner {
  width: min(100%, 520px);
  max-height: 100%;
}

.cover-slide {
  position: relative;
  place-items: end center;
  padding-bottom: calc(42px + env(safe-area-inset-bottom));
  background: #191814;
}
.cover-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .72;
  transform: scale(1.04);
  transition: transform 900ms var(--ease), opacity 780ms ease;
}
.cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22,20,16,.04), rgba(22,20,16,.62));
}
body.is-started .cover-bg {
  transform: scale(1);
  opacity: .5;
}
.cover-inner {
  position: relative;
  z-index: 1;
  color: #fff;
  transform: translateY(0);
  transition: opacity 620ms ease, transform 760ms var(--ease);
}
body.is-started .cover-inner {
  opacity: .18;
  transform: translateY(-12px);
}
.cover-kicker,
.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .72;
}
.cover-inner h1 {
  margin: 0;
  font-size: clamp(42px, 13vw, 64px);
  line-height: 1.03;
  font-weight: 640;
}
.cover-inner p:not(.cover-kicker) {
  margin: 16px 0 30px;
  font-size: 15px;
  line-height: 1.82;
  opacity: .9;
}
.enter-btn {
  width: auto;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  color: #24211d;
  background: rgba(255,255,255,.9);
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.enter-btn:hover { background: rgba(255,255,255,.96); }
.enter-btn:active,
.enter-btn.is-pressing {
  transform: scale(.98);
  box-shadow: 0 5px 18px rgba(0,0,0,.14);
}

.visual-layout,
.story-layout,
.gallery-layout {
  display: grid;
  gap: 22px;
  align-content: center;
}
.photo-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.photo-natural {
  max-width: 100%;
  max-height: calc(var(--app-height) * .58);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.slide-copy {
  padding: 0 4px;
}
.slide-copy h2,
.ending-layout h2,
.letter-paper h2 {
  margin: 0;
  font-size: clamp(26px, 7.6vw, 38px);
  line-height: 1.14;
  font-weight: 650;
  color: var(--ink);
}
.slide-copy p,
.ending-layout p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.82;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
}
.tag {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(139, 102, 81, .09);
  color: #6d5648;
  font-size: 12px;
}
.video-layout {
  display: grid;
  gap: 20px;
  align-content: center;
}
.centered-copy { text-align: center; }
.video-frame {
  padding: 8px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(255,255,255,.76), rgba(246,238,228,.76));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.video-frame video {
  width: 100%;
  max-height: calc(var(--app-height) * .68);
  aspect-ratio: 9 / 16;
  border-radius: 22px;
  background: #000;
}
.video-error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(139, 102, 81, .08);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
.media-missing {
  padding: 38px 18px;
  color: var(--muted);
  text-align: center;
  line-height: 1.8;
}
.photo-wrap.is-missing {
  min-height: 220px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.58);
}
.photo-placeholder {
  width: 100%;
  padding: 48px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.7;
}
.letter-layout { display: grid; align-content: center; }
.letter-paper {
  padding: clamp(24px, 6.6vw, 32px) clamp(22px, 6vw, 30px);
  border-radius: 30px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.letter-paper h2 { margin-bottom: 20px; }
.letter-paper p {
  margin: 0 0 16px;
  color: #42423e;
  font-size: 15px;
  line-height: 1.94;
}
.letter-paper p:last-child { margin-bottom: 0; }
.ending-layout {
  text-align: center;
  padding: 0 10px;
}
.ending-layout .eyebrow { color: var(--warm); }

.slide-ui {
  position: fixed;
  right: 14px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(67,58,48,.1);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}
.nav-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.8);
  transition: transform 180ms ease, opacity 180ms ease;
}
.nav-btn:active { transform: scale(.96); }
.nav-btn:disabled { opacity: .34; cursor: default; }
.progress-text {
  min-width: 54px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.progress-bar {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 4;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(67,58,48,.11);
}
.progress-bar span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: rgba(139, 102, 81, .62);
  transition: transform 620ms var(--ease);
}
.slide-dots {
  position: fixed;
  left: 14px;
  top: 50%;
  z-index: 4;
  display: grid;
  gap: 6px;
  transform: translateY(-50%);
}
.slide-dots button {
  width: 5px;
  height: 5px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(67,58,48,.22);
  transition: height 250ms ease, background 250ms ease;
}
.slide-dots button.is-active {
  height: 16px;
  background: rgba(139,102,81,.68);
}
.init-error-slide {
  background: var(--bg);
}
.init-error-card {
  padding: 28px 24px;
  border-radius: 28px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.init-error-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.18;
}
.init-error-card p:not(.cover-kicker) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

@media (min-width: 700px) {
  body { background: #f1ece4; }
  .slide-inner { width: min(100%, 560px); }
}
@media (max-height: 720px) {
  .slide { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .photo-natural { max-height: calc(var(--app-height) * .52); }
  .letter-paper { padding: 22px 20px; }
  .letter-paper h2 { margin-bottom: 14px; }
  .letter-paper p { font-size: 14px; line-height: 1.72; margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
