.role-story {
  --story-sticky-top: clamp(1rem, 6svh, 4rem);
  --story-visual-height: clamp(12rem, 45svh, 26rem);
}

.role-story ::selection {
  background: var(--story-accent);
  color: var(--ink);
}

.role-story .site-header {
  border-bottom: 1px solid var(--rule);
}

.role-story__top-links,
.role-story__context,
.role-story__links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.role-story__top-links {
  gap: .2rem clamp(.85rem, 2vw, 1.8rem);
}

.role-story__top-links a:last-child {
  font-weight: 750;
}

.role-story__context {
  gap: .35rem .7rem;
  padding-block: clamp(.9rem, 2.5vw, 2.25rem) .75rem;
  color: var(--muted);
  font-size: .87rem;
}

.role-story__context a {
  display: inline-flex;
  align-items: center;
  min-block-size: 2rem;
  text-underline-offset: .25em;
}

.role-story__context [aria-current] {
  color: var(--ink);
  font-weight: 720;
}

.role-story__track {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 5.25rem);
}

.role-story__stage {
  align-self: start;
  grid-column: 2;
  grid-row: 1;
  min-inline-size: 0;
}

.role-story[data-story-ready] .role-story__stage {
  position: sticky;
  inset-block-start: var(--story-sticky-top);
  z-index: 1;
}

.role-story__figure {
  display: grid;
  margin: 0;
}

.role-story__visual {
  display: grid;
  place-items: center;
  min-block-size: var(--story-visual-height);
  border-radius: 49% 49% .9rem .9rem / 42% 42% .9rem .9rem;
  background: var(--story-accent);
  color: var(--ink);
  transition: background-color .4s ease-out;
}

.role-story__canvas,
.role-story__fallback {
  grid-area: 1 / 1;
}

.role-story__canvas {
  display: block;
  visibility: hidden;
  inline-size: min(80%, calc(var(--story-visual-height) * 1.23), 27rem);
  block-size: auto;
}

.role-story__fallback {
  inline-size: clamp(4.5rem, 14vw, 8rem);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.role-story[data-story-ready] .role-story__canvas {
  visibility: visible;
}

.role-story[data-story-ready] .role-story__fallback {
  visibility: hidden;
}

.role-story__figure-caption {
  visibility: hidden;
  min-block-size: 4em;
  padding: .9rem .65rem .15rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
}

.role-story[data-story-ready] .role-story__figure-caption {
  visibility: visible;
}

.role-story__chapters {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: clamp(.25rem, .85vw, .7rem);
  margin-block-start: .55rem;
}

.role-story__chapters a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-block-size: 2.75rem;
  padding: .4rem .25rem .3rem;
  border-top: 2px solid var(--rule);
  color: var(--muted);
  font-size: clamp(.72rem, 1.4vw, .86rem);
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  text-wrap: balance;
  transition: border-color .2s, color .2s;
}

.role-story__chapters a:hover {
  border-color: var(--muted);
  text-decoration: underline;
  text-underline-offset: .22em;
}

.role-story__chapters a[aria-current] {
  border-color: var(--ink);
  color: var(--ink);
  font-weight: 750;
}

.role-story__panels {
  grid-column: 1;
  grid-row: 1;
  min-inline-size: 0;
}

.role-story .chapter-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  inline-size: 100%;
  padding-block: clamp(2.2rem, 6vw, 5.25rem);
  scroll-margin-block-start: var(--story-sticky-top);
}

.role-story .chapter-panel + .chapter-panel {
  border-top: 1px solid var(--rule);
}

.role-story[data-story-ready] .chapter-panel {
  min-block-size: clamp(25rem, 73svh, 44rem);
}

.role-story[data-story-ready] .chapter-panel:first-child {
  min-block-size: clamp(26rem, calc(100svh - 9rem), 48rem);
}

.role-story .chapter-panel :is(h1, h2) {
  max-inline-size: 14ch;
  font-size: clamp(2.8rem, 5.75vw, 6rem);
  font-weight: 800;
  line-height: .97;
  letter-spacing: -.04em;
  text-wrap: balance;
}

.role-story .chapter-panel h2 {
  font-size: clamp(2.5rem, 5.2vw, 5.2rem);
}

.role-story .chapter-panel :is(h1, h2) span {
  display: block;
}

.role-story .chapter-summary {
  max-inline-size: 38ch;
  margin-block-start: clamp(1rem, 2vw, 1.5rem);
  font-size: clamp(1.03rem, 1.55vw, 1.26rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.role-story__inline-caption {
  max-inline-size: 49ch;
  margin-block-start: .6rem;
  color: var(--muted);
  font-size: .92rem;
}

.role-story__links {
  gap: .75rem 1.65rem;
  justify-content: space-between;
  padding-block: clamp(1.6rem, 4vw, 3rem) clamp(2.75rem, 5vw, 4.75rem);
  border-top: 1px solid var(--rule);
}

@media (min-width: 741px) {
  .role-story[data-story-ready] .role-story__inline-caption {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 740px) {
  .role-story {
    --story-sticky-top: 0px;
    --story-visual-height: clamp(8rem, 24svh, 13.5rem);
  }

  .role-story .header-content {
    min-block-size: 3.85rem;
  }

  .role-story__track {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .role-story__stage,
  .role-story__panels {
    grid-area: auto;
  }

  .role-story__stage {
    padding-block: .2rem .3rem;
    background: var(--paper);
  }

  .role-story__visual {
    border-radius: 45% 45% .65rem .65rem / 42% 42% .65rem .65rem;
  }

  .role-story__figure-caption {
    display: none;
  }

  .role-story__chapters {
    margin-block-start: .45rem;
  }

  .role-story[data-story-ready] .chapter-panel {
    min-block-size: clamp(16rem, 57svh, 29rem);
    scroll-margin-block-start: calc(var(--story-visual-height) + 4.25rem);
  }

  .role-story[data-story-ready] .chapter-panel:first-child {
    justify-content: flex-start;
    min-block-size: clamp(16rem, 49svh, 25rem);
  }

  .role-story .chapter-panel :is(h1, h2) {
    font-size: clamp(2.55rem, 9.4vw, 4.5rem);
  }
}

@media (max-height: 32rem) {
  .role-story[data-story-ready] .role-story__stage {
    position: static;
  }

  .role-story[data-story-ready] .chapter-panel {
    scroll-margin-block-start: 1rem;
  }
}
