/*
 * Ottografie-inspired photographic essay.
 * The document never scrolls: JavaScript advances one fixed, transform-driven
 * track so the opening flight and every reverse position remain deterministic.
 */

.otto-story {
  --story-y: 0px;
  --story-ivory: #f0ece5;
  --story-black: #050505;
  position: fixed;
  inset: 0;
  z-index: 28;
  display: block;
  overflow: hidden;
  color: #fff;
  background: var(--story-black);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  contain: layout paint;
}

.otto-story[hidden] {
  display: none;
}

.otto-story.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.otto-story.is-opening .otto-story-cover,
.otto-story.is-opening .story-track {
  opacity: 0;
}

.otto-story.is-closing {
  pointer-events: none;
}

html.otto-story-active,
body.otto-story-active {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body.otto-story-active {
  touch-action: none;
}

body.otto-story-active .otto-bio {
  color: #fff;
}

.story-track {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: var(--story-height, 100vh);
  transform: translate3d(0, var(--story-y), 0);
  transform-origin: 50% 0;
  will-change: transform;
  transition: opacity 180ms linear;
}

.otto-story-cover,
.otto-story-beat {
  position: absolute;
  overflow: hidden;
  background: #0b0b0b;
}

.otto-story-cover {
  inset: 0 auto auto 0;
  width: 100vw;
  height: 100vh;
  z-index: 2;
  transition: opacity 180ms linear;
}

.otto-story img,
.otto-story-transition img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.otto-story img[data-large-src] {
  filter: saturate(.96);
}

.otto-story img.is-promoted {
  filter: none;
}

@keyframes otto-hero-develop {
  from {
    filter: saturate(.58) contrast(.94) brightness(.84);
    transform: scale(1.035);
  }
  to {
    filter: saturate(1) contrast(1.015) brightness(1);
    transform: scale(1.001);
  }
}

.otto-story.is-active:not(.is-opening) .otto-story-cover > img {
  animation: otto-hero-develop 780ms cubic-bezier(.16, 1, .3, 1) both;
  will-change: transform, filter;
}

.otto-story-cover::after,
.otto-story-next::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, .08), transparent 36%, rgba(0, 0, 0, .16));
}

.otto-story-title {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  width: min(94vw, 1600px);
  margin: 0;
  color: #fff;
  font-family: "Fraunces", "Big Caslon", Georgia, serif;
  font-size: clamp(7.5rem, 17.4vw, 18rem);
  font-weight: 600;
  font-optical-sizing: auto;
  line-height: .74;
  letter-spacing: -.075em;
  text-align: center;
  text-wrap: balance;
  transform: translate(-51.5%, -53%);
  text-shadow: 0 1px 16px rgba(0, 0, 0, .06);
}

.otto-story-kicker {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 2.1rem;
  margin: 0;
  color: #fff;
  font-family: "Instrument Sans", Arial, sans-serif;
  font-size: .6875rem;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.otto-story-beat {
  left: var(--beat-x, 0px);
  top: var(--beat-y, 0px);
  width: var(--beat-w, 100vw);
  height: var(--beat-h, 100vh);
  margin: 0;
  isolation: isolate;
}

.story-media {
  --story-photo-y: 0px;
  --story-photo-focus: 0;
  overflow: hidden;
  clip-path: inset(7% 0 7% 0);
  transition: clip-path 820ms cubic-bezier(.16, 1, .3, 1);
}

.story-media::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: rgb(240 236 229 / 84%);
  transform: translate3d(0, 0, 0);
  pointer-events: none;
}

.story-media__inner {
  position: absolute;
  z-index: 0;
  inset: -3.5%;
  display: block;
  transform: translate3d(0, var(--story-photo-y), 0) scale(1.035);
  will-change: transform;
  pointer-events: none;
}

.otto-story .story-media__inner > img {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 100%;
  filter: saturate(.5) contrast(.92) brightness(.78);
  transform: scale(1.055);
  transition:
    filter 760ms cubic-bezier(.16, 1, .3, 1),
    transform 880ms cubic-bezier(.16, 1, .3, 1);
  will-change: transform;
}

.story-media.is-seen {
  clip-path: inset(0);
}

.story-media.is-seen::after {
  transform: translate3d(0, 102%, 0);
  transition: transform 740ms cubic-bezier(.16, 1, .3, 1);
}

.otto-story .story-media.is-seen .story-media__inner > img,
.otto-story .story-media.is-seen .story-media__inner > img.is-promoted {
  filter:
    saturate(calc(.94 + var(--story-photo-focus) * .08))
    contrast(calc(.99 + var(--story-photo-focus) * .025))
    brightness(calc(.98 + var(--story-photo-focus) * .02));
  transform: scale(1.001);
}

.otto-story-beat--full {
  left: 0;
  width: 100vw;
}

.otto-story-beat--full img,
.otto-story-beat--landscape img {
  object-fit: cover;
}

.otto-story-beat--portrait img {
  object-fit: cover;
}

.otto-story-frame-number {
  position: absolute;
  z-index: 2;
  right: .55rem;
  bottom: .5rem;
  color: rgba(255, 255, 255, .9);
  font-family: "Instrument Sans", Arial, sans-serif;
  font-size: .6875rem;
  line-height: 1;
  letter-spacing: .06em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}

.otto-story-next {
  left: 0;
  width: 100vw;
  height: 100vh;
  cursor: pointer;
}

.otto-story-next-link {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  text-decoration: none;
}

.otto-story-next-copy {
  display: grid;
  justify-items: center;
  gap: .55rem;
  transform: translateY(-1%);
}

.otto-story-next-copy small {
  font-family: "Instrument Sans", Arial, sans-serif;
  font-size: .6875rem;
  font-weight: 400;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.otto-story-next-copy strong {
  font-family: "Fraunces", "Big Caslon", Georgia, serif;
  font-size: clamp(6rem, 16vw, 16rem);
  font-weight: 600;
  line-height: .8;
  letter-spacing: -.07em;
  text-align: center;
}

.otto-story-transition {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}

.otto-story-transition.is-active {
  visibility: visible;
}

.otto-story-flight {
  position: fixed;
  z-index: 1;
  margin: 0;
  object-fit: cover;
  transform-origin: 50% 50%;
  will-change: left, top, width, height, opacity, transform;
}

.otto-story-fallback {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
}

.otto-story-controls {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: max(27px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translateX(-50%);
  font-family: "Instrument Sans", Arial, sans-serif;
}

.otto-story-project,
.otto-story-close {
  height: 53px;
  border: 0;
  border-radius: 999px;
  background: rgb(15 15 14 / 80%);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.otto-story-project {
  display: grid;
  grid-template-columns: 35px minmax(112px, auto) 26px;
  align-items: center;
  gap: 9px;
  min-width: 222px;
  padding: 0 10px;
  box-sizing: border-box;
  font-size: 12px;
}

.otto-story-project img {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.otto-story-project__mark {
  font-size: 15px;
  text-align: center;
}

.otto-story-close {
  display: grid;
  place-items: center;
  width: 53px;
  padding: 0;
  font: 300 18px/1 Arial, sans-serif;
  cursor: pointer;
}

.otto-story-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (max-height: 600px) and (orientation: landscape) {
  .otto-story-title {
    font-size: clamp(4.75rem, 16vw, 9rem);
  }

  .otto-story-kicker {
    bottom: 1rem;
  }

  .otto-story-beat {
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
  }

  .otto-story-beat img {
    object-fit: cover;
  }

  .otto-story-next-copy strong {
    font-size: clamp(4.5rem, 15vw, 8rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-track {
    will-change: auto;
  }

  .otto-story,
  .otto-story-cover,
  .story-track {
    transition-duration: 120ms;
  }

  .otto-story.is-active .otto-story-cover > img {
    animation: none;
    filter: none;
    transform: none;
  }

  .story-media {
    clip-path: inset(0);
  }

  .story-media::after {
    display: none;
  }

  .story-media__inner {
    inset: 0;
    transform: none;
    will-change: auto;
  }

  .otto-story .story-media__inner > img {
    filter: none;
    transform: none;
    transition: none;
  }
}
