:root {
  --u: min(100vw / 1920, 100vh / 1080);
  --font: "Inter", system-ui, sans-serif;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", monospace;
  --ease: cubic-bezier(.65, 0, .35, 1);
  --ink: #111;
  --frame: #44e4ed; --power: #fff200; --data: #ff53e2;
  --accent: #fff;
}
body[data-mode="framework"] { --ink: #fff; --accent: var(--frame); }
body[data-mode="power"]     { --ink: #fff; --accent: var(--power); }
body[data-mode="data"]      { --ink: #fff; --accent: var(--data); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: #000; color: #fff; overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- intro ---------- */
.intro { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: #d8d8d8; color: #0a0a0a; transition: opacity .9s var(--ease), visibility .9s; }
.intro__fx { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro__content { position: relative; text-align: center; padding: 0 16px; }
.intro__title {
  margin: 0; font: 500 clamp(34px, calc(96 * var(--u)), 110px)/1 var(--serif); letter-spacing: -.065em; text-transform: uppercase;
  animation: titleIn 1.4s .9s both;
}
@keyframes titleIn {
  0% { opacity: 0; filter: blur(6px); letter-spacing: -.02em; }
  30% { opacity: .6; transform: translateX(-2px); }
  35% { opacity: .2; transform: translateX(3px); }
  100% { opacity: 1; filter: none; letter-spacing: -.065em; transform: none; }
}
.intro__start {
  position: relative; margin-top: clamp(14px, calc(30 * var(--u)), 34px); padding-bottom: 6px;
  font: 400 clamp(11px, calc(19 * var(--u)), 20px)/1 var(--mono); letter-spacing: .42em; color: #111;
  animation: fadeIn .6s 2.2s both;
}
.intro__start::after { content: ""; position: absolute; left: 30.5%; width: 23%; bottom: 0; height: 1px; background: currentColor; }
.intro__start:disabled { cursor: progress; color: #777; }
.intro__start:disabled::after { animation: load 1.2s ease-in-out infinite; }
@keyframes load { 50% { transform: scaleX(.2); } }
body.started .intro { opacity: 0; visibility: hidden; }

/* ---------- app ---------- */
.app { position: fixed; inset: 0; overflow: hidden; opacity: 0; transition: opacity .8s .1s var(--ease); }
body.started .app { opacity: 1; }
.bg { position: absolute; inset: 0; transition: opacity .42s linear; }
.bg--light { background: linear-gradient(180deg, #fff 5.5%, #1b1b1b 100%); }
.bg--dark { opacity: 0; background: linear-gradient(180deg, #000 8%, var(--dark-end, #161616) 100%); }
.bg__circuit {
  position: absolute; inset: 0; background: url("../assets/img/circuit-b.jpg") center / cover;
  filter: grayscale(1) contrast(1.5) brightness(.5); mix-blend-mode: screen; opacity: .1;
}
body[data-mode="power"] { --dark-end: #1f1d07; }
body[data-mode="data"]  { --dark-end: #200b1d; }
body:not([data-mode="overview"]) .bg--dark { opacity: 1; }
body.instant .bg { transition: none; }

.stage { position: absolute; inset: 0; }
.gl, .snap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gl { touch-action: none; cursor: grab; outline: none; }
.gl:active { cursor: grabbing; }
.snap { pointer-events: none; opacity: 0; }

/* ---------- header ---------- */
.header { position: absolute; inset: 0 0 auto; height: calc(170 * var(--u)); z-index: 6; pointer-events: none; color: var(--ink); transition: color .4s; }
.header > * { pointer-events: auto; }
.header__meta { position: absolute; left: 5.57vw; top: calc(74 * var(--u)); margin: 0; display: flex; flex-direction: column; font: 700 max(10px, calc(16 * var(--u)))/1.25 var(--font); }
.header__meta i { display: inline-block; width: 1.2em; }
.header__logo { position: absolute; left: 50%; top: calc(33 * var(--u)); width: calc(96 * var(--u)); min-width: 44px; aspect-ratio: 1; translate: -50% 0; }
.header__logo img { width: 100%; height: 100%; transition: transform .6s var(--ease); }
.header__logo:hover img { transform: rotate(-20deg); }
.header__logo::before, .header__logo::after {
  content: ""; position: absolute; top: 50%; width: calc(80 * var(--u)); height: max(1px, calc(3 * var(--u)));
  background: linear-gradient(90deg, transparent, #6a6a6a 70%);
}
.header__logo::before { right: 100%; }
.header__logo::after { left: 100%; transform: scaleX(-1); }
.header__menu { position: absolute; right: 5.05vw; top: calc(78 * var(--u)); width: calc(67 * var(--u)); min-width: 32px; height: calc(24 * var(--u)); min-height: 14px; }
.header__menu i { position: absolute; right: 0; height: max(2px, calc(3 * var(--u))); background: currentColor; transition: width .3s var(--ease); }
.header__menu i:first-child { top: 20%; width: 100%; }
.header__menu i:last-child { top: 70%; width: 45%; }
.header__menu:hover i:last-child { width: 100%; }

/* ---------- side arrows ---------- */
.side { position: absolute; top: calc(42.8% - 29 * var(--u)); width: calc(58 * var(--u)); min-width: 34px; aspect-ratio: 1; z-index: 4; color: rgba(255,255,255,.9); transition: color .4s, transform .3s var(--ease); }
body:not([data-mode="overview"]) .side { color: #9a9a9a; }
.side--prev { left: calc(11.56vw - 29 * var(--u)); }
.side--next { left: calc(88.44vw - 29 * var(--u)); }
.side svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.side:hover { color: #fff; }
.side--prev:hover { transform: translateX(-4px); } .side--next:hover { transform: translateX(4px); }

/* ---------- footer ---------- */
.foot { position: absolute; inset: auto 0 0; height: calc(250 * var(--u)); z-index: 5; pointer-events: none; }
.foot > * { pointer-events: auto; }
.title { position: absolute; left: 13.54vw; bottom: calc(176 * var(--u)); margin: 0; font: 300 calc(53 * var(--u))/1.15 var(--font); color: #fff; white-space: nowrap; letter-spacing: -.012em; }
.title b { font-weight: 800; }
.roll { display: inline-grid; overflow: hidden; vertical-align: top; }
.roll__item { grid-area: 1 / 1; display: block; }
.desc { position: absolute; left: 54.27vw; bottom: calc(146 * var(--u)); width: calc(660 * var(--u)); margin: 0; min-height: calc(3 * 29 * var(--u)); font: 400 calc(24 * var(--u))/1.21 var(--font); color: #fff; }
.type-caret { display: inline-block; width: .45em; height: 1em; margin-left: 1px; vertical-align: -.15em; background: currentColor; opacity: .55; }
.partnav { position: absolute; left: 50%; bottom: calc(48 * var(--u)); translate: -50% 0; display: flex; align-items: center; gap: calc(28 * var(--u)); }
.partnav__arrow { width: calc(14 * var(--u)); min-width: 10px; height: calc(24 * var(--u)); min-height: 16px; color: #fff; }
.partnav__arrow svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.partnav__arrow:hover { color: var(--accent); }
.partnav__icon { width: calc(74 * var(--u)); min-width: 40px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 max(2px, calc(3 * var(--u))) #fff; background: rgba(255,255,255,.22); }
.partnav__icon img { width: 74%; height: 74%; }
.partnav__icon.flip img { animation: iconFlip .6s var(--ease); }
@keyframes iconFlip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) scale(.8); opacity: .3; } 100% { transform: rotateY(0); } }

.modes { position: absolute; left: 5.57vw; bottom: calc(150 * var(--u)); display: flex; flex-direction: column; gap: calc(10 * var(--u)); }
.mode { display: flex; align-items: center; gap: calc(16 * var(--u)); height: calc(22 * var(--u)); min-height: 14px; color: #fff; text-align: left; }
.mode__tick { width: 1px; height: 100%; background: currentColor; opacity: .7; transition: width .3s var(--ease), background .3s, opacity .3s; }
.mode__label { font: italic 300 max(10px, calc(15 * var(--u)))/1 var(--font); opacity: 0; transform: translateX(-4px); transition: opacity .3s, transform .3s var(--ease); white-space: nowrap; }
.mode.is-on .mode__tick { width: calc(6 * var(--u)); min-width: 3px; background: var(--accent); opacity: 1; }
.mode.is-on .mode__label, .modes:hover .mode__label, .modes:focus-within .mode__label { opacity: .9; transform: none; }
.mode.is-on .mode__label { font-weight: 700; opacity: 1; }

/* ---------- hotspots + callout ---------- */
.flowlabels { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .45s .35s; --flow: #fff200; }
.flowlabels.is-on { opacity: 1; }
body[data-mode="data"] .flowlabels { --flow: #ff53e2; }
.flowlabel {
  position: absolute; left: 0; top: 0; white-space: nowrap; padding: 2px 6px 3px; border-radius: 3px;
  font: 500 clamp(10px, calc(13 * var(--u)), 12px)/1.25 var(--font); color: #f2f2f2; background: rgba(4,8,10,.72);
  border-left: 2px solid var(--flow); text-align: left;
}
.flowlabel b { font-weight: 500; }
.flowlabel em { display: block; font: 400 clamp(9.5px, calc(12 * var(--u)), 11px)/1.25 var(--mono); font-style: normal; color: color-mix(in srgb, var(--flow) 70%, #fff); }
.flowlabel--bus { padding: 1px 5px; border: 0; font: 400 clamp(9.5px, calc(12 * var(--u)), 11px)/1.2 var(--mono); color: var(--flow); background: rgba(4,8,10,.6); }
@media (max-aspect-ratio: 1/1) { .flowlabel em, .flowlabel--bus { display: none; } }
.hotspots { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.hotspot {
  position: absolute; left: 0; top: 0; width: calc(60 * var(--u)); min-width: 30px; aspect-ratio: 1; margin: calc(-30 * var(--u)); pointer-events: auto;
  border-radius: 50%; box-shadow: inset 0 0 0 max(2px, calc(3.2 * var(--u))) #fff;
  background: radial-gradient(circle, rgba(255,255,255,.55) 0 30%, rgba(255,255,255,.18) 62%);
  opacity: 0; scale: .6; transition: opacity .5s var(--ease), scale .5s var(--ease), background .3s;
}
.hotspot.is-shown { opacity: 1; scale: 1; }
.hotspot.is-back { opacity: .25 !important; }
.hotspot:hover, .hotspot.is-on { background: radial-gradient(circle, rgba(255,255,255,.85) 0 30%, rgba(255,255,255,.3) 62%); }
.hotspot.is-on::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,.5); animation: ping 1.8s ease-out infinite; }
@keyframes ping { 0% { scale: .9; opacity: 1; } 100% { scale: 1.5; opacity: 0; } }
.hotspot.is-hidden { opacity: 0 !important; pointer-events: none; }

.callout { position: absolute; left: 0; top: 0; z-index: 3; width: calc(300 * var(--u)); min-width: 180px; pointer-events: none; color: #fff; }
.callout[hidden] { display: none; }
.callout__title { position: relative; margin: 0 0 calc(18 * var(--u)); padding-bottom: calc(7 * var(--u)); font: 400 max(13px, calc(22 * var(--u)))/1 var(--font); white-space: nowrap; }
.callout__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: var(--rule, 100%); height: max(2px, calc(3 * var(--u))); background: currentColor; transform-origin: var(--rule-from, right); }
.callout__text { margin: 0; font: 400 max(11px, calc(17 * var(--u)))/1.22 var(--font); }
.callout.is-right .callout__title::after { left: auto; right: 0; }
.callout.is-in .callout__title::after { animation: rule .45s var(--ease) both; }
.callout.is-in .callout__title, .callout.is-in .callout__text { animation: reveal .55s .12s var(--ease) both; }
@keyframes rule { from { transform: scaleX(0); } }
@keyframes reveal { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
.callout.is-right.is-in .callout__title, .callout.is-right.is-in .callout__text { animation-name: revealR; }
@keyframes revealR { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- parts index ---------- */
.index { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0,0,0,.88); backdrop-filter: blur(10px); animation: fadeIn .3s var(--ease); }
.index[hidden] { display: none; }
.index__inner { width: min(560px, calc(100% - 32px)); }
.index__eyebrow { margin: 0 0 18px; font: 400 12px/1 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: #8b8b8b; }
.index__list { list-style: none; margin: 0; padding: 0; }
.index__list button { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); font: 300 clamp(20px, 3.2vw, 30px)/1.1 var(--font); text-align: left; color: #b9b9b9; transition: color .2s, padding .3s var(--ease); }
.index__list button b { font-weight: 800; }
.index__list img { width: 30px; height: 30px; flex: none; }
.index__list button:hover, .index__list button.is-on { color: #fff; padding-left: 8px; }
.index__keys { margin: 22px 0 0; font-size: 12px; color: #8b8b8b; }
.index__sound { padding: 6px 12px; border: 1px solid #444; border-radius: 999px; background: none; color: #ccc; font: inherit; cursor: pointer; }
.index__sound[aria-pressed="false"] { color: #777; border-style: dashed; }
.index__sound:hover { border-color: #888; color: #fff; }
kbd { display: inline-block; min-width: 18px; padding: 2px 4px; margin-right: 2px; border: 1px solid #444; border-radius: 3px; font: 11px var(--mono); text-align: center; color: #ccc; }

/* ---------- the flash between photo and x-ray ---------- */
.flash { position: fixed; inset: 0; z-index: 7; pointer-events: none; background: #fff; animation: flash .42s ease-out both; }
@keyframes flash { 0% { opacity: 0; } 30% { opacity: .35; } 100% { opacity: 0; } }

/* ---------- exit ---------- */
.exit { position: fixed; inset: 0; z-index: 40; pointer-events: none; visibility: hidden; }
.exit.is-on { visibility: visible; pointer-events: auto; cursor: pointer; }
.exit__warm, .exit__bit { position: absolute; inset: 0; width: 100%; height: 100%; clip-path: inset(0 0 100% 0); }
.exit__warm { background: linear-gradient(180deg, #fff 5.5%, #1b1b1b 100%); }
.exit__warm canvas { position: absolute; inset: 0; width: 100%; height: 100%; filter: grayscale(1) sepia(1) saturate(4.5) hue-rotate(-22deg) brightness(.95); }
.exit__bit { background: #2e2e2e; }
.exit__glitch { position: absolute; inset: 0; }
.exit__glitch i { position: absolute; background: #fff; }
.exit__glitch.is-black { background: #000; transition: background .5s; }

/* ---------- phones / portrait ---------- */
@media (max-aspect-ratio: 1/1) {
  :root { --u: calc(100vw / 760); }
  .header__meta { left: 16px; top: 22px; font-size: 10px; }
  .header__meta span { display: none; }
  .header__logo { top: 12px; width: 44px; }
  .header__logo::before, .header__logo::after { width: 26px; }
  .header__menu { right: 16px; top: 26px; width: 32px; }
  .side { top: 40%; width: 36px; }
  .side--prev { left: 10px; } .side--next { left: auto; right: 10px; }
  .foot { height: auto; inset: auto 0 0; padding: 0 20px 88px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.55) 30%); }
  .title, .desc, .modes { position: static; }
  .title { font-size: 26px; white-space: normal; }
  .desc { width: auto; min-height: 4.1em; font-size: 14.5px; }
  .modes { order: -1; flex-direction: row; gap: 14px; }
  .mode { height: 22px; gap: 6px; }
  .mode__label { opacity: .8; transform: none; font-size: 12px; }
  .mode__tick { height: 14px; }
  .partnav { bottom: 22px; gap: 22px; }
  .partnav__icon { width: 50px; }
  .partnav__arrow { width: 12px; height: 20px; }
  .callout { left: 16px; right: 16px; top: 72px; width: auto; padding: 12px 14px; border-radius: 12px; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); }
  .callout__title { margin-bottom: 8px; }
  .callout__title::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .intro__title, .intro__start { animation: none; }
  .bg, .hotspot { transition: none; }
}
