@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #020202;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  background: #020202;
}

body {
  min-height: 100%;
  touch-action: pan-y pinch-zoom;
}

body:has(.loader) {
  overflow: hidden;
}

.loader {
  --loader-gold: #ead9a5;
  position: fixed;
  z-index: 300;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000 var(--loader-poster) center / cover no-repeat;
  color: #f3f0e8;
  transition: opacity 900ms cubic-bezier(0.45, 0, 0.55, 1);
}

.loader::after {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.48'/%3E%3C/svg%3E");
}

.loader.is-exiting {
  opacity: 0;
  pointer-events: none;
}

.loader__film,
.loader__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.loader__film {
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(1.03);
}

.loader__shade {
  background: radial-gradient(circle, transparent 22%, rgb(0 0 0 / 18%) 64%, rgb(0 0 0 / 72%) 100%);
}

.loader__wordmark {
  position: relative;
  z-index: 1;
  width: clamp(12rem, 28vw, 24rem);
  height: auto;
  filter: grayscale(1) brightness(2.5);
  opacity: 0.9;
}

.loader__rule {
  position: absolute;
  z-index: 2;
  top: calc(50% + clamp(2.5rem, 5vw, 3.75rem));
  right: 0;
  left: 0;
  height: 2px;
  background: rgb(234 217 165 / 16%);
}

.loader__rule span {
  position: relative;
  display: block;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--loader-gold), #fff5d6 50%, var(--loader-gold));
  transform: scaleX(0);
  transform-origin: center;
  will-change: transform;
}

.loader__rule span::before,
.loader__rule span::after {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 6px;
  background: #fff5d6;
  box-shadow: 0 0 9px rgb(255 245 214 / 70%);
  content: "";
}

.loader__rule span::before {
  left: -1px;
}

.loader__rule span::after {
  right: -1px;
}

.loader__skip {
  position: absolute;
  z-index: 5;
  right: max(1.1rem, env(safe-area-inset-right));
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  min-width: 44px;
  min-height: 44px;
  padding: 0.75rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: 400 0.62rem/1 "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.18em;
  opacity: 0.7;
  text-transform: uppercase;
  touch-action: manipulation;
  transition: opacity 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.loader__skip:hover,
.loader__skip:focus-visible {
  opacity: 1;
}

.loader__skip:focus-visible {
  outline: 1px solid #f3f0e8;
  outline-offset: 5px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.study {
  position: relative;
  height: 800svh;
  background: #020202;
}

.sticky-viewport {
  position: sticky;
  top: 0;
  display: grid;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  place-items: center;
  overflow: clip;
  background: #020202;
}

.portrait-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020202;
  contain: strict;
}

.poster,
.film {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: center;
  transition: transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
}

.decoder {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.poster {
  object-fit: cover;
  object-position: 50% 50%;
}

.film {
  opacity: 0;
  object-fit: cover;
  object-position: 50% 50%;
}

.portrait-stage[data-ready="true"] .film {
  opacity: 1;
}

.hero-ui {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: #f5f1e9;
  pointer-events: none;
}

.hero-nav {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  left: max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translate3d(0, 0, 0);
  transition: transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-nav a {
  position: relative;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: rgb(245 241 233 / 88%);
  font: 500 0.61rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-shadow: 0 1px 12px rgb(0 0 0 / 70%);
  text-transform: uppercase;
  pointer-events: auto;
  -webkit-tap-highlight-color: rgb(213 184 128 / 16%);
}

.hero-nav a:last-child {
  color: rgb(245 241 233 / 62%);
}

.hero-nav a::after {
  position: absolute;
  bottom: 4px;
  width: 28px;
  height: 1px;
  background: rgb(199 169 111 / 76%);
  content: "";
  transform: scaleX(0.36);
  transform-origin: left;
  transition: transform 320ms ease;
}

.hero-nav a:hover::after,
.hero-nav a:focus-visible::after {
  transform: scaleX(1);
}

.hero-nav a:focus-visible {
  outline: 1px solid rgb(220 196 149 / 82%);
  outline-offset: 4px;
}

.hero-copy {
  position: absolute;
  top: clamp(118px, 18vh, 176px);
  top: clamp(118px, 18svh, 176px);
  right: max(24px, env(safe-area-inset-right));
  left: max(24px, env(safe-area-inset-left));
  transform: translate3d(0, 0, 0);
  transition: transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-copy__beat {
  position: absolute;
  width: min(100%, 20rem);
  margin: 0;
  opacity: 0;
  text-shadow: 0 2px 22px rgb(0 0 0 / 80%);
  transform: translate3d(0, 9px, 0);
  transition:
    opacity 480ms ease,
    transform 640ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-copy__beat > span {
  display: block;
  margin-bottom: 0.72rem;
  color: rgb(222 199 156 / 82%);
  font: 500 0.59rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.hero-copy__beat strong {
  display: block;
  font: 400 clamp(2.1rem, 10.5vw, 3.1rem) / 0.94 Georgia, "Times New Roman", serif;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.hero-copy__beat em {
  color: rgb(245 241 233 / 76%);
  font-weight: 400;
}

.study[data-chapter="reveal"] [data-beat="reveal"],
.study[data-chapter="detail"] [data-beat="detail"],
.study[data-chapter="final"] [data-beat="final"] {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.study[data-chapter="final"] .poster,
.study[data-chapter="final"] .film {
  transform: translate3d(0, clamp(-36px, -3.5svh, -26px), 0) scale(1.035);
}

.study[data-chapter="final"] .hero-copy {
  transform: translate3d(0, clamp(-40px, -4svh, -28px), 0);
}

.study[data-chapter="final"] .hero-nav {
  gap: 10px;
  transform: translate3d(
    0,
    calc(100dvh - max(10px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)) - 74px),
    0
  );
}

.study[data-chapter="final"] .hero-nav a {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  justify-content: center;
  border: 1px solid rgb(245 241 233 / 18%);
  border-radius: var(--radius-sm);
  background: rgb(2 2 2 / 52%);
}

.study[data-chapter="final"] .hero-nav a::after {
  display: none;
}

.study[data-chapter="final"] .hero-nav a:hover,
.study[data-chapter="final"] .hero-nav a:focus-visible {
  border-color: rgb(213 184 128 / 58%);
  background: rgb(22 19 14 / 72%);
}

.swipe-cue {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 48px);
  color: rgb(245 241 233 / 68%);
  font: 500 0.56rem/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.2em;
  opacity: 0;
  text-align: center;
  text-shadow: 0 1px 10px rgb(0 0 0 / 76%);
  text-transform: uppercase;
  transform: translate(-50%, 8px);
  transition:
    opacity 380ms ease,
    transform 480ms ease;
}

.swipe-cue i {
  position: relative;
  display: block;
  width: 1px;
  height: 32px;
  overflow: hidden;
  background: rgb(245 241 233 / 24%);
}

.swipe-cue i::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, rgb(213 184 128 / 92%), transparent);
  content: "";
  transform: translateY(-100%);
}

.study[data-chapter="intro"] .swipe-cue {
  opacity: 1;
  transform: translate(-50%, 0);
}

.study[data-chapter="intro"] .swipe-cue i::after {
  animation: swipe-line 2.2s ease-in-out infinite;
}

@keyframes swipe-line {
  0%,
  20% {
    transform: translateY(-100%);
  }

  75%,
  100% {
    transform: translateY(100%);
  }
}

@media (max-width: 34rem) {
  .loader__wordmark {
    width: 13rem;
  }
}

@media (min-width: 768px), (orientation: landscape) {
  .portrait-stage {
    width: min(56.25vh, 100vw);
    width: min(56.25dvh, 100vw);
    height: 100vh;
    height: 100dvh;
  }

  .poster,
  .film {
    object-fit: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loader,
  .loader__rule span {
    transition: none;
  }

  .loader__film {
    transform: none;
  }

  .loader__rule span {
    will-change: auto;
  }

  .study {
    height: 100svh;
  }

  .sticky-viewport {
    position: relative;
    height: 100svh;
  }

  .film {
    display: none;
  }

  .hero-copy__beat,
  .hero-copy,
  .hero-nav,
  .hero-nav a::after,
  .poster,
  .film,
  .swipe-cue {
    transition: none;
  }

  .swipe-cue {
    display: none;
  }

  .swipe-cue i::after {
    animation: none;
  }

  .hero-copy__beat--final {
    opacity: 1;
    transform: none;
  }

  .poster {
    transform: translate3d(0, clamp(-36px, -3.5svh, -26px), 0) scale(1.035);
  }

  .hero-copy {
    transform: translate3d(0, clamp(-40px, -4svh, -28px), 0);
  }

  .hero-nav {
    gap: 10px;
    transform: translate3d(
      0,
      calc(100dvh - max(10px, env(safe-area-inset-top)) - max(18px, env(safe-area-inset-bottom)) - 74px),
      0
    );
  }

  .hero-nav a {
    flex: 1;
    min-width: 0;
    min-height: 52px;
    justify-content: center;
    border: 1px solid rgb(245 241 233 / 18%);
    border-radius: var(--radius-sm);
    background: rgb(2 2 2 / 52%);
  }

  .hero-nav a::after {
    display: none;
  }
}
