:root {
  color-scheme: dark;
  --bg: #09090b;
  --text: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.62);
  --line: rgba(244, 241, 234, 0.16);
  --card: min(58vw, 760px);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% 38%, rgba(80, 64, 42, 0.18), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
}

button,
a {
  font: inherit;
  color: inherit;
}

.back {
  position: fixed;
  z-index: 5;
  top: 18px;
  left: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.back:hover,
.back:focus-visible {
  color: var(--text);
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100svh;
  padding: 28px 0 18px;
}

.intro {
  text-align: center;
  margin-top: 8px;
}

.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 560;
  letter-spacing: -0.03em;
}

.stage {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  perspective: 1400px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  outline: none;
}

.stage.is-dragging {
  cursor: grabbing;
}

.stage:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(244, 241, 234, 0.28);
}

.track {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.slide {
  position: absolute;
  top: 48%;
  left: 50%;
  width: var(--card);
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #141416;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.38);
  transform-origin: center center;
  will-change: transform;
}

.slide img {
  position: absolute;
  top: 0;
  left: -9%;
  width: 118%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.slide.is-active {
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(244, 241, 234, 0.2);
}

.edge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(16vw, 180px);
  pointer-events: none;
}

.edge-left {
  left: 0;
  background: linear-gradient(90deg, var(--bg), transparent);
}

.edge-right {
  right: 0;
  background: linear-gradient(270deg, var(--bg), transparent);
}

.caption {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  min-height: 2.4rem;
  margin-top: 4px;
}

.name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-style: italic;
  font-weight: 560;
}

.index {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
}

.rail {
  width: min(920px, calc(100% - 48px));
  height: 58px;
  margin-top: 8px;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.rail-strip {
  display: flex;
  gap: 8px;
  height: 100%;
  will-change: transform;
}

.thumb {
  flex: 0 0 84px;
  height: 52px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  background: #141416;
  cursor: pointer;
  opacity: 0.55;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.thumb.is-current {
  border-color: rgba(244, 241, 234, 0.85);
  opacity: 1;
}

.thumb:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.step,
.drift {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.step {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.05rem;
}

.drift {
  min-width: 108px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.drift[aria-pressed="true"] {
  background: var(--text);
  color: #16140f;
  border-color: var(--text);
}

.step:hover,
.drift:hover,
.step:focus-visible,
.drift:focus-visible {
  border-color: rgba(244, 241, 234, 0.45);
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  transition: opacity 0.6s ease;
}

.hint.is-quiet {
  opacity: 0;
}

@media (max-width: 720px) {
  :root {
    --card: 78vw;
  }

  .back {
    top: 14px;
    left: 14px;
  }

  .intro {
    margin-top: 22px;
  }

  .rail {
    width: calc(100% - 28px);
  }

  .thumb {
    flex-basis: 68px;
    height: 44px;
  }

  .hint {
    padding: 0 18px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint {
    transition: none;
  }
}
