/*
 * Shared long-form reading system for The Visual Case stories.
 *
 * This file owns page-level rhythm, typography and responsive behaviour. It
 * deliberately does not style anything inside .e20-viz so bespoke D3 figures
 * keep their own geometry, labels and interaction design.
 */

.e20-story {
  --story-layout-width: 1180px;
  --story-reading-width: 720px;
  --story-section-space: 64px;
  --story-intro-space: 32px;
  --story-text-space: 18px;
}

.e20-story .article-hero__grid {
  min-height: 0;
  padding-block: 56px 72px;
}

.e20-story .article-hero__copy {
  max-width: 960px;
}

.e20-story .article-hero h1 {
  max-width: 900px;
  font-family: var(--font-headline);
  font-size: clamp(38px, 4.6vw, 48px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.e20-story .article-hero__deck {
  max-width: 760px;
  margin-top: 20px;
  font-size: 17px;
  line-height: 1.58;
}

.e20-story .article-hero__meta {
  max-width: 900px;
  gap: 8px 22px;
  margin-top: 30px;
  color: var(--mist);
  font-size: 13px;
  line-height: 1.45;
}

.e20-story .article-layout {
  --article-type-body: 17px;
  --article-type-section-heading: clamp(29px, 2.4vw, 34px);
  --article-leading-body: 1.65;
  --article-measure: var(--story-reading-width);
  width: min(100% - (var(--gutter) * 2), var(--story-layout-width));
  grid-template-columns: 184px minmax(0, 1fr);
  gap: clamp(48px, 5.5vw, 68px);
  padding-block: 64px 96px;
}

.e20-story .article-main {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.e20-story .article-contents {
  position: sticky;
  top: 24px;
  padding-top: 14px;
  border-top: 2px solid var(--e20-basalt);
}

.e20-story .story-contents summary {
  margin: 0 0 12px;
  color: var(--e20-basalt);
  font-size: var(--article-type-supporting);
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.35;
  list-style: none;
  text-transform: uppercase;
}

.e20-story .story-contents summary::-webkit-details-marker {
  display: none;
}

.e20-story .article-contents ol {
  display: block;
}

.e20-story .article-contents li,
.choices-story .article-contents li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  padding: 9px 0;
  border: 0;
}

.e20-story .article-contents a {
  font-size: 13px;
  line-height: 1.4;
}

.e20-story .article-contents a[aria-current="location"] {
  color: var(--e20-ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--e20-brass);
  text-underline-offset: 4px;
}

.e20-story .e20-opening {
  max-width: var(--story-reading-width);
  padding-bottom: 56px;
}

.e20-story .e20-opening p,
.e20-story
  .article-section
  > p:not(.e20-bridge):not(.e20-explanation):not(.article-conclusion),
.e20-story .article-conclusion,
.e20-story .e20-bridge,
.e20-story .e20-explanation {
  max-width: var(--story-reading-width);
  color: var(--graphite);
  font-size: var(--article-type-body);
  line-height: var(--article-leading-body);
}

.e20-story .e20-opening p + p,
.e20-story .article-section > p + p,
.e20-story .article-conclusion p + p,
.e20-story .e20-explanation p + p {
  margin-top: var(--story-text-space);
}

.e20-story .article-section {
  padding: var(--story-section-space) 0 0;
  border: 0;
  scroll-margin-top: 24px;
}

.e20-story .e20-opening + .article-section {
  padding-top: 0;
}

.e20-story .article-section__intro {
  margin-bottom: var(--story-intro-space);
}

.e20-story .article-section__intro h2 {
  max-width: 820px;
  font-family: var(--font-serif);
  font-size: var(--article-type-section-heading);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.e20-story .article-section__intro > p:not(.eyebrow) {
  max-width: var(--story-reading-width);
  margin-top: 14px;
  font-size: var(--article-type-body);
  line-height: var(--article-leading-body);
}

.e20-story
  .article-section
  > p:not(.e20-bridge):not(.e20-explanation):not(.article-conclusion) {
  margin-block: 20px;
}

.e20-story .e20-bridge,
.e20-story .e20-explanation {
  margin-top: 28px;
}

.e20-story .article-conclusion {
  margin-top: var(--story-text-space);
  padding-top: 0;
  border-top: 0;
}

.e20-story .e20-sources {
  margin-top: 64px;
  padding-top: 44px;
  border-top: 1px solid var(--e20-limestone);
}

.e20-story .e20-sources h2 {
  font-size: 24px;
  line-height: 1.2;
}

.e20-story .e20-sources ol {
  gap: 0 36px;
  margin-top: 22px;
}

.e20-story .e20-sources li,
.e20-story .e20-sources a {
  overflow-wrap: anywhere;
}

@media (max-width: 1024px) {
  .e20-story .container {
    width: min(calc(100% - 64px), 960px);
  }

  .e20-story .article-hero__grid {
    padding-block: 48px 62px;
  }

  .e20-story .article-hero h1 {
    font-size: clamp(38px, 4.6vw, 48px);
  }

  .e20-story .article-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    padding-block: 48px 80px;
  }

  .e20-story .article-contents {
    position: static;
    padding: 0 16px;
    border-top: 1px solid var(--e20-limestone);
    border-bottom: 1px solid var(--e20-limestone);
    background: var(--e20-pearl);
  }

  .e20-story .story-contents summary {
    display: flex;
    min-height: 52px;
    margin: 0;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
  }

  .e20-story .story-contents summary::after {
    content: "+";
    margin-left: 20px;
    color: var(--e20-muted);
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
  }

  .e20-story .story-contents[open] summary {
    border-bottom: 1px solid var(--e20-limestone);
  }

  .e20-story .story-contents[open] summary::after {
    content: "−";
  }

  .e20-story .article-contents ol {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    padding-block: 8px 12px;
  }

  .e20-story .article-contents li {
    min-height: 44px;
    align-content: center;
  }

  .e20-story .article-contents a {
    font-size: 14px;
  }

  .e20-story .e20-sources ol {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .e20-story {
    --story-section-space: 48px;
    --story-intro-space: 24px;
    --story-text-space: 16px;
  }

  .e20-story .container {
    width: calc(100% - 32px);
  }

  .e20-story .breadcrumb {
    gap: 6px;
    padding-top: 16px;
    font-size: 12px;
    white-space: nowrap;
  }

  .e20-story .breadcrumb > span:nth-last-child(2),
  .e20-story .breadcrumb > span:last-child {
    display: none;
  }

  .e20-story .article-hero__grid {
    padding-block: 34px 48px;
  }

  .e20-story .article-hero h1 {
    font-size: clamp(30px, 8.8vw, 36px);
    line-height: 1.1;
    text-wrap: balance;
  }

  .e20-story .article-hero__deck {
    margin-top: 16px;
    font-size: 16px;
    line-height: 1.55;
  }

  .e20-story .article-hero__meta {
    display: grid;
    gap: 5px;
    margin-top: 24px;
    font-size: 12px;
  }

  .e20-story .article-layout {
    --article-type-body: 16px;
    --article-type-section-heading: clamp(26px, 7.4vw, 29px);
    --article-leading-body: 1.66;
    gap: 28px;
    padding-block: 32px 64px;
  }

  .e20-story .article-contents {
    padding-inline: 14px;
  }

  .e20-story .story-contents summary {
    min-height: 48px;
  }

  .e20-story .article-contents ol {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .e20-story .e20-opening {
    padding-bottom: 42px;
  }

  .e20-story .article-section__intro h2 {
    line-height: 1.2;
  }

  .e20-story
    .article-section
    > p:not(.e20-bridge):not(.e20-explanation):not(.article-conclusion) {
    margin-block: 18px;
  }

  .e20-story .e20-bridge,
  .e20-story .e20-explanation {
    margin-top: 24px;
  }

  .e20-story .article-conclusion {
    margin-top: var(--story-text-space);
    padding-top: 0;
  }

  .e20-story .e20-sources {
    margin-top: 48px;
    padding-top: 36px;
  }
}

@media (max-width: 360px) {
  .e20-story .container {
    width: calc(100% - 28px);
  }
}

@media print {
  .e20-story .article-contents {
    display: none;
  }
}
