/* Pitch Geek components.
   Colors, spacing, radii and control sizes are tokens from tokens.css.
   Text sizes come from the type classes (title-lg, body, data ...): put the
   type class on the element next to the pg- class. */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 24px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
p, h1, h2, h3, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

/* Type: the width axis and numeral style each family is set at */
.title-lg, .title-md, .title-sm { text-wrap: balance; }
.figure-xl { letter-spacing: -0.02em; }
.figure-lg { letter-spacing: -0.01em; }
.pg-num { font-family: var(--font-data); }
.data-sm { font-variant-numeric: tabular-nums; }
.pg-soft { color: var(--ink-soft); }
.pg-nowrap { white-space: nowrap; }

/* Focus: one ring everywhere, offset so it lands on the ground around the control */
:where(a, button, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Mark: the tag around a followed team or club, and nothing else */
.pg-hl { background: var(--mark); color: var(--on-mark); box-shadow: inset 0 0 0 1px var(--signal); border-radius: var(--radius-xs); padding: 1px var(--space-1); margin: 0 -2px; font-weight: 600; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* Wordmark: the name in the mono, after one signal square. Pair with title-sm (bars) or title-lg (openers) */
.pg-wordmark { display: inline-flex; align-items: center; gap: 0.5em; color: var(--ink); font-family: var(--font-data); font-weight: 600; letter-spacing: -0.01em; text-decoration: none; white-space: nowrap; }
.pg-wordmark::before { content: ""; flex: none; width: 0.62em; height: 0.62em; border-radius: var(--radius-xs); background: var(--signal); }

/* Monogram: a club's initials. Stands in for a crest, which Pitch Geek never shows */
.pg-mono { display: inline-grid; place-items: center; flex: none; width: var(--space-6); height: var(--space-6); border-radius: var(--radius-xs); background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); font-family: var(--font-data); font-weight: 500; font-size: 11px; line-height: 1; letter-spacing: -0.02em; }
.pg-mono--lg { width: var(--space-7); height: var(--space-7); font-size: 16px; }
.pg-mono--you { background: var(--mark); color: var(--on-mark); box-shadow: inset 0 0 0 1px var(--signal); }

/* Icons: inline SVG on a 24px grid, 2px round stroke, drawn in the current text color */
.pg-icon { width: var(--space-5); height: var(--space-5); flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-icon--sm { width: var(--space-4); height: var(--space-4); }
.pg-icon--solid { fill: currentColor; stroke: none; }

/* Buttons and links */
.pg-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-4); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink); font-family: inherit; text-decoration: none; cursor: pointer; }
.pg-btn--primary { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.pg-btn--primary:hover, .pg-btn--primary:active { background: var(--signal-deep); border-color: var(--signal-deep); }
.pg-link { color: var(--signal); text-decoration: underline; text-underline-offset: 3px; }
.pg-iconbtn { display: inline-grid; place-items: center; flex: none; width: var(--tap-min); height: var(--tap-min); border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); cursor: pointer; }

/* Top bar */
.pg-topbar { display: flex; align-items: center; gap: var(--space-2); height: var(--bar-height); padding: 0 var(--space-1) 0 var(--space-4); background: var(--sheet); border-bottom: 1px solid var(--rule); }
.pg-topbar--back { padding-left: var(--space-1); }
.pg-topbar__title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pg-topbar__spacer { flex: 1; }

/* Bottom navigation: icon and word together, always */
.pg-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; height: var(--nav-height); background: var(--sheet); border-top: 1px solid var(--rule); }
.pg-nav__item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); min-width: 0; color: var(--ink-soft); text-decoration: none; }
.pg-nav__item[aria-current="page"] { color: var(--signal); }
.pg-nav__item[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 25%; right: 25%; height: 3px; background: var(--signal); border-radius: 0 0 var(--radius-xs) var(--radius-xs); }

/* Filter chips */
.pg-chips { display: flex; gap: var(--space-2); overflow-x: auto; padding: var(--space-1) var(--space-4); scrollbar-width: none; }
.pg-chips::-webkit-scrollbar { display: none; }
.pg-chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: var(--space-1); height: var(--chip-height); padding: 0 var(--space-3); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink); font-family: inherit; white-space: nowrap; cursor: pointer; }
.pg-chip::after { content: ""; position: absolute; inset: calc((var(--chip-height) - var(--tap-min)) / 2) 0; }
.pg-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Search */
.pg-search { display: flex; align-items: center; gap: var(--space-2); height: var(--tap-min); padding: 0 var(--space-3); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink-soft); }
.pg-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font: inherit; }
.pg-search input::placeholder { color: var(--ink-soft); opacity: 1; }
.pg-search:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Tier tags: the three playoff tiers, plus "outside the cut" */
.pg-tier { display: inline-flex; align-items: center; height: var(--space-5); padding: 0 var(--space-2); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--rule-strong); white-space: nowrap; }
.pg-tier--cl { background: var(--tier-cl); color: var(--on-tier-cl); }
.pg-tier--nac { background: var(--tier-nac); color: var(--on-tier-nac); }
.pg-tier--sc { background: var(--tier-sc); color: var(--on-tier-sc); }
.pg-tier--out { background: none; color: var(--ink-soft); }

/* Standings table: mown stripes, a locked team column, cut lines */
.pg-tablewrap { container-type: inline-size; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; }
.pg-tablescroll { overflow-x: auto; }
.pg-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.pg-table th, .pg-table td { height: var(--row-min); padding: var(--space-1) var(--space-2); background: var(--sheet); color: var(--ink); text-align: right; white-space: nowrap; font-weight: inherit; }
.pg-table thead th { height: var(--chip-height); border-bottom: 1px solid var(--rule); color: var(--ink-soft); vertical-align: middle; }
.pg-table thead abbr { text-decoration: none; }
.pg-table tbody tr:nth-child(even of .pg-row) > * { background: var(--band); }
.pg-table .pg-c-team { position: sticky; left: 0; z-index: 1; width: 100%; min-width: var(--team-col); padding-left: var(--space-3); text-align: left; white-space: normal; }
.pg-teamcell { display: flex; align-items: center; gap: var(--space-2); }
.pg-teamcell a { color: inherit; text-decoration: none; }
.pg-teamcell__rank { flex: none; width: 2ch; text-align: right; color: var(--ink-soft); }
.pg-teamcell .pg-mono { display: none; }
.pg-table .pg-c-wide { display: none; }
.pg-table th:last-child, .pg-table td:last-child { padding-right: var(--space-3); }
@container (max-width: 339px) { .pg-table .pg-c-mid { display: none; } .pg-table th, .pg-table td { padding-left: var(--space-1); padding-right: var(--space-1); } .pg-table .pg-c-team { padding-left: var(--space-2); } }
@container (min-width: 420px) { .pg-teamcell .pg-mono { display: inline-grid; } }
@container (min-width: 600px) { .pg-table .pg-c-wide { display: table-cell; } }
.pg-table .pg-cut > td { height: auto; padding: 0; background: var(--sheet); text-align: left; }
.pg-cutline { position: sticky; left: 0; display: inline-flex; align-items: center; gap: var(--space-2); width: 100cqw; padding: var(--space-1) var(--space-3) var(--space-2); border-top: 2px solid var(--ink); color: var(--ink-soft); }

/* Odds cell: a figure over a fixed-width bar, so bars line up down the column */
.pg-odds { display: inline-grid; justify-items: end; gap: var(--space-1); }
.pg-odds__bar { display: block; width: var(--space-7); height: var(--space-1); border-radius: var(--radius-xs); background: var(--band-strong); overflow: hidden; }
.pg-odds__bar > i { display: block; height: 100%; background: var(--signal); }

/* Key under a table: every abbreviation, spelled out */
.pg-key { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); padding: var(--space-2) var(--space-1); color: var(--ink-soft); }
.pg-key b { color: var(--ink); font-weight: 600; }

/* Chance meter: ten cells, like a segment display. Filled cells = chances in ten */
.pg-meter { display: flex; gap: var(--space-1); }
.pg-meter > i { flex: none; width: var(--cell); height: var(--space-3); border-radius: var(--radius-xs); background: var(--band-strong); }
.pg-meter > i.is-on { background: var(--signal); }
.pg-meter--sm { gap: 2px; }
.pg-meter--sm > i { width: var(--space-2); height: var(--space-2); }
.pg-oddsblock { display: grid; gap: var(--space-3); justify-items: start; }
.pg-oddsblock__line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.pg-tag { display: inline-flex; align-items: center; height: var(--space-5); padding: 0 var(--space-2); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--rule-strong); color: var(--ink); white-space: nowrap; }

/* Movement: how far a number moved, and the note that says why */
.pg-move { display: inline-flex; align-items: center; gap: var(--space-1); white-space: nowrap; color: var(--ink); }
.pg-move svg { width: 10px; height: 10px; fill: currentColor; }
.pg-move--down svg { transform: rotate(180deg); }
.pg-note { display: flex; gap: var(--space-2); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--band); color: var(--ink); }
.pg-note--late { color: var(--ink); }
.pg-note--late .pg-icon { color: var(--alert); }

/* Outcome bar: win, draw, loss as one thin bar, figures beside it */
.pg-outcome { display: grid; gap: var(--space-2); }
.pg-outcome__bar { display: flex; gap: 2px; height: var(--space-2); }
.pg-outcome__bar > i { display: block; min-width: var(--space-1); border-radius: var(--radius-xs); }
.pg-outcome__a, .pg-swatch--a { background: var(--side-a); }
.pg-outcome__d, .pg-swatch--d { background: var(--side-draw); }
.pg-outcome__b, .pg-swatch--b { background: var(--side-b); }
.pg-outcome__key { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--space-3); align-items: start; }
.pg-outcome__key > :nth-child(2) { justify-items: center; text-align: center; }
.pg-outcome__key > :nth-child(3) { justify-items: end; text-align: right; }
.pg-outcome__item { display: grid; gap: 0; }
.pg-outcome__name { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--ink-soft); }
.pg-outcome__key > :nth-child(3) .pg-outcome__name { flex-direction: row-reverse; }
.pg-swatch { display: inline-block; flex: none; width: var(--space-2); height: var(--space-2); border-radius: var(--radius-pill); }

/* Trend: a small line in rows, a full chart on the team screen */
.pg-trend { display: block; overflow: visible; }
.pg-trend__line { fill: none; stroke: var(--rule-strong); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-trend__dot { fill: var(--signal); stroke: var(--sheet); stroke-width: 2; }
.pg-chart { display: block; width: 100%; height: auto; overflow: visible; }
.pg-chart__grid { stroke: var(--rule); stroke-width: 1; }
.pg-chart__line { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pg-chart__area { fill: var(--signal); opacity: 0.1; }
.pg-chart__dot { fill: var(--signal); stroke: var(--sheet); stroke-width: 2; }
.pg-chart__ref { stroke: var(--rule-strong); stroke-width: 1; }
.pg-chart__tick { fill: var(--ink-soft); font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 400; }
.pg-chart__label { fill: var(--ink); font-family: var(--font-data); font-size: 14px; font-weight: 600; }
.pg-chart__hit { fill: transparent; }
.pg-chart__hit:hover + .pg-chart__dot, .pg-chart__hit:focus + .pg-chart__dot { stroke: var(--ink); }

/* Heat grid: one club's teams at a glance. Every cell prints its number */
.pg-grid { display: grid; grid-template-columns: minmax(var(--space-7), auto) repeat(var(--pg-cols, 2), 1fr); gap: 2px; align-items: stretch; }
.pg-grid__h { display: flex; align-items: center; justify-content: center; min-height: var(--chip-height); color: var(--ink-soft); }
.pg-grid__h--row { justify-content: flex-start; }
.pg-grid__cell { display: grid; place-items: center; min-height: var(--tap-min); border-radius: var(--radius-xs); text-decoration: none; }
.pg-grid__cell--1 { background: var(--odds-1); color: var(--on-odds-1); }
.pg-grid__cell--2 { background: var(--odds-2); color: var(--on-odds-2); }
.pg-grid__cell--3 { background: var(--odds-3); color: var(--on-odds-3); }
.pg-grid__cell--4 { background: var(--odds-4); color: var(--on-odds-4); }
.pg-grid__cell--5 { background: var(--odds-5); color: var(--on-odds-5); }
.pg-grid__cell--none { color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--rule); }
.pg-scale { display: flex; align-items: center; gap: var(--space-2); color: var(--ink-soft); }
.pg-scale__steps { display: flex; gap: 2px; }
.pg-scale__steps > i { width: var(--space-5); height: var(--space-3); border-radius: var(--radius-xs); }

/* Lists: team rows and match rows. Ruled, never striped; stripes belong to tables */
.pg-list { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; }
.pg-list > * + * { border-top: 1px solid var(--rule); }
.pg-teamrow { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: var(--space-3); min-height: calc(var(--tap-min) + var(--space-5)); padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); color: var(--ink); text-decoration: none; }
.pg-teamrow__main, .pg-teamrow__fig { display: grid; min-width: 0; }
.pg-teamrow__fig { justify-items: end; text-align: right; }
.pg-teamrow .pg-icon { color: var(--ink-soft); }
.pg-match { display: grid; grid-template-columns: var(--space-7) 1fr auto; align-items: center; gap: var(--space-3); min-height: calc(var(--tap-min) + var(--space-5)); padding: var(--space-3) var(--space-4); color: var(--ink); text-decoration: none; }
.pg-match__when { color: var(--ink-soft); }
.pg-match__teams { display: grid; gap: var(--space-1); min-width: 0; }
.pg-match__fig { display: grid; justify-items: end; text-align: right; }
.pg-match__score { display: grid; gap: var(--space-1); justify-items: end; }
.pg-match__late { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--alert); white-space: nowrap; }

/* Status: freshness stamp, sample banner, empty, loading, error */
.pg-stamp { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--ink-soft); }
.pg-stamp--late { color: var(--alert); }
.pg-sample { padding: var(--space-2) var(--space-4); background: var(--ink); color: var(--paper); text-align: center; }
.pg-empty { display: grid; justify-items: start; gap: var(--space-3); padding: var(--space-7) var(--space-4); }
.pg-skel { display: block; height: var(--space-4); border-radius: var(--radius-xs); background: var(--band-strong); }
.pg-skel--short { width: 40%; }
.pg-skel--mid { width: 70%; }

/* Layout: the phone screen, sections, and the desktop frame */
.pg-app { display: flex; flex-direction: column; min-height: 100%; background: var(--paper); }
.pg-app__body { flex: 1; min-height: 0; overflow-y: auto; }
.pg-screen { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-4) var(--space-6); }
.pg-screen--wide { max-width: 1080px; }
.pg-head { display: grid; gap: var(--space-2); padding: var(--space-5) 0 var(--space-4); }
.pg-head__row { display: flex; align-items: center; gap: var(--space-3); }
.pg-section { display: grid; gap: var(--space-3); padding-top: var(--space-5); }
.pg-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.pg-stack { display: grid; gap: var(--space-3); }
.pg-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.pg-stage { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-5); padding: var(--space-4); }
.pg-stage--col { flex-direction: column; }
.pg-phone { width: 100%; max-width: 358px; }
.pg-screen > .pg-chips { margin-left: calc(var(--space-4) * -1); margin-right: calc(var(--space-4) * -1); }
@media (min-width: 600px) { .pg-screen { padding-left: var(--space-5); padding-right: var(--space-5); } .pg-screen > .pg-chips { margin-left: calc(var(--space-5) * -1); margin-right: calc(var(--space-5) * -1); padding-left: var(--space-5); padding-right: var(--space-5); } }
@media (prefers-reduced-motion: no-preference) { .pg-btn, .pg-chip { transition: background-color 0.12s, border-color 0.12s; } }

/* Meter list: several chances, one per named row, bars aligned */
.pg-meterlist { display: grid; grid-template-columns: auto minmax(var(--space-7), 1fr) auto; align-items: center; gap: var(--space-3); }
.pg-meterlist__bar { display: block; height: var(--space-2); border-radius: var(--radius-xs); background: var(--band-strong); overflow: hidden; }
.pg-meterlist__bar > i { display: block; height: 100%; background: var(--signal); }
.pg-meterlist__fig { min-width: 3ch; text-align: right; }

/* Facts: two or three plain figures in a ruled row */
.pg-facts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.pg-facts__item { display: grid; }

/* Footer: the disclaimer and the way to correct us, on every screen */
.pg-foot { display: grid; gap: var(--space-2); margin-top: var(--space-6); padding: var(--space-4) 0; border-top: 1px solid var(--rule); color: var(--ink-soft); }

/* Top bar from 900px: the four destinations as text links */
.pg-topnav { display: flex; align-self: stretch; gap: var(--space-5); margin-left: var(--space-5); }
.pg-topnav a { display: inline-flex; align-items: center; color: var(--ink-soft); text-decoration: none; box-shadow: inset 0 -3px 0 transparent; }
.pg-topnav a[aria-current="page"] { color: var(--signal); box-shadow: inset 0 -3px 0 var(--signal); }

/* One page, two navigations: text links in the top bar from 900px, the bottom bar below it */
.pg-topnav.pg-wideonly { display: none; }
@media (min-width: 900px) { .pg-topnav.pg-wideonly { display: flex; } .pg-narrowonly { display: none; } }
