/* Story index and chapter pages */

.story {
  width: 100%;
  max-width: 48rem;
  margin-inline: auto;
}

.story--index {
  max-width: var(--width-content);
}

.story__header h1 {
  margin: 0 0 var(--space-sm);
}

.story__header p {
  margin: 0;
  color: var(--color-text-muted);
  max-width: 40rem;
}

.story__chapters {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-lg);
}

.story--index .story__chapters {
  gap: var(--space-md);
}

.story__chapter {
  display: block;
  color: inherit;
  text-decoration: none;
  height: 100%;
}

.story__chapter-media {
  display: block;
  overflow: hidden;
  background: var(--color-surface-muted);
  aspect-ratio: 4 / 3;
}

.story__chapter-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.35s ease;
}

.story__chapter-meta {
  display: block;
  margin-top: var(--space-sm);
}

.story__chapter-num {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-magenta);
}

.story__chapter h2 {
  margin: var(--space-xs) 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-plum-deep);
  line-height: 1.3;
}

.story__chapter p {
  margin: var(--space-xs) 0 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.story__chapter:hover .story__chapter-media img,
.story__chapter:focus-visible .story__chapter-media img {
  transform: scale(1.03);
}

.story__chapter:hover h2,
.story__chapter:focus-visible h2 {
  color: var(--color-magenta);
}

.story__chapter:focus-visible {
  outline: 2px solid var(--color-magenta);
  outline-offset: 4px;
}

@media (min-width: 48rem) {
  .story--index .story__chapters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
  }
}

@media (min-width: 64rem) {
  .story--index .story__chapters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .story__chapter:hover .story__chapter-media img,
  .story__chapter:focus-visible .story__chapter-media img {
    transform: none;
  }
}

/* Chapter page */

.story__hero {
  margin: var(--space-md) 0 0;
  width: 100%;
  height: clamp(11rem, 36vw, 20rem);
  overflow: hidden;
}

.story__hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.story__audio {
  margin: var(--space-md) 0 0;
}

.story__audio audio {
  width: 100%;
  max-width: 28rem;
}

.story__body {
  margin-top: var(--space-lg);
  color: var(--color-text);
}

.story__body p {
  margin: 0 0 var(--space-md);
  line-height: 1.65;
}

.story__body p:last-child {
  margin-bottom: 0;
}

.story__body img {
  display: block;
  max-width: 100%;
  height: auto;
}

.story__back {
  margin-top: var(--space-xl);
}

.story__back a {
  color: var(--color-plum);
  font-weight: 600;
  text-decoration: none;
}

.story__back a:hover,
.story__back a:focus-visible {
  color: var(--color-magenta);
  text-decoration: underline;
}
