/* Self-hosted brand type (SIL OFL 1.1, license files under ../fonts/). */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo/archivo-latin-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo/archivo-latin-ext-standard-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("../fonts/ibm-plex-mono/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF,
    U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url("../fonts/ibm-plex-mono/ibm-plex-mono-latin-ext-500-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --surface-1: #fcfcfb;
  --page-plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-strong: #184f95;
  --seq-r: 37;
  --seq-g: 106;
  --seq-b: 191;
  --head-row-h: 2.4rem;
  --zone-libertadores-grupos: #2a78d6;
  --zone-libertadores-pre: #eb6834;
  --zone-sulamericana: #008300;
  --zone-rebaixamento: #e34948;
  --zone-direct-promotion: #2a78d6;
  --zone-playoff-promotion: #eb6834;
  /* 3rd place in a Libertadores group -- drops to the Sudamericana
     playoffs (a different real outcome from --zone-sulamericana above,
     which is Serie A's OWN Sudamericana berth via table position -- kept
     as a separate token/color on purpose, not reused, even though both
     ultimately mean "Sudamericana"). */
  --zone-group-third: #a3790a;
}

/* Dark palette applies either from the OS preference (when the user hasn't
   picked a theme via the toggle button, i.e. no data-theme attribute) or
   from an explicit data-theme="dark" set by theme.js, which always wins
   over the OS preference in either direction. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-1: #1a1a19;
    --page-plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-strong: #86b6ef;
    --seq-r: 57;
    --seq-g: 135;
    --seq-b: 229;
    --zone-libertadores-grupos: #3987e5;
    --zone-libertadores-pre: #d95926;
    --zone-sulamericana: #008300;
    --zone-rebaixamento: #e66767;
    --zone-direct-promotion: #3987e5;
    --zone-playoff-promotion: #d95926;
    --zone-group-third: #e0ac2e;
  }
}

:root[data-theme="dark"] {
  --surface-1: #1a1a19;
  --page-plane: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-strong: #86b6ef;
  --seq-r: 57;
  --seq-g: 135;
  --seq-b: 229;
  --zone-libertadores-grupos: #3987e5;
  --zone-libertadores-pre: #d95926;
  --zone-sulamericana: #008300;
  --zone-rebaixamento: #e66767;
  --zone-direct-promotion: #3987e5;
  --zone-playoff-promotion: #d95926;
  --zone-group-third: #e0ac2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  line-height: 1.4;
}

.page-header {
  padding: 1.5rem 1rem 0.5rem;
  text-align: center;
}

.page-header h1,
.page-header .brand-title {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* The SEO landing pages need their <h1> for the content title in <main>, so
   the site brand drops to a <p> styled to look exactly like the header <h1>
   it replaces. */
.page-header .brand-title a {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  height: 0.85em;
  width: auto;
  vertical-align: -0.1em;
  margin-right: 0.3em;
  overflow: visible;
}

.subtitle {
  margin: 0;
  color: var(--text-secondary);
}

.page-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem 0;
}

.page-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0.25rem;
  border-bottom: 2px solid transparent;
}

.page-nav a:hover {
  color: var(--text-primary);
}

.page-nav a[aria-current="page"] {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

/* A .page-nav entry with its own submenu (currently just "Jogos" ->
   Próximos/Passados/Simule) -- opens on hover (pure CSS, mouse users) or on
   click/tap (nav.js toggles .is-open, for touch devices that can't hover).
   The trigger is styled through the plain ".page-nav a" rules above (it's
   still a real <a>, just with this class added on top) plus the small
   caret appended here. */
.nav-dropdown {
  position: relative;
  display: flex;
}

/* The trigger stretches to the same height its plain-<a> siblings get from
   .page-nav's flex stretch (the wrapping div above already matches their
   height; without this the <a> inside it stays at its own shorter natural
   height and sits top-aligned, reading as "shifted up" relative to
   Classificação/Evolução), then centers its own text within that height. */
.nav-dropdown-trigger {
  display: flex;
  align-items: center;
}

.nav-dropdown-trigger::after {
  content: "\25BE"; /* ▾ */
  margin-left: 0.35rem;
  /* In rem, not em, since this doesn't share a font-size with anything else
     to multiply against. */
  font-size: 1.105rem;
  position: relative;
  top: 2px;
}

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  /* No gap between the trigger's bottom edge and this menu's top edge --
     top: 100% (no margin) means the two boxes are directly adjacent, so
     :hover on .nav-dropdown never lapses while the mouse crosses from one
     to the other. Breathing room comes from this box's own top padding
     instead of a margin outside it, which would have been a dead zone. */
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 0.35rem 0.35rem;
  min-width: 140px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
}

.nav-dropdown-menu a:hover {
  color: var(--text-primary);
  background: var(--border);
}

.nav-dropdown-menu a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--border);
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* One custom dropdown (button + listbox panel, built by
   competition_picker.js's buildCompetitionSelect) per competition-scoped
   panel on competitions.html (Classificação/Evolução/Próximos/Passados),
   grouped by country once a competition has one -- replaced the old flat
   row of .tabs/.tab-button buttons, which read fine for 2 competitions but
   wouldn't scale once continental expansion adds a dozen+ more (see
   plans/continental_expansion_simulation_backlog.md). NOT a native
   <select>: a native <option> can only ever hold plain text, so there's no
   standard way to show a flag icon next to a competition name inside one.
   Pattern mirrors .team-picker/.team-picker-panel (evolution.js) and
   .nav-dropdown (nav.js), already elsewhere on this site. */
.competition-picker {
  position: relative;
}

.competition-picker-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  min-width: 11rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}

.competition-picker-toggle:hover {
  border-color: var(--accent);
}

/* A plain <select> gets its dropdown affordance (the little native caret)
   for free from the browser -- this custom button doesn't, so it needs its
   own, same idea as .nav-dropdown-trigger::after elsewhere on this site.
   Generated as a real flex item (::after on a
   `display: flex` element participates in the flex layout in every current
   browser), which is also what keeps .competition-picker-current visually
   centered below: flanked by the icon on one side and this caret on the
   other, both roughly the same width, its own `flex: 1; text-align: center`
   ends up centered in the button as a whole rather than just centered
   within whatever space is left after a left-aligned icon. */
.competition-picker-toggle::after {
  content: "\25BE"; /* ▾ */
  flex-shrink: 0;
  font-size: 1.105rem;
  line-height: 1;
  color: var(--text-secondary);
}

.competition-picker-current {
  flex: 1;
  text-align: center;
}

.competition-picker-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 100%;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 0.4rem;
}

.competition-picker-group-label {
  padding: 0.3rem 0.5rem 0.15rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.competition-picker-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  font: inherit;
  text-align: left;
  padding: 0.4rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
}

.competition-picker-option:hover {
  background: var(--page-plane);
}

.competition-picker-option.is-selected {
  font-weight: 600;
  color: var(--accent-strong);
}

/* Shared by both the toggle's own current-selection icon and each option's
   -- a real SVG for Brazil (see competition_picker.js's BR_FLAG_SVG; a
   system's emoji font not mapping the 🇧🇷 flag's regional-indicator-symbol
   pair falls back to showing the raw letters "BR" in a box instead of a
   flag) and a plain emoji span for the CONMEBOL globe (🌎 is one Unicode
   code point, safe everywhere). */
.competition-picker-icon,
.flag-icon {
  width: 20px;
  height: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  line-height: 1;
}

.season-picker,
.date-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.season-picker label,
.date-picker label {
  color: var(--text-secondary);
  font-weight: 600;
}

.select-control {
  font: inherit;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
}

.team-picker {
  position: relative;
}

.team-picker-toggle {
  font: inherit;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}

.team-picker-toggle:hover {
  border-color: var(--accent);
}

#team-picker-count {
  color: var(--text-secondary);
  font-weight: 400;
}

.team-picker-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 260px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 0.4rem;
}

.team-picker-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
}

.team-picker-option:hover {
  background: var(--page-plane);
}

.team-picker-option input {
  flex-shrink: 0;
  accent-color: var(--accent);
}

.team-picker-option img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.team-picker-option span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-picker-option.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
}

/* One Plotly panel per selected team -- the points funnel's small-multiples
   layout (see evolution.js renderPointsFunnel). At most two per row so each
   funnel stays readable; a single column on narrow screens. */
.points-funnel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 720px) {
  .points-funnel-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Key for the funnel's line styles and bands -- one row spanning the grid. */
.points-funnel-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.25rem;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.points-funnel-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Crest + team name centred above each funnel panel -- a plain HTML header
   instead of Plotly's own title, which can't align an image beside text. */
.points-funnel-cell-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  /* Left padding = (Plotly margin.l - margin.r) in evolution.js's funnelLayout,
     so the centred header lines up with the plot area's centre, not the
     panel's. */
  padding: 0.4rem 0 0.1rem 28px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.points-funnel-cell-title img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.table-toggle-button {
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  cursor: pointer;
}

.table-toggle-button:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.table-toggle-button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.chart-card {
  max-width: 1100px;
  margin: 0.5rem auto 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-1);
  padding: 0.5rem;
  overflow-x: auto;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-1);
  margin-top: 1rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}

thead th {
  position: sticky;
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  padding: 0.6rem 0.5rem;
  white-space: nowrap;
  box-sizing: border-box;
  height: var(--head-row-h);
}

/* Two-row grouped header (e.g. "Libertadores" spanning fase de grupos/pré/geral):
   both rows get a fixed height so the second row's sticky offset lines up
   exactly under the first, regardless of font-size differences between them. */
#table-head-row th {
  top: 0;
  border-bottom: 2px solid var(--baseline);
}

#table-head-row th.group-header {
  border-bottom: 1px solid var(--gridline);
}

.sub-header-row th {
  top: var(--head-row-h);
  border-bottom: 2px solid var(--baseline);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

#table-head-row th:first-child,
tbody td.team-cell {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface-1);
  z-index: 1;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable:hover,
th.sortable:focus-visible {
  color: var(--text-primary);
}

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

th.sortable[aria-sort="ascending"],
th.sortable[aria-sort="descending"] {
  color: var(--accent-strong);
}

tbody td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--gridline);
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

.team-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
  /* Transparent by default so every row reserves the same 4px, and only a
     tr.zone-* class (set from the export's already-computed classification
     zone, see app.js's renderTable) needs to override the color -- crests
     stay aligned whether or not a given row has a zone. */
  border-left: 4px solid transparent;
}

.rank-number {
  min-width: 1.5rem;
  text-align: right;
  color: var(--text-muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Classification-zone color bar, inspired by the colored left-border strip
   sports tables commonly use to mark continental/access-playoff/relegation
   cutoffs -- the zone itself is decided server-side
   (src.site.export_site_data), this only maps a zone name to a color. Covers
   both Serie A (libertadores_grupos, libertadores_pre, sulamericana,
   rebaixamento) and Serie B (direct_promotion, playoff_promotion,
   rebaixamento). */
tbody tr.zone-libertadores-grupos td.team-cell {
  border-left-color: var(--zone-libertadores-grupos);
}

tbody tr.zone-libertadores-pre td.team-cell {
  border-left-color: var(--zone-libertadores-pre);
}

tbody tr.zone-sulamericana td.team-cell {
  border-left-color: var(--zone-sulamericana);
}

tbody tr.zone-direct-promotion td.team-cell {
  border-left-color: var(--zone-direct-promotion);
}

tbody tr.zone-playoff-promotion td.team-cell {
  border-left-color: var(--zone-playoff-promotion);
}

tbody tr.zone-rebaixamento td.team-cell {
  border-left-color: var(--zone-rebaixamento);
}

/* Two-row grouped header for the "Números Mágicos" (points-needed) table --
   same look as #table-head-row (sticky top row, group/sub-header borders),
   but deliberately its own id: #table-head-row's own selector also makes
   its first cell `position: sticky; left: 0` (a frozen column, for the wide
   scrolling standings/title-probs tables) -- paired with a `rowspan="2"`
   header cell here, that confused the browser's column-track placement for
   the sub-header row below it. This table is only 5 narrow columns, with
   nothing to freeze against a horizontal scroll in the first place. */
#points-needed-head-row th {
  top: 0;
  border-bottom: 2px solid var(--baseline);
}

#points-needed-head-row th.group-header {
  border-bottom: 1px solid var(--gridline);
}

#points-needed-head-row th:first-child,
.points-needed-table tbody td:first-child {
  text-align: left;
}

.zone-legend[hidden] {
  display: none;
}

.zone-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.2rem;
  margin: 0.75rem 0 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.zone-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.zone-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.zone-legend-swatch.zone-libertadores-grupos {
  background: var(--zone-libertadores-grupos);
}

.zone-legend-swatch.zone-libertadores-pre {
  background: var(--zone-libertadores-pre);
}

.zone-legend-swatch.zone-sulamericana {
  background: var(--zone-sulamericana);
}

.zone-legend-swatch.zone-direct-promotion {
  background: var(--zone-direct-promotion);
}

.zone-legend-swatch.zone-playoff-promotion {
  background: var(--zone-playoff-promotion);
}

.zone-legend-swatch.zone-rebaixamento {
  background: var(--zone-rebaixamento);
}

.crest {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.table-team-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.table-team-header .crest {
  width: 20px;
  height: 20px;
}

.team-name {
  font-weight: 600;
}

/* A .team-name built by CampoAberto.fillTeamName / .teamNameSpans holds the
   full club name and its 3-letter acronym as sibling spans; exactly one
   shows. Full name by default; a narrow layout swaps to the acronym (see
   the max-width: 640px block below for the Série A/B table, and
   bracket.css for the title-prob and group tables). A .team-name that's
   just a text node (match cards, rank page) is unaffected. */
.team-name-abbr {
  display: none;
}

.prob-cell {
  color: var(--text-primary);
}

/* Probability heat map for the pre-rendered landing pages (they have no JS to
   paint it): mirrors app.js's probabilityBackground() -- sequential single-hue
   blue, alpha = p * 0.45 -- but driven by a --p custom property per cell, since
   an inline rgba() can't react to the color scheme. */
td.prob-cell[style*="--p"] {
  background-color: rgba(37, 106, 191, calc(var(--p, 0) * 0.45));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) td.prob-cell[style*="--p"] {
    background-color: rgba(57, 135, 229, calc(var(--p, 0) * 0.45));
  }
}

:root[data-theme="dark"] td.prob-cell[style*="--p"] {
  background-color: rgba(57, 135, 229, calc(var(--p, 0) * 0.45));
}

:root[data-theme="light"] td.prob-cell[style*="--p"] {
  background-color: rgba(37, 106, 191, calc(var(--p, 0) * 0.45));
}

.stat-cell {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Projected final points -- a simulated stat sitting between the real
   classificação numbers and the probabilities, so a left divider sets it
   apart from both. */
.expected-points-cell {
  color: var(--text-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--gridline);
}

.status-cell {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.status-message {
  text-align: center;
  color: var(--text-secondary);
}

.home-intro {
  max-width: 720px;
  margin: 0 auto 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* A plain container, not a link: each card's own "Ver mais" is the one
   clickable element (an <a> can't nest inside another <a>). display:flex +
   column so home-card-more's margin-top:auto pins it to the bottom of the
   card regardless of how tall that card's own preview content is -- the 3
   cards in a row are already stretched to equal height by .home-cards'
   grid, so this keeps every "Ver mais" lined up along the same baseline. */
.home-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-1);
}

.home-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.home-card-title {
  color: var(--accent-strong);
  text-decoration: none;
}

.home-card-title:hover {
  text-decoration: underline;
}

.home-card p {
  margin: 0;
  color: var(--text-secondary);
}

/* Per-card "spoiler" preview (home.js) -- a static-at-load snapshot of that
   page's own data, not a live/auto-updating widget. Sits below the card's
   description paragraph. Grows to fill the remaining space in the card
   (cards in a row are stretched to equal height by .home-cards' grid) and
   bottom-aligns its own content, so the standings table's last row and the
   evolution sparkline's bottom edge land on the same baseline instead of the
   shorter preview leaving a gap above "Ver mais". */
.home-preview {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  justify-content: flex-end;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  min-height: 2.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.home-card-more {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  padding-top: 0.75rem;
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

.home-card-more:hover {
  text-decoration: underline;
}

/* Hidden by home.js when there are no more scheduled matches -- nothing
   left to see more of. */
.home-card-more[hidden] {
  display: none;
}

/* Grid rows instead of a <table>: an HTML table's fixed-layout algorithm
   turned out to size the table wider than its own container whenever the
   explicit column widths + content didn't add up exactly (overflowing past
   the card's edge) -- CSS Grid's `minmax(0, 1fr)` track is the standard,
   more predictable way to give one column the remaining space without that
   footgun, and it also sidesteps the page-wide thead th/tbody td rules
   (meant for #results-table) a <table> here would otherwise inherit. */
.preview-standings-row {
  display: grid;
  grid-template-columns: 1rem minmax(0, 1fr) 1.4rem 1.2rem 1.2rem 1.4rem 1.6rem 1.8rem 1.8rem 2rem;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0;
  font-size: 0.75rem;
}

.preview-standings-head {
  padding-bottom: 0.3rem;
}

.preview-num-label {
  text-align: right;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.preview-rank {
  color: var(--text-muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.preview-team-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  overflow: hidden;
}

.preview-team-cell .crest {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.preview-team {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-weight: 600;
}

.preview-num {
  text-align: right;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* height:152px is a modest bump over the 128px viewBox (see
   renderEvolutionPreview in home.js) -- a floor, not a cap: flex:1 1 auto
   lets the chart grow into whatever extra vertical space .home-preview's
   flex:1 stretch (above) gives it -- e.g. when the evolution card is
   stretched to match a taller standings card in the same row -- instead of
   that space sitting empty above a fixed-size chart pinned to the bottom
   (which left the y-axis looking flattened relative to the box around it).
   preserveAspectRatio="none" on the <svg> already stretches its 220x128
   viewBox non-uniformly to fill whatever box it's given, so a taller box
   here means a taller plotted y-axis, not distortion beyond what the chart
   already does. */
.sparkline {
  display: block;
  width: 100%;
  height: 152px;
  min-height: 152px;
  flex: 0 0 auto;
}

#preview-evolution {
  position: relative;
}

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

/* Hover/focus tooltip for the sparkline (home.js attachSparklineCursor). */
.spark-tooltip {
  position: absolute;
  top: 4px;
  display: grid;
  gap: 0.1rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  white-space: nowrap;
}

.spark-tooltip[hidden] {
  display: none;
}

.spark-tooltip span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.spark-tooltip i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* .home-card p resets margin to 0 for the card's own description text --
   more specific (class+element) than a bare .preview-legend (class-only)
   would be, so this needs the same two-part specificity to actually win. */
.home-card .preview-legend {
  display: flex;
  gap: 0.75rem;
  margin: 1.1rem 0 0;
  font-size: 0.75rem;
}

.preview-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.preview-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.preview-match {
  padding: 0.3rem 0;
}

.preview-match:not(:first-child) {
  border-top: 1px solid var(--border);
}

.preview-match-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.05rem 0;
}

.preview-match-row .crest {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.preview-match-team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-weight: 600;
}

.preview-match-date {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.page-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1.5rem 1rem 2rem;
}

/* Narrow screen: the Série A/B standings table's frozen first column
   (tbody td.team-cell is already position: sticky) collapses to the club's
   3-letter acronym, leaving more of the numeric columns visible before the
   table has to scroll. Same behaviour as the title-prob and group tables
   (bracket.css). The "Time" <th> is short text, left as-is. */
@media (max-width: 640px) {
  tbody td.team-cell .team-name-full {
    display: none;
  }

  tbody td.team-cell .team-name-abbr {
    display: inline;
  }
}

@media (max-width: 480px) {
  /* .theme-toggle is position: fixed, top: 1rem, right: 1rem, 2.25rem wide --
     on a narrow viewport the centered header title/subtitle can run under it.
     Padding both sides (not just right) keeps the text visually centered
     instead of skewing it away from the button. */
  .page-header {
    padding-left: 3.25rem;
    padding-right: 3.25rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .page-nav {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .season-picker,
  .date-picker {
    justify-content: center;
  }

  /* .controls goes column + align-items: stretch here, so .competition-picker
     becomes a full-width block while its toggle button keeps its own
     min-width: 11rem and sits left-aligned inside it -- visually off-centre
     next to the centered season/date pickers. Make the picker a centering
     flex container so the toggle lands in the middle. */
  .competition-picker {
    display: flex;
    justify-content: center;
  }

  .crest {
    width: 22px;
    height: 22px;
  }

  thead th,
  tbody td {
    padding: 0.45rem 0.4rem;
    font-size: 0.85rem;
  }

  .team-picker-panel {
    left: auto;
    right: 0;
    min-width: 220px;
  }
}

/* ---- identity tokens (identidade_visual/tokens.css) --------------------
 * --text-muted / --accent-text below override the equivalents earlier in
 * this file with WCAG AA-corrected values; --font-* are consumed by the
 * @font-face rules at the top of this file.
 */
:root {
  --font-display: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* escala: 1.25 (terça maior), base 16px */
  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;

  /* correções de contraste (WCAG AA para texto = 4.5:1), medidas contra
     --page-plane #f9f9f7 */
  --text-muted: #706e69; /* era #898781 → 3.41:1, agora 4.83:1 */
  --accent-text: #2872cc; /* azul só para TEXTO → 4.56:1 (o #2a78d6 dá 4.19) */
}

/* .brand-title is the header wordmark on the SEO landing pages, where it is a
   <p> instead of an <h1> -- listed here so it gets the same display face. */
h1,
h2,
.wordmark,
.brand-title {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  letter-spacing: 0.012em;
}

/* Todo número tabular passa pelo mono: as colunas de probabilidade alinham
   sozinhas e a vírgula decimal cai sempre no mesmo lugar. `.prob` fica de
   fora -- é só usada dentro do grid 5x5 das figurinhas de placar
   (matches.css), que mantém a fonte original. */
td.num,
th.num,
.axis-label,
time,
code {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Arco de escanteio: o único ornamento. Usar UMA vez por página, no rodapé. */
.corner-arc {
  position: relative;
  overflow: hidden;
}
.corner-arc::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 120px;
  height: 120px;
  border: 3px solid var(--gridline);
  border-radius: 50%;
  transform: translate(50%, 50%);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-text: var(--accent); /* #3987e5 já dá 5.34:1 no escuro */
    --zone-sulamericana: #039203; /* era #008300 → 3.93:1, agora 4.74:1 */
  }
}

:root[data-theme="dark"] {
  --accent-text: var(--accent);
  --zone-sulamericana: #039203;
}

.not-found {
  max-width: 32rem;
  margin: 3rem auto;
  text-align: center;
}

.not-found h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.not-found p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
