:root {
  --bg: #000;
  --fg: #f3f3f0;
  --dim: rgba(243, 243, 240, 0.5);
  --faint: rgba(243, 243, 240, 0.28);
  --ease: cubic-bezier(0.2, 0.7, 0.15, 1);
  --gutter: max(20px, env(safe-area-inset-left));
  --font: "Source Code Pro", ui-monospace, "SF Mono", Menlo, monospace;
  --foot-h: calc(48px + env(safe-area-inset-bottom));
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: #333 #000;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

::selection { background: var(--fg); color: #000; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The 3D stage sits behind the whole page; input is routed from the document. */
#stage {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  display: block;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.no-webgl #stage { display: none; }

main { position: relative; z-index: 1; }

/* ---------- hero ---------- */

#hero {
  position: relative;
  height: 100svh;
  min-height: 460px;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#hero:focus-visible::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px dashed var(--faint);
  border-radius: 14px;
  pointer-events: none;
}

.grab #hero, .grab body { cursor: grab; }
.grabbing, .grabbing * { cursor: grabbing !important; }

.fallback {
  display: none;
  position: absolute;
  left: 50%; top: 46%;
  width: min(88vw, 1500px);
  height: auto;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.45));
}
html:not(.js) .fallback, .no-webgl .fallback { display: block; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ---------- footer: fixed, always on screen ---------- */

.site-foot {
  --progress: 0;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: var(--foot-h);
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
          backdrop-filter: blur(12px) saturate(1.2);
  border-top: 1px solid rgba(243, 243, 240, 0.08);
}
/* The top edge fills as you scroll. */
.foot-progress {
  position: absolute;
  left: 0; top: -1px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transform: scaleX(var(--progress));
  transform-origin: 0 50%;
}

.copy { white-space: nowrap; }
@media (max-width: 480px) { .copy-name { display: none; } }

.socials { display: flex; align-items: center; gap: 2px; }
.socials a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--fg);
  opacity: 0.72;
  outline: none;
  transition: opacity 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease), filter 0.3s var(--ease);
}
@media (max-width: 400px) {
  .socials { gap: 0; }
  .socials a { width: 32px; }
}
.socials svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.socials svg .fill { fill: currentColor; stroke: none; }
.socials a:hover, .socials a:focus-visible {
  opacity: 1;
  color: var(--accent);
  transform: translateY(-2px);
  filter: drop-shadow(0 0 6px var(--accent));
}
.socials a:focus-visible { box-shadow: inset 0 0 0 1px var(--faint); }
.socials a:active { transform: scale(0.92); }

.foot-nav {
  justify-self: end;
  appearance: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(243, 243, 240, 0.16);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  cursor: pointer;
  outline: none;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), filter 0.3s var(--ease), transform 0.3s var(--ease);
}
/* Bobs gently while it invites a scroll; flips to point up once you've scrolled. */
.foot-arrow { display: grid; animation: bob 1.8s var(--ease) infinite; }
.scrolled .foot-arrow { animation: none; }
.foot-arrow svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.6s cubic-bezier(0.5, 0, 0.15, 1.35);
}
.scrolled .foot-arrow svg { transform: rotate(180deg); }
.foot-nav:hover, .foot-nav:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent));
}
.foot-nav:active { transform: scale(0.92); }

/* Tight phones: claw back space so everything stays on one line. */
@media (max-width: 360px) {
  :root { --gutter: max(14px, env(safe-area-inset-left)); }
  .site-foot { gap: 8px; }
  .socials a { width: 30px; }
}

:root, [data-theme="galaxy"] { --accent: #9d8cff; }
[data-theme="ember"] { --accent: #ff8a3d; }

/* ---------- below the logo: black for now, stars show through ---------- */

.void { height: 150svh; }

/* ---------- the show: rises out of the dark as the last cubes wink out ---------- */

.show {
  --q: 0;                 /* 0 → 1 as the section reaches centre, set from main.js */
  display: grid;
  place-items: center;
  min-height: 100svh;  /* grows if the episode list ever outgrows the screen */
  padding: 24px var(--gutter) calc(var(--foot-h) + 24px);  /* centre in the space above the footer */
}
.show-inner {
  width: min(88vw, 1100px);
  text-align: center;
  opacity: var(--q);
  transform: translateY(calc((1 - var(--q)) * 48px)) scale(calc(0.94 + var(--q) * 0.06));
  filter: blur(calc((1 - var(--q)) * 12px));
  will-change: transform, opacity, filter;
}
/* A stack of masked layers in CSS 3D: crisp, with chunky sprite-stack depth. */
.show-stage {
  position: relative;
  display: block;
  margin: 0;
  aspect-ratio: 2000 / 282;
  perspective: 1400px;
  cursor: grab;
  touch-action: pan-y;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.show-stage.dragging { cursor: grabbing; }
.show-stage:focus-visible { outline: 1px dashed var(--faint); outline-offset: 18px; border-radius: 6px; }

.show-rig {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}
.layer {
  position: absolute;
  inset: 0;
  -webkit-mask: url("assets/the-show.webp") center / 100% 100% no-repeat;
          mask: url("assets/the-show.webp") center / 100% 100% no-repeat;
}
.layer.front { background: #fff; }
.show-glow { position: absolute; inset: 0; filter: blur(16px); }
.show-glow .layer { background: var(--glowc); }

/* Episode list under the wordmark. Rows share one width so the buttons line up. */
.episodes {
  display: grid;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin: clamp(24px, 4.5vw, 52px) auto 0;
  padding: 0;
  list-style: none;
}
.episode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
}
.ep-title {
  margin: 0;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: left;
  color: var(--fg);
}
.ep-num { color: var(--dim); font-weight: 400; }
.ep-links { flex: none; }
/* Too narrow for one line: the role drops under the names. */
@media (max-width: 760px) {
  .ep-role { display: block; color: var(--dim); font-weight: 400; }
  .ep-comma { display: none; }
}
/* Phones: each episode stacks and centres, with the buttons underneath. */
@media (max-width: 560px) {
  .episodes { gap: 20px; width: 100%; }
  .episode { flex-direction: column; }
  .ep-title { text-align: center; line-height: 1.6; }
  .ep-num, .ep-names { display: block; }
}
.ep-links { gap: 8px; }
.socials.ep-links a {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(243, 243, 240, 0.16);
  opacity: 0.85;
}
.socials.ep-links a:hover, .socials.ep-links a:focus-visible { border-color: var(--accent); }

.show-fallback { display: none; width: 100%; height: auto; }
html:not(.js) .show-fallback { display: block; }
html:not(.js) .show-stage { aspect-ratio: auto; }

:root, [data-theme="galaxy"] { --glowc: rgba(140, 110, 255, 0.85); }
[data-theme="ember"] { --glowc: rgba(255, 120, 40, 0.8); }
html:not(.js) .show { --q: 1; }

@media (prefers-reduced-motion: reduce) {
  .foot-arrow { animation: none; }
}
