:root {
  --ink: #100e14;
  --paper: #f3efe8;
  --sand: #c4a882;
  --brand: #5a3f8c;
  --white: #faf8f4;
  --muted: rgba(250, 248, 244, 0.78);
  --display: "Syne", system-ui, sans-serif;
  --body: "Outfit", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: #0a090c;
  line-height: 1.5;
}

body.is-loading {
  overflow: hidden;
  height: 100svh;
}

/* Fullscreen loader — blocks scroll until frames are ready */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(90, 63, 140, 0.35), transparent 60%),
    #0a090c;
  transition: opacity 0.55s var(--ease), visibility 0.55s;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-card {
  text-align: center;
  color: var(--white);
  padding: 1.5rem;
}

.loader-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.loader-brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  margin-bottom: 0.35rem;
}

.loader-copy {
  font-size: 0.9rem;
  color: rgba(250, 248, 244, 0.65);
  margin-bottom: 1.35rem;
}

.loader-track {
  width: min(220px, 70vw);
  height: 3px;
  margin: 0 auto 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.loader-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a78bfa, #f5d0a9);
  transition: width 0.15s linear;
}

.loader-pct {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: rgba(250, 248, 244, 0.5);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin: 0;
}

p {
  margin: 0;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(to bottom, rgba(10, 9, 12, 0.75), transparent);
  pointer-events: none;
}

.site-header a {
  pointer-events: auto;
}

.brand img {
  width: 108px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--white);
}

.nav a {
  opacity: 0.85;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.nav a:hover {
  opacity: 1;
}

.nav-cta {
  background: var(--white);
  color: var(--ink) !important;
  opacity: 1 !important;
  padding: 0.45rem 0.85rem;
  border-radius: 0.3rem;
  text-shadow: none !important;
}

/* Progress */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  background: rgba(255, 255, 255, 0.12);
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #f5d0a9);
  transform-origin: left;
}

/* Scrolly: taller track = more scroll per frame (slower, smoother control) */
.scrolly {
  position: relative;
  /* ~1.75 viewports per section → user scrolls more to advance */
  height: 875vh;
  height: 875svh;
}

.scrolly-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  z-index: 1;
}

/* Absolute rail — stop 0 is the top (first text section) */
.snap-rail {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.snap-stop {
  flex: 1 0 0;
  min-height: 0;
  scroll-snap-align: start;
}

.stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #1a1510;
}

.poster,
#scrubCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
}

#scrubCanvas {
  opacity: 0;
  transition: opacity 0.35s ease;
}

#scrubCanvas.is-ready {
  opacity: 1;
}

.poster.is-hidden {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.stage-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 9, 12, 0.72) 0%, rgba(10, 9, 12, 0.25) 42%, rgba(10, 9, 12, 0.15) 100%),
    linear-gradient(to top, rgba(10, 9, 12, 0.55) 0%, transparent 35%);
}

@media (max-width: 720px) {
  .stage-veil {
    background:
      linear-gradient(to top, rgba(10, 9, 12, 0.82) 0%, rgba(10, 9, 12, 0.35) 45%, rgba(10, 9, 12, 0.4) 100%);
  }

  .poster,
  #scrubCanvas {
    object-position: center 40%;
  }
}

/* Chapters */
.chapters {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  display: grid;
}

.chapter {
  grid-area: 1 / 1;
  align-self: end;
  max-width: min(420px, 88vw);
  margin: 0 0 18vh 6vw;
  color: var(--white);
  opacity: 0;
  visibility: hidden;
  transform: translateY(22px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.55s var(--ease),
    visibility 0.55s;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.chapter.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.chapter.is-leaving {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  pointer-events: none;
}

.phase-dots {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.phase-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.3s ease, transform 0.3s ease;
}

.phase-dots span.is-on {
  background: #fff;
  transform: scale(1.35);
}

.chapter-right {
  margin-left: auto;
  margin-right: 6vw;
  text-align: right;
}

.chapter-center {
  justify-self: center;
  align-self: center;
  margin: 0;
  text-align: center;
  max-width: min(460px, 90vw);
}

.kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d4b8f5;
  margin-bottom: 0.7rem;
}

.kicker.dark {
  color: var(--brand);
}

.chapter h1,
.chapter h2 {
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  margin-bottom: 0.75rem;
}

.chapter .body {
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  color: var(--muted);
  max-width: 34ch;
}

.chapter-right .body,
.chapter-center .body {
  margin-inline: auto;
}

.chapter-right .body {
  margin-left: auto;
  margin-right: 0;
}

.cta-row {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.65rem 1.35rem;
  border-radius: 0.35rem;
  background: var(--white);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  pointer-events: auto;
  transition: transform 0.2s var(--ease), background 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
  background: #efe6ff;
}

.btn-dark {
  background: var(--ink);
  color: var(--white);
}

.btn-dark:hover {
  background: var(--brand);
}

.mail {
  display: inline-block;
  margin-top: 0.9rem;
  font-weight: 600;
  color: rgba(250, 248, 244, 0.8);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  pointer-events: auto;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: rgba(250, 248, 244, 0.7);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: opacity 0.4s ease;
}

.scroll-hint.is-gone {
  opacity: 0;
  pointer-events: none;
}

.scroll-hint-line {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.7), transparent);
  animation: pulse-line 1.6s ease-in-out infinite;
}

@keyframes pulse-line {
  0%,
  100% {
    opacity: 0.35;
    transform: scaleY(0.85);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

.load-status {
  position: absolute;
  top: 5.5rem;
  right: 1.25rem;
  z-index: 6;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(250, 248, 244, 0.55);
  transition: opacity 0.5s ease;
}

.load-status.is-done {
  opacity: 0;
  pointer-events: none;
}

/* Outro */
.outro {
  position: relative;
  z-index: 2;
  background: var(--paper);
  color: var(--ink);
  padding: 4.5rem 1.5rem;
  min-height: calc(100svh - 10rem);
  scroll-snap-align: start;
}

.outro-inner {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(140px, 240px) 1fr;
  gap: 2.5rem;
  align-items: center;
}

.outro-product {
  width: 100%;
  max-width: 240px;
  margin-inline: auto;
  filter: drop-shadow(0 18px 28px rgba(16, 14, 20, 0.18));
}

.outro h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0.4rem 0 0.75rem;
}

.outro p {
  color: #5a5460;
  max-width: 40ch;
  margin-bottom: 1.25rem;
}

.site-footer {
  background: var(--paper);
  min-height: 22svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  color: #6a6470;
  font-size: 0.88rem;
  border-top: 1px solid rgba(16, 14, 20, 0.08);
  scroll-snap-align: end;
  scroll-snap-stop: always;
}

.site-footer img {
  width: 90px;
  margin: 0 auto 0.75rem;
  opacity: 0.85;
}

@media (max-width: 720px) {
  .nav a:not(.nav-cta) {
    display: none;
  }

  .phase-dots {
    right: 0.75rem;
  }

  .chapter {
    align-self: end;
    margin: 0 1.1rem 16vh;
    max-width: none;
    text-align: left;
  }

  .chapter-right {
    margin-left: 1.1rem;
    margin-right: 1.1rem;
    text-align: left;
  }

  .chapter-right .body {
    margin-left: 0;
  }

  .chapter-center {
    align-self: end;
    text-align: left;
    margin: 0 1.1rem 14vh;
  }

  .chapter-center .cta-row {
    justify-content: flex-start;
  }

  .outro-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .outro p {
    margin-inline: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-snap-type: none;
  }

  .scrolly {
    height: auto;
  }

  .snap-rail {
    display: none;
  }

  .scrolly-sticky {
    position: relative;
    height: auto;
    min-height: 70svh;
  }

  .scroll-hint,
  .load-status,
  .progress,
  .phase-dots {
    display: none;
  }

  .chapter {
    position: relative;
    grid-area: auto;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    margin: 1.5rem 1.25rem;
    pointer-events: auto;
  }

  .chapters {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 5rem 0 2rem;
    background: linear-gradient(to top, rgba(10, 9, 12, 0.9), transparent 40%);
  }

  #scrubCanvas {
    display: none;
  }

  .poster {
    opacity: 1 !important;
  }
}
