body.has-open-story-overlay {
  overflow: hidden;
}

.story-overlay[hidden] {
  display: none !important;
}

.story-overlay {
  --story-ink: #102c33;
  --story-mint: #9ad8c7;
  position: fixed;
  z-index: 10000;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 0%, rgba(49, 143, 121, 0.2), transparent 34rem),
    #071a1f;
  color: #fff;
}

.story-overlay-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(10px, 1.8dvh, 20px);
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2.3vw, 30px);
}

.story-overlay-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 58px;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  min-height: 58px;
}

.story-overlay-header > div {
  min-width: 0;
}

.story-overlay-header p,
.story-overlay-header h2 {
  margin: 0;
}

.story-overlay-header p {
  margin-bottom: 3px;
  color: var(--story-mint);
  font-size: clamp(0.68rem, 1vw, 0.8rem);
  font-weight: 950;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.story-overlay-header h2 {
  overflow: hidden;
  font-size: clamp(1.15rem, 2.2vw, 2rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-overlay-counter {
  min-width: 84px;
  color: #e7f5f0;
  font-size: clamp(0.86rem, 1.3vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.story-overlay-close,
.story-overlay-arrow {
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.story-overlay-close {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
}

.story-overlay-close span {
  display: block;
  margin-top: -4px;
  font-size: 2.65rem;
  font-weight: 300;
  line-height: 1;
}

.story-overlay-close:hover,
.story-overlay-arrow:hover:not(:disabled) {
  border-color: #fff;
  background: #fff;
  color: var(--story-ink);
}

.story-overlay-close:focus-visible,
.story-overlay-arrow:focus-visible,
.story-overlay .deck-dot:focus-visible,
.story-overlay-viewport:focus-visible {
  outline: 4px solid #ffd37a;
  outline-offset: 3px;
  box-shadow: none;
}

.story-overlay-stage {
  display: grid;
  grid-template-columns: clamp(58px, 6.4vw, 94px) minmax(0, 1fr) clamp(58px, 6.4vw, 94px);
  align-items: stretch;
  gap: clamp(10px, 1.6vw, 24px);
  min-width: 0;
  min-height: 0;
}

.story-overlay-arrow {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 10px 4px;
  border-radius: 18px;
}

.story-overlay-arrow span {
  font-family: Arial, sans-serif;
  font-size: clamp(2.8rem, 6vw, 5.8rem);
  font-weight: 300;
  line-height: 0.75;
}

.story-overlay-arrow small {
  font-size: clamp(0.66rem, 1vw, 0.82rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.story-overlay-arrow:disabled {
  opacity: 0.26;
  cursor: not-allowed;
}

.story-overlay-deck {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(8px, 1.2dvh, 13px);
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.story-overlay-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: #e7f5f0;
  text-align: center;
}

.story-overlay-loading[hidden],
.story-overlay-viewport[hidden] {
  display: none !important;
}

.story-overlay-loading span {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--story-mint);
  border-radius: 50%;
  animation: story-overlay-spin 700ms linear infinite;
}

.story-overlay-loading--error {
  padding: 24px;
}

.story-overlay-loading--error span {
  display: none;
}

.story-overlay-loading a {
  color: #fff;
  font-weight: 900;
  text-underline-offset: 4px;
}

.story-overlay-viewport {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: var(--story-ink);
}

.story-overlay .deck-track,
.story-overlay .deck-slide {
  height: 100%;
  min-height: 0;
}

.story-overlay .deck-card {
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: clamp(22px, 4dvh, 54px) clamp(22px, 4.5vw, 72px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 17px;
}

.story-overlay .deck-copy h2 {
  font-size: clamp(1.8rem, 5.8dvh, 4.7rem);
}

.story-overlay .deck-copy,
.story-overlay .deck-visual {
  min-width: 0;
}

.story-overlay .deck-lead {
  margin-top: clamp(14px, 2.6dvh, 26px);
  font-size: clamp(0.98rem, 2.2dvh, 1.32rem);
}

.story-overlay .deck-detail {
  margin-top: clamp(9px, 1.8dvh, 15px);
  font-size: clamp(0.82rem, 1.65dvh, 0.98rem);
}

.story-overlay .deck-visual {
  min-height: min(35dvh, 310px);
}

.story-overlay-dots {
  min-height: 13px;
}

.story-overlay .deck-dot {
  background: rgba(255, 255, 255, 0.42);
}

.story-overlay .deck-dot[aria-current="true"] {
  background: #fff;
}

@keyframes story-overlay-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .story-overlay .deck-card {
    grid-template-columns: minmax(0, 1.08fr) minmax(230px, 0.92fr);
    align-content: center;
  }

  .story-overlay .deck-visual {
    min-height: min(32dvh, 270px);
  }
}

@media (max-width: 680px) {
  .story-overlay-shell {
    gap: 8px;
    padding: 8px;
  }

  .story-overlay-header {
    grid-template-columns: minmax(0, 1fr) auto 48px;
    gap: 8px;
    min-height: 48px;
  }

  .story-overlay-header h2 {
    font-size: 1rem;
  }

  .story-overlay-header p {
    display: none;
  }

  .story-overlay-counter {
    min-width: 62px;
    font-size: 0.74rem;
  }

  .story-overlay-close {
    width: 46px;
    height: 46px;
  }

  .story-overlay-close span {
    font-size: 2.2rem;
  }

  .story-overlay-stage {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 6px;
  }

  .story-overlay-arrow {
    border-radius: 12px;
  }

  .story-overlay-arrow span {
    font-size: 2.5rem;
  }

  .story-overlay-arrow small {
    display: none;
  }

  .story-overlay .deck-card {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 18px;
    min-height: 0;
    padding: 24px 18px;
  }

  .story-overlay .deck-copy h2 {
    font-size: clamp(1.85rem, 9.8vw, 3rem);
  }

  .story-overlay .deck-lead {
    font-size: 0.98rem;
  }

  .story-overlay .deck-detail {
    font-size: 0.84rem;
  }

  .story-overlay .deck-visual {
    min-height: 220px;
  }
}

@media (max-height: 640px) and (min-width: 681px) {
  .story-overlay-shell {
    gap: 8px;
    padding-block: 8px;
  }

  .story-overlay-header {
    min-height: 48px;
  }

  .story-overlay-close {
    width: 48px;
    height: 48px;
  }

  .story-overlay .deck-card {
    padding-block: 20px;
  }

  .story-overlay .deck-step {
    margin-bottom: 10px;
  }

  .story-overlay .deck-copy h2 {
    font-size: clamp(1.65rem, 5.4dvh, 2.6rem);
  }

  .story-overlay .deck-visual {
    min-height: min(34dvh, 220px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-overlay-loading span {
    animation: none;
  }
}
