/* Page styles. Colour variables live in styles.css; team colours come from
   charts.css (the pdh-/pda- classes set --pd-h and --pd-a for graphics,
   --pd-ht and --pd-at for text: WCAG AA on the panel colour). */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }
body {
	min-height: 100svh;
	background: var(--pd-bg);
	color: var(--c-lt);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
}
a { color: inherit; }
[hidden] { display: none !important; }

/* Layout grid from the 2025 prototype (brdj-): a contained column with
   flared and full-bleed tracks either side. */
:root {
	--brdj-full-offset: 1rem;
	--brdj-flared-offset: 1rem;
	--brdj-flared-width: 1920px;
	--brdj-con-width: 1440px;
	--brdj-full: minmax(var(--brdj-full-offset), 1fr);
	--brdj-con: min(calc(100% - ((var(--brdj-full-offset) + var(--brdj-flared-offset)) * 2)), var(--brdj-con-width));
	--brdj-flared: minmax(0, calc((var(--brdj-flared-width) - var(--brdj-con-width)) * 0.5));
}
.brdj-primary {
	display: grid;
	grid-template-columns:
		[full-start] var(--brdj-full)
		[flared-start] var(--brdj-flared)
		[contained-start] var(--brdj-con) [contained-end]
		var(--brdj-flared) [flared-end]
		var(--brdj-full) [full-end];
}
.brdj-primary > * { grid-column: contained; }
.brdj-primary > .brdj-full { grid-column: full; }

/* Site header. */
.site { border-bottom: 1px solid var(--pd-line); background: var(--pd-panel); }
.site .bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; }
.site-nav { margin-left: auto; font-size: .85rem; }
.site-nav a { color: var(--pd-muted); text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--c-lt); text-decoration: underline; }
.wordmark { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem; text-decoration: none; }
.wordmark img { width: 28px; height: 28px; }
.live { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--pd-muted); display: inline-flex; align-items: center; gap: .4rem; }
.live:empty { display: none; }
.live::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--pd-muted); }
.live.on { color: var(--c-lt); }
.live.on::before { background: var(--c-r); box-shadow: 0 0 0 3px rgb(237 51 64 / .25); }
.live.off::before { background: var(--c-dy); }

/* Scoreboard: away left, home right, team colours from --pd-a / --pd-h. */
.score-wrap { margin: 1rem 0; }
.sb {
	display: grid;
	grid-template-columns: 1fr auto minmax(8rem, auto) auto 1fr;
	align-items: center;
	gap: .75rem 1.25rem;
	padding: 1rem 1.25rem;
	background: var(--pd-panel);
	border: 1px solid var(--pd-line);
	border-radius: 10px;
	border-left: 6px solid var(--pd-a);
	border-right: 6px solid var(--pd-h);
	font-variant-numeric: tabular-nums;
}
.sb-team { display: grid; gap: .1rem; }
.sb-home { justify-items: end; text-align: right; }
.sb-abbr { font-size: clamp(1.6rem, 4vw, 2.6rem); font-weight: 900; letter-spacing: -.02em; line-height: 1; }
.sb-away .sb-abbr { color: var(--pd-at); }
.sb-home .sb-abbr { color: var(--pd-ht); }
.sb-name { color: var(--pd-muted); font-size: .9rem; }
.sb-sog { color: var(--pd-muted); font-size: .8rem; }
.sb-score { font-size: clamp(2.4rem, 7vw, 4.2rem); font-weight: 900; line-height: 1; min-width: 1.2ch; text-align: center; }
.sb-mid { display: grid; justify-items: center; gap: .2rem; text-align: center; }
.sb-status { font-size: 1.1rem; font-weight: 700; padding: .2rem .6rem; border-radius: 6px; background: var(--pd-line); white-space: nowrap; }
.sb-status.is-live { background: var(--pd-red-text-bg); color: #fff; }
.sb-venue { color: var(--pd-muted); font-size: .8rem; }
.sb-tag { justify-self: start; font-size: .7rem; font-weight: 800; letter-spacing: .06em; padding: .05rem .35rem; border-radius: 4px; background: var(--c-dy); color: #111; }
.sb-home .sb-tag { justify-self: end; }
.sb-stale { grid-column: 1 / -1; text-align: center; color: var(--c-dy); font-size: .9rem; font-weight: 600; margin: .25rem 0 0; padding: .35rem .75rem; border: 1px solid var(--c-dy); border-radius: .4rem; }

/* Game page grid: charts left, feed right; stacked on narrow screens. */
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); gap: 1rem; align-items: start; padding-bottom: 2rem; }
@media (max-width: 960px) { .game-grid { grid-template-columns: minmax(0, 1fr); } }
.game-main { display: grid; gap: 1rem; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: .75rem; }
.tiles > [id$="-away"] { order: -1; } /* away first, as on the scoreboard */
.tiles .pd-chart { background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: 10px; padding: .6rem; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr)); gap: 1rem; }
.panel { background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: 10px; padding: .75rem; min-width: 0; }
.panel figcaption { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--pd-muted); margin-bottom: .4rem; }
.panel-body svg { width: 100%; height: auto; display: block; }
.panel-box .panel-body { overflow-x: auto; }
.chart-err { color: var(--pd-muted); padding: 2rem 0; text-align: center; }

/* Play-by-play feed. */
.game-feed { position: sticky; top: .75rem; display: grid; gap: .5rem; background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: 10px; padding: .75rem; }
.feed-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.feed-head h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pd-muted); }
.chip { font: inherit; font-size: .8rem; color: var(--c-lt); background: transparent; border: 1px solid var(--pd-line); border-radius: 999px; padding: .15rem .7rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--c-lt); color: #111; }
.pill { justify-self: center; font: inherit; font-size: .8rem; font-weight: 700; color: #fff; background: var(--pd-red-text-bg); border: 0; border-radius: 999px; padding: .25rem .8rem; cursor: pointer; }
.feed-box { max-height: calc(100svh - 7rem); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 960px) { .game-feed { position: static; } .feed-box { max-height: 70svh; } }
.feed { list-style: none; display: grid; }
.fr { display: grid; grid-template-columns: 4.6rem 2.6rem 1fr; gap: .5rem; padding: .35rem .25rem; border-top: 1px solid var(--pd-line); font-size: .88rem; font-variant-numeric: tabular-nums; }
.fr:first-child { border-top: 0; }
.fr-time { color: var(--pd-muted); white-space: nowrap; }
.fr-team { font-weight: 800; }
.fr.s-h .fr-team { color: var(--pd-ht); }
.fr.s-a .fr-team { color: var(--pd-at); }
.fr-label { font-weight: 700; }
.fr.k-goal { background: color-mix(in srgb, var(--c-r) 22%, transparent); border-radius: 6px; font-weight: 600; }
.fr.k-goal .fr-label { color: #fff; text-transform: uppercase; letter-spacing: .04em; }
.fr.k-penalty .fr-label { color: var(--c-dy); }
.fr.alert { background: color-mix(in srgb, var(--c-lt) 7%, transparent); border-radius: 6px; }
.fr.alert .fr-label { color: var(--c-ly); }
.fr.retracted .fr-body { text-decoration: line-through; color: var(--pd-muted); }
.feed-box.key-only .fr:not(.key) { display: none; }

/* Games list. */
.slate-page { padding-bottom: 2rem; }
.slate-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin: 1.25rem 0 .75rem; }
.slate-head h1 { font-size: 1.5rem; font-weight: 800; }
.slate-head h1 span { color: var(--pd-muted); font-weight: 500; }
.slate-head nav { display: flex; gap: 1rem; font-size: .9rem; }
.slate-head nav a { color: var(--pd-muted); text-decoration: none; }
.slate-head nav a:hover { color: var(--c-lt); }
.note { color: var(--pd-muted); margin-bottom: .75rem; }
.slate { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: .75rem; }
.slate:empty::before { content: "No games stored for this date."; color: var(--pd-muted); }
.feed:empty::before { content: "No plays yet."; color: var(--pd-muted); display: block; padding: .75rem; }
.card a { display: grid; gap: .3rem; padding: .8rem 1rem; text-decoration: none; background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: 10px; font-variant-numeric: tabular-nums; }
.card a:hover { border-color: var(--pd-muted); }
.card-row { display: grid; grid-template-columns: 3.4rem 1fr auto auto; align-items: center; gap: .5rem; }
.card-abbr { font-size: 1.35rem; font-weight: 900; }
.card-a .card-abbr { color: var(--pd-at); }
.card-h .card-abbr { color: var(--pd-ht); }
.card-name { color: var(--pd-muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-score { font-size: 1.5rem; font-weight: 900; grid-column: 4; }
.card-status { justify-self: start; font-size: .8rem; font-weight: 700; padding: .1rem .5rem; border-radius: 5px; background: var(--pd-line); }
.card-status.is-live { background: var(--c-r); color: #fff; }
.card-stale { color: var(--c-dy); font-size: .75rem; }

/* Overlay builder (GET /overlay). */
.builder { padding-bottom: 2rem; }
.builder-head { margin: 1.25rem 0 .75rem; }
.builder-head h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.ob-grid { display: grid; grid-template-columns: minmax(18rem, 26rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .ob-grid { grid-template-columns: minmax(0, 1fr); } }
.ob-form { display: grid; gap: .9rem; }
.ob-q { display: grid; gap: .9rem; }
.ob-field { display: grid; gap: .3rem; border: 0; min-width: 0; }
.ob-field > label:not(.ob-check), .ob-field legend { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--pd-muted); }
.ob-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .75rem; }
.ob-form input:not([type="checkbox"]), .ob-form select {
	font: inherit; color: var(--c-lt); background: var(--pd-bg); border: 1px solid var(--pd-line);
	border-radius: 6px; padding: .4rem .5rem; min-width: 0; width: 100%;
}
.ob-form input:focus-visible, .ob-form select:focus-visible, .chip:focus-visible { outline: 2px solid var(--c-ly); outline-offset: 1px; }
.ob-check { display: flex; align-items: center; gap: .4rem; font-size: .9rem; cursor: pointer; }
.ob-for { color: var(--pd-muted); font-size: .8rem; }
.ob-help { color: var(--pd-muted); font-size: .85rem; }
.ob-help code, .ob-url { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.ob-out { display: grid; gap: 1rem; min-width: 0; }
.ob-urlbox { display: grid; gap: .5rem; }
.ob-urlhead { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.ob-urlhead h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pd-muted); }
.ob-url { display: block; padding: .5rem .6rem; background: var(--pd-bg); border: 1px solid var(--pd-line); border-radius: 6px; font-size: .85rem; word-break: break-all; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
/* The preview: a 1920 × 1080 canvas at half size over a checkerboard, so
   transparency shows. The iframe's color-scheme matches the overlay
   document's (light: it sets none), or Chrome paints an opaque
   backdrop behind it. */
.ob-stage {
	position: relative; width: 960px; max-width: 100%; height: 540px; overflow: hidden; border-radius: 6px;
	background: repeating-conic-gradient(#2b2b2b 0 25%, #1d1d1d 0 50%) 0 0 / 24px 24px;
}
.ob-stage.bg-light { background: repeating-conic-gradient(#ececec 0 25%, #ffffff 0 50%) 0 0 / 24px 24px; }
.ob-stage iframe { position: absolute; top: 0; left: 0; border: 0; transform: scale(.5); transform-origin: 0 0; color-scheme: light; background: transparent; }
.ob-nopreview { position: absolute; inset: 0; display: grid; place-items: center; color: var(--pd-muted); }
.ob-stage.bg-light .ob-nopreview { color: #444; }

/* Status page (M10). */
.status-page { padding: 1rem 0 3rem; }
.status-page h1 { margin: .5rem 0; }
.status-page h2 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem; }
.st-card { background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: .5rem; padding: .5rem .75rem; }
.st-card h2 { margin: 0 0 .25rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pd-muted); }
.st-card p, .st-card ul { margin: 0; padding: 0; list-style: none; font-size: .9rem; }
.st-card.bad, .st-table tr.bad, .st-inline.bad { border-color: var(--c-dy); color: var(--c-dy); }
.st-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.st-table th, .st-table td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--pd-line); vertical-align: top; }
.st-table thead th { color: var(--pd-muted); font-weight: 600; }
.st-small { color: var(--pd-muted); font-size: .8rem; }
.st-inline { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; padding: 0; margin: 0; }
.st-list { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
