/* =============================================================================================
   Field Hockey Match Analyzer — design tokens and components.

   Direction: **light editorial**. Paper ground, one accent, generous whitespace, hairline
   borders, large numerals. The dashboard should read like a well-set printed match report,
   not a bootstrap admin panel.

   Rules this file keeps:
     * Every colour is used through a token. No literal hex outside the token blocks.
     * Light is the designed default and is tuned first. Dark mode is the same tokens under
       prefers-color-scheme, not a second design.
     * AA contrast in both modes. Focus is always visible.
     * No build step, no npm, no framework. Hand-written CSS, system fonts only.
   ============================================================================================= */

:root {
  /* --- colour: light (the designed default) ------------------------------------------- */
  --paper: #faf9f6; /* page ground — warm, so it reads as paper and not as "unstyled" */
  --surface: #ffffff; /* cards and panels sitting on the paper */
  --surface-sunken: #f2f0ea; /* wells, table stripes, code */
  --ink: #16191d; /* body text — ~15:1 on paper */
  --ink-muted: #5b6472; /* secondary text — ~5.6:1 on paper */
  --ink-faint: #767e8b; /* labels, axis ticks — ~4.6:1, still AA for small text */
  --hairline: #e2ded4; /* the border that does most of the work here */
  --hairline-strong: #cec9bc;

  /* static/favicon.svg holds a copy of this value and of its dark counterpart below. A favicon
     is fetched outside any document, so it can never resolve a custom property. Move both. */
  --accent: #0f6d59; /* one strong accent — ~5.9:1 on paper */
  --accent-strong: #0a5344; /* hover/active */
  --accent-wash: #e6f2ee; /* tinted backgrounds */
  --accent-ink: #ffffff; /* text on top of --accent */

  --danger: #a32a25;
  --danger-wash: #fbeceb;
  --warn: #7f5300;
  --warn-wash: #fdf3e0;
  --ok: #1c6b3f;
  --ok-wash: #e8f4ec;

  /* Strava's brand orange, used only where their guidelines call for it. */
  --strava: #fc5200;
  --strava-ink: #ffffff;

  /* The pitch drawing. It has no fill of its own, so --pitch-heat is drawn straight onto
     --surface at 0.52-1.00 opacity and the composited steps are what was validated — which is
     why both of these change with the mode and why they are one decision, not two. */
  --pitch-line: #16191d;
  --pitch-heat: #2a78d6;

  /* --- type ---------------------------------------------------------------------------- */
  --font-display: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;
  --text-4xl: 3rem;
  --text-numeral: 2.75rem; /* the headline numbers on the dashboard */

  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.6;

  /* --- space (4px base) ---------------------------------------------------------------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 6rem;

  /* --- shape --------------------------------------------------------------------------- */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgb(20 25 30 / 6%);
  --shadow-2: 0 6px 24px -12px rgb(20 25 30 / 22%);

  --measure: 34rem; /* comfortable reading width */
  --page-max: 76rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161a;
    --surface: #1b1e23;
    --surface-sunken: #23272e;
    --ink: #eceef1;
    --ink-muted: #a8b0bb;
    --ink-faint: #939ba7;
    --hairline: #2f343c;
    --hairline-strong: #434a54;

    --accent: #4fc0a4;
    --accent-strong: #6fd3ba;
    --accent-wash: #16302a;
    --accent-ink: #0c1a17;

    --danger: #f08a84;
    --danger-wash: #33201f;
    --warn: #e0aa4e;
    --warn-wash: #302713;
    --ok: #6cc48d;
    --ok-wash: #16291d;

    --pitch-line: #ffffff;
    --pitch-heat: #3987e5;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 6px 24px -12px rgb(0 0 0 / 70%);

    color-scheme: dark;
  }
}

/* An explicit toggle wins over the media query, in both directions. */
:root[data-theme="dark"] {
  --paper: #14161a;
  --surface: #1b1e23;
  --surface-sunken: #23272e;
  --ink: #eceef1;
  --ink-muted: #a8b0bb;
  --ink-faint: #939ba7;
  --hairline: #2f343c;
  --hairline-strong: #434a54;
  --accent: #4fc0a4;
  --accent-strong: #6fd3ba;
  --accent-wash: #16302a;
  --accent-ink: #0c1a17;
  --danger: #f08a84;
  --danger-wash: #33201f;
  --warn: #e0aa4e;
  --warn-wash: #302713;
  --ok: #6cc48d;
  --ok-wash: #16291d;
  --pitch-line: #ffffff;
  --pitch-heat: #3987e5;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 6px 24px -12px rgb(0 0 0 / 70%);
  color-scheme: dark;
}

/* =============================================================================================
   Base
   ============================================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
}

p {
  margin: 0 0 var(--space-4);
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--space-6) 0;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-sunken);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

/* One focus treatment, everywhere, and never removed. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -4rem;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  transition: top 120ms ease;
}

.skip-link:focus {
  top: var(--space-3);
}

/* =============================================================================================
   Layout
   ============================================================================================= */

.page {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.main {
  flex: 1;
  padding-block: var(--space-7) var(--space-10);
}

.stack > * + * {
  margin-top: var(--space-4);
}

.stack-lg > * + * {
  margin-top: var(--space-6);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.row-between {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-cards {
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.grid-halves {
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--space-5);
}

.narrow {
  max-width: 30rem;
  margin-inline: auto;
}

/* =============================================================================================
   Masthead & footer
   ============================================================================================= */

.masthead {
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 4rem;
  flex-wrap: wrap;
  padding-block: var(--space-3);
}

.wordmark {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
}

/* The mark. Geometry and its derivation live in templates/_logo.html. */
.wordmark__mark {
  /* In em, so it tracks the wordmark rather than needing its own responsive step. */
  width: 1.35em;
  height: 1.35em;
  flex: 0 0 auto; /* a long lockup on a narrow screen must not squash the square */
  /* .wordmark aligns on the baseline, which is right for its text. An <svg> is an atomic
     inline box whose baseline is its bottom edge, so baseline alignment would hang it above
     the descenders. Align this one child instead of changing the rule for the text. */
  align-self: center;
  fill: none;
  stroke: var(--accent);
  /* Not a taste setting. The two Ds' straight segments are 3.66 units apart and the stroke is
     centred on the path, so the goal mouth between them measures (3.66 - stroke-width): at
     3.66 or above the two shapes fuse and the mark becomes a lozenge. Below about 2.4 the
     arcs get too faint against the serif wordmark. */
  stroke-width: 2.6;
  stroke-linejoin: round;
}

/* "Hockey" recedes so "Match Analyzer" carries the lockup — weight and ink only, same family
   and same size, so both spans keep a common baseline. */
.wordmark__lead {
  font-weight: 400;
  color: var(--ink-muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.nav a {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
}

.nav a:hover {
  color: var(--ink);
  background: var(--surface-sunken);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--accent-wash);
}

.nav__role {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.5rem;
}

.footer {
  border-top: 1px solid var(--hairline);
  padding-block: var(--space-5);
  color: var(--ink-muted);
  font-size: var(--text-sm);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}

.footer p {
  margin: 0;
  max-width: none;
}

/* =============================================================================================
   Page header
   ============================================================================================= */

.page-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  gap: var(--space-4);
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
}

.eyebrow {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin: 0 0 var(--space-1);
  font-weight: 600;
}

.lede {
  font-size: var(--text-lg);
  color: var(--ink-muted);
  max-width: var(--measure);
}

/* =============================================================================================
   Cards, stat tiles, notes
   ============================================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-1);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card__title {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 700;
  margin: 0 0 var(--space-3);
}

.card__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--hairline);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.stat__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 700;
}

.stat__value {
  font-family: var(--font-display);
  font-size: var(--text-numeral);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-top: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.stat__value--missing {
  color: var(--ink-faint);
  font-size: var(--text-2xl);
  font-style: italic;
}

.stat__note {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-top: var(--space-2);
}

.note {
  border-left: 3px solid var(--hairline-strong);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

.note > :last-child {
  margin-bottom: 0;
}

.note--warn {
  border-left-color: var(--warn);
  background: var(--warn-wash);
  color: var(--ink);
}

.note--danger {
  border-left-color: var(--danger);
  background: var(--danger-wash);
  color: var(--ink);
}

.note--accent {
  border-left-color: var(--accent);
  background: var(--accent-wash);
  color: var(--ink);
}

.empty {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-muted);
  background: var(--surface);
}

.empty h2 {
  font-size: var(--text-xl);
  color: var(--ink);
}

.empty p {
  margin-inline: auto;
}

/* =============================================================================================
   Badges
   ============================================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}

.badge--ok {
  background: var(--ok-wash);
  color: var(--ok);
  border-color: transparent;
}

.badge--warn {
  background: var(--warn-wash);
  color: var(--warn);
  border-color: transparent;
}

.badge--danger {
  background: var(--danger-wash);
  color: var(--danger);
  border-color: transparent;
}

.badge--accent {
  background: var(--accent-wash);
  color: var(--accent);
  border-color: transparent;
}

/* =============================================================================================
   Buttons
   ============================================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  padding: 0.7rem var(--space-4);
  min-height: 2.75rem; /* touchline-sized tap target */
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
}

.btn:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.btn--secondary:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--danger:hover {
  background: var(--danger);
  filter: brightness(0.9);
  color: #fff;
}

.btn--quiet {
  background: transparent;
  color: var(--ink-muted);
  border-color: transparent;
  padding-inline: var(--space-3);
}

.btn--quiet:hover {
  background: var(--surface-sunken);
  color: var(--ink);
}

.btn--small {
  font-size: var(--text-xs);
  padding: 0.4rem var(--space-3);
  min-height: 2rem;
}

.btn--block {
  width: 100%;
}

/* Strava's guidelines: the connect control links to their authorize URL, uses their orange at
   the documented 48 px height, and never implies Strava built or endorsed this app. See
   PLAN.md §8.3 — the official button asset should replace this markup before API approval. */
.btn--strava {
  background: var(--strava);
  color: var(--strava-ink);
  min-height: 48px;
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
}

.btn--strava:hover {
  background: var(--strava);
  filter: brightness(0.92);
  color: var(--strava-ink);
}

.strava-attribution {
  display: block;
  height: 24px;
  width: auto;
  margin-top: var(--space-4);
}

/* =============================================================================================
   Forms
   ============================================================================================= */

.field {
  display: block;
  margin-bottom: var(--space-4);
}

.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.field__hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin-top: var(--space-2);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  padding: 0.65rem var(--space-3);
  min-height: 2.75rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 2rem;
}

.checkbox {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.checkbox input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  flex: none;
}

fieldset {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin: 0 0 var(--space-4);
}

legend {
  font-size: var(--text-sm);
  font-weight: 700;
  padding-inline: var(--space-2);
}

.form-errors {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-5);
  border-left: 3px solid var(--danger);
  background: var(--danger-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink);
  font-size: var(--text-sm);
}

.form-errors ul {
  margin: 0;
  padding-left: var(--space-4);
}

.form-errors p {
  margin: 0 0 var(--space-2);
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* =============================================================================================
   Flash messages
   ============================================================================================= */

.flashes {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--text-sm);
  background: var(--surface-sunken);
  border-left: 3px solid var(--hairline-strong);
  color: var(--ink);
}

.flash--success {
  background: var(--ok-wash);
  border-left-color: var(--ok);
}

.flash--error {
  background: var(--danger-wash);
  border-left-color: var(--danger);
}

.flash--warning {
  background: var(--warn-wash);
  border-left-color: var(--warn);
}

.flash--info {
  background: var(--accent-wash);
  border-left-color: var(--accent);
}

/* =============================================================================================
   Tables
   ============================================================================================= */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th,
td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-weight: 700;
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.numeric,
th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

caption {
  caption-side: top;
  text-align: left;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 0 var(--space-4) var(--space-3);
}

/* =============================================================================================
   Maps
   ============================================================================================= */

.map {
  height: 26rem;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface-sunken);
  z-index: 0; /* keep Leaflet's panes under the masthead */
}

.map--small {
  height: 12rem;
}

.map-toolbar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

/* The pitch editor's address search. Satellite imagery has no place names to steer by, so this
   is how an admin gets to a club they have not visited. */
.map-search {
  margin-bottom: var(--space-4);
}

.map-search__row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}

.map-search__row input {
  flex: 1 1 16rem;
  min-width: 0;
}

.map-search .field__hint {
  margin-top: var(--space-2);
}

/* Bounded on purpose: eight results should never push the map itself off the screen. */
.search-results {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  max-height: 13rem;
  overflow-y: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-results li + li {
  border-top: 1px solid var(--hairline);
}

.search-results__choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.search-results__choice:hover {
  background: var(--accent-wash);
}

.search-results__choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

#search-status {
  margin-top: var(--space-3);
}

.leaflet-container {
  font: inherit;
  background: var(--surface-sunken);
}

/* =============================================================================================
   Utilities
   ============================================================================================= */

.muted {
  color: var(--ink-muted);
}

.faint {
  color: var(--ink-faint);
}

.numeric {
  font-variant-numeric: tabular-nums;
}

.missing {
  color: var(--ink-faint);
  font-style: italic;
}

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.mt-0 {
  margin-top: 0;
}

.mb-0 {
  margin-bottom: 0;
}

.full-measure {
  max-width: none;
}

@media (max-width: 40rem) {
  :root {
    --text-3xl: 1.875rem;
    --text-numeral: 2.25rem;
  }

  /* The masthead reads "Match Analyzer" on a phone, as it did before the lockup. display:none
     drops it from the accessible name too, which is fine — both forms name the destination. */
  .wordmark__lead {
    display: none;
  }

  .page {
    padding-inline: var(--space-4);
  }

  .main {
    padding-block: var(--space-5) var(--space-8);
  }

  .card,
  .stat {
    padding: var(--space-4);
  }

  th,
  td {
    padding: var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Leaflet tooltips used as pitch labels on the locator map. Styled through the tokens so the
   map reads as part of the page rather than as an embedded widget. */
.pitch-label.leaflet-tooltip {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.15rem 0.45rem;
}

.pitch-label.leaflet-tooltip-top::before {
  border-top-color: var(--hairline-strong);
}

/* =============================================================================================
   Charts

   Server-rendered inline SVG from app/viz.py. Everything below is styling only — no geometry,
   no scales. Text wears the page's ink tokens rather than the series colour, so a value is
   never carried by colour alone.
   ============================================================================================= */

.chart-wrap {
  position: relative;
  overflow-x: auto;
}

.chart {
  width: 100%;
  height: auto;
  display: block;
  --series: #2a78d6; /* blue 450 — validated against the light chart surface */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chart {
    --series: #3987e5; /* blue 400, stepped for the dark surface */
  }
}

:root[data-theme="dark"] .chart {
  --series: #3987e5;
}

.chart__line {
  fill: none;
  stroke: var(--series);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Recessive: the grid orients the reader, it does not compete with the data. */
.chart__grid {
  stroke: var(--hairline);
  stroke-width: 1;
}

.chart__tick,
.chart__band-label {
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--ink-faint);
}

.chart__band-label {
  font-weight: 600;
  letter-spacing: 0.04em;
}

.chart__value {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  fill: var(--ink);
}

.chart__missing {
  font-family: var(--font-sans);
  font-size: 11px;
  font-style: italic;
  fill: var(--ink-faint);
}

.chart__band {
  fill: var(--accent);
  opacity: 0.05;
}

.chart__band--break {
  fill: var(--ink-faint);
  opacity: 0.06;
}

/* Half-time is drawn differently from the short breaks on purpose: it is five times longer and
   the recovery across it is not comparable to theirs. */
.chart__band--halftime {
  fill: var(--ink-faint);
  opacity: 0.12;
}

.chart__band--gap {
  fill: var(--warn);
  opacity: 0.14;
}

.chart__track {
  fill: var(--surface-sunken);
}

.chart__bar {
  /* 4px rounded data-end, anchored to the baseline; fill is set per bar from the ordinal ramp */
  stroke: var(--surface);
  stroke-width: 2; /* the 2px surface gap between adjacent fills */
}

.chart__crosshair {
  stroke: var(--ink-faint);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.chart-tooltip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  padding: 0.2rem 0.5rem;
  font-size: var(--text-xs);
  white-space: nowrap;
  pointer-events: none;
}

/* =============================================================================================
   Pitch heatmap

   The pitch is a line drawing, not a green rectangle: no turf fill, so the card shows through
   and the whole drawing follows the mode like everything else here. That is what makes the
   markings mode-dependent — white lines only read against something dark — and it is what the
   ramp is validated against, because what the eye sees is --pitch-heat composited onto
   --surface, never the token on its own. Both modes pass the ordinal checks (monotone
   lightness, adjacent ΔL >= 0.06, single hue, light end 2.04:1 light / 2.19:1 dark); giving the
   pitch a fill again, or restyling --surface, invalidates that and means re-running the checker.
   ============================================================================================= */

.pitch-wrap {
  display: flex;
  justify-content: center;
}

.pitch {
  width: 100%;
  height: auto;
}

.pitch__line,
.pitch__goal {
  fill: none;
  stroke: var(--pitch-line);
}

.pitch__grid {
  fill: none;
  stroke: var(--pitch-line);
  stroke-opacity: 0.28;
}

/* The key's swatches are the cells' own fill at the cells' own opacities, so the key composites
   against the same surface the cells do. */
.pitch__cell,
.pitch__key {
  fill: var(--pitch-heat);
}
