/*
 * One stylesheet for the whole site.
 *
 * It used to be a shared base plus a <style> block per page, and the blocks
 * disagreed -- h2 was a small uppercase label here and a section heading there,
 * and the keeper board and history page each had their own unrelated version of
 * "pick one of these". Everything lives here now, as named components used by
 * more than one page.
 */

:root {
  --bg:#fbfaf8; --panel:#fff; --text:#1c1b19; --muted:#6b6862; --line:#e5e1da;
  --accent:#7a3418; --accent-soft:#f2ebe4; --ok:#2f6b3f; --warn:#8a5a00;
  --sel:#7a3418; --sel-bg:#f7efe8; --on-accent:#fff;

  /* Spacing scale, so sections and stacks agree without magic numbers. */
  --s1:.25rem; --s2:.5rem; --s3:.75rem; --s4:1rem; --s5:1.5rem;
  --s6:2rem; --s7:3rem; --s8:4rem;

  /* Type scale. */
  --t-micro:.7rem; --t-small:.82rem; --t-body:.92rem; --t-lede:1.08rem;
  --radius:10px; --radius-sm:8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#171614; --panel:#1f1e1b; --text:#eceae6; --muted:#9c988f; --line:#302e2a;
    --accent:#e0855a; --accent-soft:#2a2420; --ok:#7fbe8f; --warn:#d6a44a;
    --sel:#e0855a; --sel-bg:#2c2420; --on-accent:#1a1512;
  }
}

* { box-sizing:border-box; }
body {
  margin:0; background:var(--bg); color:var(--text);
  font:16px/1.65 ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
a { color:var(--accent); }
p { margin:0 0 var(--s4); }
ul { margin:0 0 var(--s4); padding-left:1.1rem; }
li { margin-bottom:.55rem; }
li::marker { color:var(--accent); }
strong { font-weight:600; }

.wrap { max-width:46rem; margin:0 auto; padding:var(--s6) var(--s5) var(--s8); }
.wrap.wide { max-width:64rem; }

/* ---- Masthead ---------------------------------------------------------- */

.masthead {
  display:flex; align-items:center; justify-content:space-between; gap:var(--s5);
  flex-wrap:wrap; padding-bottom:var(--s4); margin-bottom:var(--s6);
  border-bottom:1px solid var(--line);
}
.brand {
  font-weight:600; font-size:.95rem; letter-spacing:-.01em;
  color:var(--text); text-decoration:none; white-space:nowrap;
}
.brand span { color:var(--muted); font-weight:400; }
.nav { display:flex; align-items:center; gap:var(--s5); font-size:var(--t-body); flex-wrap:wrap; }
.nav a { color:var(--muted); text-decoration:none; padding:var(--s1) 0; }
.nav a:hover { color:var(--text); }
.nav a[aria-current="page"] {
  color:var(--text); font-weight:500; box-shadow:inset 0 -2px 0 var(--accent);
}
/* Pushed away from the page links: it is not one of them. */
.nav .signout { margin-left:var(--s2); font-size:var(--t-small); }

/* ---- Page header ------------------------------------------------------- */

header { margin-bottom:var(--s6); }
.eyebrow {
  font-size:var(--t-micro); letter-spacing:.12em; text-transform:uppercase;
  color:var(--accent); font-weight:600; margin:0 0 var(--s3);
}
h1 { font-size:clamp(1.7rem,4vw,2.2rem); line-height:1.15; margin:0 0 var(--s3); letter-spacing:-.02em; }
.lede { font-size:var(--t-lede); color:var(--muted); margin:0; max-width:36rem; }
.sub { color:var(--muted); margin:0; font-size:var(--t-body); }

/*
 * The section pattern. `h2` alone used to mean two different things depending
 * on the page; now a section always has a heading and may have a description,
 * and they are styled here once.
 */
section { margin-bottom:var(--s7); }
h2 {
  font-size:1.05rem; font-weight:600; letter-spacing:-.01em; text-transform:none;
  color:var(--text); margin:var(--s6) 0 var(--s3);
}
.section-head { margin-bottom:var(--s4); }
.section-head h2 { margin:0 0 var(--s1); }
.section-head p { margin:0; font-size:var(--t-body); color:var(--muted); max-width:38rem; }

/* A small uppercase label, for when that is genuinely what is wanted. */
.label {
  font-size:var(--t-micro); letter-spacing:.1em; text-transform:uppercase;
  color:var(--muted); font-weight:600; margin:0 0 var(--s2);
}

/* ---- Surfaces ---------------------------------------------------------- */

.card { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:var(--s5) var(--s5); }
.note {
  background:var(--accent-soft); border:1px solid var(--line); border-radius:var(--radius);
  padding:1.1rem 1.3rem; font-size:var(--t-body); color:var(--muted);
}
.note strong { color:var(--text); }
.banner { margin:var(--s4) 0 var(--s6); }
.button {
  display:inline-block; background:var(--accent); color:var(--on-accent);
  text-decoration:none; font-weight:500; border-radius:var(--radius-sm); padding:.7rem 1.2rem;
}
.button:hover { filter:brightness(1.08); }

/* ---- Picker ------------------------------------------------------------ */

/*
 * One control for "choose one of these", used by the season selector and the
 * team selector. They were two different components doing the same job.
 */
.picker { display:flex; flex-wrap:wrap; gap:var(--s1); margin:0 0 var(--s6); }
.picker button {
  font:inherit; font-size:var(--t-small); cursor:pointer; padding:.35rem .8rem;
  border:1px solid var(--line); background:var(--panel); color:var(--muted);
  border-radius:999px;
}
.picker button:hover { color:var(--text); border-color:var(--muted); }
.picker button[aria-pressed="true"] {
  background:var(--sel); border-color:var(--sel); color:var(--on-accent); font-weight:500;
}

/* ---- Tables ------------------------------------------------------------ */

.scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
table { border-collapse:collapse; width:100%; font-size:var(--t-body); }
th, td { text-align:right; padding:.5rem .6rem; white-space:nowrap; }
th {
  font-size:var(--t-micro); text-transform:uppercase; letter-spacing:.06em;
  color:var(--muted); font-weight:600; border-bottom:1px solid var(--line);
}
td { border-bottom:1px solid var(--line); font-variant-numeric:tabular-nums; }
th:first-child, td:first-child {
  text-align:left; position:sticky; left:0; background:var(--bg); z-index:1;
}
tbody tr:hover td, tbody tr:hover td:first-child { background:var(--panel); }
.team { font-weight:500; }
.mgr { display:block; font-size:var(--t-small); color:var(--muted); font-weight:400; }
.pos { color:var(--ok); }
.neg { color:var(--warn); }
.bar { display:flex; align-items:center; gap:var(--s2); justify-content:flex-end; }
.bar i { display:block; height:5px; border-radius:3px; background:var(--accent); opacity:.75; }

.grid td, .grid th { padding:.4rem .45rem; font-size:var(--t-small); text-align:center; }
.grid td.self { color:var(--line); }

/* ---- Stat cards -------------------------------------------------------- */

.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(13rem,1fr)); gap:var(--s4); }
.cards .card { padding:1.1rem 1.2rem; }
.cards .k {
  font-size:var(--t-micro); text-transform:uppercase; letter-spacing:.06em;
  color:var(--muted); font-weight:600; margin:0 0 var(--s1);
}
.cards .v {
  font-size:1.5rem; font-weight:600; letter-spacing:-.02em; margin:0 0 var(--s1);
  font-variant-numeric:tabular-nums;
}
.cards .w { font-size:var(--t-small); color:var(--muted); margin:0; }

/* ---- Keeper board ------------------------------------------------------ */

.cols { display:grid; grid-template-columns:1fr 19rem; gap:var(--s6); align-items:start; }
aside { position:sticky; top:var(--s6); }
aside .card { padding:1.1rem 1.2rem; }

.row {
  display:flex; align-items:baseline; gap:var(--s3); width:100%; text-align:left;
  font:inherit; cursor:pointer; padding:.6rem .8rem; border-radius:var(--radius-sm);
  background:transparent; border:1px solid transparent; color:inherit;
}
.row:hover { background:var(--panel); border-color:var(--line); }
.row[aria-pressed="true"] { background:var(--sel-bg); border-color:var(--sel); }
.row.off { cursor:not-allowed; opacity:.45; }
.row.off:hover { background:transparent; border-color:transparent; }
.cost {
  font-variant-numeric:tabular-nums; font-weight:600; font-size:var(--t-small);
  min-width:2.4rem; color:var(--accent);
}
.who { flex:1; }
.meta { font-size:var(--t-small); color:var(--muted); }
.tag {
  font-size:var(--t-micro); text-transform:uppercase; letter-spacing:.07em; font-weight:600;
  color:var(--warn); margin-left:var(--s2);
}
.slot { display:flex; justify-content:space-between; gap:var(--s2); padding:.45rem 0; font-size:var(--t-body); }
.slot + .slot { border-top:1px solid var(--line); }
.slot .r { font-variant-numeric:tabular-nums; font-weight:600; color:var(--accent); }
.empty { color:var(--muted); font-size:var(--t-body); padding:.45rem 0; }
.verdict {
  margin-top:var(--s3); padding-top:var(--s3);
  border-top:1px solid var(--line); font-size:var(--t-body);
}
.verdict.bad { color:var(--warn); }
.verdict.good { color:var(--ok); }
details { margin-top:var(--s6); }
summary { cursor:pointer; font-size:var(--t-small); color:var(--muted); }
details .row { cursor:default; }

/* ---- Attribution ------------------------------------------------------- */

/*
 * Yahoo's required attribution mark, used as supplied: no recolouring, no
 * effects, no change of proportion. The file pads a 168.5x22.9 wordmark into a
 * 293x293 canvas, so the window below crops that padding away -- the mark's own
 * aspect ratio is untouched. It sits on white in both themes because the
 * wordmark is black and must not be inverted to suit our dark palette.
 */
.attribution { display:inline-flex; align-items:center; gap:.55rem; text-decoration:none; color:inherit; }
.attribution:hover { text-decoration:underline; }
.yf {
  display:inline-block; width:110px; height:15px; overflow:hidden; position:relative;
  background:#fff; border-radius:3px; padding:0; flex:none;
}
.yf img { position:absolute; width:191.3px; height:191.3px; left:-40.7px; top:-88.2px; }
footer {
  margin-top:var(--s8); padding-top:var(--s5); border-top:1px solid var(--line);
  font-size:var(--t-small); color:var(--muted);
}
footer .attribution { margin-bottom:var(--s2); }

/* ---- Narrow screens ---------------------------------------------------- */

@media (max-width:52rem) {
  .cols { grid-template-columns:1fr; }
  aside { position:static; }
}

/*
 * Below this the wide tables stop being tables. A sticky first column in a
 * horizontally scrolling table is unusable on a phone -- you lose the row you
 * are reading. Each row becomes a stacked block labelled by its column header,
 * carried in data-label by the page that renders it.
 */
@media (max-width:34rem) {
  .stacked thead { display:none; }
  .stacked tr {
    display:block; border-bottom:1px solid var(--line);
    padding:var(--s3) 0;
  }
  .stacked tr:hover td { background:transparent; }
  .stacked td {
    display:flex; justify-content:space-between; gap:var(--s4);
    border:0; padding:.15rem 0; white-space:normal; text-align:right;
  }
  .stacked td:first-child {
    position:static; text-align:left; font-weight:600;
    padding-bottom:var(--s2); display:block;
  }
  .stacked td[data-label]::before {
    content:attr(data-label); color:var(--muted); font-size:var(--t-small);
    text-align:left; font-variant-numeric:normal;
  }
  /* The head-to-head grid stays a grid; stacking 12 columns helps nobody. */
  .grid.stacked thead { display:table-header-group; }
  .grid.stacked tr { display:table-row; padding:0; }
  .grid.stacked td { display:table-cell; text-align:center; padding:.4rem .45rem; }
  .grid.stacked td::before { content:none; }
}
