/* Self-hosted fonts (SIL Open Font License) */
@font-face { font-family: "Montserrat"; src: url("../fonts/montserrat-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/montserrat-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Archivo Narrow"; src: url("../fonts/archivo-narrow-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo Narrow"; src: url("../fonts/archivo-narrow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
*, *::before, *::after { box-sizing: border-box; }

/* Layout: a full-bleed WebGL stage behind a letterboxed overlay: top bar, star rails down both edges, one content panel bottom-left, bottom status bar. Single dark look by choice. */
:root {
  --void: #070606;        /* black stage */
  --ink: #ece6e1;         /* warm off-white text */
  --smoke: #948a86;       /* secondary text */
  --gold: #ffad2e;        /* LED amber-gold, shared with the rack interface */
  --gold-hot: #ffc566;    /* burn edge / focus */
  --gold-dim: rgba(255, 173, 46, 0.45);
  --logo-white: #ffffff;  /* logo, from logo.psd */
  --logo-gold: #cc9900;
  --panel: rgba(12, 9, 9, 0.8);
  --rule: rgba(236, 230, 225, 0.14);
  --f-logo: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --f-panel: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --panel-h: 196px;       /* fixed panel height, fits the longest scene copy */
  --panel-h-sm: 206px;
  --f-body: "Archivo Narrow", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
html, body { height: 100%; }
body { margin: 0; background: var(--void); color: var(--ink); font-family: var(--f-body); overflow: hidden; }
canvas#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.ui {
  position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
  pointer-events: none;
}
.ui > * { pointer-events: auto; }
.topbar, .bottombar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-inline: max(16px, 2vw); }
.topbar { padding-block: 10px; border-bottom: 1px solid var(--rule); background: linear-gradient(rgba(0,0,0,.85), rgba(0,0,0,.35)); }
.sp-logo { margin: 0; font-family: var(--f-logo); font-size: clamp(18px, 2vw, 24px); line-height: 1; letter-spacing: 0; white-space: nowrap; font-weight: 400; }
.sp-logo .sp-studio { color: var(--logo-white); font-weight: 400; }
.sp-logo .sp-projects { color: var(--logo-gold); font-weight: 700; }
.tools { display: flex; gap: 6px; }
.icon {
  width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--rule); border-radius: 2px;
  background: rgba(0,0,0,.5); color: var(--smoke); cursor: pointer; padding: 0;
}
.icon:hover, .icon[aria-pressed="true"] { color: var(--ink); border-color: var(--smoke); }
.icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.main { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 0; padding-inline: max(12px, 1.6vw); gap: 16px; pointer-events: none; }
.rail { display: flex; flex-direction: column; gap: 12px; pointer-events: auto; }
.star-btn {
  width: 58px; display: grid; justify-items: center; gap: 4px; padding: 8px 0 6px;
  background: rgba(8, 6, 6, .72); border: 1px solid var(--rule); border-radius: 2px; cursor: pointer; color: var(--smoke);
  font: 500 9px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase;
  transition: border-color .25s, color .25s, box-shadow .25s;
}
.star-btn svg { width: 22px; height: 22px; fill: var(--gold); transition: transform .45s cubic-bezier(.2,.8,.2,1), fill .25s, filter .25s; }
.star-btn:hover { color: var(--ink); border-color: var(--gold-dim); }
.star-btn:hover svg { transform: rotate(72deg) scale(1.12); }
.star-btn[aria-current="true"] { color: var(--ink); border-color: var(--gold); box-shadow: 0 0 22px rgba(255,173,46,.3), inset 0 0 12px rgba(255,173,46,.2); }
.star-btn[aria-current="true"] svg { fill: var(--ink); filter: drop-shadow(0 0 6px rgba(255,173,46,.95)); }
.star-btn:focus-visible, .icon:focus-visible { outline: 2px solid var(--gold-hot); outline-offset: 2px; }
.panel {
  grid-column: 2; align-self: end; justify-self: start; margin-bottom: 4vh;
  /* constant size: the box never resizes between scenes, whatever the copy length */
  width: min(500px, 100%); height: var(--panel-h); overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--rule); border-left: 3px solid var(--gold);
  padding: 20px 22px 18px; font-family: var(--f-panel);
  view-transition-name: panel; pointer-events: auto;
}
.eyebrow { margin: 0 0 10px; font: 700 11px/1.2 var(--f-panel); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-variant-numeric: tabular-nums; }
.panel h2 { margin: 0 0 10px; font: 700 26px/1.12 var(--f-panel); letter-spacing: -.01em; text-transform: uppercase; text-wrap: balance; }
.panel p.copy { margin: 0 0 14px; font: 400 15px/1.55 var(--f-panel); color: #cfc7c2; }
.meta { margin: auto 0 0; font: 400 11px/1.4 var(--f-panel); color: var(--smoke); letter-spacing: .04em; }
.bottombar { padding-block: 9px; border-top: 1px solid var(--rule); background: linear-gradient(rgba(0,0,0,.35), rgba(0,0,0,.85)); font: 400 11px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--smoke); }
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.timer { width: 120px; height: 2px; background: var(--rule); position: relative; overflow: hidden; flex: none; }
.timer i { position: absolute; inset: 0; background: var(--gold); transform-origin: left; transform: scaleX(0); }
.play { background: none; border: 0; color: var(--smoke); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; padding: 4px 0; }
.play:hover { color: var(--ink); }
.play:focus-visible { outline: 2px solid var(--gold-hot); outline-offset: 2px; }
.status { position: fixed; inset: auto 0 50% 0; text-align: center; font: 500 11px var(--f-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--smoke); pointer-events: none; transition: opacity .6s; }
.status.done { opacity: 0; }

/* panel swap: old card drops away, new one wipes in from the left with a red edge */
::view-transition-old(panel) { animation: panel-out .32s cubic-bezier(.5,0,.75,0) both; }
::view-transition-new(panel) { animation: panel-in .55s cubic-bezier(.2,.8,.2,1) .12s both; }
@keyframes panel-out { to { opacity: 0; transform: translateY(14px); filter: blur(3px); } }
@keyframes panel-in { from { clip-path: inset(0 100% 0 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
:root { view-transition-name: none; }

@media (max-width: 720px) {
  .main { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto auto; grid-template-areas: ". ." "panel panel" "railL railR"; padding-inline: 16px; gap: 10px 6px; }
  .panel { grid-area: panel; margin-bottom: 0; width: auto; justify-self: stretch; padding: 14px 16px; height: var(--panel-h-sm); }
  .panel h2 { font-size: 21px; }
  .panel p.copy { font-size: 14px; margin-bottom: 8px; }
  .rail { flex-direction: row; gap: 6px; }
  .rail.left { grid-area: railL; justify-self: end; } .rail.right { grid-area: railR; justify-self: start; }
  .star-btn { width: 52px; }
  .bottombar .credit { display: none; }
  .main { padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(panel), ::view-transition-new(panel) { animation-duration: .01s; }
  .star-btn svg { transition: none; }
}
