:root {
  --motion-yellow: #fedd70;
  --motion-red: #cb1316;
  --motion-ink: #0b0b0d;
  --motion-blue: #0e1a36;
}

html.motion-ready { scroll-padding-top: 84px; }

.story-progress {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: 5px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.12);
}

.story-progress span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--motion-red), #f58220 52%, var(--motion-yellow));
  box-shadow: 0 0 18px rgba(254, 221, 112, 0.65);
}

.motion-ready .motion-section {
  isolation: isolate;
  transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.9s ease;
}

.motion-ready .motion-section:not(.is-visible) {
  opacity: 0;
  transform: translateY(54px) scale(0.985);
  filter: blur(5px);
}

.motion-ready .motion-section.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: none;
}

.motion-card {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.28s ease, filter 0.28s ease, box-shadow 0.28s ease !important;
}

.motion-card:hover { filter: brightness(1.04) saturate(1.04); }

.motion-decoration {
  will-change: transform;
  transform-origin: 70% 30%;
}

.motion-hero {
  position: relative;
  min-height: min(86vh, 900px);
  overflow: hidden;
  background: var(--motion-ink);
}

.motion-hero > img {
  width: 100%;
  min-height: min(86vh, 900px);
  object-fit: cover;
  object-position: center;
  will-change: transform;
  animation: hero-arrival 1.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.motion-hero::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(11, 11, 13, 0.82));
}

.scroll-cue {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(22px, 4vw, 48px);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-50%);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 999px;
  padding: 10px 17px 10px 20px;
  color: #fff;
  background: rgba(11, 11, 13, 0.72);
  backdrop-filter: blur(12px);
  font: 700 14px/1 'Rubik', sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  transition: transform 0.25s ease, background 0.25s ease;
}

.scroll-cue:hover { transform: translateX(-50%) translateY(-4px); background: rgba(203, 19, 22, 0.9); }
.scroll-cue b { color: var(--motion-yellow); font-size: 20px; animation: cue-bounce 1.5s ease-in-out infinite; }

.chapter-nav {
  position: fixed;
  z-index: 90;
  top: 50%;
  right: 18px;
  display: grid;
  justify-items: center;
  gap: 9px;
  transform: translateY(-50%);
  color: #fff;
}

.chapter-current {
  position: absolute;
  right: 32px;
  top: 50%;
  width: max-content;
  max-width: 260px;
  transform: translateY(-50%);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(11,11,13,0.82);
  backdrop-filter: blur(12px);
  font: 700 12px/1.2 'Rubik', sans-serif;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.chapter-nav:hover .chapter-current,
.chapter-nav:focus-within .chapter-current { opacity: 1; }

.chapter-dots { display: grid; gap: 6px; }

.chapter-dot {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255,255,255,0.88);
  border-radius: 50%;
  padding: 0;
  background: rgba(11,11,13,0.76);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chapter-dot:hover,
.chapter-dot:focus-visible { transform: scale(1.5); background: #fff; outline: none; }
.chapter-dot.is-active { transform: scale(1.45); background: var(--motion-yellow); border-color: var(--motion-red); box-shadow: 0 0 0 3px rgba(203,19,22,0.35); }

.chapter-step {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  padding: 0;
  color: #fff;
  background: rgba(11,11,13,0.78);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.chapter-step:hover:not(:disabled),
.chapter-step:focus-visible { color: var(--motion-ink); background: var(--motion-yellow); outline: none; }
.chapter-step:disabled { opacity: 0.28; cursor: default; }

@keyframes hero-arrival {
  from { opacity: 0; transform: scale(1.09); filter: saturate(0.6) brightness(0.55); }
  to { opacity: 1; transform: scale(1); filter: none; }
}

@keyframes cue-bounce {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(3px); }
}

@media (max-width: 760px) {
  .motion-hero, .motion-hero > img { min-height: 72svh; }
  .motion-hero > img { object-position: center; }
  .scroll-cue span { display: none; }
  .scroll-cue { width: 46px; height: 46px; justify-content: center; padding: 0; }
  .chapter-nav {
    top: auto;
    right: 50%;
    bottom: 14px;
    grid-template-columns: 38px minmax(150px, 1fr) 38px;
    width: min(88vw, 390px);
    gap: 8px;
    transform: translateX(50%);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    padding: 7px 9px;
    background: rgba(11,11,13,0.86);
    box-shadow: 0 12px 36px rgba(0,0,0,0.48);
    backdrop-filter: blur(15px);
  }
  .chapter-dots { display: none; }
  .chapter-current {
    position: static;
    width: auto;
    max-width: none;
    transform: none;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
    opacity: 1;
  }
  .chapter-step { width: 36px; height: 36px; }
  .chapter-prev { order: 0; }
  .chapter-current { order: 1; }
  .chapter-next { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .motion-section { opacity: 1 !important; transform: none !important; filter: none !important; }
  .motion-hero > img, .motion-decoration, .motion-card { transform: none !important; }
}
