:root {
  --ink: #f2f4f6;
  --dim: rgba(225, 230, 236, 0.62);
  --faint: rgba(225, 230, 236, 0.36);
  --line: rgba(225, 230, 236, 0.18);
  --glow: 0 0 10px rgba(220, 235, 255, 0.35);
  --thin: "Jost", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --pad: max(18px, env(safe-area-inset-left));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden; }
body { font: 300 15px/1.5 var(--thin); font-variant-ligatures: none; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.mono { font-family: var(--mono); }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }

/* ---- the name ---- */
#title {
  position: fixed; left: 0; right: 0; top: 50%; margin: 0; text-align: center; pointer-events: none;
  font: 200 min(5vw, 74px)/1.15 var(--thin); letter-spacing: 0.24em; text-indent: 0.24em; color: #fff;
  transform: translateY(-50%); transform-origin: 50% 0;
  transition: top 1.8s cubic-bezier(.65,0,.35,1), transform 1.8s cubic-bezier(.65,0,.35,1), opacity 1s ease;
  white-space: nowrap;
}
#title .w { display: inline-block; white-space: nowrap; }
#title .ch {
  display: inline-block; opacity: 0; filter: blur(14px); transform: translateY(0.12em) scale(1.08);
  transition: opacity 1.1s ease, filter 1.3s cubic-bezier(.2,.7,.2,1), transform 1.3s cubic-bezier(.2,.7,.2,1);
}
#title.in .ch { opacity: 1; filter: blur(0); transform: none; }
/* the owner's name, under the title in the same face */
#title .by {
  display: block; margin-top: 0.9em; font-size: 0.26em; font-weight: 300; letter-spacing: 0.42em; text-indent: 0.42em; color: rgba(242,244,246,.72);
  opacity: 0; filter: blur(8px); transition: opacity 1.4s ease 1.6s, filter 1.6s ease 1.6s;
}
#title.in .by { opacity: 1; filter: blur(0); }
/* readable over the star: a soft dark halo, and still legible once the title docks small at the top */
#title .by, #title.pulse .by { text-shadow: 0 0 2px rgba(0,0,0,.9), 0 0 10px rgba(0,0,0,.85), 0 0 24px rgba(0,0,0,.75); color: rgba(242,244,246,.85); }
#title .by { margin-top: 7em; transition: opacity 1.4s ease 1.6s, filter 1.6s ease 1.6s, margin-top 1.8s cubic-bezier(.65,0,.35,1), font-size 1.8s cubic-bezier(.65,0,.35,1); } /* centred: below the star's glow */
#title.docked .by { font-size: 0.5em; margin-top: 0.6em; }
#title.pulse { animation: pulse 6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(235,242,255,.35), 0 0 18px rgba(200,220,255,.12); }
  50% { text-shadow: 0 0 9px rgba(235,242,255,.6), 0 0 28px rgba(200,220,255,.22); }
}
#title.docked { top: max(22px, env(safe-area-inset-top)); transform: translateY(0) scale(0.42); }
#title.away { opacity: 0; }
@media (max-width: 640px) {
  #title { font-size: 10.4vw; letter-spacing: 0.17em; text-indent: 0.17em; line-height: 1.2; white-space: normal; }
  #title .w { display: block; }
  #title.docked { transform: translateY(0) scale(0.36); }
  #title .by { font-size: 0.5em; letter-spacing: 0.2em; text-indent: 0.2em; margin-top: 0.7em; }
}

#hint {
  position: fixed; left: 0; right: 0; bottom: max(26px, env(safe-area-inset-bottom)); margin: 0; text-align: center;
  font-size: 10.5px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--faint);
  opacity: 0; transition: opacity 1.2s ease; pointer-events: none; padding: 0 var(--pad);
}
#hint.on { opacity: 1; }

/* ---- world labels in the system view ---- */
#labels { position: fixed; inset: 0; pointer-events: none; }
.lbl {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; text-decoration: none;
  font: 400 10.5px/1 var(--mono); letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim);
  white-space: nowrap; pointer-events: none; padding: 10px 6px; opacity: 0; transition: opacity .6s ease, color .3s ease;
  will-change: transform;
}
.lbl::before { content: ""; width: 18px; height: 1px; background: var(--line); transition: width .3s ease, background .3s ease; }
.lbl.on { opacity: 1; pointer-events: auto; }
.lbl.sel, .lbl:hover, .lbl:focus-visible { color: #fff; text-shadow: var(--glow); outline: none; }
.lbl.sel::before, .lbl:hover::before { width: 28px; background: rgba(255,255,255,.6); }

/* ---- panels ---- */
#panel, #about {
  position: fixed; z-index: 2; color: var(--ink);
  left: var(--pad); right: var(--pad); bottom: max(20px, env(safe-area-inset-bottom));
  max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding-top: 8px;
}
#panel::-webkit-scrollbar { display: none; }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  #panel, #about { left: 57%; right: auto; width: min(520px, 37vw); top: 50%; bottom: auto; transform: translateY(-50%); max-height: 86vh; }
}
#panel > *, #about > * { opacity: 0; filter: blur(8px); transform: translateY(6px); transition: opacity .9s ease, filter 1s ease, transform 1s ease; }
#panel.in > *, #about.in > * { opacity: 1; filter: blur(0); transform: none; }
#panel.in > :nth-child(2), #about.in > :nth-child(2) { transition-delay: .08s; }
#panel.in > :nth-child(3), #about.in > :nth-child(3) { transition-delay: .18s; }
#panel.in > :nth-child(4) { transition-delay: .28s; }
#panel.in > :nth-child(5) { transition-delay: .38s; }
#panel.in > :nth-child(6), #panel.in > :nth-child(7) { transition-delay: .46s; }
#panel.in > :nth-child(8), #about.in > :nth-child(4) { transition-delay: .55s; }

.kicker { margin: 0 0 6px; font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--faint); }
#panel h2, #about h2 {
  margin: 0; font: 200 clamp(30px, 8.6vw, 54px)/1.05 var(--thin); letter-spacing: 0.04em; color: #fff;
  text-shadow: 0 0 14px rgba(230,240,255,.28); overflow-wrap: anywhere;
}
#p-pitch, #about-line { margin: 10px 0 12px; font-size: 16px; line-height: 1.45; color: rgba(240,243,246,.86); max-width: 34em; }
#p-facts { list-style: none; margin: 0 0 14px; padding: 0; }
#p-facts li { position: relative; padding: 5px 0 5px 18px; font-size: 13.5px; line-height: 1.45; color: var(--dim); border-top: 1px solid rgba(255,255,255,.06); }
#p-facts li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 5px; height: 1px; background: rgba(255,255,255,.5); }
.tags { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; }
.tag { font: 400 10px/1 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: rgba(225,240,255,.78); text-shadow: 0 0 8px rgba(160,210,255,.45); display: inline-flex; align-items: center; gap: 7px; }
.tag::before { content: ""; width: 4px; height: 4px; transform: rotate(45deg); border: 1px solid rgba(200,230,255,.8); box-shadow: 0 0 6px rgba(160,210,255,.6); }

.glyphs { display: flex; flex-wrap: wrap; gap: 4px 26px; margin: 0 0 6px; }
.glyph {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; background: none; border: 0; cursor: pointer;
  font: 400 11px/1 var(--mono); letter-spacing: 0.28em; text-transform: uppercase; color: #fff; text-decoration: none;
}
.glyph svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.1; overflow: visible; transition: filter .3s ease, transform .4s ease; }
.glyph:hover svg, .glyph:focus-visible svg { filter: drop-shadow(0 0 5px rgba(230,240,255,.8)); transform: rotate(45deg); }
.glyph:hover span, .glyph:focus-visible span { text-shadow: var(--glow); }
.glyph:focus-visible { outline: 1px solid rgba(255,255,255,.35); outline-offset: 4px; }
.glyph.pending { color: var(--faint); cursor: default; }
.glyph.pending:hover svg { filter: none; transform: none; }
.glyph.back { color: var(--dim); }
.glyph.back svg { width: 18px; height: 18px; }
.glyph.back:hover svg { transform: translateX(-3px); }
.note { font: 400 10px/1 var(--mono); letter-spacing: .24em; text-transform: uppercase; color: var(--faint); align-self: center; }


#tilt {
  position: fixed; right: var(--pad); top: max(8px, env(safe-area-inset-top)); z-index: 3; color: var(--faint);
  font-size: 9.5px; gap: 6px;
}
#tilt svg { width: 16px; height: 16px; }
#tilt.on { color: #fff; }

/* ---- the plain list: hidden for screen readers until asked for ---- */
#list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.list #list {
  position: fixed; inset: 0; width: auto; height: auto; clip: auto; overflow-y: auto; white-space: normal; z-index: 10;
  background: #000; padding: max(28px, env(safe-area-inset-top)) var(--pad) 40px; font-size: 15px;
}
body.list #list h2 { font: 200 30px/1.1 var(--thin); letter-spacing: .12em; text-transform: uppercase; margin: 0 0 10px; }
body.list #list > ul { list-style: none; padding: 0; margin: 24px 0; max-width: 680px; }
body.list #list li { border-top: 1px solid rgba(255,255,255,.12); padding: 14px 0; }
body.list #list li ul { list-style: none; padding-left: 16px; margin: 8px 0 0; }
body.list #list h3, body.list #list h4 { margin: 0 0 4px; font-weight: 400; }
body.list #list p { margin: 4px 0; color: var(--dim); }
body.list #list a { color: #fff; }
body.list #scene, body.list #title, body.list #labels, body.list #hint, body.list #panel, body.list #about, body.list #tilt { display: none; }

@media (prefers-reduced-motion: reduce) {
  #title, #title .ch, #panel > *, #about > *, .lbl, #hint { transition-duration: .01s !important; transition-delay: 0s !important; }
  #title .ch { filter: none; }
  #title.pulse { animation: none; text-shadow: 0 0 8px rgba(235,242,255,.45); }
}
.lbl.flip { flex-direction: row-reverse; }

@media (max-width: 640px) {
  #panel, #about { max-height: 62vh; max-height: 62dvh; bottom: max(10px, env(safe-area-inset-bottom)); }
  #p-pitch, #about-line { font-size: 15px; margin: 6px 0 8px; }
  #p-facts { margin-bottom: 10px; }
  #p-facts li { font-size: 12.8px; padding: 4px 0 4px 16px; }
  #p-facts li::before { top: 12px; }
  .tags { margin-bottom: 6px; }
  .glyph { min-height: 40px; }
  #panel h2 { font-size: clamp(28px, 8.4vw, 40px); }
}

/* ---- keyboard: skip link, shortcut overlay, live region, focus ---- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: fixed; left: var(--pad); top: max(14px, env(safe-area-inset-top)); z-index: 20; padding: 8px 12px; background: #000; color: #fff;
  font: 400 11px/1.2 var(--mono); letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
  border: 1px solid rgba(255,255,255,.4); transform: translateY(-220%); transition: transform .3s;
}
.skip:focus { transform: none; }
body.list .skip { display: none; }
.lbl:focus-visible { opacity: 1; }
.lbl:focus-visible::before { width: 34px; background: #fff; box-shadow: 0 0 8px rgba(220,235,255,.7); }
.lbl:focus-visible span, .lbl:focus-visible { text-decoration: underline; text-underline-offset: 5px; text-decoration-color: rgba(255,255,255,.5); }
#panel:focus, #about:focus { outline: none; }
#panel .glyph:focus-visible, #about .glyph:focus-visible, #tilt:focus-visible, #list a:focus-visible { outline: 1px solid rgba(255,255,255,.6); outline-offset: 4px; }
#keys { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.72); padding: var(--pad); }
#keys .keys-card { max-width: 520px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 26px 28px 18px; background: rgba(4,6,10,.92); border: 1px solid var(--line); }
#keys h2 { margin: 0 0 14px; font: 400 10px/1.4 var(--mono); letter-spacing: .3em; text-transform: uppercase; color: var(--faint); }
#keys dl { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 0; font-size: 14px; }
#keys dt { font: 400 12px/1.6 var(--mono); color: #fff; white-space: nowrap; }
#keys dd { margin: 0; color: var(--dim); }
#keys .keys-foot { margin: 16px 0 0; font: 400 10px/1.4 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
#keys .keys-foot a { color: var(--ink); }
