:root { color-scheme: dark; --bg: #0b0c0f; }
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); overflow: hidden; overscroll-behavior: none;
}
body {
  position: fixed; inset: 0;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none; touch-action: none;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* measures the safe area for the layout */
#safe {
  position: fixed; visibility: hidden; pointer-events: none;
  top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px); left: env(safe-area-inset-left, 0px);
}

/* the one quiet line under the word (placed by app.js); it settles in: fades up as its letters draw together */
.tag {
  position: fixed; left: 0; right: 0; top: 0; margin: 0; pointer-events: none;
  text-align: center; font-size: 11px; font-weight: 400; letter-spacing: .95em; text-indent: .95em;
  color: rgba(214, 222, 240, .24); opacity: 0; filter: blur(3px);
  transform: translateY(calc(var(--y, 64vh) + 4px));
  transition: opacity .3s ease, filter .3s ease, letter-spacing .3s ease, text-indent .3s ease, transform .3s ease;
}
.tag.on {
  opacity: 1; filter: none; letter-spacing: .5em; text-indent: .5em; transform: translateY(var(--y, 64vh));
  transition: opacity 1.1s ease .15s, filter 1.1s ease .15s, letter-spacing 1.6s cubic-bezier(.2, .7, .2, 1) .1s,
    text-indent 1.6s cubic-bezier(.2, .7, .2, 1) .1s, transform 1.6s cubic-bezier(.2, .7, .2, 1) .1s;
}
html.capture .tag { transition: none; } /* (tests run on virtual time) */

/* no WebGL: the word in its four colours, softly glowing */
.fallback {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; gap: .06em;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  font-weight: 800; font-size: min(24vw, 168px); line-height: 1; letter-spacing: .02em; pointer-events: none;
  opacity: 0; animation: fb .8s ease 1.6s forwards;
}
.fallback span { --c: 255, 255, 255; color: rgb(var(--c)); text-shadow: 0 0 .06em rgba(255, 255, 255, .5), 0 0 .2em rgba(var(--c), .75), 0 0 .6em rgba(var(--c), .4); }
.fallback .n { --c: 76, 141, 255; }
.fallback .u { --c: 255, 95, 87; }
.fallback .l1 { --c: 255, 197, 61; }
.fallback .l2 { --c: 47, 207, 122; }
html.gl .fallback { display: none; }
html.nogl .fallback { display: flex; animation: none; opacity: 1; }
html.nogl #stage, html.nogl .tag { visibility: hidden; }
@keyframes fb { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tag, .tag.on { transition: opacity .2s; filter: none; letter-spacing: .5em; text-indent: .5em; } .fallback { animation-duration: 0s; } }

/* ---- the tree ---- */
/* names under the cubes of a branch: quiet lowercase, wide tracking, a breath of the cube's own colour; they settle in
   (blur to sharp, letters drawing together) once their cube has landed */
.labels { position: fixed; inset: 0; pointer-events: none; }
.label {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 0; white-space: nowrap; will-change: transform, opacity;
}
.label .nm {
  font-size: 12.5px; font-weight: 450; letter-spacing: .3em; text-indent: .3em; color: rgba(236, 240, 248, .82);
  text-shadow: 0 0 14px rgba(var(--c), .45), 0 0 2px rgba(var(--c), .35);
  opacity: 0; filter: blur(5px); transform: translateY(6px); letter-spacing: .55em; text-indent: .55em;
  transition: opacity .25s ease, filter .25s ease, transform .25s ease, letter-spacing .25s ease, text-indent .25s ease;
}
.label .sub {
  font-size: 9.5px; letter-spacing: .22em; text-indent: .22em; color: rgba(var(--c), .66); text-transform: lowercase;
  opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease;
}
.label.on .nm {
  opacity: 1; filter: none; transform: none; letter-spacing: .3em; text-indent: .3em;
  transition: opacity .7s ease .05s, filter .7s ease .05s, transform 1s cubic-bezier(.2, .7, .2, 1), letter-spacing 1.1s cubic-bezier(.2, .7, .2, 1), text-indent 1.1s cubic-bezier(.2, .7, .2, 1);
}
.label.on .sub { opacity: 1; transform: none; transition: opacity .8s ease .35s, transform .9s cubic-bezier(.2, .7, .2, 1) .3s; }
.label.soon .nm { color: rgba(236, 240, 248, .42); text-shadow: none; }
.label.soon .sub { color: rgba(236, 240, 248, .28); }

/* where you are: null / labs / two d. Each step is a way back up */
.crumbs {
  position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 14px); display: flex; justify-content: center;
  gap: 0; pointer-events: none; opacity: 0; transform: translateY(-6px); transition: opacity .4s ease, transform .5s ease;
}
.crumbs.on { opacity: 1; transform: none; pointer-events: none; transition: opacity .8s ease .5s, transform 1s cubic-bezier(.2, .7, .2, 1) .45s; }
.crumbs.on button { pointer-events: auto; } /* only the words take taps: the strip between them is the scene's */
.crumbs button {
  appearance: none; background: none; border: 0; margin: 0; padding: 10px 4px; min-height: 44px; cursor: pointer;
  font: 400 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; letter-spacing: .36em; text-indent: .36em;
  color: rgba(214, 222, 240, .4); -webkit-tap-highlight-color: transparent; transition: color .3s ease;
}
.crumbs button + button::before { content: "/"; margin-right: .75em; color: rgba(214, 222, 240, .2); }
.crumbs button:hover, .crumbs button:focus-visible { color: rgba(236, 240, 248, .85); outline: none; }
.crumbs button[aria-current] { color: rgba(236, 240, 248, .72); cursor: default; }

/* a leaf opening: the screen washes into its colour just before the project loads */
.veil { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: #0b0c0f; transition: opacity .25s ease; }
.veil.on { opacity: 1; transition: opacity .45s cubic-bezier(.5, 0, .7, .4) .38s; }

/* the tree as a list: only for screen readers and crawlers while the cubes are up; the page itself without WebGL */
html.gl .tree { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tree { position: fixed; left: 0; right: 0; bottom: 0; top: 62vh; overflow: auto; padding: 0 24px 40px; display: none; }
html.nogl .tree { display: block; }
html:not(.gl):not(.nogl) .tree { display: block; opacity: 0; animation: fb .8s ease 1.6s forwards; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 18px; }
.tree > ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; padding: 0; max-width: 760px; margin: 0 auto; }
.tree li { margin: 6px 0; font-size: 13px; letter-spacing: .2em; color: rgba(214, 222, 240, .5); }
.tree > ul > li > span { color: rgba(236, 240, 248, .85); letter-spacing: .4em; }
.tree a { color: rgba(236, 240, 248, .85); text-decoration: none; border-bottom: 1px solid rgba(236, 240, 248, .2); }
.tree li[data-soon] { color: rgba(214, 222, 240, .28); }
html.nogl .fallback { align-items: flex-start; padding-top: 22vh; }
@media (prefers-reduced-motion: reduce) { .label .nm, .label .sub, .label.on .nm, .label.on .sub, .crumbs, .crumbs.on, .veil.on { transition: opacity .2s; filter: none; } }
html.capture .label .nm, html.capture .label .sub, html.capture .crumbs, html.capture .veil { transition: none !important; }

/* ---- the way back: the orb itself is glass in the 3D scene (app.js makeOrb); this button is its invisible hit area
   over it, reachable by keyboard, with a soft ring when focused ---- */
.orb {
  position: fixed; z-index: 3; left: calc(env(safe-area-inset-left, 0px) + 10px); top: calc(env(safe-area-inset-top, 0px) + 6px);
  width: 62px; height: 62px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; pointer-events: none; touch-action: manipulation;
}
.orb.on { pointer-events: none; } /* touches go to the canvas, which treats the orb like a cube; the button stays for keyboards */
.orb-core { display: none; }
.orb:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(236, 240, 248, .35); }
html.nogl .orb { display: none; }
