/* The Scored Bracket season record (/bracket/scorecard/{season}/), rendered by
   _includes/bracket-record.html. Wide: comparison column + a narrower score column.
   900px and below: one column in DOM order (finding, score, differences, every team,
   sources). Phone: each team row becomes a labeled group; no horizontal scroll. */

.br-page { max-width: var(--max); margin: 0 auto; }
.br-scope-line { font-family: var(--fb); font-size: var(--t-ui); color: var(--sub); margin-bottom: var(--s-2); }

.br-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  column-gap: var(--s-7);
  padding: var(--s-6) var(--pad) var(--s-7);
}
.br-record > * { grid-column: 1; min-width: 0; }
.br-score { grid-column: 2; grid-row: 1 / span 4; align-self: start; }

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

/* Summary: the one dominant finding. */
.br-finding { font-family: var(--fe); font-weight: 600; font-size: var(--t-display); line-height: 1.15; color: var(--text); margin: 0 0 var(--s-3); max-width: 22ch; }
.br-lede { font-size: var(--t-read); color: var(--sub); max-width: 60ch; margin: 0 0 var(--s-6); }

/* Score column. */
.br-score { border-top: 2px solid var(--orange); padding-top: var(--s-4); }
.br-label { font-family: var(--fb); font-size: var(--t-label); font-weight: 600; color: var(--muted); margin: 0 0 var(--s-2); }
.br-score-num { margin: 0; line-height: 1; }
.br-big { font-family: var(--fd); font-size: calc(var(--t-display) * 2); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.br-of { font-family: var(--fd); font-size: var(--t-h3); color: var(--sub); }
.br-scope { font-family: var(--fm); font-size: var(--t-meta); color: var(--sub); margin: var(--s-2) 0 var(--s-4); }
.br-breakdown { width: 100%; border-collapse: collapse; font-size: var(--t-ui); margin-bottom: var(--s-4); }
.br-breakdown th, .br-breakdown td { padding: 8px 0; border-bottom: 1px solid var(--border); text-align: right; font-weight: 400; }
.br-breakdown th[scope="row"], .br-breakdown thead th:first-child { text-align: left; }
.br-breakdown thead th { font-family: var(--fb); font-size: var(--t-label); color: var(--muted); }
.br-breakdown td { font-family: var(--fm); color: var(--sub); font-variant-numeric: tabular-nums; }
.br-breakdown tfoot th, .br-breakdown tfoot td { color: var(--text); font-weight: 600; border-bottom: 0; }
.br-note { font-size: var(--t-ui); color: var(--sub); line-height: 1.6; margin: 0 0 var(--s-3); max-width: 64ch; }
.br-era { font-style: italic; }
.br-state { font-family: var(--fe); font-size: var(--t-h2); color: var(--text); margin: 0 0 var(--s-3); }
.br-bubble { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.br-bubble dl { margin: 0 0 var(--s-3); }
.br-bubble dt { font-family: var(--fb); font-size: var(--t-label); color: var(--muted); margin-top: var(--s-2); }
.br-bubble dd { margin: 2px 0 0; font-size: var(--t-body); color: var(--text); }

/* Sections. */
.br-section { margin-top: var(--s-6); }
.br-h2 { font-family: var(--fe); font-weight: 600; font-size: var(--t-h2); color: var(--text); margin: 0 0 var(--s-2); }
.br-h3 { font-family: var(--fb); font-size: var(--t-ui); font-weight: 600; color: var(--muted); margin: var(--s-5) 0 var(--s-2); }

.br-table { width: 100%; border-collapse: collapse; font-size: var(--t-body); margin: var(--s-3) 0 0; }
.br-table thead th { font-family: var(--fb); font-size: var(--t-label); font-weight: 600; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.br-table td, .br-table tbody th { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; font-weight: 400; vertical-align: middle; }
.br-team { color: var(--text); }
.br-team-inner { display: inline-flex; align-items: center; gap: var(--s-2); }
.br-num { font-family: var(--fm); font-variant-numeric: tabular-nums; color: var(--sub); }
.br-none { font-family: var(--fb); color: var(--muted); }
.br-table .result { font-size: var(--t-ui); white-space: normal; }

.br-sources ul { margin: 0; padding-left: 18px; }
.br-sources li { font-size: var(--t-ui); color: var(--sub); line-height: 1.6; margin-bottom: 6px; }
.br-sources a, .br-note a { color: var(--orange); }

.br-links { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.br-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4);
  border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text);
  font-family: var(--fb); font-size: var(--t-ui); text-decoration: none;
}
.br-links a:hover { border-color: var(--orange); color: var(--orange); }
.br-record a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

@media (max-width: 1099px) {
  .br-record { grid-template-columns: minmax(0, 1fr) 280px; column-gap: var(--s-6); }
}

@media (max-width: 900px) {
  .br-record { display: block; }
  .br-score { margin-bottom: var(--s-6); }
}

/* Phone: each team is a labeled row group, its four facts in a 2x2 grid so 84 rows stay
   scannable. Roles on the markup keep table semantics. */
@media (max-width: 640px) {
  .br-record { padding: var(--s-5) 16px var(--s-6); }
  .br-big { font-size: calc(var(--t-display) * 1.5); }
  .br-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .br-table, .br-table tbody { display: block; }
  .br-table tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-4); padding: 10px 0; border-bottom: 1px solid var(--border); }
  .br-table td, .br-table tbody th { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); padding: 2px 0; border: 0; text-align: right; min-width: 0; }
  .br-table tbody th.br-team { grid-column: 1 / -1; justify-content: flex-start; text-align: left; font-weight: 600; padding-bottom: 4px; }
  .br-table td::before { content: attr(data-label); font-family: var(--fb); font-size: var(--t-label); color: var(--muted); text-align: left; flex-shrink: 0; }
}

/* The season at a glance: the diagonal, the score bar, all my brackets and the seed tracks. Orange is
   Grant's voice, so the outcome ramp is his colour; logos sit on paper because several vanish on navy. */
.br-record { --br-one-off: rgba(255, 119, 4, 0.5); --br-farther-off: rgba(255, 119, 4, 0.22); --br-hairline: 2px; }
.br-o-exact { background: var(--orange); }
.br-o-one-off { background: var(--br-one-off); }
.br-o-farther-off { background: var(--br-farther-off); }
.br-o-missed { box-shadow: inset 0 0 0 1px var(--sub); }
.br-finding-note { font-size: var(--t-read); color: var(--text); margin: 0 0 var(--s-2); max-width: 60ch; }

.br-dg-fig { margin: var(--s-4) 0 var(--s-6); }
.br-dg-x { font-size: var(--t-meta); color: var(--muted); text-align: center; margin: 0 0 var(--s-1) 26px; }
.br-dg-wrap { display: flex; gap: var(--s-1); }
.br-dg-y { writing-mode: vertical-rl; transform: rotate(180deg); font-size: var(--t-meta); color: var(--muted); text-align: center; }
.br-dg { position: relative; flex: 1; min-width: 0; display: grid; grid-template-columns: 20px repeat(16, minmax(0, 1fr)); grid-template-rows: 20px; grid-auto-rows: minmax(40px, auto); gap: var(--br-hairline); }
.br-dg-h { display: flex; align-items: center; justify-content: center; font-family: var(--fm); font-size: var(--t-mini); color: var(--muted); }
.br-dg-bg { background: var(--surface); opacity: 0.55; border-radius: var(--r-sm); }
.br-dg-bg.is-line { opacity: 1; box-shadow: inset 0 0 0 1px var(--muted); }
.br-dg-out { margin-top: var(--s-2); }
.br-dg-cell { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: var(--br-hairline); padding: 1px; background: var(--paper); border-radius: var(--r-sm); min-width: 0; }
.br-dg-cell.is-off { box-shadow: inset 0 0 0 2.5px var(--orange); }
.br-dg-cell.is-missed { box-shadow: inset 0 0 0 2.5px var(--muted); }
.br-dg-t { flex: 0 0 calc(50% - 1px); max-width: 20px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.br-dg-t img { display: block; width: 100%; height: 100%; object-fit: contain; }
.br-dg-t b { font-family: var(--fm); font-size: var(--t-mini); font-weight: 500; color: var(--ink); }
.br-dg-tag { position: absolute; z-index: 0; font-size: var(--t-meta); color: var(--sub); pointer-events: none; }
.br-dg-tag.is-high { top: 64px; right: var(--s-3); }
.br-dg-tag.is-low { bottom: 64px; left: var(--s-6); }

.br-score-bar { position: relative; display: flex; height: 22px; margin-bottom: var(--s-3); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.br-score-bar i { display: block; height: 100%; }
.br-score-avg { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--text); }
.br-swatch { display: inline-block; width: 12px; height: 12px; margin-right: var(--s-2); vertical-align: -2px; }

.br-seasons { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--border); }
.br-seasons-h { font-family: var(--fe); font-weight: 600; font-size: var(--t-lede); color: var(--text); margin: 0 0 var(--s-1); }
.br-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--br-hairline); align-items: end; }
.br-strip-c { display: flex; flex-direction: column; gap: var(--br-hairline); min-width: 0; text-decoration: none; opacity: 0.72; }
.br-strip-c:hover, .br-strip-c.is-now { opacity: 1; }
.br-strip-b { display: flex; flex-direction: column; height: 110px; background: var(--surface); }
.br-strip-b i { display: block; width: 100%; }
.br-strip-n, .br-strip-y { font-family: var(--fm); font-size: var(--t-mini); text-align: center; color: var(--sub); }
.br-strip-y { color: var(--muted); }
.br-strip-c.is-now .br-strip-n, .br-strip-c.is-now .br-strip-y { color: var(--orange); }

.br-diff { width: 100%; border-collapse: collapse; margin-top: var(--s-3); table-layout: fixed; }
.br-diff thead th { font-size: var(--t-meta); font-weight: 400; color: var(--muted); text-align: left; padding: var(--s-2) 0; }
.br-diff thead th:first-child { width: 180px; }
.br-diff thead th:last-child { width: 92px; text-align: right; }
.br-diff-key { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.br-diff-key i { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -3px; border-radius: var(--r-sm); }
.br-diff-key .is-mine { background: var(--orange); }
.br-diff-key .is-committee { background: var(--paper); }
.br-diff-row th, .br-diff-row td { padding: var(--s-2) 0; border-top: 1px solid var(--border); font-weight: 400; vertical-align: middle; }
.br-diff-team { text-align: left; font-size: var(--t-body); color: var(--text); padding-right: var(--s-3) !important; }
.br-diff-team > span:last-child { font-weight: 600; }
.br-diff-logo { display: inline-flex; width: 30px; height: 30px; margin-right: var(--s-2); vertical-align: middle; align-items: center; justify-content: center; background: var(--paper); border-radius: var(--r-sm); }
.br-diff-logo img { display: block; width: 24px; height: 24px; object-fit: contain; }
.br-tk { position: relative; height: 26px; }
.br-tk::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 2px; background: var(--border); }
.br-tk-gap { position: absolute; top: 11px; height: 4px; background: var(--orange); opacity: 0.55; }
.br-tk-m { position: absolute; top: 1px; width: 24px; height: 24px; margin-left: -12px; display: flex; align-items: center; justify-content: center; font-family: var(--fm); font-size: var(--t-meta); font-weight: 500; color: var(--ink); border-radius: var(--r-sm); }
.br-tk-m.is-mine { background: var(--orange); }
.br-tk-m.is-committee { background: var(--paper); }
.br-tk-out { position: absolute; left: 0; top: 4px; padding-right: var(--s-2); font-size: var(--t-meta); color: var(--sub); background: var(--bg); }
.br-pips { display: flex; justify-content: flex-end; gap: var(--br-hairline); }
.br-pips i { display: block; width: 12px; height: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.br-pips i.is-on { background: var(--orange); box-shadow: none; }

@media (max-width: 640px) {
  .br-dg-y { display: none; }
  .br-dg-x { margin-left: 14px; }
  .br-dg { grid-template-columns: 14px repeat(16, minmax(0, 1fr)); grid-template-rows: 16px; grid-auto-rows: minmax(19px, auto); --br-hairline: 1px; }
  .br-dg-t { flex: 0 0 auto; width: 6px; height: 6px; max-width: none; aspect-ratio: auto; background: var(--ink); }
  .br-dg-t img, .br-dg-t b { display: none; }
  .br-dg-tag { font-size: var(--t-mini); }
  .br-dg-tag.is-high { top: 40px; right: var(--s-1); }
  .br-dg-tag.is-low { bottom: 32px; left: var(--s-4); }
  .br-diff thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .br-diff, .br-diff tbody { display: block; }
  .br-diff-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px; grid-template-areas: "team points" "track track"; gap: var(--s-1) var(--s-2); padding: var(--s-2) 0; border-top: 1px solid var(--border); align-items: center; }
  .br-diff-row th, .br-diff-row td { display: block; padding: 0; border: 0; }
  .br-diff-team { grid-area: team; }
  .br-diff-track { grid-area: track; }
  .br-diff-points { grid-area: points; }
}
