:root {
  --paper: #f3f0e9;
  --ink: #202522;
  --muted: #646a65;
  --accent: #506b5a;
  /* --accent: #ef8409; */
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Utopia Std", serif;
}
.navigation {
  height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4vw;
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #d7d7cb;
}
.brand {
  color: var(--ink);
  text-decoration: none;
}

.navigation > div {
  display: flex;
  align-items: center;
  gap: 28px;
}
.navigation a:not(.brand),
button {
  font:
    12px "Utopia Std",
    serif;
  color: var(--ink);
}
.navigation a:not(.brand) {
  text-decoration: none;
}
.navigation a[aria-current] {
  text-decoration: underline;
  text-underline-offset: 6px;
}
button {
  border: 1px solid #aaa;
  background: transparent;
  padding: 9px 12px;
  cursor: pointer;
}
.progress {
  height: 3px;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--accent);
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  z-index: 20;
}
/* The opening image stays behind the scrolling foreground. */
.opening-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: #201b13;
  overflow: hidden;
}
main {
  position: relative;
  z-index: 1;
}
#story {
  position: relative;
  display: flow-root;
  background: var(--paper);
}
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100svh;
  min-height: 560px;
  position: relative;
  overflow: hidden;
  background: transparent;
  color: white;
}
.hero-image {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  object-fit: cover;
  object-position: center;
}
.opening-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.66), rgba(0, 0, 0, 0.12)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.35), transparent 70%);
}
.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 950px;
  margin-inline: auto;
  text-align: center;
  padding: 40px 6vw;
}
.eyebrow {
  font:
    11px/1.5 "Utopia Std",
    serif;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.subtitle {
  font-size: clamp(48px, 5.4vw, 68px);
  line-height: 1.24;
  letter-spacing: -0.8px;
  margin: 120px 0 45px;
}
.scroll-cue {
  font:
    12px "Utopia Std",
    serif;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  display: inline-block;
}
.title-block {
  padding: 110px 24px 60px;
  text-align: center;
}
h1 {
  font-weight: 400;
  font-size: clamp(48px, 7.5vw, 108px);
  line-height: 1.03;
  letter-spacing: -3px;
  margin: 25px auto 35px;
}
h1 em {
  font-weight: 400;
  color: var(--accent);
}
.byline {
  font:
    14px/1.7 "Utopia Std",
    serif;
}
.support {
  font:
    10px/1.7 "Utopia Std",
    serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.photos {
  max-width: 1120px;
  width: 88%;
  margin: 65px auto 85px;
}
.photos.single {
  width: 96%;
  max-width: 1440px;
}
/* Reserve the measured caption and sticky navigation height below/above the image. */
.photos.single .photo img {
  max-height: max(
    1px,
    calc(
      100svh - var(--story-nav-height, 76px) - var(--caption-space, 180px) -
        32px
    )
  );
}
.photo {
  margin: 0;
  min-width: 0;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 74vh;
  object-fit: contain;
}
.photo figcaption {
  font:
    13px/1.65 "Utopia Std",
    serif;
  color: var(--muted);
  max-width: 850px;
  margin: 17px auto 0;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
}
.pair .photo:nth-child(2) {
  margin-top: 85px;
}
.prose {
  max-width: 670px;
  margin: 65px auto;
  padding: 0 24px;
  font-size: 20px;
  line-height: 1.8;
}
.prose p {
  margin: 0 0 1.3em;
}
.chapter {
  border-top: 1px solid #b9c1b8;
  max-width: 1020px;
  width: 88%;
  margin: 110px auto 55px;
  padding: 45px 0 0;
  scroll-margin-top: 100px;
}
.chapter h2 {
  font-size: clamp(42px, 6vw, 76px);
  font-weight: 400;
  letter-spacing: -2px;
  margin: 20px 0;
}
.chapter h2 small {
  font:
    clamp(20px, 2vw, 26px) "Utopia Std",
    serif;
  letter-spacing: 0;
  display: inline-block;
}
.chapter p {
  font:
    17px/1.8 "Utopia Std",
    serif;
  max-width: 700px;
  color: var(--muted);
}
.closing-quote {
  text-align: center;
  max-width: 900px;
  width: 86%;
  margin: 110px auto;
  color: var(--accent);
}
.closing-quote p {
  font-size: clamp(30px, 4vw, 54px);
  line-height: 1.3;
  letter-spacing: -1px;
}
.closing-quote span {
  font:
    12px "Utopia Std",
    serif;
}
footer {
  border-top: 1px solid #c8cbbb;
  padding: 32px max(6vw, 24px);
  display: grid;
  grid-template-columns: minmax(0, 670px);
  justify-content: center;
  gap: 14px;
  text-align: center;
}
footer p {
  margin: 0;
  font:
    13px/1.8 "Utopia Std",
    serif;
  color: var(--muted);
}
footer > a {
  font:
    12px "Utopia Std",
    serif;
  color: inherit;
  text-align: center;
}
.skip {
  position: fixed;
  top: -80px;
  left: 20px;
  background: white;
  padding: 16px;
  z-index: 100;
}
.skip:focus {
  top: 10px;
}
:focus-visible {
  outline: 3px solid #a34939;
  outline-offset: 5px;
}
.reveal {
  transition:
    opacity 0.85s ease,
    transform 0.85s ease;
}
/* Paired photos enter from opposite sides, then settle into the grid. */
.pair .photo.reveal {
  --reveal-y: 0px;
  transition:
    opacity 0.9s ease,
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.pair .photo.reveal:nth-child(odd) {
  --reveal-x: clamp(-38px, -3vw, -12px);
}
.pair .photo.reveal:nth-child(even) {
  --reveal-x: clamp(12px, 3vw, 38px);
}
.pending {
  opacity: 0;
  transform: translate(var(--reveal-x, 0px), var(--reveal-y, 24px));
}
.no-motion * {
  scroll-behavior: auto !important;
  transition: none !important;
}
.no-motion .pending {
  opacity: 1;
  transform: none;
}
@media (max-width: 700px) {
  .navigation {
    height: 68px;
    padding: 0 18px;
  }
  .brand {
    color: var(--ink);
    text-decoration: none;
  }

  .navigation > div {
    gap: 12px;
  }
  .navigation a:not(.brand) {
    font-size: 10px;
  }
  button {
    font-size: 10px;
    padding: 7px;
  }
  .hero {
    height: 100svh;
    min-height: 530px;
  }
  .hero-copy {
    padding: 32px 7vw;
    max-width: 570px;
  }
  .hero-image {
    object-position: 57% center;
  }
  .subtitle {
    font-size: 31px;
  }
  .title-block {
    padding-top: 75px;
  }
  h1 {
    letter-spacing: -2px;
  }
  .photos {
    width: 90%;
    margin: 45px auto 55px;
  }
  .pair {
    grid-template-columns: 1fr;
    gap: 35px;
  }
  .pair .photo:nth-child(2) {
    margin-top: 0;
  }
  .prose {
    font-size: 18px;
    line-height: 1.8;
    margin: 45px auto;
  }
  .chapter {
    margin-top: 75px;
  }
  .chapter h2 small {
    display: block;
    margin-top: 16px;
  }
  footer {
    grid-template-columns: minmax(0, 670px);
    gap: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal,
  .pair .photo.reveal {
    transition: none;
  }
  .pending {
    opacity: 1;
    transform: none;
  }
}
.navigation .brand {
  color: var(--ink);
  text-decoration: none;
}
.navigation > div {
  min-width: 0;
}
@media (max-width: 360px) {
  .navigation {
    padding: 0 12px;
  }
  .navigation > div {
    gap: 9px;
  }
  .navigation a:not(.brand) {
    font-size: 9px;
  }
  button {
    font-size: 9px;
    padding: 7px 5px;
  }
  .brand {
    color: var(--ink);
    text-decoration: none;
  }

  .subtitle {
    font-size: 29px;
  }
}

/* Series wordmark: the same split U and underline as food pharmacies. */
.title-label {
  display: inline-block;
  position: relative;
  white-space: nowrap;
  font-family: "acumin-pro", "Acumin Pro", "Arial Black", sans-serif;
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}
.title-label::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  margin-top: 0.14em;
  background: currentColor;
  opacity: 0.8;
}
.title-broken-u {
  position: relative;
  display: inline-block;
  width: 0.72em;
  height: 0.92em;
  vertical-align: -0.02em;
}
.title-u-piece {
  position: absolute;
  inset: 0;
  line-height: 0.92;
}
.title-u-top {
  clip-path: polygon(0 0, 100% 0, 100% 44%, 0 59%);
  transform: translate(-0.025em, -0.012em);
}
.title-u-bottom {
  clip-path: polygon(0 59%, 100% 44%, 100% 100%, 0 100%);
  transform: translate(0.035em, 0.018em);
}
.navigation .title-label,
footer .title-label {
  font-size: 1.15rem;
}
h1,
.chapter h2 {
  font-family: "Utopia Std Bold", "Utopia Std", serif;
}
@media (max-width: 700px) {
  .navigation {
    flex-wrap: wrap;
    height: auto;
    min-height: 76px;
    gap: 12px;
    padding: 15px 18px;
  }
  .navigation > div {
    flex-wrap: wrap;
  }
  .title-label {
    font-size: 1.3rem;
  }
}

/* Keep the author link consistent with the byline. */
.byline a {
  color: inherit;
  text-decoration: none;
}

.byline a:hover,
.byline a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* Match the opening logo sizing in the diabetes-clinic story. */
.opening-logo {
  display: block;
  position: relative;
  width: 110px;
  height: auto;
  margin-inline: auto;
  margin-top: 2rem;
}

@media (max-width: 500px) {
  .opening-logo {
    width: 76px;
    margin-top: 1.25rem;
  }
}

/* Respect readers who prefer the image to scroll with the page. */
@media (prefers-reduced-motion: reduce) {
  .opening-backdrop {
    position: absolute;
    height: 100svh;
    min-height: 560px;
    bottom: auto;
  }
}

/* Full-screen photographic transition into Mark Ryan's section. */
.photo-parallax {
  width: 100%;
  margin: 80px 0;
}
.photo-parallax > .photo {
  position: relative;
  height: 100svh;
  min-height: 480px;
  overflow: hidden;
  isolation: isolate;
  background: #202522;
}
.photo-parallax > .photo img {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  height: 140%;
  max-height: none;
  object-fit: cover;
  object-position: center;
  will-change: transform;
}
.photo-parallax > .photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 55%, rgba(0, 0, 0, 0.8));
  pointer-events: none;
}
.photo-parallax > .photo figcaption {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 850px;
  margin: 0 auto;
  padding: 32px 24px;
  color: white;
  font-size: 15px;
  text-shadow: 0 1px 3px #000;
}
@media (prefers-reduced-motion: reduce) {
  .photo-parallax > .photo img {
    transform: none !important;
    will-change: auto;
  }
}

/* Keep the story title in view after its main heading has scrolled past. */
.navigation .nav-story-title {
  font-family: "Utopia Std", serif;
  font-size: clamp(17px, 2vw, 25px);
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
}
.nav-story-title em {
  color: var(--accent);
}
.navigation [hidden] {
  display: none;
}

/* Center the story title in the available space between logo and links. */
.navigation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  column-gap: 24px;
}
.navigation .nav-story-title {
  text-align: center;
  min-width: 0;
}
.navigation .nav-story-title[hidden] {
  display: block;
  visibility: hidden;
  pointer-events: none;
}
@media (max-width: 700px) {
  .navigation {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 8px;
  }
  .navigation .brand.title-label {
    font-size: clamp(12px, 3.5vw, 18px);
  }
  .navigation > div {
    grid-column: 2;
    grid-row: 1;
    gap: 10px;
  }
  .navigation .nav-story-title {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 17px;
  }
}

/* The final photograph stays behind the credits as they scroll into view. */
.ending-scene {
  position: relative;
  isolation: isolate;
  background: #171b18;
}
#photo19 {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  z-index: 0;
}
#photo19 img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
}
.ending-scene footer {
  position: relative;
  z-index: 1;
  border-top: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 30%);
  color: white;
  text-shadow: 0 1px 4px #000;
}
.ending-scene footer p,
.ending-scene footer > a {
  color: inherit;
}

/* Alternate emphasis without changing the photographs' staggered placement. */
.photos.interactive-pair {
  /* Expand the available grid width so the changes are exactly +20% / -20%. */
  width: calc(92% - 1.363636px);
  max-width: 1169.545455px;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 0.68fr);
  transition: grid-template-columns 0.55s ease;
}
.photos.interactive-pair.second-enlarged {
  grid-template-columns: minmax(0, 0.68fr) minmax(0, 1.62fr);
}
.photo-toggle {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  background: transparent;
  color: white;
  text-align: inherit;
  cursor: zoom-in;
}
.photo-toggle[aria-pressed="true"] {
  cursor: default;
}
.photo-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 6px;
}
.photo-enlarge-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.72);
  color: white;
  font:
    12px/1.3 "Utopia Std",
    serif;
  pointer-events: none;
}
.photo-toggle[aria-pressed="true"] .photo-enlarge-hint {
  display: none;
}
@media (max-width: 700px) {
  .photos.interactive-pair,
  .photos.interactive-pair.second-enlarged {
    /* Keep the enlarged photo within the mobile viewport. */
    width: 96%;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .interactive-pair .photo {
    width: 55.5%;
    transition:
      width 0.55s ease,
      opacity 0.9s ease,
      transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .interactive-pair .photo.is-enlarged {
    width: 100%;
  }
  .interactive-pair .photo:nth-child(2) {
    justify-self: end;
    margin-top: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .photos.interactive-pair,
  .interactive-pair .photo.reveal {
    transition: none;
  }
}

/* Story links stay black and underlined; the title-page byline keeps its styling. */
#story p:not(.byline) a,
#story figcaption a {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* The logo and navigation title appear together as one centered group. */
.nav-story-title .nav-vcij-logo {
  display: block;
  width: auto;
  height: 28px;
  margin: 0 auto 4px;
  object-fit: contain;
}

/* A quiet end mark for the instructor's section. */
.section-end-divider {
  width: 80px;
  height: 0;
  border: 0;
  border-top: 2px solid var(--accent);
  margin: 64px auto;
}

/* Preserve the requested subtitle line breaks. */
.subtitle > span {
  display: block;
}
@media (min-width: 701px) {
  .hero-copy {
    width: 100%;
    padding-inline: clamp(24px, 4vw, 48px);
  }
  .subtitle {
    font-size: clamp(22px, 2.7vw, 36px);
  }
  .subtitle > span {
    white-space: nowrap;
  }
}

/* Mobile reads as a simple sequence of uncropped photographs. */
@media (max-width: 700px) {
  .photos.interactive-pair,
  .photos.interactive-pair.second-enlarged {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
  .interactive-pair .photo,
  .interactive-pair .photo.is-enlarged {
    width: 100%;
  }
  .interactive-pair .photo:nth-child(2) {
    margin-top: 0;
    justify-self: stretch;
  }
  .photo-toggle:disabled {
    opacity: 1;
    cursor: default;
  }
  .photo-enlarge-hint {
    display: none;
  }
  .photo-parallax {
    margin: 45px 0;
  }
  .photo-parallax > .photo,
  #photo19 {
    position: relative;
    height: auto;
    min-height: 0;
  }
  .photo-parallax > .photo {
    background: var(--paper);
  }
  .photo-parallax > .photo img,
  #photo19 img {
    position: static;
    width: 100%;
    height: auto;
    max-height: calc(100svh - var(--story-nav-height, 100px) - 24px);
    object-fit: contain;
    transform: none !important;
    will-change: auto;
  }
  .photo-parallax > .photo::after {
    display: none;
  }
  .photo-parallax > .photo figcaption {
    position: static;
    padding: 0 5%;
    margin: 17px auto 0;
    color: var(--muted);
    text-shadow: none;
    font-size: 13px;
  }
  .ending-scene footer {
    background: transparent;
  }
}

/* Give mobile parallax a small travel area without cropping the photograph. */
.parallax-image-window {
  display: contents;
}
@media (max-width: 700px) {
  .photo-parallax > .photo .parallax-image-window {
    display: block;
    position: relative;
    height: min(
      calc(66.8vw + 48px),
      calc(100svh - var(--story-nav-height, 100px) - 160px)
    );
    min-height: 120px;
    overflow: hidden;
  }
  .photo-parallax > .photo img {
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    height: calc(100% - 48px);
    max-height: none;
    object-fit: contain;
    transform: translateY(var(--mobile-parallax-offset, 0px)) !important;
    will-change: transform;
  }
  #photo19 {
    position: sticky;
    top: var(--story-nav-height, 100px);
    height: auto;
  }
  #photo19 img {
    height: auto;
    max-height: calc(100svh - var(--story-nav-height, 100px) - 24px);
    object-fit: contain;
    object-position: center top;
  }
  .ending-scene footer {
    /* Overlap only the image edge instead of reserving a blank screen. */
    margin-top: -32px;
    padding: 48px 24px 24px;
    gap: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85) 48px);
  }
}
@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
  .photo-parallax > .photo img {
    transform: none !important;
    will-change: auto;
  }
  #photo19 {
    position: relative;
    top: auto;
    height: auto;
  }
  #photo19 img {
    height: auto;
  }
}

/* Native vertical scrolling drives the mobile pair's horizontal reveal. */
.pair-stage {
  display: contents;
}
@media (max-width: 700px) {
  .photos.interactive-pair,
  .photos.interactive-pair.second-enlarged {
    display: block;
    height: calc(
      var(--pair-stage-height, 450px) + var(--pair-scroll-travel, 280px)
    );
    margin-bottom: 24px;
    position: relative;
  }
  .interactive-pair .pair-stage {
    display: block;
    position: sticky;
    top: var(--story-nav-height, 100px);
    height: var(--pair-stage-height, 450px);
    overflow: hidden;
    isolation: isolate;
  }
  .interactive-pair .pair-stage > .photo {
    position: absolute;
    inset: 0;
    width: 100%;
    margin: 0;
    padding: 16px 0;
    transition: none;
    transform: translateX(var(--swipe-x, 0%)) !important;
    opacity: var(--swipe-opacity, 1) !important;
    background: var(--paper);
    will-change: transform;
  }
  .pair-stage > .mobile-first {
    z-index: 1;
  }
  .pair-stage > .mobile-next {
    z-index: 2;
  }
  .interactive-pair .pair-stage img {
    max-height: max(
      1px,
      calc(
        100svh - var(--story-nav-height, 100px) -
          var(--pair-caption-height, 180px) - 56px
      )
    );
    object-fit: contain;
  }
}
