:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --panel: #f6f7f8;
  --ink: #14181d;
  --muted: #58636e;
  --faint: #8a95a0;
  --line: #e6e9ec;
  --line-strong: #d2d7dc;
  --accent: #c8102e;      /* PWHL red */
  --accent-2: #003087;    /* deep blue */
  --accent-soft: #fbe9ec;
  --ice: #f2f8fc;
  --pos: 22, 132, 92;
  --neg: 190, 66, 56;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(16,25,29,.04), 0 6px 22px rgba(16,25,29,.06);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top nav ---------- */
nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: 1200px; margin: 0 auto;
  padding: 13px 24px;
  display: flex; align-items: center; gap: 22px;
}
.brand {
  font-family: var(--serif); font-weight: 600; font-size: 17px;
  letter-spacing: -.01em; margin-right: auto; color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.nav-in a { font-size: 14px; color: var(--muted); font-weight: 500; }
.nav-in a:hover { color: var(--ink); text-decoration: none; }
.nav-in a.active { color: var(--ink); font-weight: 700; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.wrap.wide { max-width: min(1560px, 96vw); }

/* ---------- masthead ---------- */
header.hero { padding: 56px 24px 28px; border-bottom: 1px solid var(--line); }
.hero-in { max-width: 1200px; margin: 0 auto; }
.kicker { color: var(--muted); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 14px; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 44px);
  letter-spacing: -.01em; line-height: 1.1; margin: 0 0 12px;
}
.hero .dek { font-size: 17px; color: var(--muted); max-width: 64ch; margin: 0 0 22px; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 26px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--mono); font-size: 22px; color: var(--ink); }
.stat span { color: var(--muted); font-size: 13px; letter-spacing: .04em; }

section { padding: 34px 0 44px; }
section > .wrap > h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 6px; }
section > .wrap > .sub { color: var(--muted); font-size: 15px; margin: 0 0 22px; max-width: 70ch; }

/* ---------- home grid ---------- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.home-card {
  display: block;
  border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 22px 20px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.home-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.home-card .num { font-family: var(--mono); font-size: 12px; color: var(--faint); letter-spacing: .04em; }
.home-card h3 { font-size: 18px; margin: 8px 0 8px; font-family: var(--serif); }
.home-card p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.home-card .go { font-size: 13px; color: var(--accent-2); font-weight: 600; margin-top: 12px; display: inline-block; }

/* ---------- controls ---------- */
.controls {
  display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: end;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.ctl { display: flex; flex-direction: column; gap: 4px; }
.ctl label { font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.ctl select, .ctl input[type="search"], .ctl input[type="text"] {
  font-family: var(--sans); font-size: 14px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--surface); color: var(--ink);
  min-width: 160px;
}
.ctl select:focus, .ctl input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle; white-space: nowrap;
}
table.data th {
  font-weight: 600; color: var(--muted);
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--line-strong);
}
/* Sort indicator via ::after — suppressed while the header is hovered so
 * the tooltip's ::after content is what actually shows. */
table.data th.sorted-asc:not(:hover):not(:focus-visible)::after {
  content: " ▲"; color: var(--accent); font-size: 10px;
}
table.data th.sorted-desc:not(:hover):not(:focus-visible)::after {
  content: " ▼"; color: var(--accent); font-size: 10px;
}
table.data td.num, table.data th.num { font-family: var(--mono); text-align: right; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: var(--panel); }

table.data td.heat { position: relative; }
table.data td.heat::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(var(--pos), var(--heat, 0));
  pointer-events: none;
}
table.data td.heat.neg::before { background: rgba(var(--neg), var(--heat, 0)); }
table.data td.heat > span { position: relative; }

.pill {
  display: inline-block; font-size: 11.5px; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--muted); background: var(--panel);
  font-family: var(--sans); text-transform: none;
}
.pill.goal { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.pill.shot { background: #fff5cf; color: #7a5a00; border-color: #ecd97e; }

/* ---------- play viewer ---------- */
.play-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 26px;
  align-items: start;
}
@media (max-width: 900px) { .play-grid { grid-template-columns: 1fr; } }

.rink-panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); }
.rink-panel svg { display: block; width: 100%; height: auto; background: var(--ice); border-radius: 8px; }

.scrubber-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px 4px;
  font-family: var(--mono); font-size: 13px; color: var(--muted);
}
.scrubber-row input[type="range"] {
  flex: 1; accent-color: var(--accent);
}
.scrubber-row .clock { min-width: 72px; text-align: center; color: var(--ink); font-weight: 600; }
.scrubber-row button {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; font-family: var(--sans);
  font-size: 13px;
}
.scrubber-row button:hover { background: var(--panel); border-color: var(--accent); }
.scrubber-row button.play { background: var(--accent); color: white; border-color: var(--accent); }

.info-panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--surface); }
.info-panel h3 { font-family: var(--serif); font-size: 18px; margin: 0 0 12px; }
.info-panel dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; margin: 0; font-size: 14px; }
.info-panel dt { color: var(--muted); }
.info-panel dd { margin: 0; font-family: var(--mono); }

.legend {
  display: flex; flex-wrap: wrap; gap: 12px 16px;
  font-size: 12px; color: var(--muted); margin-top: 10px;
}
.legend .swatch {
  display: inline-block; width: 10px; height: 10px; border-radius: 999px;
  margin-right: 6px; vertical-align: middle;
}

/* ---------- charts ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.chart {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); padding: 16px;
}
.chart h3 { font-family: var(--serif); font-size: 16px; margin: 0 0 12px; }
.chart svg { display: block; width: 100%; height: auto; }

/* ---------- tooltips ---------- */
/* `.tt` is added to elements (usually <th>) that carry a data-tooltip attr.
 * Hovering reveals a themed tooltip below the element, pure CSS. */
.tt {
  position: relative;
  cursor: help;
  text-decoration: underline dotted var(--faint) 1px;
  text-underline-offset: 3px;
}
.tt:hover::before,
.tt:focus-visible::before {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translate(-6px, 4px);
  border: 6px solid transparent;
  border-bottom-color: var(--ink);
  z-index: 40; pointer-events: none;
}
.tt:hover::after,
.tt:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%; left: 0;
  transform: translateY(16px);
  background: var(--ink); color: #fff;
  font-family: var(--sans); font-weight: 400;
  font-size: 12.5px; line-height: 1.45;
  letter-spacing: 0; text-transform: none;
  padding: 8px 12px; border-radius: 6px;
  min-width: 220px; max-width: 340px;
  white-space: normal;
  box-shadow: 0 6px 24px rgba(16,25,29,.18);
  z-index: 40; pointer-events: none;
}
/* right-aligned numeric column tooltips anchor to the right edge */
table.data th.num.tt:hover::after,
table.data th.num.tt:focus-visible::after {
  left: auto; right: 0;
}
table.data th.num.tt:hover::before,
table.data th.num.tt:focus-visible::before {
  left: auto; right: 6px;
  transform: translate(0, 4px);
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 30px 24px;
  font-size: 13px; color: var(--faint); text-align: center;
}
