/* Toga.tv, in one stylesheet.
 *
 * The design system is toga-workspaces' (packages/toga-ui and apps/web): the indigo palette, Barlow,
 * pill-shaped controls with a raised shadow, glass surfaces and the indigo footer with rounded top
 * corners. Its tokens are restated here as custom properties because this app has no build step —
 * a stylesheet that needed compiling would be the one thing that did.
 *
 * Superseded (2026-11-07): the app used to be dark gold-on-black (--accent #d4a24c on #101014),
 * a placeholder palette that predates adopting the design system. */

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/barlow-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/barlow-latin-600.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/barlow-latin-700.woff2") format("woff2");
}

:root {
  /* Design-system palette (toga-ui). */
  --toga-indigo: #323a7b;
  --toga-indigo-deep: #1d2249;
  --toga-indigo-soft: #4c59c3;
  --toga-night: #0e1029;
  --glass: rgb(57 59 75 / 0.9);
  --glass-light: rgb(255 255 255 / 0.1);
  --sheen: linear-gradient(180deg, rgb(255 255 255 / 0.14) 0%, rgb(255 255 255 / 0) 100%);
  --sheen-reversed: linear-gradient(180deg, rgb(255 255 255 / 0) 0%, rgb(255 255 255 / 0.14) 100%);
  --shadow-raised: 0 10px 30px rgb(0 0 0 / 0.35);
  --radius-pill: 24px;
  --radius-card: 12px;
  --radius-footer: 50px 50px 0 0;

  /* Roles, in terms of the palette. Components use these. */
  --ink: #ffffff;
  --muted: #b7bbdb;
  --paper: var(--toga-night);
  --panel: rgb(29 34 73 / 0.72);
  --edge: rgb(255 255 255 / 0.12);
  --accent: #8f9bff;
  --warn: #ff7a70;

  --font: "Barlow", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

/* `hidden` must always win. An element given a display of its own (the off-air card is a grid)
 * otherwise ignores the attribute, and the card showed over a live broadcast. */
[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(80rem 40rem at 50% -10rem, rgb(76 89 195 / 0.35), transparent 70%),
    linear-gradient(180deg, var(--toga-indigo-deep) 0%, var(--toga-night) 32rem);
  background-attachment: fixed;
  color: var(--ink);
  font: 17px/1.55 var(--font);
}

/* --- Header and navigation ------------------------------------------------------------------ */

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  padding: 1rem 1.5rem;
}

.wordmark { display: inline-flex; align-items: center; text-decoration: none; }
.wordmark img { display: block; height: 32px; width: auto; }

nav { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* toga-ui's navigation anchor: a glass pill that gains an indigo ring on hover. */
nav a {
  padding: 0.3rem 0.85rem;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--glass-light);
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 200ms, background 200ms;
}

nav a:hover,
nav a:focus-visible { border-color: var(--toga-indigo-soft); background: rgb(255 255 255 / 0.2); }

a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--toga-indigo-soft); outline-offset: 2px; }

/* --- Layout and type ----------------------------------------------------------------------- */

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 0.5rem; }

small, .muted { color: var(--muted); }

/* --- Forms ---------------------------------------------------------------------------------- */

form { display: grid; gap: 1rem; max-width: 26rem; margin: 1.5rem 0; }
label { display: grid; gap: 0.35rem; font-weight: 600; }

/* Help text sits after its field, outside the label, so the field's name is only its label. Pulled
 * up against the field it describes rather than spaced like the next one. */
form > small { margin-top: -0.65rem; font-weight: 400; }

/* toga-ui's input: a glass pill. */
input,
select {
  padding: 0.65rem 1.25rem;
  background: var(--glass);
  backdrop-filter: blur(40px);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--ink);
  font: 500 1.05rem var(--font);
}

input:focus { border-color: var(--toga-indigo-soft); outline: none; }

/* toga-ui's button: an indigo pill with a sheen and a raised shadow that settles on hover. */
button {
  padding: 0.8rem 1.6rem;
  background: var(--sheen), var(--toga-indigo-deep);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-raised);
  color: #ffffff;
  font: 700 1rem var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 250ms, box-shadow 250ms;
}

button:hover { background: var(--sheen-reversed), var(--toga-indigo); box-shadow: none; }

button:disabled {
  background: var(--sheen), var(--toga-indigo-soft);
  box-shadow: none;
  opacity: 0.6;
  cursor: default;
}

button.secondary {
  background: transparent;
  border: 2px solid var(--edge);
  box-shadow: none;
  color: var(--ink);
}

button.secondary:hover { border-color: var(--toga-indigo-soft); }

/* --- Surfaces ------------------------------------------------------------------------------- */

dialog {
  max-width: 28rem;
  padding: 1.5rem;
  background: var(--toga-indigo-deep);
  color: inherit;
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
}

dialog::backdrop { background: rgb(0 0 0 / 0.6); backdrop-filter: blur(4px); }

dialog button + button { margin-left: 0.5rem; }

.error { color: var(--warn); }

/* The contest panel. Choices are big targets because they are pressed in a ten-second window,
 * often on a phone, often in a hurry. */
#contest {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--panel);
  backdrop-filter: blur(20px);
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
}

.question { font-size: 1.35rem; font-weight: 700; margin-top: 0; }

.choices { display: grid; gap: 0.6rem; }
.choices button { padding: 1rem 1.25rem; text-align: left; text-transform: none; letter-spacing: 0; font-size: 1.1rem; }

/* The channel. Black behind the video so letterboxing reads as part of the picture. */
#player video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
}

#video-status { color: var(--muted); }

/* Off air: the channel is dark between slots — nothing publishes, which is also what keeps it
 * free — so the space the video would take says what comes next instead. */
.offair {
  display: grid;
  place-items: center;
  gap: 0.75rem;
  aspect-ratio: 16 / 9;
  padding: 2rem;
  text-align: center;
  background:
    radial-gradient(30rem 18rem at 50% 30%, rgb(76 89 195 / 0.45), transparent 70%),
    var(--toga-indigo-deep);
  border: 1px solid var(--edge);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-raised);
}

.offair img { width: 96px; height: 96px; }
.offair strong { font-size: 1.6rem; font-weight: 700; }
.offair p { margin: 0; color: var(--muted); }

.answer { font-weight: 700; }
.verdict { color: var(--accent); font-size: 1.15rem; font-weight: 600; }

#countdown { color: var(--muted); font-variant-numeric: tabular-nums; }

ol, ul { padding-left: 1.25rem; }
.podium { font-variant-numeric: tabular-nums; }

/* Draft notices on the legal pages. */
.draft {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-card);
  background: rgb(255 122 112 / 0.12);
  border: 1px solid rgb(255 122 112 / 0.4);
}

/* --- Footer --------------------------------------------------------------------------------- */

/* toga-ui's footer: the indigo slab with rounded top corners. */
footer {
  flex-shrink: 0;
  padding: 2rem 1.5rem 2.5rem;
  background: var(--toga-indigo);
  border-radius: var(--radius-footer);
  color: var(--muted);
  text-align: center;
}

footer p { margin: 0 0 0.75rem; }

footer nav { justify-content: center; }
footer nav a { padding: 0.15rem 0.6rem; font-weight: 500; font-size: 0.9rem; box-shadow: none; }

/* --- Motion --------------------------------------------------------------------------------- */

/* A live game show runs on a countdown, so motion carries meaning here in a way it does not on
 * most sites. Honour the preference anyway: a viewer who asked for less motion still needs to read
 * the timer, and every animation in this app is decorative. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
