/* "Rink" theme: blue header band, white rounded cards with a status-colored edge, bold scores,
   filled rank chips, pill buttons. Light only; colors live in the tokens below. */

:root {
  --bg: #eef3f8;
  --card: #ffffff;
  --text: #0f1b2d;
  --muted: #5d6b7f;
  --border: #dbe4ef;
  --row: #f4f7fb;
  --live: #e0243b;
  --live-tint: #fff4f5;
  --final: #0f1b2d;
  --scheduled: #0b63ce;
  --accent: #0b63ce;
  --accent-dark: #0b2a5b;
  --accent-light: #1f8dff;
  --win: #1b8a4a;
  --radius: 16px;
  --shadow: 0 6px 18px rgba(15, 27, 45, 0.08);
  --shadow-hover: 0 10px 26px rgba(15, 27, 45, 0.14);
  /* Barlow for text, Barlow Condensed for headings, labels and scores (loaded from Google Fonts
     in each page's <head>; the fallbacks keep the layout close if the fonts do not load). */
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Barlow", system-ui, sans-serif;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
}

body {
  margin: 0 auto;
  max-width: 960px;
  padding: 1rem;
  background: var(--bg);
}

/* --- header band (every page) --------------------------------------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(100deg, var(--accent-dark), var(--accent) 70%, var(--accent-light));
  color: #fff;
  margin: -1rem -1rem 1rem;
  padding: 1rem 1rem 0.9rem;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 8px 24px rgba(11, 42, 91, 0.25);
}

header h1 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0 0 0.7rem;
  color: #fff;
  line-height: 1.1;
}

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.controls button,
.controls input {
  font: inherit;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.controls input { color-scheme: dark; }
.controls button { cursor: pointer; font-weight: 600; }
.controls button,
.controls input { font-family: var(--font-body); }
.controls button:hover { background: rgba(255, 255, 255, 0.24); }

#date-label {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0.85rem 0 0;
  color: #d6e6ff;
}

/* Detail pages: breadcrumb, title and subtitle sit on the band. */
.back {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: #d6e6ff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.back:hover { color: #fff; text-decoration: underline; }

.game-page header h1 {
  text-transform: none;
  letter-spacing: 0;
  font-size: 2rem;
  margin: 0.15rem 0 0.35rem;
}

.subtitle {
  margin: 0;
  color: #d6e6ff;
  font-size: 0.95rem;
}

.game-page header .team-link { color: #fff; }
.game-page header .team-link:hover { color: #fff; }
.game-page header .rank-badge { color: #d6e6ff; }

.game-page header .logo-large { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }

/* --- scoreboard grid and cards -------------------------------------------------------------- */

/* The scores page stacks its sections (live, upcoming, final); each section holds a card grid. */
#board {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.message {
  color: var(--muted);
  margin: 1rem 0;
}

.message.error { color: var(--live); }

.card {
  position: relative;
  background: var(--card);
  border: none;
  border-left: 6px solid #cbd6e6;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: box-shadow 0.15s, transform 0.15s;
}

.card.status-in_progress {
  border-left-color: var(--live);
  background: linear-gradient(90deg, var(--live-tint), var(--card) 40%);
}
.card.status-final { border-left-color: var(--final); }
.card.status-scheduled { border-left-color: var(--scheduled); }

.card:hover,
.card:focus-within {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.status {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.82rem;
}

.status-in_progress .status { color: var(--live); }
.status-final .status { color: var(--final); }
.status-scheduled .status { color: var(--scheduled); }

.teams { display: flex; flex-direction: column; gap: 0.35rem; }

.teams .team {
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.teams .at { display: none; }

.teams .score {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.teams .score.losing { color: var(--muted); font-weight: 700; }

.meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--live);
  font-weight: 600;
}

/* The status text is the game link; stretched over the card, team links sit above it. */
.card .card-link {
  color: inherit;
  text-decoration: none;
}

.card .card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card .teams .team-link { position: relative; z-index: 1; }

.card .card-link:focus-visible { outline: none; }
.card .card-link:focus-visible::after { box-shadow: 0 0 0 3px rgba(11, 99, 206, 0.4); }

/* --- detail pages: sections ----------------------------------------------------------------- */

.game-page main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-page .message { margin: 0.5rem 0; }

.linescore,
.scoring-summary,
.team-box,
.season,
.game-log,
.rankings {
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

/* Game page: the matchup and score sit on the header band instead of a title. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.matchup {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.2rem 0 0.5rem;
  max-width: 34rem;
}

.matchup .status {
  font-size: 0.85rem;
  color: #d6e6ff;
}

.matchup.status-in_progress .status { color: #ffd1d6; }

.matchup .team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.matchup .team {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.4rem;
  color: #fff;
}

.matchup .team .team-label { gap: 0.5rem; }

.matchup .home-tag {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d6e6ff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
}

.matchup .score {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #fff;
}

.matchup .score.losing { color: #9fbfe8; }

.game-page h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.team-box h2 {
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.15rem;
  color: var(--text);
}

.team-stats {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- tables --------------------------------------------------------------------------------- */

.game-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.game-page caption {
  font-family: var(--font-display);
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.6rem 0 0.4rem;
}

.game-page th,
.game-page td {
  padding: 0.4rem 0.45rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.game-page th {
  font-family: var(--font-display);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--row);
}

.game-page thead th:first-child { border-radius: 8px 0 0 8px; }
.game-page thead th:last-child { border-radius: 0 8px 8px 0; }

.game-page th.text,
.game-page td.text {
  text-align: left;
}

.game-page td.text:nth-child(2) { width: 100%; white-space: normal; }

.game-page tbody tr:last-child td { border-bottom: none; }
.game-page tbody tr:hover td { background: var(--row); }

.game-page td.total { font-weight: 800; }

.stats + .stats { margin-top: 0.75rem; }

/* --- goal-by-goal scoring summary --------------------------------------------------------- */

.goals td.period { color: var(--muted); font-weight: 700; }
.goals td.goal { white-space: normal; width: 100%; }
.goals .assists { color: var(--muted); }
.goals td.running { font-weight: 800; }

.goals th.team-logo,
.goals td.team-logo {
  width: 24px;
  padding-left: 0;
  padding-right: 0.2rem;
  text-align: center;
}

.goals td.team-logo .logo { display: block; margin: 0 auto; }

.badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--muted);
  vertical-align: 0.1em;
}

.badge-PP { background: var(--accent); }
.badge-SH { background: #6a1b9a; }
.badge-GW { background: var(--live); }
.badge-EA,
.badge-EN { background: #ef6c00; }

.game-page .note {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* --- player and team links ------------------------------------------------------------------ */

.player-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
}

.player-link:hover,
.player-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.team-link {
  color: inherit;
  text-decoration: none;
}

.team-link:hover,
.team-link:focus-visible { color: var(--accent); text-decoration: underline; }

.game-log td.text a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.game-log td.text a:hover { text-decoration: underline; }

.game-log td.result-W { color: var(--win); font-weight: 800; }
.game-log td.result-L { color: var(--live); font-weight: 800; }
.game-log td.result-T { color: var(--muted); font-weight: 800; }

.player-page td.text:nth-child(2) { width: auto; white-space: nowrap; }

.team-page .game-log td.text:nth-child(2) { width: 100%; white-space: normal; }
.team-page .game-log tr.status-scheduled td { color: var(--muted); }
.team-page .game-log tr.status-in_progress td.text:last-child { color: var(--live); font-weight: 800; }

/* --- team labels: rank chip, logo, name ------------------------------------------------------ */

.team-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.logo {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  object-fit: contain;
  vertical-align: middle;
}

.logo-large {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.rank-badge {
  color: var(--muted);
  font-size: 0.78em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.game-page h1 .team-label { gap: 0.5rem; }

/* Keep "(home)" and the label on one line. */
.team-box h2,
.game-page h1 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* --- rankings sidebar ----------------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}

.layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr) auto; }

.rankings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.rankings-head h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}

.rankings-head button,
.poll-switch button,
.tabs button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.rankings-head button:hover,
.poll-switch button:hover,
.tabs button:hover { border-color: var(--accent); color: var(--accent); }

.poll-switch {
  display: flex;
  gap: 0.4rem;
  margin: 0.7rem 0 0.4rem;
}

.poll-switch button[aria-selected="true"],
.tabs button[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.poll-switch button[aria-selected="true"]:hover,
.tabs button[aria-selected="true"]:hover { color: #fff; }

.rankings .note { margin: 0 0 0.5rem; }

.rankings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.rankings-list li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  column-gap: 0.45rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.rankings-list li:last-child { border-bottom: none; }

.rankings-list .rank {
  font-family: var(--font-display);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rankings-list .school {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
  font-weight: 600;
}

.rankings-list .detail {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.8rem;
}

.rankings-list .message { grid-column: 1 / -1; margin: 0.4rem 0; }

.rankings-list .votes {
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 500;
}

.move {
  font-size: 0.8em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.move-up { color: var(--win); }
.move-down { color: var(--live); }
.move-new { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 0.7em; letter-spacing: 0.04em; }

/* --- team page tabs ------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.tabs[hidden] { display: none; }

/* --- small screens -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .layout,
  .layout.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  /* The full rankings list would push the games off a phone screen: show it after them. */
  .rankings { order: 1; }
  header { border-radius: 0 0 16px 16px; }
  header h1 { font-size: 1.6rem; }
  .teams .score { font-size: 1.7rem; }
  .matchup .team { font-size: 1.15rem; }
  .matchup .score { font-size: 2rem; }
}

/* --- masthead with page links ----------------------------------------------------------------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  line-height: 1.1;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d6e6ff;
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.site-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.site-nav a[aria-current="page"] { color: var(--accent-dark); background: #fff; }

/* Detail pages: the breadcrumb and title sit under the masthead. */
.game-page header .back { margin-top: 0.6rem; }

/* --- date strip ------------------------------------------------------------------------------ */

.date-strip {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  margin: 0 0 1rem;
  padding: 0.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.strip-arrow {
  font: inherit;
  font-size: 0.75rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
}

.strip-arrow:hover { background: var(--row); }

.date-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.strip-date {
  width: 100%;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  padding: 0.35rem 0.2rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.strip-date:hover { background: var(--row); color: var(--text); }

.strip-weekday {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.strip-day {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.strip-date.selected {
  background: var(--accent);
  color: #fff;
}

.strip-date.selected .strip-day { font-weight: 800; font-size: 1.2rem; }

/* --- rankings sidebar: footnote date, rank numbers like the cards ---------------------------- */

.rankings-list .rank {
  font-family: var(--font-body);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.rankings-updated {
  margin: 0.6rem 0 0 !important;
  color: var(--muted);
  font-size: 0.78rem;
}

/* --- sortable tables -------------------------------------------------------------------------- */

.game-page th.sortable { cursor: pointer; user-select: none; }
.game-page th.sortable:hover { color: var(--accent); }
.game-page th[aria-sort] { color: var(--accent); }
/* Reserve the indicator's width on every sortable header so sorting never changes column widths. */
.game-page th.sortable::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  text-align: right;
}
.game-page th[aria-sort="descending"]::after { content: "\25BE"; }
.game-page th[aria-sort="ascending"]::after { content: "\25B4"; }

/* --- standings page --------------------------------------------------------------------------- */

.conference-switch { flex-wrap: wrap; }

.standings-table td.text:nth-child(2) { width: 100%; white-space: normal; }
.standings-table td:first-child { color: var(--muted); font-weight: 700; }

@media (max-width: 760px) {
  .date-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .date-list li:nth-child(n+6) { display: none; }
}

/* --- scores page: sections ------------------------------------------------------------------ */

.scores-page main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.group-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.group-live .group-title { color: var(--live); }

.group-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--card);
  border-radius: 999px;
  padding: 0 0.5rem;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

/* --- stats page -------------------------------------------------------------------------------- */

.stats-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.stats-controls .tabs { margin: 0; }

.category-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.category-pick select {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

.stats-table td.text:nth-child(2) { width: auto; white-space: nowrap; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0.9rem 0 0;
}

.pager button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
}

.pager button:disabled { color: var(--muted); cursor: default; opacity: 0.6; }

.pager-status { color: var(--muted); font-size: 0.85rem; }

.rankings-table td.text:nth-child(2) { width: 100%; white-space: normal; }

/* Class year beside a player's name (stats and team pages). */
.class-year {
  font-family: var(--font-display);
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Site footer: independence statement and source credit on every page. */
.site-footer {
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-decoration: underline; }
