/* The site's shared look: every page loads this file, then its feature's own
   stylesheet (glaze.css, mogs.css...) for the parts only it has.

   How to change the look:
   - Colours are the named tokens in the first :root block (light mode) and
     the one under prefers-color-scheme: dark. Change a value there and every
     page follows.
   - Each feature's accent colour is set by data-feature="..." on <body> (or
     on any element, like the home page's cards). The accent is only for small
     things: icons, the current top-bar link, the main button, highlighted
     rows. Never a page background.
   - Sizes use rem: 1rem = 16px. */

/* Inter, served from /static/fonts (SIL Open Font License, Inter-LICENSE.txt).
   Two files: basic Latin, and accented letters (Jokić, Dončić). The browser
   downloads the second only when a page uses one of its letters. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #fafafa;          /* page background */
  --surface: #ffffff;     /* cards, top bar, inputs */
  --text: #18181b;
  --muted: #71717a;       /* secondary text */
  --faint: #a1a1aa;       /* footer, placeholders */
  --line: #e4e4e7;        /* borders */
  --line-strong: #d4d4d8; /* input borders */
  --hover: #f4f4f5;
  --error: #b42318;
  --radius: 8px;
  --width: 1000px;        /* widest a page's content gets */
  --font: "Inter", system-ui, "Segoe UI", sans-serif;
  /* Accent when a page names no feature. */
  --accent: #52525b; --accent-tint: #f4f4f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11; --surface: #18181b; --text: #f4f4f5; --muted: #a1a1aa; --faint: #71717a;
    --line: #27272a; --line-strong: #3f3f46; --hover: #202024; --error: #f97066;
    --accent: #a1a1aa; --accent-tint: #202024;
  }
}

/* Feature accents: a muted colour and a light tint of it. */
[data-feature="glaze"]   { --accent: #b03a62; --accent-tint: #fbf1f4; }
[data-feature="mogs"]    { --accent: #4f55b0; --accent-tint: #f0f1fb; }
[data-feature="similar"] { --accent: #2f7d74; --accent-tint: #edf6f4; }
[data-feature="records"] { --accent: #a16207; --accent-tint: #fcf6e8; }
[data-feature="franken"] { --accent: #4d7a2a; --accent-tint: #f1f6ea; }
@media (prefers-color-scheme: dark) {
  [data-feature="glaze"]   { --accent: #e07a9b; --accent-tint: #2a1a20; }
  [data-feature="mogs"]    { --accent: #9aa0e8; --accent-tint: #1c1e33; }
  [data-feature="similar"] { --accent: #6cc3b6; --accent-tint: #142624; }
  [data-feature="records"] { --accent: #d6a548; --accent-tint: #28220f; }
  [data-feature="franken"] { --accent: #9cc56b; --accent-tint: #1d2614; }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; max-width: var(--width); margin: 0 auto; padding: 32px 16px 48px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar: site name, then every feature ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: var(--width); margin: 0 auto; padding: 0 16px; height: 52px;
  display: flex; align-items: center; gap: 24px;
}
.brand { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; }
.topbar nav {
  display: flex; gap: 20px; height: 100%; overflow-x: auto; scrollbar-width: none; font-size: 0.875rem;
}
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  display: flex; align-items: center; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
/* Phones: the links get their own row under the name, scrolling sideways. */
@media (max-width: 640px) {
  .topbar-inner { height: auto; flex-wrap: wrap; gap: 0; padding-top: 12px; }
  /* The fade at the right edge hints that there are more links. */
  .topbar nav { width: 100%; height: 40px; gap: 18px; padding-right: 24px;
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
}

/* ---------- Page heading: icon, title, one line of description ---------- */
.page-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.page-head p { margin-top: 2px; color: var(--muted); }
/* The feature's line icon, in its accent colour, straight on the page (no
   tinted square behind it: Matt, 2026-10-15). */
.icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; color: var(--accent); }
.icon svg { width: 26px; height: 26px; }

/* ---------- Controls ---------- */
.btn {
  font: 600 0.875rem var(--font); padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid transparent; background: var(--text); color: var(--surface);
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--hover); opacity: 1; }
input[type="text"], input[type="search"], input[type="number"], select {
  font: inherit; font-size: 0.9rem; padding: 7px 12px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
}
input::placeholder { color: var(--faint); }
/* League switch, name box and buttons on one line, wrapping on phones. */
.search-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search-row input { flex: 1 1 220px; }
/* A button that looks like a link (Reset). */
.link-button {
  font: inherit; padding: 0; border: 0; background: none; color: var(--muted);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.link-button:hover { color: var(--text); }
/* A row of options where one is picked (NFL / NBA). */
/* A grey track; the picked option sits on it as a raised white tab. */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--hover);
}
.segmented button {
  font: 500 0.85rem var(--font); padding: 5px 12px; border: 0; border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-checked="true"] {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgb(0 0 0 / 0.08);
}

/* ---------- Cards and tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-body { padding: 14px 16px; }
.eyebrow { font-size: 0.75rem; font-weight: 600; color: var(--accent); }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 7px 10px; text-align: left; white-space: nowrap; border-top: 1px solid var(--line); }
/* The outer columns line up with the card's text. */
table.data th:first-child, table.data td:first-child { padding-left: 16px; }
table.data th:last-child, table.data td:last-child { padding-right: 16px; }
table.data th { font-size: 0.75rem; font-weight: 500; color: var(--muted); background: var(--bg); }
table.data .num { text-align: right; }
table.data tr.highlight td { background: var(--accent-tint); font-weight: 600; }
table.data tr.highlight td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

/* ---------- Status, errors, results ---------- */
.status { margin: 20px 0; color: var(--muted); font-size: 0.9rem; }
/* Buttons to pick between players who share a name. */
.choices { display: grid; gap: 6px; margin: 12px 0; }
.choices .btn { text-align: left; font-weight: 400; }
.notes { padding: 10px 16px 12px; border-top: 1px solid var(--line); }
.note { color: var(--muted); font-size: 0.8rem; }
/* The open-in-a-new-tab corner and other small icon buttons. */
.icon-button {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.icon-button:hover { color: var(--text); border-color: var(--line-strong); }
.expand { position: absolute; top: 12px; right: 12px; }

/* ---------- Full list pages: back link, heading, pinned notes ---------- */
.back { display: inline-block; margin-bottom: 12px; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }
.list-head { margin-bottom: 16px; }
.list-head h1 { font-size: 1.35rem; }
.list-head p { margin-top: 4px; color: var(--muted); font-size: 0.875rem; }
.list-head .raw { font-size: 0.8rem; color: var(--faint); }
/* The notes stay on screen while the long table scrolls past. */
.pinned-notes {
  position: sticky; top: 0; z-index: 1; padding: 8px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}

/* ---------- Three bouncing dots after a "working on it" message ---------- */
.dots { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.dots span {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  animation: dots-bounce 1.2s infinite ease-in-out both;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dots-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .dots span { animation-name: dots-fade; }
  @keyframes dots-fade { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
}
.error { color: var(--error); }

/* ---------- Footer: data credits (NBA.com's terms require a prominent
   attribution; nflverse's data is CC BY 4.0) ---------- */
.site-footer {
  max-width: var(--width); width: 100%; margin: 0 auto; padding: 16px 16px 28px;
  color: var(--faint); font-size: 0.75rem; line-height: 1.5; text-align: center;
}
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--text); }
