:root {
  --bg-0: #0c0906;
  --bg-1: #15100a;
  --bg-2: #21160d;
  --ember-rim: #3a2414;
  --cream: #f4ecdb;
  --cream-2: rgba(244, 236, 219, 0.66);
  --cream-3: rgba(244, 236, 219, 0.40);
  --ember: #f2661a;
  --ember-2: #ffb35c;
  --ember-deep: #7a3414;
  --flame-red: #e8391f;
  --frost: #7e98ae;
  --frost-2: #b2c7d8;
  --paper: #fbf9f4;
  --ink: #26201a;
  --ink-2: #3a332a;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-enter: 600ms;
  --t-cross: 720ms;
  --maxw: 1600px;
  --serif: 'Fraunces Variable', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk Variable', 'Hanken Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --fs-xl: clamp(64px, 12cqw, 200px);
  --fs-display: clamp(40px, min(8cqw, 9cqh), 104px);
  --fs-m: clamp(26px, min(4.4cqw, 5cqh), 56px);
  --fs-body: clamp(16px, min(2cqw, 2.4cqh), 26px);
  --fs-label: clamp(11px, 1.1cqw, 15px);
  --paper-ratio: 0.7727;
}

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

html,
body {
  height: 100%;
}

body {
  background:
    radial-gradient(120% 120% at 50% 18%, #241609 0%, var(--bg-0) 70%),
    var(--bg-0);
  color: var(--cream);
  font-family: var(--sans);
  font-weight: 400;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  cursor: default;
}

#deck {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.deck-stage {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
}

.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember);
}

.eyebrow--ruled::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  margin-right: 14px;
  vertical-align: middle;
  background: var(--ember);
  opacity: 0.7;
}

.h-xl {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-xl);
  line-height: 0.96;
  letter-spacing: -0.012em;
  text-wrap: balance;
  color: var(--cream);
}

.h-display {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--cream);
}

.h-m {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-m);
  line-height: 1.08;
  letter-spacing: -0.005em;
  text-wrap: balance;
  color: var(--cream);
}

.lede {
  font-family: var(--sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.42;
  color: var(--cream-2);
  max-width: 34ch;
}

.lede.wide {
  max-width: 62ch;
}

.gold {
  color: var(--ember-2);
}

.italic {
  font-style: italic;
}

.faint {
  color: var(--cream-3);
}

.stage-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(14px, 2.2cqh, 30px);
  padding: clamp(28px, 5cqh, 90px) clamp(32px, 6cqw, 110px);
  text-align: center;
}

.full-bleed {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.bg-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform-origin: center;
}

.slide.active.is-live .bg-image.kenburns {
  animation: kenburns 22s ease-in-out infinite alternate;
}

@keyframes kenburns {
  from { transform: scale(1.04); }
  to { transform: scale(1.13); }
}

.scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(12, 9, 6, 0.55) 0%, rgba(12, 9, 6, 0.04) 32%, rgba(12, 9, 6, 0.16) 58%, rgba(12, 9, 6, 0.82) 100%);
}

.scrim--strong {
  background: linear-gradient(180deg, rgba(12, 9, 6, 0.72) 0%, rgba(12, 9, 6, 0.28) 45%, rgba(12, 9, 6, 0.9) 100%);
}

.corner-tl {
  position: absolute;
  top: clamp(22px, 4cqh, 54px);
  left: clamp(26px, 4cqw, 64px);
  z-index: 6;
}

.corner-tr {
  position: absolute;
  top: clamp(22px, 4cqh, 54px);
  right: clamp(26px, 4cqw, 64px);
  z-index: 6;
}

.corner-bl {
  position: absolute;
  bottom: clamp(22px, 4cqh, 54px);
  left: clamp(26px, 4cqw, 64px);
  z-index: 6;
}

.corner-br {
  position: absolute;
  bottom: clamp(22px, 4cqh, 54px);
  right: clamp(26px, 4cqw, 64px);
  z-index: 6;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  z-index: 2;
  pointer-events: none;
  transition: opacity var(--t-cross) var(--ease);
}

.slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 4;
  pointer-events: auto;
}

.slide.exit {
  opacity: 0;
  visibility: visible;
  z-index: 3;
}

[data-reveal] {
  opacity: 0;
  will-change: transform, opacity;
}

.slide.active [data-reveal] {
  animation: rise var(--t-enter) var(--ease) both;
  animation-delay: calc(var(--ri, 0) * 90ms + 120ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.slide.settle [data-reveal] {
  animation-delay: 0ms !important;
}

.ambient {
  position: absolute;
  inset: -12%;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
}

.slide.active.is-live .ambient {
  opacity: 1;
  animation: drift 19s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1.04);
  }
  to {
    transform: translate3d(4cqw, -3cqh, 0) scale(1.1);
  }
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

#stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#rail {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 0;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--ember), transparent);
  box-shadow: 0 0 14px rgba(242, 102, 26, 0.45);
  opacity: 0;
  transition:
    width var(--t-cross) var(--ease),
    opacity var(--t-cross) var(--ease),
    bottom var(--t-cross) var(--ease);
}

#rail.rail--hidden {
  opacity: 0;
  width: 0;
}

#rail.rail--cover {
  opacity: 0.7;
  width: min(280px, 32cqw);
  bottom: clamp(60px, 12cqh, 140px);
}

#rail.rail--line {
  opacity: 0.55;
  width: min(180px, 22cqw);
  bottom: 50%;
}

#rail.rail--low {
  opacity: 0.4;
  width: 86cqw;
  bottom: clamp(40px, 8cqh, 92px);
}

#rail.rail--full {
  opacity: 0.36;
  width: 86cqw;
  bottom: 50%;
}

#chrome {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
}

#deckProgress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--ember-deep), var(--ember-2));
  box-shadow: 0 0 12px rgba(242, 102, 26, 0.5);
  transition: width var(--t-cross) var(--ease);
}

#deckCounter {
  position: absolute;
  left: clamp(20px, 3cqw, 40px);
  bottom: clamp(16px, 2.4cqh, 26px);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--cream-3);
  font-variant-numeric: tabular-nums;
}

#deckHint {
  position: absolute;
  right: clamp(20px, 3cqw, 40px);
  bottom: clamp(15px, 2.2cqh, 24px);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream-3);
  transition: opacity 0.8s ease;
}

#deckHint.is-faded {
  opacity: 0;
}

#deckNav {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 2.4cqh, 26px);
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.deck-nav-btn {
  display: grid;
  place-items: center;
  width: clamp(32px, 4cqh, 40px);
  height: clamp(32px, 4cqh, 40px);
  border-radius: 999px;
  border: 1px solid rgba(242, 102, 26, 0.32);
  background: rgba(21, 16, 10, 0.55);
  color: var(--cream-2);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.deck-nav-btn svg {
  width: 44%;
  height: 44%;
}

.deck-nav-btn:hover {
  border-color: rgba(242, 102, 26, 0.62);
  color: var(--ember-2);
  background: rgba(33, 22, 13, 0.78);
}

.deck-nav-btn:disabled {
  opacity: 0.26;
  pointer-events: none;
  cursor: default;
}

.binder {
  --binder-h: clamp(360px, 64cqh, 760px);
  position: relative;
  height: var(--binder-h);
  width: calc(var(--binder-h) * var(--paper-ratio));
}

.binder__page {
  position: absolute;
  inset: 0;
  width: calc(var(--binder-h) * var(--paper-ratio));
  height: var(--binder-h);
  border-radius: 6px;
  background-color: var(--paper);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(242, 102, 26, 0.28);
  box-shadow:
    0 30px 70px -28px rgba(0, 0, 0, 0.72),
    0 2px 0 rgba(242, 102, 26, 0.34);
  overflow: hidden;
}

.binder__page::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 30%, rgba(0, 0, 0, 0) 72%, rgba(0, 0, 0, 0.1));
}

.binder--closed {
  width: calc(var(--binder-h) * var(--paper-ratio));
}

.binder--closed .binder__page {
  transform: rotate(-1.6deg);
}

.binder--open {
  width: calc(var(--binder-h) * var(--paper-ratio));
}

.binder--open::before {
  content: '';
  position: absolute;
  top: 3%;
  left: -7%;
  width: 100%;
  height: 94%;
  border-radius: 6px;
  background: var(--bg-2);
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.62);
}

.binder--open .binder__page {
  transform: none;
}

.binder--page {
  width: calc(var(--binder-h) * var(--paper-ratio));
}

.binder--page .binder__page {
  transform: none;
}

.binder--fan {
  width: calc(var(--binder-h) * 0.92);
}

.binder--fan .binder__page {
  left: 50%;
  top: 0;
  margin-left: calc(var(--binder-h) * var(--paper-ratio) / -2);
  transform-origin: bottom center;
}

.binder--fan .binder__page:nth-child(1) {
  transform: rotate(-13deg);
  z-index: 1;
}

.binder--fan .binder__page:nth-child(2) {
  transform: rotate(-6.5deg);
  z-index: 2;
}

.binder--fan .binder__page:nth-child(3) {
  transform: rotate(0deg);
  z-index: 3;
}

.binder--fan .binder__page:nth-child(4) {
  transform: rotate(6.5deg);
  z-index: 2;
}

.binder--fan .binder__page:nth-child(5) {
  transform: rotate(13deg);
  z-index: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: clamp(10px, 1cqw, 14px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ember-2);
  background: rgba(242, 102, 26, 0.08);
  border: 1px solid rgba(242, 102, 26, 0.32);
  border-radius: 999px;
  padding: 0.42em 0.82em;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .slide {
    transition: none !important;
  }
  .slide.active [data-reveal],
  .slide.active.is-live .ambient,
  .slide.active.is-live .bg-image.kenburns {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  #rail,
  #deckProgress {
    transition: none !important;
  }
}
