/* Light Fantastic: a stage-lighting swatchbook. Black stage, tungsten-white type, amber only for the torch;
   everything else takes its colour from the show. */

@font-face {
  font-family: "Big Shoulders Display";
  src: url("/fonts/big-shoulders-display.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --stage: #000000;      /* OLED black: the dark of the venue */
  --riser: #17130e;      /* raised surfaces */
  --rig: #2b251c;        /* rules and outlines */
  --tungsten: #f4ebdc;   /* text, warm like a stage lamp */
  --dimmed: #a0937f;     /* secondary text */
  --amber: #ffb000;      /* the torch, from the app icon */
  --screen: #000000;     /* the colour the screen sequence is showing, set by app.js */

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif-condensed, sans-serif;
  --text: "Atkinson Hyperlegible Next", -apple-system, system-ui, sans-serif;

  --gutter: 16px;
  --bar-h: 60px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--stage);
  color: var(--tungsten);
  font: 400 17px/1.5 var(--text);
  -webkit-tap-highlight-color: transparent;
}
p { margin: 0; }
a { color: var(--tungsten); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.icon { width: 22px; height: 22px; flex: none; }

.view { display: none; }
.view.active { display: block; }

/* ---------- Play ---------- */

#view-play {
  position: fixed; inset: 0;
  padding: calc(var(--safe-top) + 14px) var(--gutter) calc(var(--bar-h) + var(--safe-bottom) + 16px);
  background: var(--screen);
  cursor: pointer;
}
#view-play.active { display: flex; flex-direction: column; }
/* Difference blending keeps the type readable on any colour: white on black, cyan on red, black on white. */
.wordmark, .marquee, .hint {
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.wordmark {
  font: 800 22px/1 var(--display);
  letter-spacing: .01em;
}
.marquee { margin: auto 0 18px; }
.marquee-name {
  font: 900 clamp(72px, 26vw, 200px)/.82 var(--display);
  text-transform: uppercase;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.marquee-name.long { font-size: clamp(56px, 17vw, 150px); }
.marquee-torch {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  font: 700 15px/1.2 var(--text);
}
.play-actions { cursor: default; }
.play-actions .torch-message {
  margin-bottom: 4px; padding: 10px 12px; border-radius: 8px;
  background: rgba(0, 0, 0, .78); color: var(--tungsten); font-size: 15px;
}
.play-actions .torch-message:empty { display: none; }
.play-actions .button:not(.primary) { background: rgba(0, 0, 0, .78); }
.hint { margin-top: 10px; font-size: 13px; }
body.immersive .wordmark,
body.immersive .marquee,
body.immersive .play-actions,
body.immersive .tabbar { display: none; }

/* ---------- Buttons ---------- */

.button {
  font: 700 17px/1 var(--text);
  min-height: 48px; padding: 0 20px; margin: 8px 8px 0 0;
  border-radius: 24px;
  border: 1.5px solid var(--rig);
  background: var(--riser); color: var(--tungsten);
}
.button.primary { background: var(--amber); border-color: var(--amber); color: #000; }
.button[hidden] { display: none; }

/* ---------- Sequences and Settings ---------- */

.page {
  max-width: 640px; margin: 0 auto;
  padding: calc(var(--safe-top) + 20px) 0 calc(var(--bar-h) + var(--safe-bottom) + 24px);
}
.page-title {
  margin: 0 var(--gutter) 12px;
  font: 900 64px/.9 var(--display);
  letter-spacing: -.01em;
}

/* The two lighting channels: what the torch and screen are playing */
.channels {
  position: sticky; top: 0; z-index: 1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 0; padding: calc(var(--safe-top) + 10px) var(--gutter) 12px;
  background: var(--stage);
  border-bottom: 1px solid var(--rig);
}
.channel { min-width: 0; }
.channel dt { display: flex; align-items: center; gap: 6px; color: var(--dimmed); font-size: 14px; }
/* A small lamp lit in the channel's current colour; the rim keeps it visible on black steps */
.lamp {
  width: 12px; height: 12px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 1.5px var(--rig), 0 0 10px currentColor;
}
.channel dd {
  margin: 2px 0 0;
  font: 800 22px/1.05 var(--display);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Each sequence is a gel in the swatchbook: name, colour strip, and which channel it's on */
.gels { list-style: none; margin: 0; padding: 0; }
.gel { padding: 14px var(--gutter) 16px; border-bottom: 1px solid var(--rig); }
.gel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.gel-name { flex: 1; min-width: 0; margin: 0; font: 800 26px/1 var(--display); }
.strip {
  position: relative;
  display: flex; height: 40px;
  border-radius: 6px; overflow: hidden;
  /* Drawn over the colours so all-black sequences still show their edge */
  outline: 1px solid var(--rig); outline-offset: -1px;
}
.strip span { min-width: 1px; }
.playhead {
  position: absolute; top: 0; bottom: 0; left: 0; width: 3px; margin-left: -1.5px;
  display: none;
  background: var(--tungsten);
  box-shadow: 0 0 0 1.5px #000;
}
.playhead[data-for="torch"] { background: var(--amber); }
.gel[data-screen] .playhead[data-for="screen"],
.gel[data-torch] .playhead[data-for="torch"] { display: block; }

.pick {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 40px; padding: 0 12px 0 9px;
  font: 700 15px/1 var(--text);
  border-radius: 20px; border: 1.5px solid var(--rig);
  background: none; color: var(--dimmed);
}
.pick .icon { width: 18px; height: 18px; }
.pick[aria-pressed="true"] { background: var(--tungsten); border-color: var(--tungsten); color: #000; }
.pick[data-target="torch"][aria-pressed="true"] { background: var(--amber); border-color: var(--amber); }

.setting { padding: 20px var(--gutter); border-top: 1px solid var(--rig); }
.setting h2 { margin: 0 0 6px; font: 800 28px/1 var(--display); }
.setting p + p, .setting .button + p { margin-top: 12px; }
.small { font-size: 15px; color: var(--dimmed); }
.small a { color: var(--dimmed); }

/* ---------- Tab bar: the current tab is lit by the show ---------- */

.tabbar {
  position: fixed; inset: auto 0 0; z-index: 2;
  height: calc(var(--bar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex;
  background: var(--stage);
  border-top: 1px solid var(--rig);
}
.tabbar a {
  position: relative;
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--dimmed); text-decoration: none; font-size: 13px; font-weight: 700;
}
.tabbar a[aria-current="page"] { color: var(--tungsten); }
.tabbar a[aria-current="page"]::before {
  content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--screen);
  box-shadow: 0 0 12px var(--screen);
}

#torch-video { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (min-width: 700px) {
  .page-title { font-size: 88px; }
}
