/*
 * Postdoc's own additions to the default theme's story styles: a story's cover, its
 * figures, and the look of the steps that float over its maps.
 */

/* The cover can open with a line above its heading. The heading and the paragraph
   after it then look as they do when the heading comes first. */
.storyContent > .story-kicker:first-child {
  margin-top: clamp(3rem, 12vh, 8rem);
  margin-bottom: 1rem;
  color: var(--story-accent);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.storyContent > .story-kicker + h1 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: clamp(2.25rem, 6vw, 4rem);
  letter-spacing: -0.015em;
}

.storyContent > .story-kicker + h1 + p {
  margin-bottom: 2.5rem;
  color: var(--story-muted);
  font-size: 1.3rem;
}

/* The story in numbers: each number above what it counts. */
.storyContent > .story-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1.25rem 2rem;
  margin-top: 0;
  margin-bottom: 3.5rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  border-top: 1px solid var(--story-border);
  border-bottom: 1px solid var(--story-border);
}

.story-stats > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.125rem;
}

.story-stats dt {
  color: var(--story-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

.story-stats dd {
  margin: 0;
  font-size: clamp(1.5rem, 3.4vw, 2.125rem);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

/* Figures are wider than the text they sit in. */
.storyContent > figure {
  width: min(58rem, 100%);
  margin-top: 2.5rem;
  margin-bottom: 3rem;
}

.storyContent img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.storyContent figcaption {
  margin-top: 0.75rem;
  color: var(--story-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/*
 * The steps over a map are sheets of frosted glass, so the sea still shows around
 * what they say. Each has its number above its heading.
 */
.storyPage .storymap.is-floating {
  --storymap-panel-background: rgb(255 255 255 / 0.84);
}

:root[data-theme="dark"] .storyPage .storymap.is-floating {
  --storymap-panel-background: rgb(11 24 38 / 0.8);
}

.storyPage .storymap.is-floating .storymap-steps {
  counter-reset: story-step;
}

.storyPage .storymap.is-floating .storymap-step {
  border: 1px solid rgb(255 255 255 / 0.5);
  border-radius: 14px;
  box-shadow: 0 12px 40px -14px rgb(6 20 34 / 0.55);
  backdrop-filter: blur(14px) saturate(1.3);
  counter-increment: story-step;
}

:root[data-theme="dark"] .storyPage .storymap.is-floating .storymap-step {
  border-color: rgb(255 255 255 / 0.12);
}

.storyPage .storymap.is-floating .storymap-step::before {
  content: counter(story-step, decimal-leading-zero);
  display: block;
  margin-bottom: 0.5rem;
  color: var(--story-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.1em;
}

/* Legends and popups keep the solid panel, which is easier to read at their size. */
.storyPage .storymap-legend,
.storyPage .storymap-popup .maplibregl-popup-content {
  background-color: var(--storymap-default-panel-background);
}
