/* ===========================================================================
   Tennessee Soccer Stats: shared design layer
   ---------------------------------------------------------------------------
   One file replaces the token block that was copy-pasted into all 44 pages.
   Load it BEFORE each page's inline <style> so page-specific rules still win.

   Pairs with:
     - the inline <head> snippet that sets data-theme before first paint
     - tss-theme.js (toggle behaviour + TSSColors() for canvas/SVG charts)

   Light is a re-declaration, not an inversion. Paper needs its own decisions:
   chart hues re-step darker to hold against a light ground, gold drops to clear
   contrast, rules go warm rather than blue-grey.
   ======================================================================== */

:root{
  /* --- ground: flat. no radial glows, no noise overlay. ------------------ */
  --ink:#0a0c0f;
  --panel:#12161b;
  --panel-deep:#0d1115;
  --rule:#1e252d;
  --rule-strong:#2b3540;

  /* --- ink -------------------------------------------------------------- */
  --text:#e9eef3;        /* 16.8:1  headings, emphasis, figures */
  --prose:#d9e0e7;       /* 14.7:1  running body copy */
  --muted:#98a3ae;       /*  6.9:1  secondary copy, nav */
  --muted2:#78818b;      /*  4.95:1 labels, captions. was #6b7681 at 4.23 (sub-AA) */

  /* --- brand: identity and emphasis. NEVER a data series. --------------- */
  --gold:#e7b24c;
  --gold-dim:#a87a03;
  --on-gold:#1a1206;     /* text sitting on a gold fill */

  /* --- status: reserved, used as text ----------------------------------- */
  --win:#5dd39e;
  --loss:#e8795e;
  --draw:#8a96a3;

  /* --- categorical chart fills. FIXED ORDER, never cycled. --------------
     Computed and validated against this surface: lightness band PASS, chroma
     floor PASS, worst adjacent CVD dE 17.8 (target 8), normal-vision floor
     25.2, contrast all >3:1. Lightness is staggered on purpose so adjacent
     pairs survive deuteranopia, where equal-lightness red and green collapse. */
  --c1:#4592dc; --c2:#a23e31; --c3:#02a7b2; --c4:#734ca1; --c5:#41a563;

  /* --- sequential (magnitude): one hue, light = high -------------------- */
  --s1:#876200; --s2:#a87a03; --s3:#c59634; --s4:#e2b254; --s5:#ffd078;

  /* --- diverging (polarity): clay <- neutral -> teal --------------------- */
  --d-lo2:#a04034; --d-lo1:#c15e50; --d-mid:#78818b; --d-hi1:#01929b; --d-hi2:#0bb3bf;

  /* --- surfaces & effects ----------------------------------------------- */
  --ring:#0a0c0f;                        /* surface ring on overlapping marks */
  --hover:rgba(255,255,255,.035);
  --hover-line:#3a4654;
  --shadow-color:rgba(0,0,0,.55);        /* a COLOUR, for use inside box-shadow */
  --shadow:0 10px 30px rgba(0,0,0,.55);  /* a complete shadow value */
  --logo-bg:#ffffff;                     /* school crests are drawn for white */

  /* --- tints. color-mix keeps these correct in both themes automatically. */
  --wash-gold:color-mix(in srgb, var(--gold) 9%, transparent);
  --wash-gold-soft:color-mix(in srgb, var(--gold) 5%, transparent);
  --line-gold:color-mix(in srgb, var(--gold) 34%, transparent);
  --wash-win:color-mix(in srgb, var(--win) 10%, transparent);
  --wash-loss:color-mix(in srgb, var(--loss) 10%, transparent);
  --wash-draw:color-mix(in srgb, var(--draw) 14%, transparent);
  --wash-c1:color-mix(in srgb, var(--c1) 14%, transparent);
  --wash-c2:color-mix(in srgb, var(--c2) 14%, transparent);
  --wash-c4:color-mix(in srgb, var(--c4) 14%, transparent);

  /* --- type ------------------------------------------------------------- */
  --serif:'Literata','Iowan Old Style','Palatino Linotype',Palatino,Georgia,serif;
  --sans:'Instrument Sans',system-ui,-apple-system,'Segoe UI',sans-serif;
  --mono:'Spline Sans Mono',ui-monospace,'Cascadia Mono',Consolas,monospace;

  /* --- rhythm ----------------------------------------------------------- */
  --measure:680px;       /* prose column: ~66 characters at 17px */
  --breakout:880px;      /* figures and tables */
  --wrap:1180px;         /* masthead and full-width tools */
  --gutter:22px;

  /* --- radius: 4 steps, down from the 20 ad-hoc values in the old pages -- */
  --r-sm:6px; --r-md:10px; --r-lg:16px; --r-full:999px;

  /* --- LEGACY ALIASES ----------------------------------------------------
     Un-migrated pages still reference these names in their own <style>.
     Keeping them mapped means a page gets a working light theme the moment
     its :root block is removed, before anyone touches its layout. Delete a
     line here only once no page references it. */
  --line:var(--rule);
  --panel2:var(--panel);
  --mint:var(--win);
  --coral:var(--loss);
  --tie:var(--draw);
}

:root[data-theme="light"]{
  --ink:#f7f4ee;
  --panel:#efeae1;
  --panel-deep:#e8e2d7;
  --rule:#ddd7cc;
  --rule-strong:#c2bab0;

  --text:#16181c;        /* 16.2:1 */
  --prose:#1c1f24;       /* 15.1:1 */
  --muted:#54595f;       /*  6.4:1 */
  --muted2:#63686d;      /*  5.1:1 */

  --gold:#8a5d05;        /*  5.2:1. re-stepped, not the dark-mode gold */
  --gold-dim:#6f4a04;
  --on-gold:#f7f4ee;     /* flips: light gold takes dark text, dark gold takes light */

  --win:#1f7a4d;         /*  4.8:1 */
  --loss:#a8341f;        /*  6.0:1 */
  --draw:#5f656b;

  --c1:#2f6ea8; --c2:#8c3123; --c3:#0a6f77; --c4:#59397d; --c5:#2c7346;

  --ring:#f7f4ee;
  --hover:rgba(0,0,0,.035);
  --hover-line:#a89e91;
  --shadow-color:rgba(0,0,0,.16);
  --shadow:0 10px 30px rgba(0,0,0,.16);

  /* sequential ramp for paper: dark = high, so magnitude reads against a light
     ground instead of dissolving into it. Not the dark ramp inverted. */
  --s1:#f2e3c0; --s2:#dcc07a; --s3:#c09a3f; --s4:#9a7413; --s5:#6f5205;
  --d-lo2:#8c3123; --d-lo1:#a8523f; --d-mid:#7d8288; --d-hi1:#0a6f77; --d-hi2:#05555c;
}

/* ---------------------------------------------------------------------------
   RESET + BASE
   ------------------------------------------------------------------------ */
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
  background:var(--ink);
  color:var(--prose);
  font-family:var(--sans);
  line-height:1.5;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--gold);color:var(--on-gold)}
img{max-width:100%}
/* form controls do not inherit font-family, so an unstyled input renders in the
   browser default (Arial) next to text that does not */
button,input,select,textarea{font-family:inherit}
@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* ---------------------------------------------------------------------------
   LAYOUT
   ------------------------------------------------------------------------ */
.wraplg{max-width:var(--wrap);margin:0 auto;padding:0 var(--gutter)}

/* Article pages: prose sits in the measure, .breakout children go wide.
   The width change IS the rhythm: a narrow line of argument, interrupted by
   wide evidence. A page that never changes width reads as a strip.

   NOTE the class name. This deliberately does NOT hook `.wrap`, which every page
   on the site already uses as a generic full-width page container. An earlier
   version did, and its `> *` rule squeezed index.html's rankings table into a
   680px column, which then overflowed the viewport by 284px. A shared stylesheet
   must not redefine the behaviour of a class the pages already own. */
.article{max-width:calc(var(--breakout) + var(--gutter) * 2);margin:0 auto;padding:0 var(--gutter)}
.article > *:not(.breakout){max-width:var(--measure);margin-left:auto;margin-right:auto}
.breakout .figtitle,.breakout .leg,.breakout figcaption{
  max-width:var(--measure);margin-left:auto;margin-right:auto}

/* ---------------------------------------------------------------------------
   MASTHEAD
   ------------------------------------------------------------------------ */
/* Brand left, nav and toggle together on the right. NOT space-between: with three
   flex children that pushes the toggle to the far edge and leaves a dead gap
   between it and the last nav link. `margin-left:auto` on the nav does the job. */
.topbar{display:flex;align-items:center;gap:18px;
  padding:18px 0 11px;border-bottom:1px solid var(--rule-strong)}
.topbar .nav{margin-left:auto}
.brand{display:flex;align-items:center;gap:9px;text-decoration:none;color:var(--text)}
.brand .crest{width:17px;height:17px;border-radius:50%;background:var(--gold);flex:0 0 auto}
.brand .mark{font-family:var(--serif);font-weight:600;font-size:17px;letter-spacing:.01em}
.nav{display:flex;gap:20px;font-size:14px}
.nav a{color:var(--muted);text-decoration:none;padding-bottom:11px;margin-bottom:-11px;
  border-bottom:2px solid transparent;transition:color .16s,border-color .16s}
.nav a:hover{color:var(--text)}
.nav a.on{color:var(--text);border-bottom-color:var(--gold)}

/* theme toggle: muted like a nav link, never an accent. Available, not loud. */
.theme{background:none;border:0;padding:4px;cursor:pointer;color:var(--muted);
  display:grid;place-items:center;line-height:0;border-radius:2px;transition:color .16s}
.theme:hover{color:var(--text)}
.theme:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.theme svg{display:block}

/* ---------------------------------------------------------------------------
   TYPE
   ------------------------------------------------------------------------ */
h1{font-family:var(--serif);font-weight:500;font-size:46px;line-height:1.08;
  letter-spacing:0;color:var(--text)}
h2{font-family:var(--serif);font-weight:600;font-size:31px;line-height:1.18;color:var(--text);
  border-top:1px solid var(--rule-strong);padding-top:26px;margin:48px 0 6px}
h3{font-family:var(--serif);font-weight:600;font-size:21px;line-height:1.28;color:var(--text)}
.standfirst{font-family:var(--serif);font-style:italic;font-weight:400;font-size:19px;
  line-height:1.5;color:var(--muted);margin-top:14px}
.deck{font-family:var(--serif);font-style:italic;font-size:16px;color:var(--muted);margin-bottom:18px}
.dateline{display:flex;gap:18px;flex-wrap:wrap;font-size:13px;color:var(--muted2);
  margin-top:22px;padding-bottom:24px;border-bottom:1px solid var(--rule)}
p{font-size:17px;line-height:1.65;margin:0 0 18px}
p b,p strong{color:var(--text);font-weight:600}
em{font-family:var(--serif);font-style:italic;font-size:1.04em;color:var(--text)}
/* links: a gold rule under the baseline, not a colour swap, so a paragraph
   with four links in it still reads as a paragraph. */
a.lnk{color:var(--text);text-decoration:none;
  background-image:linear-gradient(var(--gold),var(--gold));
  background-size:100% 1px;background-repeat:no-repeat;background-position:0 1.15em;
  padding-bottom:1px;transition:color .16s}
a.lnk:hover{color:var(--gold)}

/* ---------------------------------------------------------------------------
   EDITORIAL PRIMITIVES
   ------------------------------------------------------------------------ */
.aside{border-top:1px solid var(--rule);border-bottom:1px solid var(--rule);
  padding:14px 0;margin:0 0 22px;font-size:14px;line-height:1.55;color:var(--muted2)}
.aside b{display:block;font-family:var(--serif);font-style:italic;font-weight:400;
  font-size:15px;color:var(--muted);margin-bottom:4px}

.stats{margin:4px 0 26px}
.st{display:flex;justify-content:space-between;align-items:baseline;gap:16px;
  padding:13px 0;border-bottom:1px solid var(--rule)}
.st:first-child{border-top:1px solid var(--rule-strong)}
.st .l{font-size:14.5px;color:var(--muted)}
.st .v{font-family:var(--serif);font-weight:500;font-size:30px;line-height:1;
  color:var(--text);font-feature-settings:"tnum"}
.st.lead .v{color:var(--gold)}

figure{margin:26px 0 10px;border-top:1px solid var(--rule-strong);
  border-bottom:1px solid var(--rule);padding:20px 0 18px}
figcaption{font-size:13px;color:var(--muted2);line-height:1.55;margin-top:14px}
.figtitle{font-family:var(--serif);font-weight:600;font-size:19px;color:var(--text);
  margin-bottom:16px}
.leg{display:flex;gap:20px;font-size:13px;color:var(--muted);margin-bottom:18px}
.leg i{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:7px;
  vertical-align:-1px}

.verdict{border-top:1px solid var(--rule-strong);border-bottom:1px solid var(--rule-strong);
  padding:26px 0;margin:44px 0 26px}
.verdict h3,.verdict h4{font-family:var(--serif);font-style:italic;font-weight:400;
  font-size:17px;color:var(--muted);margin-bottom:12px}
.verdict p:last-child{margin-bottom:0}

.related{margin:4px 0 34px}
.rcard{display:block;padding:16px 0;border-bottom:1px solid var(--rule);text-decoration:none}
.rcard h4{font-family:var(--serif);font-weight:600;font-size:18px;color:var(--text);margin-bottom:4px}
.rcard p{font-size:14px;color:var(--muted2);line-height:1.55;margin:0}
.rcard:hover h4{color:var(--gold)}

.foot{color:var(--muted2);font-size:13.5px;padding:20px 0 56px;line-height:1.65;
  border-top:1px solid var(--rule-strong);margin-top:34px}
.foot b{color:var(--muted)}
.mobile-note{display:none;color:var(--muted2);font-size:13px;line-height:1.6;margin:2px 0 18px}

/* ---------------------------------------------------------------------------
   DATA
   ------------------------------------------------------------------------ */
.tbl{width:100%;border-collapse:collapse;font-size:14px;margin:4px 0 8px}
.tbl th{text-align:left;font-size:11px;letter-spacing:.07em;text-transform:uppercase;
  color:var(--muted2);font-weight:600;padding:0 12px 9px 0;
  border-bottom:1px solid var(--rule-strong)}
.tbl th.num{text-align:right;padding-right:0}
.tbl td{padding:10px 12px 10px 0;border-bottom:1px solid var(--rule);
  font-family:var(--mono);font-size:13px;color:var(--muted)}
.tbl td.nm{font-family:var(--sans);font-size:14px;color:var(--text);font-weight:500}
.tbl td.num{text-align:right;padding-right:0;font-feature-settings:"tnum";color:var(--text)}
.tbl tr:hover td{background:var(--hover)}

.seg{display:inline-flex;border:1px solid var(--rule-strong)}
.seg button{background:transparent;border:0;color:var(--muted);font-family:var(--sans);
  font-weight:500;font-size:14px;padding:8px 20px;cursor:pointer;
  transition:background .16s,color .16s}
.seg button + button{border-left:1px solid var(--rule-strong)}
.seg button.on{background:var(--gold);color:var(--on-gold);font-weight:600}
.seg button:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

/* ---------------------------------------------------------------------------
   CHART COLOURS
   ---------------------------------------------------------------------------
   Chart code sets colour as an SVG presentation attribute (fill="#4a5568"),
   and a presentation attribute cannot take var(). But `fill` and `stroke` ARE
   CSS properties, and any CSS rule outranks a presentation attribute, so these
   selectors retheme every chart on the site without touching a line of chart JS
   and without needing a redraw on theme change.

   That is why this exists rather than a TSSColors() rewrite of 17 pages: same
   result, far smaller blast radius. Verified in-browser: with the attribute
   still reading #4a5568, computed fill resolves to var(--muted2).

   21 literals covered 152 uses across 17 pages. #4a5568 alone was 62 of them,
   as axis labels, and it failed contrast against BOTH grounds.

   When you write a NEW chart, do not add to this list. Either set the colour
   from TSSColors() (see tss-theme.js) or give the element a class and style it.
   This block is a bridge for existing pages, not a pattern to copy.
   ------------------------------------------------------------------------ */
svg [fill="#4a5568"]{fill:var(--muted2)}      /* axis + tick labels */
svg [fill="#6b7681"]{fill:var(--muted2)}
svg [fill="#889"]   {fill:var(--muted)}
svg [fill="#9aa5b0"]{fill:var(--muted)}
svg [fill="#cdd6df"]{fill:var(--prose)}
svg [fill="#2a3340"]{fill:var(--rule-strong)} /* watermark text */
svg [fill="#2a333d"]{fill:var(--rule-strong)}
svg [fill="#e7b24c"]{fill:var(--gold)}
svg [fill="#e8795e"]{fill:var(--loss)}
svg [fill="#4dd3a2"]{fill:var(--win)}
svg [fill="#5dd39e"]{fill:var(--win)}
svg [fill="#5b9cf6"]{fill:var(--c1)}
svg [fill="#a78bfa"]{fill:var(--c4)}

svg [stroke="#1c2229"]{stroke:var(--rule)}    /* gridlines */
svg [stroke="#14191f"]{stroke:var(--rule)}
svg [stroke="#1a2129"]{stroke:var(--rule)}
svg [stroke="#1a2026"]{stroke:var(--rule)}
svg [stroke="#3a4654"]{stroke:var(--rule-strong)}
svg [stroke="#2a333d"]{stroke:var(--rule-strong)}
svg [stroke="#232b34"]{stroke:var(--rule-strong)}
svg [stroke="#6b7681"]{stroke:var(--muted2)}
svg [stroke="#12161b"]{stroke:var(--panel)}
svg [stroke="#e7b24c"]{stroke:var(--gold)}
svg [stroke="#5dd39e"]{stroke:var(--win)}
svg [stroke="#fff"]   {stroke:var(--text)}    /* selection outline, 25% opacity */

/* Chart TEXT wears text tokens, never a series colour. Some charts painted their
   value labels with the same runtime-computed colour as the mark beside them,
   which no attribute selector can catch (the value is `rgb(232,144,87)`, built by
   a JS interpolation) and which fails contrast on the paper ground. The mark
   carries identity; the label just has to be readable. */
svg text.cval{fill:var(--text)}
svg text.cmut{fill:var(--muted2)}
svg text.cgold{fill:var(--gold)}

/* ---------------------------------------------------------------------------
   MOBILE
   ------------------------------------------------------------------------ */
.nt,.hamb{display:none}
@media(max-width:760px){
  h1{font-size:30px}
  h2{font-size:24px;margin-top:38px;padding-top:20px}
  h3{font-size:19px}
  .standfirst{font-size:17px}
  p{font-size:16px}
  .st .v{font-size:26px}
  .mobile-note{display:block}
  .tbl .opt{display:none}

  .topbar{flex-wrap:wrap;gap:10px;padding:15px 0 10px}
  .brand{order:1}
  .topbar .nav{margin-left:0}
  /* 44px tap targets: WCAG 2.5.8 asks 24 minimum, platform guidance 44.
     Negative margins grow the hit area without changing the visual weight. */
  .theme{order:2;margin-left:auto;width:44px;height:44px;margin-right:-10px}
  .hamb{display:flex;flex-direction:column;justify-content:center;order:3;cursor:pointer;
    width:44px;height:44px;margin-right:-11px;user-select:none;color:var(--text)}
  .hamb span{display:block;width:19px;height:1.5px;background:currentColor;margin:4px auto 4px 0}
  .nav{display:none;order:4;width:100%;flex-direction:column;gap:0;
    border-top:1px solid var(--rule);margin-top:4px}
  .nav a{padding:13px 0;margin:0;border-bottom:1px solid var(--rule);width:100%;
    border-left:2px solid transparent;border-bottom-width:1px}
  .nav a.on{border-bottom-color:var(--rule);padding-left:10px;border-left-color:var(--gold)}
  .nt:checked ~ .nav{display:flex}
}
