:root {
  --bg: #131316;
  --ink: #f2f1ec;
  --muted: #9b9a93;
  --lime: #c9f158;
  --panel: #1b1b1f;
  --line: rgba(255, 255, 255, 0.10);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --disp: "Space Grotesk", sans-serif;
  --body: "Inter", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* visually hidden fallback list of links for assistive tech */
.sr-list { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; cursor: grab; touch-action: none; }
#stage.is-dragging { cursor: grabbing; }
#stage.is-hover { cursor: pointer; }
#stage canvas { display: block; }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  transition: opacity 0.55s ease;
}
#loader.is-done { opacity: 0; pointer-events: none; }
.ld-mark svg { display: block; animation: ldSpin 7s linear infinite; }
.ld-ring { transform-origin: 32px 32px; animation: ldTilt 3.2s ease-in-out infinite alternate; }
@keyframes ldSpin { to { transform: rotate(360deg); } }
@keyframes ldTilt { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }
.ld-word { font-family: var(--disp); font-weight: 700; font-size: 26px; letter-spacing: 0.34em; margin-left: 0.34em; }
.ld-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }
.ld-bar { width: 220px; height: 2px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.ld-fill { width: 0%; height: 100%; background: var(--lime); transition: width 0.25s ease; }
.ld-pct { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- HUD ---------- */
#hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 26px; pointer-events: none;
}
.brand-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em; color: var(--muted); margin-bottom: 6px; }
.brand-word { font-family: var(--disp); font-weight: 700; font-size: 22px; letter-spacing: 0.30em; }
.stats { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: right; line-height: 1.8; letter-spacing: 0.08em; }
.stats b { color: var(--lime); font-weight: 500; }
.brand, .stats, #hint, #credit { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.8); }

#filters {
  position: fixed; left: 26px; bottom: 24px; z-index: 10;
  display: flex; gap: 8px;
}
.chip {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.10em;
  color: var(--muted); background: rgba(27, 27, 31, 0.92);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}
.chip:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.28); }
.chip.is-on { color: #131313; background: var(--lime); border-color: var(--lime); font-weight: 500; }

#hint {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 9;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--muted);
  pointer-events: none; white-space: nowrap;
}
.hint-key { color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }

#credit {
  position: fixed; right: 26px; bottom: 28px; z-index: 10;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.10em;
  color: var(--muted); text-decoration: none; transition: color 0.25s;
}
#credit:hover { color: var(--lime); }

/* ---------- hover label ---------- */
#label {
  position: fixed; z-index: 12; pointer-events: none;
  background: rgba(19, 19, 22, 0.88); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; max-width: 320px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  opacity: 0; transform: translate(14px, 14px);
}
.lb-title { font-family: var(--disp); font-weight: 600; font-size: 14px; }
.lb-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px; letter-spacing: 0.06em; max-width: 290px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- detail overlay ---------- */
#detail { position: fixed; inset: 0; z-index: 30; display: none; }
#detail.is-open { display: block; }
.d-bg {
  position: absolute; inset: 0;
  background: rgba(15, 15, 18, 0.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0;
}
.d-inner {
  position: relative; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr);
  gap: 48px; align-items: center;
  padding: clamp(20px, 5vw, 72px);
  max-width: 1500px; margin: 0 auto;
}
.d-media {
  width: 100%; aspect-ratio: 16 / 10;
  border-radius: 14px;
  background-size: cover; background-position: top center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  /* the #morph element paints the image during the transition,
     then hands it off to this in-flow element so mobile scroll works */
}
.d-info { max-width: 460px; }
.d-chip {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em; color: #131313; background: var(--lime);
  padding: 5px 10px; border-radius: 4px; margin-bottom: 18px;
}
.d-chip.is-concept { background: #8ab4ff; }
.d-title { font-family: var(--disp); font-weight: 700; font-size: clamp(26px, 3.2vw, 44px); line-height: 1.04; letter-spacing: -0.01em; }
.d-sub { font-size: 14.5px; line-height: 1.65; color: var(--muted); margin-top: 16px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  font-family: var(--disp); font-weight: 600; font-size: 14px;
  border-radius: 10px; padding: 13px 22px; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; transition: transform 0.2s, background 0.25s, color 0.25s, border-color 0.25s;
}
.btn:active { transform: scale(0.97); }
.btn-live { background: var(--lime); color: #131313; }
.btn-live:hover { background: #d8fa75; }
.btn-back { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-back:hover { border-color: rgba(255, 255, 255, 0.35); }
.d-cta { font-size: 12.5px; color: var(--muted); margin-top: 26px; }
.d-cta a { color: var(--lime); text-decoration: none; }
.d-cta a:hover { text-decoration: underline; }

/* the morphing card */
#morph {
  position: fixed; z-index: 31; display: none;
  background-size: cover; background-position: top center;
  border-radius: 10px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

/* hint collides with the filter chips between ~900 and ~1110px */
@media (max-width: 1120px) {
  #hint { display: none; }
}

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  #hud-top { padding: 16px 18px; }
  .brand-word { font-size: 17px; }
  .stats { display: none; }
  #hint { display: none; }
  #credit { display: none; }
  #filters { left: 50%; transform: translateX(-50%); bottom: 18px; }
  .chip { padding: 8px 13px; font-size: 10px; }
  #label { display: none; }
  #detail { overflow-y: auto; }
  .d-inner {
    grid-template-columns: 1fr; gap: 22px; align-items: start;
    padding: 74px 18px 40px; height: auto; min-height: 100%;
  }
  .d-info { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ld-mark svg, .ld-ring { animation: none; }
}
