/* Competition hub and archive — FR-DIS-09.
 *
 * Three pages, one stylesheet. Nothing here is per-competition: a
 * federation's colours arrive in the published cards and are applied as
 * swatches, so a new competition is a published object rather than a
 * stylesheet somebody has to edit and re-upload.
 */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1d4ed8;
  --bad: #b91c1c;
  --good: #0a7d32;
  --panel: #f8fafc;
  /* Fills carry white text, so they keep their light-mode depth in both
   * schemes. The TEXT colours above are lightened for dark mode below;
   * a fill that followed them would put white on pale blue. */
  --fill: #1d4ed8;
  --fill-bad: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --fg: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
    --panel: #111b2e;
    /* TR-QA-07. These three were missing, so dark mode painted the links,
     * the errors and the what-if verdicts at 2.6-3.6:1. Each is now at
     * least 6:1 on both the page and the panel (tools/a11y). */
    --accent: #60a5fa;
    --bad: #f87171;
    --good: #4ade80;
  }
}

* { box-sizing: border-box; }

/* The attribute beats any display rule below it. A `label { display:
 * block }` quietly overriding `hidden` has shipped twice in this tree. */
[hidden] { display: none !important; }

body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  margin: 0 auto;
  max-width: 72rem;
  padding: 1.5rem 1rem 4rem;
}

h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
h2:first-of-type { margin-top: 0; }
h3 { font-size: .95rem; margin: 0 0 .5rem; color: var(--muted); }

.lede { color: var(--muted); margin: 0 0 .75rem; max-width: 46rem; }
.note { color: var(--muted); font-size: .85rem; margin: .75rem 0 0; }

nav { display: flex; gap: 1rem; margin: 0 0 1.25rem; }
nav a { color: var(--accent); text-decoration: none; font-weight: 600; }
nav a[aria-current="page"] { color: var(--fg); text-decoration: underline; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: 1rem;
  margin: 0 0 1rem;
}

.settings { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
.settings label { display: grid; gap: .25rem; font-size: .85rem; flex: 1 1 22rem; }
input {
  font: inherit; padding: .4rem .5rem; border-radius: .35rem;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
button {
  font: inherit; font-weight: 600; padding: .45rem .9rem;
  border-radius: .35rem; border: 1px solid var(--fill);
  background: var(--fill); color: #fff; cursor: pointer;
}

.status { margin: 0; flex: 1 1 100%; font-size: .85rem; color: var(--muted); }
.status.ok { color: var(--good); }
.status.error { color: var(--bad); }

.hub { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 60rem) {
  .hub { grid-template-columns: 22rem 1fr; align-items: start; }
}

.fixtures { list-style: none; margin: 0; padding: 0; }
.fixture { border-bottom: 1px solid var(--line); }
.fixture:last-child { border-bottom: 0; }
.fixture > *, .fixture > a {
  display: flex; gap: .5rem; align-items: baseline;
  padding: .45rem 0; color: inherit; text-decoration: none;
}
.fixture > a:hover .sides { text-decoration: underline; }
.sides { flex: 1 1 auto; font-weight: 600; }
.score { font-variant-numeric: tabular-nums; font-weight: 700; }
.when { color: var(--muted); font-size: .85rem; }
.empty { color: var(--muted); padding: .45rem 0; list-style: none; }

.badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  padding: .1rem .35rem; border-radius: .25rem;
}
.badge.live { background: var(--fill-bad); color: #fff; }

/* The caveat is never invisible: no colour here makes it disappear into
 * the background, and it holds its space when empty so a table cannot
 * slide up into where it should have been. */
.caveat {
  margin: 0 0 .75rem;
  min-height: 1.4em;
  font-weight: 600;
  color: var(--fg);
}

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
caption { text-align: left; font-weight: 700; padding: .5rem 0; }
th, td { text-align: right; padding: .35rem .4rem; border-bottom: 1px solid var(--line); }
th:nth-child(2), td:nth-child(2) { text-align: left; width: 40%; }
thead th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.pts { font-weight: 700; }

.swatch {
  display: inline-block; width: .6rem; height: .6rem; border-radius: 50%;
  margin-right: .4rem; vertical-align: baseline;
}

.groups { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 48rem) {
  .groups { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }
}
.group {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: .5rem; padding: .75rem 1rem;
}
/* A round heading: an h2 for the outline, sized as the old h3 was. */
.group h2 { font-size: .95rem; margin: 0 0 .5rem; color: var(--muted); }

.final {
  font-size: 2.5rem; font-weight: 800; margin: 0 0 1rem;
  font-variant-numeric: tabular-nums;
}
.boxes { display: grid; gap: 1rem; }
@media (min-width: 48rem) { .boxes { grid-template-columns: 1fr 1fr; } }

.problems { border-color: var(--bad); }
.problems ul { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--muted); }

/* The what-if page — FR-CLS-08.
 *
 * A verdict is a word before it is a colour. "Through" and "Out" decide
 * a season, and a reader on a projector, in sunlight, or colour-blind
 * must get the same answer as everybody else.
 */
.fixture.choices { display: flex; gap: .75rem; align-items: center;
                   flex-wrap: wrap; padding: .45rem 0; }
.picks { display: flex; gap: .35rem; }
.pick {
  font-size: .78rem; border: 1px solid var(--line); border-radius: .3rem;
  padding: .1rem .45rem; cursor: pointer; white-space: nowrap;
}
.pick.chosen { border-color: var(--accent); color: var(--accent);
               font-weight: 600; }
/* The radio itself is the control a keyboard and a screen reader use; it
 * is small rather than hidden, because `display: none` takes it out of
 * the tab order and out of the accessibility tree with it. */
.pick input { margin-right: .25rem; }

.verdict { text-align: left; white-space: nowrap; }
.verdict .good { color: var(--good); font-weight: 600; }
.verdict .bad { color: var(--bad); font-weight: 600; }
.verdict .muted { color: var(--muted); }

.actions { margin-top: .75rem; }
