:root {
  --ink: #0d0d0c;
  --paper: #f0eee7;
  --coral: #ff603f;
  --blue: #5067ff;
  --acid: #d9ff45;
  --muted: #8e8b84;
  --display: "Syne", "Arial Black", sans-serif;
  --condensed: "Anton", "Arial Narrow", sans-serif;
  --sans: "Manrope", Arial, sans-serif;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }

html {
  color: var(--paper);
  background: var(--ink);
  overflow-x: clip;
}

html.lenis,
html.lenis body { height: auto; }

.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--sans);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button,
a { -webkit-tap-highlight-color: transparent; }

button { font: inherit; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--acid);
  outline-offset: 4px;
}

::selection {
  color: var(--ink);
  background: var(--acid);
}

.skip-link {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--acid);
  font: 500 11px var(--mono);
  text-transform: uppercase;
  transform: translateY(-160%);
  transition: transform .2s ease;
}

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

.experience-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  height: 76px;
  padding: 0 clamp(20px, 3.4vw, 54px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 30px;
  color: var(--paper);
  background: linear-gradient(180deg, rgba(13,13,12,.94), rgba(13,13,12,.72) 74%, transparent);
}

.experience-brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 800 16px var(--display);
  letter-spacing: -.05em;
  text-decoration: none;
}

.brand-key {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--acid);
  border-radius: 8px;
  box-shadow: inset 0 -5px rgba(0,0,0,.24), 0 4px 0 #777f30;
  transition: transform .12s ease, box-shadow .12s ease;
}

.experience-brand:hover .brand-key {
  transform: translateY(3px);
  box-shadow: inset 0 -2px rgba(0,0,0,.24), 0 1px 0 #777f30;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(240,238,231,.58);
  font: 400 9px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--acid);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(217,255,69,.12);
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  50% { box-shadow: 0 0 0 9px rgba(217,255,69,0); }
}

.back-link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 500 10px var(--mono);
  letter-spacing: .04em;
  text-decoration: none;
  text-transform: uppercase;
}

.back-line {
  position: relative;
  width: 30px;
  height: 1px;
  background: currentColor;
  transition: width .2s ease;
}

.back-line::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 0;
  width: 7px;
  height: 7px;
  border-bottom: 1px solid currentColor;
  border-left: 1px solid currentColor;
  transform: rotate(45deg);
}

.back-link:hover .back-line { width: 42px; }

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.08);
}

.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--acid);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

.experience-sequence {
  position: relative;
  height: 500vh;
  min-height: 3300px;
}

.experience-stage {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 100svh;
  min-height: 660px;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 48%, rgba(80,103,255,.18), transparent 30%),
    var(--ink);
}

.stage-grid {
  position: absolute;
  inset: 0;
  opacity: .2;
  background:
    linear-gradient(rgba(240,238,231,.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,238,231,.15) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(90deg, #000, transparent 80%);
}

.ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .17;
  pointer-events: none;
}

.ambient-one {
  right: 2%;
  bottom: -18%;
  width: 44vw;
  aspect-ratio: 1;
  background: var(--blue);
}

.ambient-two {
  top: 17%;
  left: 25%;
  width: 18vw;
  aspect-ratio: 1;
  background: var(--coral);
}

.stage-heading {
  position: absolute;
  top: clamp(112px, 14vh, 150px);
  left: clamp(22px, 4.2vw, 68px);
  z-index: 3;
  pointer-events: none;
}

.stage-index,
.rail-label,
.rail-hint,
.screen-meta span,
.chapter-card > span,
.outro-label {
  font: 500 9px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.stage-index {
  display: inline-flex;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--coral);
  border-radius: 999px;
}

.stage-heading h1 {
  margin: 23px 0 15px;
  padding-bottom: .3em;
  font: 400 clamp(58px, 6.25vw, 104px)/.96 var(--condensed);
  letter-spacing: -.025em;
  text-transform: uppercase;
  overflow: visible;
}

.stage-heading h1 em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 1px var(--paper);
}

.stage-heading p {
  margin: 0;
  color: rgba(240,238,231,.64);
  font: 400 11px var(--mono);
  text-transform: uppercase;
}

.webgl-wrap {
  position: absolute;
  inset: 0 0 0 31%;
  z-index: 1;
}

#macbook-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: 0;
  touch-action: pan-y;
}

.webgl-fallback {
  position: absolute;
  top: 50%;
  left: 56%;
  width: min(50vw, 720px);
  aspect-ratio: 1.3;
  display: none;
  transform: translate(-50%, -45%) perspective(1000px) rotateY(-8deg);
}

.webgl-timeout #macbook-canvas { display: none; }
.webgl-timeout .webgl-fallback { display: block; }

.fallback-lid {
  position: absolute;
  top: 0;
  left: 8%;
  width: 84%;
  height: 69%;
  padding: 2.4%;
  background: #161617;
  border: 2px solid #4a4a4c;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}

.fallback-screen {
  width: 100%;
  height: 100%;
  padding: 9%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  color: var(--paper);
  background: var(--blue);
  border-radius: 11px;
}

.fallback-screen span { font: 500 9px var(--mono); }
.fallback-screen strong {
  margin-top: 12px;
  padding-bottom: .12em;
  font: 700 clamp(24px,4vw,55px)/1.08 var(--display);
  overflow: visible;
}
.fallback-screen small { margin-top: 15px; font: 400 10px var(--mono); }

.fallback-base {
  position: absolute;
  right: 0;
  bottom: 2%;
  left: 0;
  height: 32%;
  background: linear-gradient(#aaa, #4c4c4e);
  border-radius: 8px 8px 35px 35px;
  clip-path: polygon(8% 0, 92% 0, 100% 80%, 94% 100%, 6% 100%, 0 80%);
}

.key-rail {
  position: absolute;
  top: 50%;
  left: clamp(22px, 4.2vw, 68px);
  z-index: 6;
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-23%);
}

.rail-label {
  position: absolute;
  top: 50%;
  right: calc(100% + 18px);
  width: max-content;
  color: rgba(240,238,231,.46);
  transform: translateY(-50%) rotate(-90deg);
}

.rail-keys {
  padding: 9px;
  display: grid;
  gap: 9px;
  background: rgba(29,29,28,.82);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 22px;
  box-shadow: 0 18px 55px rgba(0,0,0,.4);
  backdrop-filter: blur(18px);
}

.rail-key {
  position: relative;
  width: 68px;
  height: 68px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.rail-cap {
  position: absolute;
  inset: 3px 3px 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #3b3b3d, #0b0b0c 72%);
  border: 1px solid #000;
  border-radius: 15px;
  box-shadow: inset 3px 3px 5px rgba(255,255,255,.16), inset -4px -5px 7px #000, 0 6px 0 #030303;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
}

.rail-key:hover .rail-cap { transform: translateY(2px); }

.rail-key:active .rail-cap,
.rail-key.is-pressed .rail-cap {
  transform: translateY(6px);
  box-shadow: inset 3px 3px 5px rgba(255,255,255,.16), inset -4px -5px 7px #000, 0 1px 0 #030303;
}

.rail-key.is-active .rail-cap {
  color: var(--ink);
  background: var(--acid);
  box-shadow: inset 3px 3px 5px rgba(255,255,255,.42), inset -4px -5px 7px rgba(67,75,23,.4), 0 6px 0 #697b22;
}

.rail-name {
  position: absolute;
  left: calc(100% + 13px);
  padding: 5px 7px;
  color: var(--paper);
  background: var(--ink);
  font: 500 8px var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(-7px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.rail-key:hover .rail-name,
.rail-key:focus-visible .rail-name {
  opacity: 1;
  transform: none;
}

.rail-hint {
  margin-top: 17px;
  color: rgba(240,238,231,.42);
  white-space: nowrap;
}

.key-icon {
  position: relative;
  width: 28px;
  height: 28px;
  display: block;
  font: 500 17px var(--mono);
  font-variant-emoji: text;
}

.icon-files {
  border: 2px solid currentColor;
  border-radius: 6px;
}

.icon-files::before,
.icon-files::after {
  content: "";
  position: absolute;
  top: 7px;
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
}

.icon-files::before { left: 6px; }
.icon-files::after { right: 6px; }

.icon-files i {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 14px;
  height: 7px;
  border-bottom: 2px solid currentColor;
  border-radius: 0 0 50% 50%;
}

.icon-files b {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  border-left: 1px solid currentColor;
}

.icon-ask::before,
.icon-ask::after,
.icon-ask i,
.icon-ask b {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 3px;
  background: currentColor;
  border-radius: 3px;
  transform: translate(-50%,-50%);
}

.icon-ask::after { transform: translate(-50%,-50%) rotate(90deg); }
.icon-ask i { width: 20px; transform: translate(-50%,-50%) rotate(45deg); }
.icon-ask b { width: 20px; transform: translate(-50%,-50%) rotate(-45deg); }

.icon-focus {
  width: 25px;
  height: 24px;
  margin-top: 3px;
  border: 2px solid currentColor;
  border-radius: 48% 52% 50% 48%;
}

.icon-focus::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 12px;
  width: 8px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-radius: 7px 0;
  transform: rotate(18deg);
}

.icon-focus::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

.icon-terminal {
  width: auto;
  height: auto;
  display: inline;
}

.screen-meta {
  position: absolute;
  top: 96px;
  right: clamp(22px, 3.5vw, 55px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
}

.screen-meta span { color: rgba(240,238,231,.42); }

.screen-meta strong {
  font: 500 10px var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.screen-reader-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.scroll-cue {
  position: absolute;
  right: clamp(22px, 3.5vw, 55px);
  bottom: 30px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(240,238,231,.46);
  font: 400 8px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.scroll-cue i {
  position: relative;
  width: 30px;
  height: 48px;
  border: 1px solid rgba(240,238,231,.35);
  border-radius: 18px;
}

.scroll-cue i::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  width: 3px;
  height: 8px;
  background: var(--acid);
  border-radius: 3px;
  transform: translateX(-50%);
  animation: scrollDot 1.7s ease-in-out infinite;
}

@keyframes scrollDot {
  60%, 100% { transform: translate(-50%, 18px); opacity: 0; }
}

.experience-chapters {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.experience-chapter {
  height: 100vh;
  min-height: 650px;
  padding: 0 clamp(22px, 4.2vw, 68px) clamp(58px, 8vh, 95px);
  display: flex;
  align-items: flex-end;
}

.chapter-card {
  width: min(390px, 28vw);
  margin-left: clamp(115px, 10vw, 165px);
  padding: 23px 0 0;
  color: var(--paper);
  border-top: 1px solid rgba(240,238,231,.32);
  opacity: .28;
  transform: translateY(20px);
  transition: opacity .45s ease, transform .45s ease;
}

.experience-chapter.is-current .chapter-card {
  opacity: 1;
  transform: none;
}

.chapter-card > span { color: var(--acid); }

.chapter-card h2 {
  margin: 13px 0 14px;
  padding-bottom: .2em;
  font: 700 clamp(27px, 2.6vw, 42px)/1.2 var(--sans);
  letter-spacing: -.055em;
  overflow: visible;
}

.chapter-card p {
  max-width: 355px;
  margin: 0;
  color: rgba(240,238,231,.62);
  font-size: 13px;
  line-height: 1.6;
}

.experience-outro {
  min-height: 100svh;
  padding: 120px clamp(24px, 7vw, 110px);
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(60px, 10vw, 170px);
  align-items: center;
  color: var(--ink);
  background:
    linear-gradient(rgba(13,13,12,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,13,12,.08) 1px, transparent 1px),
    var(--acid);
  background-size: 38px 38px;
}

.outro-orbit {
  position: relative;
  width: min(34vw, 470px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.outro-orbit::before,
.outro-orbit::after {
  content: "";
  position: absolute;
  inset: 11%;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

.outro-orbit::after { inset: 22%; }

.outro-orbit span {
  position: relative;
  z-index: 2;
  width: 38%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  border-radius: 23%;
  box-shadow: inset 0 -14px #000, 9px 12px 0 rgba(13,13,12,.32);
  font: 700 clamp(50px, 7vw, 100px) var(--display);
}

.outro-copy h2 {
  max-width: 850px;
  margin: 26px 0 45px;
  padding-bottom: .26em;
  font: 700 clamp(52px, 6.9vw, 110px)/1.16 var(--sans);
  letter-spacing: -.075em;
  overflow: visible;
}

.outro-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.outro-actions a,
.outro-actions button {
  min-height: 58px;
  padding: 0 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  font: 700 13px var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.outro-actions button {
  color: var(--ink);
  background: transparent;
}

.outro-actions .outro-store {
  color: var(--ink);
  background: var(--acid);
}

.outro-actions button:hover { color: var(--paper); background: var(--ink); }

@media (max-width: 1050px) {
  .stage-heading h1 { font-size: clamp(52px, 6.5vw, 75px); }
  .webgl-wrap { left: 24%; }
  .chapter-card { width: 320px; }
  .header-center { display: none; }
  .experience-header { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .experience-header {
    height: 66px;
    padding: 0 17px;
  }

  .experience-brand { font-size: 14px; }
  .brand-key { width: 33px; height: 33px; }
  .back-link { font-size: 8px; }
  .back-line { width: 20px; }

  .experience-sequence {
    height: 500svh;
    min-height: 3000px;
  }

  .experience-stage { min-height: 600px; }

  .stage-grid {
    opacity: .16;
    background-size: 31px 31px;
    mask-image: linear-gradient(#000, transparent 86%);
  }

  .stage-heading {
    top: 88px;
    left: 19px;
  }

  .stage-heading h1 {
    margin-top: 15px;
    font-size: clamp(50px, 16vw, 68px);
  }

  .stage-heading p { font-size: 8px; }

  .webgl-wrap {
    inset: 17% -20% 8% -20%;
  }

  .webgl-fallback {
    left: 50%;
    width: 88vw;
  }

  .screen-meta {
    top: auto;
    right: 18px;
    bottom: 110px;
  }

  .screen-meta span { display: none; }

  .key-rail {
    position: fixed;
    top: auto;
    bottom: 20px;
    left: 50%;
    z-index: 25;
    width: auto;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity .2s ease;
  }

  .sequence-active .key-rail {
    opacity: 1;
    pointer-events: auto;
  }

  .rail-label,
  .rail-hint,
  .rail-name { display: none; }

  .rail-keys {
    padding: 8px;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    border-radius: 17px;
  }

  .rail-key {
    width: clamp(55px, 16vw, 65px);
    height: clamp(55px, 16vw, 65px);
  }

  .key-icon {
    font-family: var(--mono);
    font-variant-emoji: text;
  }

  .scroll-cue { display: none; }

  .experience-chapter {
    min-height: 600px;
    padding: 0 19px 122px;
  }

  .chapter-card {
    width: min(315px, 82vw);
    margin-left: 0;
    padding: 15px 16px 17px;
    color: var(--ink);
    background: rgba(240,238,231,.94);
    border: 0;
    box-shadow: 6px 6px 0 rgba(13,13,12,.8);
  }

  .chapter-card > span { color: #435719; }
  .chapter-card h2 { font-size: clamp(25px, 8vw, 34px); }
  .chapter-card p { color: rgba(13,13,12,.68); font-size: 11px; }

  .experience-outro {
    padding: 95px 20px;
    grid-template-columns: 1fr;
    gap: 70px;
  }

  .outro-orbit { width: min(78vw, 350px); margin: auto; }
  .outro-copy h2 { font-size: clamp(50px, 15vw, 72px); }
  .outro-actions { align-items: stretch; flex-direction: column; }
  .outro-actions a,
  .outro-actions button { width: 100%; }

}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
