.story-view {
  font-size: 0.8125rem;
  line-height: 1.3;
  letter-spacing: -0.03em;
  overflow-x: clip;
}
.story-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4rem;
  min-height: 100vh;
  padding: 8rem var(--gutter) 2rem;
}
.story-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4rem;
  position: sticky;
  top: 8rem;
  align-self: start;
  height: calc(100dvh - 8rem);
  padding-bottom: 1.25rem;
}
.story-fold {
  height: 0;
  opacity: 0;
  overflow: hidden;
  color: #777;
  line-height: 1.625;
}
.story-fold > div {
  padding-top: 1rem;
}
.story-fold p + p,
.story-source p + p {
  margin-top: 1rem;
}
.story-toggle {
  display: flex;
  align-items: start;
  justify-content: space-between;
  width: 100%;
  text-transform: uppercase;
}
.story-toggle span:last-child,
.story-player button {
  white-space: nowrap;
}
.story-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}
.story-player input {
  appearance: none;
  flex: 1;
  min-width: 1rem;
  margin: 0;
  height: 2rem;
  cursor: pointer;
  background: linear-gradient(
      to right,
      #171717 var(--progress, 0%),
      #ccc var(--progress, 0%)
    )
    center/100% 1px no-repeat;
}
.story-player input::-webkit-slider-thumb {
  appearance: none;
  background: #171717;
  width: 5px;
  height: 5px;
}
.story-player input::-moz-range-thumb {
  border: 0;
  border-radius: 0;
  background: #171717;
  width: 5px;
  height: 5px;
}
.story-credit span,
.story-right dt,
.story-source {
  color: #777;
}
.story-credit span {
  display: block;
}
.story-credit a:hover {
  color: white;
  background: #171717;
}
.story-photos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7.5rem;
  min-width: 0;
}
.story-slide {
  width: fit-content;
  max-width: 100%;
}
:is(.story-slide, .project-media) figure {
  margin: 0;
  position: relative;
  overflow: hidden;
}
.story-slide img {
  display: block;
  width: 100%;
  height: auto;
}
.story-slide figure > :is(i, b) {
  position: absolute;
  inset: 0;
  transform-origin: right;
  background: #171717;
  pointer-events: none;
}
.story-slide figure > b {
  background: #fff;
}
.story-right {
  display: flex;
  flex-direction: column;
  gap: 30rem;
}
.story-right dl {
  margin: 0;
  padding-top: 80%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 2rem;
}
.story-right dl > div:first-child {
  grid-column: span 2;
  margin-bottom: 0.5rem;
}
.story-right dd {
  margin: 0;
  overflow: hidden;
}
.story-right dd span {
  display: block;
}
.mobile-source {
  display: none;
}
.story-related {
  margin: 2.5rem var(--gutter);
  padding: 4rem 0 1.5rem;
  border-top: 1px solid #d4d4d4;
}
.story-rail {
  position: relative;
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter) 1.5rem;
}
.story-rail a {
  flex: 0 0 12rem;
  max-width: 58vw;
  transition: transform 0.3s;
}
.story-rail a:hover {
  transform: scale(0.98);
}
.story-rail a[aria-current] {
  color: #777;
}
.story-rail small {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.6875rem;
  margin-bottom: 0.5rem;
}
.story-rail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}
.story-view .contact-footer {
  margin-top: 0;
}
@media (max-width: 1023px) {
  .story-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .story-right {
    order: 0;
    gap: 5rem;
  }
  .story-right dl {
    padding: 0;
  }
  .story-photos {
    order: 1;
    display: flex;
    align-items: start;
    flex-direction: row;
    gap: 1.5rem;
    overflow: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 calc(var(--gutter) + 1.5rem) 2.5rem;
  }
  .story-slide {
    width: calc((100vw - 3rem) / 1.2);
    flex: none;
    scroll-snap-align: center;
  }
  .story-left {
    order: 2;
    position: static;
    height: auto;
    padding-bottom: 2rem;
  }
  .story-right dl {
    column-gap: 1rem;
  }
}
@media (max-width: 767px) {
  .mobile-source {
    display: block;
  }
  .desktop-source {
    display: none;
  }
  .story-player {
    position: fixed;
    inset: auto 0 0;
    padding: 1.25rem var(--gutter);
    margin: 0;
    background: #fff;
    z-index: 5;
  }
  .story-rail {
    gap: 1rem;
  }
  .story-rail a {
    flex-basis: 58vw;
  }
  .story-view:has(audio) {
    padding-bottom: 4rem;
  }
  body[data-page="story"] #locale {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .story-slide figure > :is(i, b) {
    display: none;
  }
}

:root:has(.project-detail) {
  scrollbar-gutter: auto;
}
body[data-page="story"] {
  background: #fff;
}
body[data-page="story"] .site-grain {
  background: inherit;
}
body[data-page="story"] .site-grain::before {
  display: none;
}
.project-detail {
  padding-top: 8rem;
}
body:has(.project-detail) #navbar {
  background: #fff;
  color: var(--foreground);
  mix-blend-mode: normal;
  pointer-events: auto;
}
body:has(.project-detail) #navbar .tag {
  --ink: #171717;
  --on-ink: #fff;
}
.project-media {
  /* Preserve the width of the former two-column image area. */
  width: calc((200% - var(--gutter) - 4rem) / 3);
  margin-inline: auto;
}
.project-media :is(img, video) {
  display: block;
  width: 100%;
  height: auto;
}
.project-media video {
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #f6f6f6;
}
.project-detail .story-rail small {
  min-height: 2.6em;
  align-items: end;
}
.project-detail .story-rail small span:last-child {
  text-align: end;
}
@media (max-width: 1023px) {
  body:has(.project-detail) {
    --portfolio-nav-height: 3.5rem;
  }
  body:has(.project-detail) #navbar {
    padding-block: 0.75rem;
  }
  .project-detail {
    padding-top: var(--portfolio-nav-height);
  }
  .project-media {
    width: 100%;
  }
}
@media (max-width: 767px) {
  body:has(.project-detail) #navbar .nav-end {
    display: block;
  }
  body:has(.project-detail) #navbar .mobile-toggle {
    display: none;
  }
}
