:root {
  --ink: #f4f0e8;
  --ink-dim: rgba(244, 240, 232, 0.55);
  --line: rgba(244, 240, 232, 0.25);
  --bg: #05070a;
}

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

html { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Jost', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============ PRELOADER ============ */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #05070a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease, visibility 1s ease;
}
#preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.preloader-mark {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: 0.04em;
  color: var(--ink);
  opacity: 0.9;
}
.preloader-bar {
  width: min(220px, 40vw);
  height: 1px;
  background: var(--line);
  position: relative;
}
.preloader-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--ink);
  transition: width 0.2s ease-out;
}
.preloader-percent {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
}

#site.hidden-until-ready { visibility: hidden; }
#site.ready { visibility: visible; }

/* ============ STAGE / CANVAS ============ */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
}
.frame-stack {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  width: auto;
  aspect-ratio: 720 / 1280;
}
.frame-stack img {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  object-fit: cover;
  visibility: hidden;
  z-index: 0;
}
.frame-stack img.is-visible {
  visibility: visible;
  z-index: 1;
}
.frame-stack img.is-backdrop {
  visibility: visible;
  z-index: 0;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(to bottom, rgba(0,0,0,0.35) 0%, transparent 20%, transparent 75%, rgba(0,0,0,0.5) 100%);
}
.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  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");
}

/* ============ CHROME ============ */
.chrome-top {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px clamp(20px, 4vw, 48px);
  pointer-events: none;
}
.wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--ink);
  opacity: 0.85;
}
.chrome-scroll-hint {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.dots {
  position: fixed;
  right: clamp(18px, 3vw, 40px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.4s ease;
}
.dot.active {
  background: var(--ink);
  border-color: var(--ink);
  transform: scale(1.3);
}

.chrome-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 26px clamp(20px, 4vw, 48px);
  pointer-events: none;
}
.progress-track {
  flex: 1;
  height: 1px;
  background: var(--line);
  position: relative;
}
.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--ink);
}
.progress-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  min-width: 32px;
}

/* ============ TEXT SECTIONS ============ */
/* Panels are fixed and stacked on top of each other; JS toggles which
   one is visible based on scroll progress. They do NOT scroll with
   the page — the canvas + text together simulate the "scenes". */
.sections {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.9s ease;
}
.panel.is-visible {
  opacity: 1;
  visibility: visible;
}
.panel .eyebrow,
.panel .line {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  filter: blur(6px);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
              transform 1s cubic-bezier(0.16, 1, 0.3, 1),
              filter 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel.is-visible .eyebrow,
.panel.is-visible .line {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  transition-delay: 0.15s;
}
.panel.is-visible .line {
  transition-delay: 0.28s;
}
.eyebrow {
  font-family: 'Jost', sans-serif;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 22px;
}
.line {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(34px, 6.2vw, 72px);
  line-height: 1.2;
  max-width: 15ch;
  color: var(--ink);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.5), 0 0 80px rgba(244, 240, 232, 0.08);
}
.line-final {
  font-style: italic;
  letter-spacing: 0.1em;
  font-size: clamp(30px, 5vw, 58px);
}

/* Scroll spacer: height is set dynamically by JS based on frame count */
#scrollSpacer {
  position: relative;
  z-index: 1;
}

@media (max-width: 640px) {
  .chrome-scroll-hint { display: none; }
  .dots { right: 14px; gap: 12px; }
}

/* ============ EPILOGUE STATE ============ */
body.in-epilogue .stage,
body.in-epilogue .chrome-top,
body.in-epilogue .dots,
body.in-epilogue .chrome-bottom,
body.in-epilogue .sections {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

/* ============ EPILOGUE ============ */
.epilogue {
  position: relative;
  z-index: 20;
  min-height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 24px;
  gap: 40px;
}
.epilogue-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(244, 240, 232, 0.15);
  border-top-color: rgba(244, 240, 232, 0.7);
  animation: spin 1.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.epilogue-text {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(16px, 2.1vw, 21px);
  line-height: 1.9;
  color: var(--ink-dim);
  max-width: 36ch;
  letter-spacing: 0.02em;
}
