/* Disc golf stats site. Light palette on :root; dark via prefers-color-scheme or data-theme="dark". */
:root {
  --bg: #F6F7F4;
  --surface: #FFFFFF;
  --surface-2: #EEF1EC;
  --border: #DDE2DC;
  --rule: #EEF1EC;
  --text: #14201A;
  --muted: #4A554F;
  --accent: #1F7A4D;
  --accent-soft: rgba(31, 122, 77, 0.22);
  --accent-ink: #FFFFFF;
  --toggle-bg: #E6EAE4;
  --inverse-bg: #14201A;
  --inverse-text: #FFFFFF;
  --inverse-muted: #C9D3CC;
  --down: #A8501E;
  --gold: #8A6A00;
  --radius: 14px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1512; --surface: #161F1A; --surface-2: #1E2924; --border: #2A3830; --rule: #222E28;
    --text: #E4EBE6; --muted: #A3B3AA; --accent: #4CC38A; --accent-soft: rgba(76, 195, 138, 0.25);
    --accent-ink: #0F1512; --toggle-bg: #1E2924; --inverse-bg: #E4EBE6; --inverse-text: #0F1512;
    --inverse-muted: #33413A; --down: #E8935F; --gold: #E0C35A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1512; --surface: #161F1A; --surface-2: #1E2924; --border: #2A3830; --rule: #222E28;
  --text: #E4EBE6; --muted: #A3B3AA; --accent: #4CC38A; --accent-soft: rgba(76, 195, 138, 0.25);
  --accent-ink: #0F1512; --toggle-bg: #1E2924; --inverse-bg: #E4EBE6; --inverse-text: #0F1512;
  --inverse-muted: #33413A; --down: #E8935F; --gold: #E0C35A; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; }
a { color: var(--text); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent); }
a.link { color: var(--accent); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.up { color: var(--accent); }
.down { color: var(--down); }
.small { font-size: 13px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* header */
.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header nav { max-width: 1160px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 20px; margin-right: auto; }
.site-header nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.theme-toggle { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; cursor: pointer; }
.theme-toggle svg { width: 18px; height: 18px; }

/* layout */
main { max-width: 1160px; margin: 0 auto; padding: 36px 24px 56px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.page-head > div { max-width: 680px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
h1 { margin: 0 0 8px; font-family: var(--display); font-size: 44px; line-height: 1.05; letter-spacing: -0.01em; }
h2 { margin: 0 0 10px; font-family: var(--display); font-size: 20px; line-height: 1.2; }
h3 { margin: 18px 0 6px; font-family: var(--display); font-size: 16px; }
.lede { margin: 0; font-size: 16px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; min-width: 0; }
.card.flush { padding: 0; overflow-x: auto; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }
.card.inverse { background: var(--inverse-bg); color: var(--inverse-text); border-color: var(--inverse-bg); }
.card.inverse .muted { color: var(--inverse-muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > .wide { flex: 999 1 540px; }
.row > .narrow { flex: 1 1 300px; display: flex; flex-direction: column; gap: 16px; }
.stat-label { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.stat { margin: 0; font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.1; }
.stat small { font-size: 16px; font-weight: 500; color: var(--muted); }
.card.inverse .stat small { color: var(--inverse-muted); }
.stat-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }

/* segmented control (division switch) */
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--toggle-bg); border-radius: 10px; }
.seg a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 22px; border-radius: 8px; font-weight: 600; }
.seg a[aria-current="page"] { background: var(--text); color: var(--bg); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
.card.flush table { min-width: 720px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 8px; white-space: nowrap; }
td { padding: 10px 8px; border-top: 1px solid var(--rule); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
.card:not(.flush) th:first-child, .card:not(.flush) td:first-child { padding-left: 0; }
.card:not(.flush) th:last-child, .card:not(.flush) td:last-child { padding-right: 0; }
td.r, th.r { text-align: right; }
td.name { font-weight: 600; }
.rank { font-weight: 600; color: var(--muted); width: 48px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort] button { all: inherit; cursor: pointer; padding: 0; }
th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 10px; }
th[aria-sort="descending"] button::after { content: " ▼"; font-size: 10px; }
tr.won td { background: var(--accent-soft); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.win { background: var(--accent); color: var(--accent-ink); }
.badge.upset { background: transparent; color: var(--down); border: 1px solid currentColor; }
.scroll { overflow-x: auto; }
.table-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px 4px; }
input[type="search"] { min-height: 44px; min-width: 240px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
label.inline { font-size: 13px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }

/* rating bar with range */
.bar { position: relative; height: 14px; background: var(--surface-2); border-radius: 7px; min-width: 140px; }
.bar .fill { position: absolute; left: 0; top: 3px; height: 8px; border-radius: 4px; background: var(--accent); }
.bar .range { position: absolute; top: 0; height: 14px; border-radius: 7px; background: var(--accent-soft); }
.pbar { display: flex; align-items: center; gap: 10px; }
.pbar .track { flex: 1; height: 10px; background: var(--surface-2); border-radius: 5px; min-width: 80px; }
.pbar .track div { height: 10px; border-radius: 5px; background: var(--accent); }
.pbar span { width: 52px; text-align: right; font-weight: 600; }

/* chart */
.chart svg { width: 100%; min-width: 560px; height: auto; display: block; }
.chart .grid-line { stroke: var(--rule); }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linejoin: round; }
.chart .band { fill: var(--accent-soft); stroke: none; }
.chart .win { fill: var(--gold); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* prose (methodology) */
.prose { max-width: 760px; }
.prose p, .prose li { color: var(--text); }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0 0 14px; padding-left: 20px; }
.prose h2 { margin-top: 28px; }
.toc { display: flex; flex-wrap: wrap; gap: 10px; }
.toc a { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 14px; }

.site-footer { border-top: 1px solid var(--border); }
.site-footer div { max-width: 1160px; margin: 0 auto; padding: 22px 24px 40px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

@media (max-width: 640px) {
  h1 { font-size: 34px; }
  main { padding: 28px 16px 44px; }
  .site-header nav { padding: 12px 16px; gap: 6px 18px; }
  .stat { font-size: 28px; }
  input[type="search"] { min-width: 0; width: 100%; }
}
.prose > :first-child { margin-top: 0; }
