/* Top 100 Career Arcs. Layout: one centred column of cards under a navy bar, like a scorebook page: the chart first, then
   the small multiples, then the table. Colours: navy ink, stitch red for the average, a field blue for the player you pick. */
:root {
  --paper: #f4f6f9;
  --card: #ffffff;
  --ink: #0f1d33;
  --muted: #56647a;
  --line: #d9e0e8;
  --navy: #0d2b55;
  --on-navy: #f4f6f9;
  --mean: #c8102e;
  --pick: #1565c0;
  --bo: #b45309;
  --each: #7d8aa0;
  --grid: #e6ebf1;
  --axis: #9aa6b6;
  --shadow: 0 1px 2px rgba(15, 29, 51, .06), 0 6px 18px rgba(15, 29, 51, .06);
  --display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0a1120;
    --card: #111b2e;
    --ink: #e9eef6;
    --muted: #9eabbe;
    --line: #25334b;
    --navy: #0d2b55;
    --on-navy: #f4f6f9;
    --mean: #ff5c70;
    --pick: #5ea8ff;
    --bo: #fbbf24;
    --each: #7f8ca3;
    --grid: #1c2840;
    --axis: #55647c;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
a { color: var(--pick); }
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 12px; top: 12px; }

/* the bar: navy, with a stitched red rule under it */
.bar { background: var(--navy); color: var(--on-navy); border-bottom: 3px dashed var(--mean); padding-top: env(safe-area-inset-top, 0px); }
.bar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 20px; padding-block: 12px; }
.brand { color: var(--on-navy); text-decoration: none; font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: .02em; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.nav a { color: var(--on-navy); opacity: .85; text-decoration: none; font-size: .95rem; }
.nav a:hover, .nav a:focus-visible { opacity: 1; text-decoration: underline; }

.page { display: grid; gap: 24px; padding-block: 28px 40px; }
.intro { display: grid; gap: 12px; }
.eyebrow { margin: 0; font-family: var(--display); font-weight: 600; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mean); }
h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4.5vw, 3.1rem); line-height: 1.02; letter-spacing: -.005em; text-wrap: balance; max-width: 22ch; }
.lede { margin: 0; max-width: 68ch; color: var(--muted); font-size: 1.06rem; }
.lede b, .note b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 12px; margin-top: 6px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.tile-label { margin: 0; font-size: .82rem; color: var(--muted); }
.tile-value { margin: 0; font-family: var(--display); font-weight: 600; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 14px; min-width: 0; box-shadow: var(--shadow); scroll-margin-top: 12px; }
.card-head { display: grid; gap: 4px; }
h2 { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.55rem; line-height: 1.15; text-wrap: balance; }
.note { margin: 0; font-size: .88rem; color: var(--muted); max-width: 82ch; }

.controls { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.field { display: grid; gap: 4px; font-size: .82rem; color: var(--muted); min-width: 0; }
.select, .search { font: inherit; font-size: .95rem; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: min(100%, 11rem); max-width: 100%; }
.select:disabled { opacity: .55; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--ink); padding-bottom: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--bo); margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1 1 auto; font: inherit; font-size: .95rem; color: var(--ink); background: var(--paper); border: 0; padding: 7px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); }
button:focus-visible, select:focus-visible, input:focus-visible, .table tbody tr:focus-visible, a:focus-visible { outline: 2px solid var(--pick); outline-offset: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 22px; height: 12px; border-radius: 2px; }
.key-mean { height: 3px; background: var(--mean); }
.key-band { background: var(--mean); opacity: .18; }
.key-each { height: 1px; background: var(--each); }
.key-pick { height: 3px; background: var(--pick); }
.key-bo { height: 3px; background: var(--bo); }
.key-bo-proj { height: 0; border-top: 3px dashed var(--bo); background: none; }
.legend .bo-key[hidden] { display: none; }

.chart { position: relative; min-height: 22rem; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--body); }
.chart .strong { fill: var(--ink); font-weight: 600; paint-order: stroke; stroke: var(--card); stroke-width: 4px; stroke-linejoin: round; }
.loading { background: linear-gradient(90deg, var(--grid), transparent 60%) 0 0 / 200% 100%; border-radius: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .loading { animation: shimmer 1.4s linear infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .mean-path { animation: fade .5s ease-out; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}
.fail { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: inherit; font-size: .9rem; color: var(--muted); }
.fail::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mean); }
.tip { position: absolute; pointer-events: none; z-index: 2; min-width: 12rem; max-width: 17rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px;
       box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 8px 10px; font-size: .82rem; line-height: 1.45; }
.tip-head { color: var(--muted); font-weight: 600; }
.tip-row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip-row span:first-child { color: var(--muted); }

.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr)); gap: 8px; min-height: 12rem; }
.mini { display: grid; gap: 2px; text-align: left; font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; min-width: 0; }
.mini:hover { border-color: var(--axis); }
.mini[aria-pressed="true"] { border-color: var(--pick); box-shadow: inset 0 0 0 1px var(--pick); }
.mini-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini svg { display: block; width: 100%; height: 3rem; }

.search { min-width: min(100%, 16rem); }
.table-wrap { max-height: 34rem; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--card); text-align: right; padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.left, .table td.left { text-align: left; }
.sort { font: inherit; font-weight: 600; color: var(--ink); background: transparent; border: 0; padding: 8px 10px; cursor: pointer; width: 100%; text-align: inherit; }
.table th[aria-sort="ascending"] .sort::after { content: " ▲"; font-size: .7em; color: var(--muted); }
.table th[aria-sort="descending"] .sort::after { content: " ▼"; font-size: .7em; color: var(--muted); }
.table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--paper); }
.table tbody tr[aria-selected="true"] td { background: var(--paper); font-weight: 600; box-shadow: inset 0 0 0 0 var(--pick); }
.table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--pick); }

h3 { margin: 6px 0 0; font-family: var(--display); font-weight: 600; font-size: 1.2rem; }
.bo-finding { margin: 0; font-size: 1.06rem; max-width: 70ch; }
.bo-finding b { font-variant-numeric: tabular-nums; }
.bo-point { margin: 0; max-width: 72ch; }
.bo-point b { font-variant-numeric: tabular-nums; }
.table-wrap.bo-wrap { max-height: none; }
.bo-wrap .table th { padding: 8px 10px; }
.table.bo-totals tbody tr, .table.bo-seasons tbody tr { cursor: default; }
.table .proj td { color: var(--muted); font-style: italic; }
.table .proj td:first-child { box-shadow: inset 3px 0 0 var(--bo); }
.about summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.about dl { display: grid; gap: 8px; margin: 4px 0 0; font-size: .92rem; max-width: 82ch; }
.about dt { font-weight: 600; }
.about dd { margin: 0 0 6px; color: var(--muted); }

.foot { border-top: 1px solid var(--line); padding-block: 18px calc(24px + env(safe-area-inset-bottom, 0px)); font-size: .85rem; color: var(--muted); }
.foot p { margin: 0 0 6px; }
.foot a { color: inherit; }

@media (max-width: 560px) {
  .card { padding: 14px; }
  .seg button { padding: 7px 9px; font-size: .9rem; }
}
@media (max-width: 511px) {   /* two tiles a row: the fifth takes the whole row rather than sitting alone */
  .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
