/* Floodlights. Existing route and navigation state select the same colour pair. */
@media (forced-colors: none) {
  :root,
  html[data-section="ratings"],
  :is([data-page="ratings"],[data-app-page="ratings"],[data-browser-category="domestic"],[data-browser-kind="domestic"],[data-kind="domestic"]) {
    --section-light: #2453a7;
    --section-dark: #8fb9ff;
  }
  html[data-section="ratings"]:has(#ratings[data-app-view="performance"]) {
    --section-light: #1a5993; --section-dark: #85c2ee;
  }
  html[data-section="ratings"]:has(#ratings[data-app-view="projections"]) {
    --section-light: #325a70; --section-dark: #99c6c8;
  }
  html[data-section="ratings"]:has(#ratings[data-app-view="fixtures"]) {
    --section-light: #315796; --section-dark: #a0c0f4;
  }
  html[data-section="competitions"],
  :is([data-page="competitions"],[data-app-page="competitions"],[data-browser-category="european"],[data-browser-kind="european"],[data-kind="european"]) {
    --section-light: #49624c;
    --section-dark: #aec9ad;
  }
  html[data-section="global"],
  :is([data-page="global"],[data-app-page="global"],[data-browser-category="supremacy"],[data-browser-kind="supremacy"],[data-kind="supremacy"]) {
    --section-light: #006a60;
    --section-dark: #6bd8c1;
  }
  html[data-section="international"],
  html[data-section="global"]:has(#global [data-global-mode="international"][aria-pressed="true"]),
  :is([data-page="international"],[data-app-page="international"],[data-browser-category="international"],[data-browser-kind="international"],[data-kind="international"]) {
    --section-light: #70612b;
    --section-dark: #ddcc7e;
  }
  /* The active Supremacy icon follows the team type selected on that page. */
  html[data-section="global"] :is([data-page="global"], [data-app-page="global"]) {
    --section-light: inherit;
    --section-dark: inherit;
  }
  html[data-section="predict"],
  :is([data-page="predict"],[data-app-page="predict"],[data-browser-category="predict"],[data-browser-kind="predict"]) {
    --section-light: #895244;
    --section-dark: #dfb6a8;
  }
  html[data-section="predict"]:has([data-team-mode="international"][aria-pressed="true"]) {
    --section-light: #795b3d;
    --section-dark: #dbbe9f;
  }
  html:is([data-section="explore"],[data-section="welcome"]) {
    --section-light: #365978;
    --section-dark: #a5c9ee;
  }
  html[data-section="method"] { --section-light: #54602c; --section-dark: #b8cc83; }
  html[data-current-page="creator"] { --section-light: #525f52; --section-dark: #bfcea9; }
  html[data-current-page="faqs"] { --section-light: #326441; --section-dark: #98d19c; }
  html[data-current-page="terms"] { --section-light: #4c6326; --section-dark: #aed57c; }
  html:has(body.feedback-page) { --section-light: #506075; --section-dark: #c6d0db; }

  html[data-theme], html[data-theme] body[data-palette] {
    --bg: var(--brand-paper);
    --panel: #fff;
    --ink: #172a47;
    --muted: #455b70;
    --sidebar: #132b43;
    --silver: #506075;
    --green: var(--brand-blue-700);
    --on-action: #fff;
  }
  html[data-theme="dark"], html[data-theme="dark"] body[data-palette] {
    --bg: #101419;
    --panel: #151a20;
    --ink: #edf4ff;
    --muted: var(--brand-slate);
    --sidebar: #171c22;
    --silver: #c6d0db;
    --green: var(--brand-blue-300);
    --on-action: #09131f;
  }
  html[data-theme] { background-color: var(--bg) !important; }
  html[data-theme] body[data-palette] {
    --line: color-mix(in srgb, var(--ink) 17%, var(--panel));
    --control-edge: color-mix(in srgb, var(--silver) 82%, var(--panel));
    --section-fill: var(--section-dark);
    --page-accent: var(--green);
    --page-heading: var(--green);
    --lime: var(--section-dark);
    --focus: var(--green);
    --action: var(--green);
    --action-hover: color-mix(in srgb, var(--green) 85%, var(--ink));
    --soft: color-mix(in srgb, var(--green) 7%, var(--panel));
    --column: color-mix(in srgb, var(--green) 12%, var(--panel));
    --selected: var(--column);
    --on-selected: var(--green);
    --surface: var(--panel);
    --surface-muted: var(--soft);
    --surface-control: var(--panel);
    --surface-hover: var(--column);
    --table-row: var(--panel);
    --table-heading: var(--soft);
    --table-heading-ink: var(--ink);
    --table-rule: var(--line);
    --table-selected: var(--column);
    --table-row-hover: var(--soft);
    --table-accent: var(--green);
    --table-bar: color-mix(in srgb, light-dark(var(--section-light),var(--section-dark)) 55%, var(--panel));
    --table-track: var(--line);
    --matchday-navigation: var(--sidebar);
    --matchday-navigation-hover: color-mix(in srgb, var(--sidebar) 83%, #c6d0db);
    --matchday-edge: color-mix(in srgb, var(--sidebar) 57%, #c6d0db);
    --matchday-white: #edf4fa;
    --matchday-muted: #c6d0db;
    --matchday-nav-selected: var(--selected);
    --matchday-nav-selected-ink: var(--on-selected);
    --matchday-nav-selected-accent: var(--green);
    background-color: var(--bg);
    color: var(--ink);
  }
  html[data-theme] #site-navigation {
    --matchday-nav-selected: color-mix(in srgb, var(--section-dark) 17%, var(--matchday-navigation));
    --matchday-nav-selected-ink: #edf4fa;
    --matchday-nav-selected-accent: var(--section-dark);
  }

  /* Both national-team views use the same pale selections and gold lettering. */
  html[data-theme="light"]:is([data-section="international"], [data-section="global"]:has(#global [data-global-mode="international"][aria-pressed="true"])) body[data-palette] {
    --selected: #f2ecd2;
    --column: #f5f0dc;
    --soft: #faf8ef;
    --nav-active-fill: var(--selected);
    --action: #dece88;
    --action-hover: #d2bf73;
    --on-action: #342f1c;
  }
  html[data-theme="light"][data-table-navigation]:is([data-section="international"], [data-section="global"]:has(#global [data-global-mode="international"][aria-pressed="true"])) body[data-palette] #main
  :is(.competition-view-tabs > button[aria-current="page"], .supremacy-team-selector > button[aria-pressed="true"], :is(#strength-table, #global-table, .snapshot-table) thead th:is(.main-metric, [aria-sort="ascending"], [aria-sort="descending"])) {
    border-bottom-color: #8c783b;
  }
  html[data-theme] #site-navigation #primary-nav button[data-page] > svg,
  html[data-theme] #site-navigation .brand .logo-mark { color: var(--section-dark); }
  html[data-theme] body[data-palette] #main .journey-navigation :is(button,a) {
    color: var(--ink);
    background-color: var(--panel);
    border-color: var(--line);
  }
  html[data-theme][data-table-navigation] body[data-palette] #main .table-heading-controls {
    background-color: var(--soft);
    box-shadow: none;
  }

  /* Each selected tab supplies its own underline. Keep the surrounding space. */
  html[data-theme] body[data-palette] #main #explore.competition-browser .browser-categories,
  html[data-theme] body[data-palette] #main .tabs {
    border-bottom-color: transparent;
  }

  html[data-theme][data-table-navigation] body[data-palette] #main #ratings .table-shell > .view-intro {
    border-top-color: transparent;
  }

  /* Sticky headings use the cell border, including the selected column colour. */
  html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings, #global) :is(#strength-table, #global-table, .snapshot-table) > thead th,
  html[data-theme] body[data-palette] :is(#main, dialog) :is(.history-table, .chart-values, .chart-values table) > thead th,
  html[data-theme] body[data-palette] :is(.history-table, .chart-values, .chart-values table) > thead {
    box-shadow: none;
  }
  @media (min-width: 761px) {
    html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings, #global) :is(#strength-table, #global-table, .snapshot-table) > thead {
      box-shadow: 0 -3px 0 var(--panel);
    }
    /* Cover fractional-pixel seams while the controls and the table header
       are composited as independent sticky layers. */
    html[data-theme][data-table-navigation] body[data-palette] #main .table-heading-controls {
      border-radius: 0;
      box-shadow: 0 -2px 0 var(--soft), 0 2px 0 var(--soft);
    }
  }

  /* A chart heading already draws the top edge of its card. */
  html[data-theme] body[data-palette] :is(.club-chart-section:has(> .chart-heading:first-child), .team-radar:has(> .radar-heading:first-child)) {
    border-top-color: transparent;
  }

  html[data-theme][data-table-navigation] body[data-palette] #main .table-heading-controls .table-heading-view {
    color: var(--green);
  }
  html[data-theme] body[data-palette] #main :is(.table-tools,.table-settings,.global-table-toolbar) { background: var(--panel); }
  html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings,#global) .table-shell td.main-metric {
    background-color: var(--column);
    color: var(--green);
  }
  html[data-theme] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) :is(td.main-metric .score,th.main-metric) { color: var(--green); }
  html[data-theme] body[data-palette] #main :is(#strength-table,#global-table,.snapshot-table) .main-metric .bar i { background: light-dark(var(--section-light),var(--section-dark)); }
  html[data-theme][data-table-navigation] body[data-palette] #main :is(#ratings,#global) {
    --sp-fill: var(--selected);
    --sp-ink: var(--ink);
    --sp-text: var(--muted);
    --sp-border: var(--control-edge);
    --sp-input: var(--panel);
    --sp-muted: var(--soft);
    --sp-active: var(--green);
  }
  html[data-theme][data-table-navigation] body[data-palette] #main #ratings .performance-column-switch {
    --pc-fill: var(--selected);
    --pc-off: var(--muted);
    --pc-surface: var(--soft);
    --pc-border: var(--control-edge);
  }
  html[data-theme] body[data-palette] #main .collection-menu-toggle {
    background: var(--action);
    border-color: var(--action);
    color: var(--on-action);
  }

  /* Explore and its pickers render several destinations on the same page. */
  html[data-theme] body[data-palette] #main #explore.competition-browser,
  html[data-theme] body[data-palette] .competition-picker[data-kind],
  html[data-theme] body[data-palette] #main #explore [data-browser-category],
  html[data-theme] body[data-palette] #main #explore .browser-accordion-section[data-kind] {
    --browser-accent: light-dark(var(--section-light), var(--section-dark));
    --category-ink: var(--browser-accent);
    --category-tint: color-mix(in srgb, var(--category-ink) 12%, var(--panel));
    --browser-tint: var(--category-tint);
    --browser-surface: color-mix(in srgb, var(--browser-accent) 6%, var(--panel));
  }
  html[data-theme] body[data-palette] #main #explore .browser-accordion-heading :is(.browser-accordion-icon,strong),
  html[data-theme] body[data-palette] #main #explore .browser-category svg { color: var(--category-ink); }
  html[data-theme] body[data-palette] #main #explore .browser-category[aria-pressed=true] svg { color: inherit; }

  @media (max-width:760px) {
    html[data-theme][data-table-navigation] body[data-palette] .app-bottom-nav:not([hidden]) {
      background: var(--panel);
      border-top-color: transparent;
    }
    html[data-theme][data-table-navigation] body[data-palette] .app-bottom-nav button[data-app-page] {
      --dock-accent: light-dark(var(--section-light), var(--section-dark));
      --matchday-nav-selected-accent: var(--dock-accent);
      --matchday-nav-selected: color-mix(in srgb, var(--dock-accent) 12%, var(--panel));
      --matchday-nav-selected-ink: var(--dock-accent);
      color: var(--muted);
    }
    html[data-theme][data-table-navigation] body[data-palette] .app-bottom-nav button[data-app-page]:not([aria-current=page]):is(:hover,:active) { color: var(--ink); }
    html[data-theme][data-table-navigation] body[data-palette] .app-bottom-nav button[data-app-page][aria-current=page] {
      color: var(--matchday-nav-selected-ink);
      box-shadow: none;
    }
  }
  html[data-theme] body[data-palette] #main > .prose :is(h1,h2) { color: var(--green); }
  html[data-theme] .feedback-page .feedback-intro h1 { color: var(--green); }
}
