/* Story viewer — scrollytelling book club stories (story.html) */

.story-page {
  max-width: 960px;
  padding-bottom: 8rem;
}

/* ── Hero ── */

.story-hero {
  position: relative;
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
}

.story-hero .back-link {
  position: absolute;
  top: 1rem;
  left: 0;
}

.story-hero-eyebrow {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  margin-bottom: 0.75rem;
}

.story-hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.story-hero-author {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  color: var(--ink);
  opacity: 0.7;
}

/* ── Clusters ── */

.story-cluster {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 0;
  margin: 0 auto 0.5rem;
  max-width: 880px;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.story-cluster.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.story-cluster--right .story-cluster-media {
  order: 2;
}

.story-cluster--right .story-cluster-text {
  order: 1;
  margin-right: -3rem;
  margin-left: 0;
}

.story-cluster-media {
  position: relative;
}

.story-cluster-media img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
  object-fit: contain;
  background: #fffefa;
  border-radius: 6px;
  border: 6px solid #fffefa;
  box-shadow: 0 14px 34px rgba(21, 16, 92, 0.16);
  transform: rotate(-2deg);
  transition: transform 500ms ease, box-shadow 500ms ease;
}

.story-cluster--right .story-cluster-media img {
  transform: rotate(2deg);
}

.story-cluster.is-active .story-cluster-media img {
  transform: rotate(-1deg) scale(1.02);
  box-shadow: 0 18px 42px rgba(21, 16, 92, 0.22);
}

.story-cluster--right.is-active .story-cluster-media img {
  transform: rotate(1deg) scale(1.02);
}

.story-cluster-text {
  position: relative;
  z-index: 2;
  margin-left: -3rem;
  padding: 1.4rem 1.6rem;
  background: rgba(255, 254, 250, 0.94);
  border: 1px solid rgba(21, 16, 92, 0.10);
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(21, 16, 92, 0.10);
  font-family: 'Newsreader', serif;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.62;
  color: var(--ink);
}

/* Text-only cluster (no image) */
.story-cluster--text-only {
  grid-template-columns: 1fr;
  max-width: 660px;
}

.story-cluster--text-only .story-cluster-text {
  margin-left: 0;
  margin-right: 0;
}

/* Inked word timing */
.story-word {
  color: rgba(21, 16, 92, 0.15);
  transition: color 180ms ease;
}

.story-word.spoken {
  color: rgba(21, 16, 92, 0.88);
}

.story-word.current {
  color: var(--ink);
}

/* ── Connector ── */

.story-connector {
  width: 2px;
  height: 76px;
  margin: 0.4rem auto;
  background: linear-gradient(to bottom, rgba(21, 16, 92, 0.45), rgba(21, 16, 92, 0.08));
  border-radius: 2px;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 800ms ease 150ms;
  position: relative;
}

.story-connector.is-visible {
  transform: scaleY(1);
}

.story-connector::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 7px;
  height: 7px;
  background: var(--ink);
  border-radius: 50%;
  transform: translateX(-50%);
  opacity: 0.5;
}

/* ── End CTA ── */

.story-note-cta {
  display: block;
  text-align: center;
  margin: 3rem auto 0;
  padding: 14px 24px;
  background: #fffefa;
  border: 1.5px solid #d8d1f5;
  border-radius: 12px;
  text-decoration: none;
  max-width: 320px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms ease, transform 600ms ease, border-color 160ms ease, box-shadow 160ms ease;
  pointer-events: none;
}

.story-note-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.story-note-cta:hover {
  border-color: #b8b0e8;
  box-shadow: 2px 3px 0 rgba(94, 76, 190, 0.1);
}

.story-note-title {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #15105c;
  line-height: 1.4;
  margin-bottom: 4px;
}

.story-note-body {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: rgba(21, 16, 92, 0.65);
  line-height: 1.5;
}

.story-end-cta {
  display: block;
  text-align: center;
  margin: 12px auto 1rem;
  padding: 16px 32px;
  background: var(--ink);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  text-decoration: none;
  max-width: 320px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms ease, transform 600ms ease;
  pointer-events: none;
}

.story-end-cta.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.story-end-cta:hover {
  opacity: 0.92;
}

/* ── Player bar ── */

.story-player-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 780px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: #fffefa;
  border: 1px solid rgba(200, 192, 239, 0.35);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 12px rgba(21, 16, 92, 0.06);
  z-index: 10;
}

.story-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 160ms ease, color 160ms ease;
}

.story-play-btn:hover {
  background: var(--ink);
  color: #fffefa;
}

.story-play-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.story-timeline {
  flex: 1;
  height: 3px;
  background: rgba(21, 16, 92, 0.12);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.story-progress {
  height: 100%;
  background: var(--ink);
  width: 0;
  transition: width 100ms linear;
}

.story-time {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  color: var(--ink);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* ── States ── */

.story-error {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
}

.story-error h2 {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  font-size: 1.8rem;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.story-error p {
  color: var(--ink);
  opacity: 0.7;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

/* ── Mobile ── */

@media (max-width: 700px) {
  .story-hero {
    padding: 3.2rem 0.75rem 2rem;
  }

  .story-cluster {
    grid-template-columns: 1fr;
    gap: 0;
    max-width: 520px;
  }

  .story-cluster--right .story-cluster-media {
    order: 0;
  }

  .story-cluster--right .story-cluster-text {
    order: 0;
    margin-right: 0;
  }

  .story-cluster-media img,
  .story-cluster--right .story-cluster-media img {
    max-height: 40vh;
    transform: rotate(-1.5deg);
  }

  .story-cluster.is-active .story-cluster-media img,
  .story-cluster--right.is-active .story-cluster-media img {
    transform: rotate(-1deg) scale(1.01);
  }

  .story-cluster-text,
  .story-cluster--right .story-cluster-text {
    margin: -1.6rem 0.5rem 0;
    padding: 1.1rem 1.2rem;
  }

  .story-connector {
    height: 52px;
  }
}
