:root {
  color-scheme: dark;
  --ink: #f5f5f2;
  --muted: #bfc2c9;
  --page: #15171b;
  --gutter: clamp(1rem, 4vw, 4.5rem);
  --ease: cubic-bezier(.22, 1, .36, 1);
  font-family: "Helvetica Neue", Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
}

html { scroll-snap-type: y mandatory; }
*, *::before, *::after { box-sizing: border-box; }
body, p, h1, h2 { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #a8c0ff; outline-offset: 5px; }
h2:focus { outline: none; }

.skip-link {
  position: fixed;
  z-index: 20;
  inset: .5rem auto auto var(--gutter);
  padding: .8rem;
  background: #242a39;
  transform: translateY(-180%);
}

.skip-link:focus { transform: none; }

.site-head {
  position: fixed;
  z-index: 5;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 3.75rem;
  padding: .375rem var(--gutter);
  background: linear-gradient(#101114e8, #10111400);
}

.site-head a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  gap: .55rem;
  font-size: .875rem;
  font-weight: 700;
}

.site-head a:hover { text-decoration: underline; text-underline-offset: .24em; }
.studio-brand svg { width: 1.25rem; height: 1.25rem; }

.chapter {
  min-block-size: 100svh;
  padding: clamp(4.5rem, 9svh, 6rem) var(--gutter) clamp(5rem, 10svh, 6.5rem);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  align-items: center;
  isolation: isolate;
  background: radial-gradient(ellipse at 75% 54%, var(--haze, #292c33) 0%, transparent 68%), var(--base, #15171b);
}

.opening {
  position: relative;
  overflow: hidden;
  justify-items: center;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  padding-top: clamp(4.85rem, 11svh, 8rem);
  background: #111317;
}

.opening-backdrop {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 46% center;
  transition: opacity .4s ease;
}

.opening::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: min(54%, 28rem);
  background: linear-gradient(#141719e8 0%, #101317a1 37%, #10131700 100%);
  pointer-events: none;
}

.opening-stage {
  grid-area: 2 / 1;
  align-self: stretch;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(12rem, 31svh, 17rem);
}

.opening-window {
  position: absolute;
  inset: .45rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(.64rem, 2svh, 1rem);
  container-type: size;
  visibility: hidden;
  opacity: 0;
  transition: opacity .18s ease-out;
}

.opening-window video {
  display: block;
  width: min(100%, 55rem);
  width: min(100%, 55rem, calc(172cqh - 6.6rem));
  max-height: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid #989e9d;
  border-radius: clamp(.7rem, 1.3vw, 1.25rem);
  background: #17191c;
  box-shadow: 0 1.1rem 3.25rem #0b100dcf;
}

.opening[data-launched="true"] .opening-backdrop { opacity: .3; }
.opening[data-launched="true"] .opening-window {
  visibility: visible;
  opacity: 1;
}

body:has(.opening[data-launched="true"]) .chapter-dock { visibility: hidden; }

.opening-copy {
  grid-area: 1 / 1;
  text-align: center;
  text-shadow: 0 .2rem 1.4rem #090d0ca6;
}

.opening h1 {
  font-size: clamp(3rem, 7.1vw, 7.5rem);
  letter-spacing: -.075em;
  line-height: .98;
  text-wrap: balance;
}

.opening-copy p {
  margin: .85rem auto 0;
  max-width: 44ch;
  color: #ecedf1;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  line-height: 1.4;
  text-wrap: balance;
}

.opening-launch {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .83rem;
  border-radius: 1.25rem;
  transition: opacity .24s ease, transform .38s var(--ease), visibility 0s .25s;
}

.opening[data-launched="true"] .opening-launch {
  visibility: hidden;
  opacity: 0;
  transform: scale(.58) translateY(1.2rem);
  pointer-events: none;
}

.launch-orb {
  display: grid;
  place-items: center;
  width: clamp(8rem, 18svh, 12rem);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #fff;
  background: #f8f8f7;
  color: #181a1e;
  box-shadow: 0 0 0 .625rem rgb(16 17 20 / 67%), 0 1.4rem 4rem rgb(10 11 16 / 58%);
  transition: transform .21s var(--ease), box-shadow .24s ease;
}

.launch-orb svg { width: 53%; height: 53%; }
.opening-launch:hover .launch-orb { box-shadow: 0 0 0 .95rem rgb(14 16 22 / 70%), 0 1.4rem 4rem rgb(10 11 16 / 62%); }
.opening-launch:active .launch-orb { transform: scale(.92); }

.opening-label {
  padding: .53rem .82rem;
  border: 1px solid #ffffff38;
  border-radius: .5rem;
  background: #121919e8;
  color: #fff;
  font-size: .9375rem;
  font-weight: 700;
}

.opening-launch:hover .opening-label { text-decoration: underline; text-underline-offset: .25em; }

.opening .scope-guide { grid-area: 3 / 1; }
.opening[data-launched="true"] .scope-guide { visibility: hidden; }

.orb-fan {
  flex: 0 0 auto;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 1.75rem);
  gap: clamp(.2rem, 1vw, .55rem);
  pointer-events: auto;
}

.orb-fan a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: .5rem clamp(.55rem, 1.7vw, 1.05rem);
  border: 1px solid #565b6b;
  border-radius: 999px;
  background: #1e2029;
  box-shadow: 0 .65rem 1.25rem #07080b7d;
  font-size: clamp(.72rem, 1.5vw, 1rem);
  font-weight: 700;
  animation: fan-open 680ms var(--ease) both;
}

.orb-fan a:hover { background: #3a539e; }

@keyframes fan-open {
  from { opacity: 0; transform: translate(var(--fan-x), 2.7rem) scale(.38); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}

.chapter--walk { --base: #161918; --haze: #393d35; }
.chapter--plan { --base: #14181c; --haze: #313d48; }
.chapter--section { --base: #171917; --haze: #363a31; }
.chapter--measure { --base: #17191e; --haze: #383e48; }
.chapter--share { --base: #17181b; --haze: #363945; }

.chapter-grid {
  width: 100%;
  max-width: 100rem;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(12rem, .86fr) minmax(0, 3fr);
  align-items: center;
  gap: clamp(1.4rem, 3.65vw, 4rem);
}

.chapter-copy h2, .closing h2 {
  font-size: clamp(2.4rem, 4.8vw, 5.7rem);
  line-height: .98;
  letter-spacing: -.065em;
  text-wrap: balance;
}

.chapter-copy p, .closing p {
  max-width: 37ch;
  color: var(--muted);
  font-size: clamp(.9375rem, 1.2vw, 1.15rem);
  line-height: 1.53;
  margin-top: clamp(.65rem, 2vh, 1.25rem);
}

.chapter-copy strong { color: #fff; font-weight: 700; }

.stage {
  --screen-height: max(17rem, calc(100svh - 13.5rem));
  display: grid;
  justify-items: center;
  align-items: center;
  min-width: 0;
}

.stage--pair {
  grid-template-columns: minmax(0, 1fr) minmax(5.5rem, .21fr);
  align-items: end;
  gap: clamp(.6rem, 2.15vw, 2rem);
}

.stage--section { grid-template-columns: minmax(0, 1fr) auto; gap: clamp(.5rem, 1.4vw, 1.4rem); }

.device {
  min-width: 0;
  position: relative;
  background: #0b0b0e;
  border: 1px solid #717582;
  box-shadow: 0 1.8rem 3.2rem rgb(0 0 0 / 38%);
}

.device-screen {
  overflow: hidden;
  border-radius: inherit;
  background: #16171b;
}

.device-screen video { display: block; width: 100%; height: auto; object-fit: contain; }

.stage :is(.device-screen, .gyro-look),
.opening-stage {
  touch-action: pan-y;
  -webkit-touch-callout: none;
  user-select: none;
}

.opening-backdrop,
.opening-window,
.device-screen :is(video, img),
.gyro-look img {
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

.device--laptop {
  width: min(100%, var(--screen-height) * 1.6);
  padding: clamp(.42rem, .92vw, .8rem) clamp(.42rem, .82vw, .72rem) clamp(.57rem, 1.1vw, .95rem);
  border-radius: clamp(.75rem, 1.35vw, 1.35rem);
  margin-bottom: .55rem;
}

.device--laptop .device-screen { border-radius: clamp(.35rem, .75vw, .73rem); }

.device--laptop::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #343846;
}

.device--laptop::after {
  content: "";
  position: absolute;
  inset: auto -2% -.47rem;
  height: .52rem;
  border-radius: 0 0 40% 40%;
  border-top: 1px solid #8d919a;
  background: linear-gradient(#727680, #373a43 64%, #22242a);
}

.device--phone {
  width: min(100%, 11.75rem, var(--screen-height) * .46);
  padding: clamp(.19rem, .42vw, .38rem);
  border-radius: clamp(.9rem, 2vw, 1.85rem);
  border-width: 2px;
  margin-bottom: .5rem;
}

.device--phone .device-screen { border-radius: clamp(.65rem, 1.6vw, 1.45rem); }
.device--phone::after {
  content: "";
  position: absolute;
  top: 3%;
  left: 36%;
  width: 28%;
  height: 2.65%;
  border-radius: 999px;
  background: #101115;
}

.device--tablet {
  width: min(100%, var(--screen-height) * 1.34);
  padding: clamp(.6rem, 1.15vw, 1rem);
  border-radius: clamp(.85rem, 1.75vw, 1.8rem);
}

.device--tablet .device-screen { border-radius: clamp(.3rem, .75vw, .67rem); }

.scrub-panel {
  padding: .75rem .65rem .7rem;
  display: grid;
  min-width: 5.65rem;
  justify-items: center;
  gap: .5rem;
  border: 1px solid #545761;
  border-radius: 1.05rem;
  background: #1f2026;
  box-shadow: 0 .7rem 2rem #08090a77;
}

.scrub-panel label { font-size: .875rem; font-weight: 700; }
.scrub-panel output { font-size: .75rem; color: #c4c7d0; }
.scrub-track { display: flex; align-items: center; justify-content: center; }

.scrub-track input {
  appearance: none;
  writing-mode: vertical-lr;
  direction: ltr;
  width: 2.625rem;
  height: clamp(5rem, 19svh, 10rem);
  margin: 0;
  padding: .25rem 0;
  background: transparent;
  cursor: ns-resize;
  touch-action: none;
}

.scrub-track input::-webkit-slider-runnable-track { width: .3rem; border-radius: 999px; background: #626776; }
.scrub-track input::-moz-range-track { width: .3rem; border-radius: 999px; background: #626776; }
.scrub-track input::-webkit-slider-thumb {
  appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  margin-left: -.52rem;
  border: 2px solid #fff4f5;
  border-radius: 50%;
  background: #e75462;
}
.scrub-track input::-moz-range-thumb { width: 1.15rem; height: 1.15rem; border: 2px solid #fff4f5; border-radius: 50%; background: #e75462; }

.chapter--contact { justify-items: center; text-align: center; }
.closing { max-width: 57rem; }
.closing p { margin-inline: auto; }
.closing-contact span { font-size: .53em; color: #bcebd6; vertical-align: .16em; }
.closing-contact:hover { text-decoration: underline; text-underline-offset: .11em; text-decoration-thickness: .06em; }
.closing-information { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.25rem; margin-top: 1.5rem; }
.closing-information a { padding-block: .4rem; color: var(--muted); font-size: .875rem; text-decoration: underline; text-underline-offset: .2em; }

.chapter-dock {
  position: fixed;
  z-index: 5;
  inset: auto auto max(.65rem, env(safe-area-inset-bottom)) 50%;
  transform: translateX(-50%);
  display: flex;
  gap: clamp(.12rem, .4vw, .36rem);
  padding: .3rem;
  border: 1px solid #505462;
  border-radius: 999px;
  background: #202129ee;
  box-shadow: 0 .75rem 1.5rem #07080b80;
  backdrop-filter: blur(12px);
}

.chapter-dock a {
  display: grid;
  place-items: center;
  min-height: 2.65rem;
  padding-inline: clamp(.48rem, 1.4vw, 1rem);
  border-radius: 999px;
  font-size: clamp(.72rem, 1vw, .875rem);
  font-weight: 700;
  color: #e6e8f0;
  transition: background 270ms ease, color 270ms ease;
}

.chapter-dock a:hover { background: #323645; }
.chapter-dock a[aria-current] { color: white; background: #36519e; }
.chapter-dock .dock-home { min-width: 2.65rem; padding: .65rem; }
.dock-home svg { width: 1.15rem; height: 1.15rem; }

@media (max-width: 49rem), (max-width: 61rem) and (max-height: 35rem) {
  .chapter-dock { display: none; }
}

@media (max-width: 49rem) {
  .chapter { padding-top: 4.35rem; padding-bottom: 4.65rem; }
  .opening { padding-top: min(19svh, 7rem); }
  .opening-backdrop { object-position: 38% center; }
  .chapter-grid { grid-template-columns: minmax(0, 1fr); gap: clamp(1.25rem, 4svh, 2.25rem); }
  .chapter-copy h2 { font-size: clamp(2.4rem, 9vw, 3.9rem); text-wrap: wrap; }
  .chapter-copy p { max-width: 55ch; }
  .stage { --screen-height: max(10rem, calc(100svh - 22rem)); }
  .stage--pair { grid-template-columns: minmax(0, 1fr) minmax(4.25rem, .28fr); align-items: center; }
  .stage--section { grid-template-columns: minmax(0, 1fr); gap: .65rem; }
  .scrub-panel { width: min(100%, 29rem); grid-template-columns: auto minmax(2.5rem, 1fr) 3.6rem; align-items: center; }
  .scrub-track input { writing-mode: horizontal-tb; width: 100%; height: 2.625rem; padding: 0 .2rem; cursor: ew-resize; }
  .scrub-track input::-webkit-slider-runnable-track { width: 100%; height: .3rem; }
  .scrub-track input::-moz-range-track { width: 100%; height: .3rem; }
  .scrub-track input::-webkit-slider-thumb { margin-left: 0; margin-top: -.52rem; }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .chapter:not(.opening) .stage {
      animation: camera-in linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 44%;
    }
  }
}

@keyframes camera-in {
  from { transform: translateY(2.6rem) scale(.94); opacity: .68; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .opening-window, .opening-backdrop, .opening-launch, .launch-orb, .chapter-dock a { transition: none; }
  .orb-fan a { animation: none; }
}
