/* ==========================================
   Shared site chrome (base_site.html)
   ==========================================
   Loaded AFTER landing.css so these rules win where they overlap. Everything
   here is nav, footer and page-shell; the section styles stay in landing.css.
   ========================================== */

/* ---- Sticky footer: the footer sits at the bottom, not mid-screen ----
   A short page (/screens/ while it is a placeholder, /faq/ with everything
   collapsed) left the footer floating in the middle of the window with dead
   space beneath it, which reads as "the rest of the page failed to load".
   base_site.html wraps its content block in <main>; this makes that column
   fill the viewport. 100dvh, not 100vh: on mobile Safari 100vh is the TALLEST
   viewport, so a vh page is always a URL-bar taller than the screen. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
main { flex: 1 0 auto; }

/* ---- Nav: 56px desktop, 52px mobile (D15) ---- */
.site-nav .nav-inner {
  min-height: 56px;
  padding: 0 24px;
  gap: 12px;
}
.site-nav .nav-links { flex-wrap: nowrap; }
.nav-brand.active { color: var(--accent); }

/* landing.css collapses the link row at 900px; the brand + Steam pill fit down
   to ~820px, so keep the links inline until then. */
@media (min-width: 821px) {
  .site-nav .nav-toggle { display: none; }
  .site-nav .nav-links {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 0;
    background: none;
    border-bottom: 0;
    box-shadow: none;
  }
}

/* ---- Below 820px: brand + Steam pill stay, the rest becomes a sheet ---- */
@media (max-width: 820px) {
  .site-nav .nav-inner { min-height: 52px; padding: 0 16px; }
  .site-nav .nav-toggle { display: inline-flex; width: 40px; height: 40px; }
  .site-nav .nav-links {
    display: none;
    /* absolute, not fixed: .site-nav carries backdrop-filter, and a filtered
       element becomes the containing block for its fixed descendants — a
       position:fixed sheet then resolves top/bottom against the 52px nav bar
       instead of the viewport and spills out behind the hero. Measured. */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    /* dvh, not vh: with vh the sheet is the TALL-viewport height minus 52px, so
       on a phone showing the URL bar its last row sits below the fold and the
       whole sheet scrolls by exactly the bar's height. */
    height: calc(100dvh - 52px);
    max-height: calc(100dvh - 52px);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    overflow-y: auto;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-1);
    border-bottom: 0;
    box-shadow: none;
  }
  .site-nav.nav-open .nav-links { display: flex; }
  .site-nav .nav-links .nav-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    font-size: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border-bottom: 1px solid var(--border);
  }
  .site-nav .nav-links .nav-link--cta,
  .site-nav .nav-links .nav-link--login { margin-left: 0; }
  /* In the sheet every entry is a full-width row. landing.css styles Login as a
     bordered pill, and a pill in a stack of plain rows reads as the page's
     primary action — it is the least important thing in the list. Steam stays a
     pill, up in the bar, which is where the primary action belongs. */
  .site-nav .nav-links .nav-link--login {
    background: none;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-m);
    font-weight: inherit;
    padding: 12px 14px;
  }
  /* The sheet owns the viewport while it is open. */
  body.nav-locked { overflow: hidden; }
}

/* ---- Flash messages (a failed login lands back on the page it came from) ---- */
.flash-stack {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(560px, calc(100% - 32px));
}
.flash-note {
  background: var(--bg-2);
  border: 1px solid var(--border-b);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}

/* ---- Page shell: content clears the fixed nav ---- */
.page-head {
  padding: 112px 24px 0;
  max-width: var(--max-w);
  margin: 0 auto;
}
@media (max-width: 820px) { .page-head { padding-top: 88px; } }
.page-head .page-title {
  font-family: var(--font-d);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
}
@media (max-width: 600px) { .page-head .page-title { font-size: 30px; } }
.page-head .page-sub {
  color: var(--text-m);
  font-size: 17px;
  max-width: 640px;
}
.page-note {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--border-b);
  border-left: 3px solid var(--warm);
  border-radius: 8px;
  background: var(--bg-1);
  color: var(--text-m);
  font-size: 13px;
  max-width: 640px;
}
.page-body { padding-top: 24px; }
.page-empty {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 24px 96px;
  color: var(--text-m);
  font-size: 16px;
}

/* ---- Homepage livebar: the one-player qualifier (L11) ----
   A second .livebar-note would sit in a 190px column beside the first and read
   as a caption on the last number. This one is a footnote for the whole strip,
   so it breaks to its own full-width line underneath. */
.livebar-note--qualifier {
  flex-basis: 100%;
  max-width: none;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ---- /music/ Twitch bar: click-to-load, never auto-injected (L7) ---- */
.twitch-live {
  max-width: 640px;
  margin: 28px auto 0;
  padding: 16px 18px;
  border: 1px solid var(--border-b);
  border-left: 3px solid #9146ff;
  border-radius: 12px;
  background: var(--bg-1);
  text-align: center;
}
.twitch-live-label {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.twitch-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #e53935;
  vertical-align: middle;
}
.twitch-live-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.twitch-live .btn-sm { padding: 9px 18px; font-size: 14px; }
.twitch-live-dismiss {
  background: none;
  border: 0;
  color: var(--text-d);
  font-size: 13px;
  cursor: pointer;
  padding: 9px 6px;
  text-decoration: underline;
}
.twitch-live-dismiss:hover { color: var(--text-m); }
.twitch-live-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-d);
}
.twitch-stage {
  margin-top: 16px;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
}
.twitch-stage iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---- Footer additions ---- */
.footer-nav {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.footer-nav a {
  color: var(--text-d);
  font-size: 13px;
  text-decoration: none;
}
.footer-nav a:hover { color: var(--accent); }
.footer-credit {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-d);
}

/* A page whose first block already carries its own heading gets no page-head;
   the section's own padding clears the fixed nav, so add nothing on top. */
.page-body--bare { padding-top: 32px; }

/* Standalone /faq/: the question list is a centred 700px column, but its eyebrow
   and title inherited the section's full-width left alignment, so the heading
   began a long way to the left of the questions it introduces. Scoped to the FAQ
   section — music.html is .page-body--bare too and must keep its full width. */
.page-body--bare .faq-section .section-label,
.page-body--bare .faq-section .section-title {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

/* Body copy links inside the shell (landing.css only styles links inside its
   own components, so an unstyled <a> here falls back to browser blue).
   `:not(.btn)` is load-bearing: site.css loads AFTER landing.css, so a bare
   `.page-empty a` beat `.btn-primary` on colour and on background and the
   /screens/ Steam CTA rendered as an empty pill with invisible text. Anything
   carrying .btn is a component and keeps landing.css's styling. */
.page-empty a:not(.btn) {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(102,192,244,0.35);
}
.page-empty a:not(.btn):hover { border-bottom-color: var(--accent); }

/* ==========================================================================
   /stats/ — "What GuitarSesh records"
   ==========================================================================
   Ten groups, a sticky rail on desktop and a jump-to select on mobile. The
   chart marks are inline SVG from templates/partials/charts.html; everything
   here is the frame around them.

   THE ONLY COLOURS IN A CHART ARE THE ACCENT AND ITS OWN HEAT RAMP. The ramp
   is five steps of the accent hue, dark to light, validated against this
   page's surface (#161b22) as an ordinal ramp: lightness monotone, every
   adjacent gap >= 0.06, the darkest step 2.13:1 on the surface, hue spread 3
   degrees. There is no categorical palette on the page at all — four discrete
   timing verdicts in four hues could not clear the all-pairs colour-blindness
   floor on a dark surface (worst pair measured at delta-E 1.6), so identity is
   carried by a written row label everywhere instead. Do not add a series
   colour here without re-running that check.
   ========================================================================== */
:root {
  --viz-mark: #66c0f4;
  --viz-track: rgba(102,192,244,0.14);
  --viz-grid: rgba(255,255,255,0.07);
  --viz-heat-0: #184f95;
  --viz-heat-1: #256abf;
  --viz-heat-2: #3987e5;
  --viz-heat-3: #6da7ec;
  --viz-heat-4: #9ec5f4;
}

.stats-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.stats-main { min-width: 0; }

/* ---- The rail ---- */
.stats-rail { position: sticky; top: 76px; }
.stats-rail-head {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-d);
  margin-bottom: 10px;
}
.stats-rail ol { list-style: none; margin: 0; padding: 0; counter-reset: rail; }
.stats-rail li { counter-increment: rail; }
.stats-rail a {
  display: block;
  padding: 7px 10px 7px 28px;
  position: relative;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-m);
  border-left: 2px solid var(--border);
  text-decoration: none;
}
.stats-rail a::before {
  content: counter(rail);
  position: absolute;
  left: 9px;
  color: var(--text-d);
  font-size: 11px;
}
.stats-rail a:hover { color: var(--text); }
.stats-rail a.is-current {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-dim);
}

.stats-jump { display: none; }

@media (max-width: 900px) {
  .stats-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 20px 16px 56px; }
  .stats-rail { display: none; }
  .stats-jump {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 52px;
    z-index: 5;
    margin: 0 -16px 20px;
    padding: 10px 16px;
    background: var(--bg-0);
    border-bottom: 1px solid var(--border);
  }
  .stats-jump label { font-size: 12px; color: var(--text-d); white-space: nowrap; }
  .stats-jump select {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    background: var(--bg-1);
    color: var(--text);
    border: 1px solid var(--border-b);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* ---- Groups ---- */
.stats-warming-banner {
  padding: 14px 16px;
  margin-bottom: 24px;
  border: 1px solid var(--border-b);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-1);
  color: var(--text-m);
  font-size: 14px;
}
.stats-group { padding: 34px 0 8px; border-top: 1px solid var(--border); scroll-margin-top: 72px; }
.stats-group:first-child { border-top: 0; padding-top: 8px; }
.stats-group-head h2 {
  font-family: var(--font-d);
  font-size: 27px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.stats-group-blurb { color: var(--text-m); font-size: 15px; max-width: 60ch; }
.stats-chip {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 12px;
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  background: rgba(102,192,244,0.07);
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}
.stats-chip:hover { background: var(--accent-dim); }

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 6px;
}
.stats-summary div {
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}
.stats-summary b {
  display: block;
  font-size: 22px;
  line-height: 1.15;
  color: var(--text);
  overflow-wrap: anywhere;
}
.stats-summary span { display: block; margin-top: 3px; font-size: 12px; color: var(--text-d); line-height: 1.3; }
@media (max-width: 520px) {
  .stats-summary { gap: 8px; }
  .stats-summary div { padding: 10px; }
  .stats-summary b { font-size: 17px; }
  .stats-summary span { font-size: 11px; }
}

/* ---- Blocks ---- */
.stats-blocks { margin-top: 22px; display: grid; gap: 18px; }
.stats-block {
  padding: 18px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 0;
}
.stats-block h3 { font-size: 17px; line-height: 1.3; margin-bottom: 6px; }
.stats-block-blurb { color: var(--text-m); font-size: 13.5px; max-width: 68ch; }
.stats-block-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  margin: 14px 0 4px;
}
.stats-block-summary div { min-width: 0; }
.stats-block-summary b { display: block; font-size: 18px; color: var(--accent); overflow-wrap: anywhere; }
.stats-block-summary span { font-size: 11.5px; color: var(--text-d); }
.stats-block-state {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px dashed var(--border-b);
  border-radius: 8px;
  color: var(--text-d);
  font-size: 13px;
}
.stats-source { margin-top: 14px; }
.stats-source summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-d);
  list-style: none;
}
.stats-source summary::-webkit-details-marker { display: none; }
.stats-source summary::before { content: "+ "; color: var(--accent); }
.stats-source[open] summary::before { content: "- "; }
.stats-source p { margin-top: 8px; font-size: 12.5px; color: var(--text-m); }
.stats-source code {
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--warm);
}
.stats-backtotop { margin: 18px 0 0; font-size: 12px; }
.stats-backtotop a { color: var(--text-d); text-decoration: none; }
.stats-backtotop a:hover { color: var(--accent); }

/* ---- Tables. Only a table may scroll sideways, and only inside its own box. ---- */
.stats-table-wrap { margin-top: 14px; overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.stats-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-d);
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--border);
}
.stats-table td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--border); color: var(--text-m); }
.stats-table td:first-child { color: var(--text); }
.stats-table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* The table is nowrap so the numeric columns stay in one line each. Two
   columns are PROSE, not numbers -- the song title, and the last column of
   "My best run at each song", which reads "No help - the written tempo" and
   was being cut mid-word at "the written temp" because the wrap scroller ends
   at the card edge. Those two wrap; nothing else does. */
.stats-table td.wrap { white-space: normal; min-width: 96px; }
.stats-table td.wrap a { color: var(--accent); text-decoration: none; }
.stats-table td.wrap a:hover { text-decoration: underline; }

.stats-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.stats-kv dt { font-size: 11.5px; color: var(--text-d); }
.stats-kv dd { font-size: 16px; color: var(--text); margin: 2px 0 0; overflow-wrap: anywhere; }

.stats-setlists { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.stats-setlists li { font-size: 13px; color: var(--text-m); }
.stats-setlists b { color: var(--text); margin-right: 8px; }
.stats-setlists span { color: var(--text-d); }
.stats-setlists em { display: block; font-style: normal; font-size: 12px; color: var(--text-d); }
.stats-chain { list-style: none; margin: 12px 0 0; padding: 0; font-size: 12.5px; color: var(--text-m); }

.stats-heat-years { margin-top: 14px; display: grid; gap: 6px; }
.stats-heat-year { display: grid; grid-template-columns: 42px minmax(0, 1fr) 54px; gap: 10px; align-items: center; }
.stats-heat-label { font-size: 12px; color: var(--text-d); }
.stats-heat-total { font-size: 12px; color: var(--text-m); text-align: right; font-variant-numeric: tabular-nums; }
.stats-heat-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.stats-heat-row span { display: block; height: 18px; border-radius: 3px; }

/* ==========================================================================
   Chart marks (templates/partials/charts.html)
   ========================================================================== */
.viz-label { margin-top: 16px; font-size: 12px; color: var(--text-d); text-transform: uppercase; letter-spacing: 0.06em; }
.viz-caption { margin-top: 10px; font-size: 12px; color: var(--text-d); line-height: 1.5; }

.viz-bars { margin-top: 12px; display: grid; gap: 6px; }
.viz-bar-row { display: grid; grid-template-columns: minmax(74px, 27%) minmax(0, 1fr) minmax(64px, auto); gap: 10px; align-items: center; }
.viz-bar-label { font-size: 12.5px; color: var(--text-m); overflow-wrap: anywhere; }
.viz-bar-track { background: var(--viz-track); border-radius: 3px; height: 14px; overflow: hidden; }
/* 4px rounded data-end, square at the baseline. */
.viz-bar-fill { display: block; height: 100%; background: var(--viz-mark); border-radius: 0 4px 4px 0; min-width: 2px; }
.viz-bar-value { font-size: 12.5px; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.viz-bar-value em { font-style: normal; color: var(--text-d); }
.viz-bar-note { margin: 0 0 4px calc(27% + 10px); font-size: 11px; color: var(--text-d); }

.viz-hist { margin-top: 14px; }
.viz-hist-svg { display: block; width: 100%; height: 190px; }
.viz-hist-bar { fill: var(--viz-mark); }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.viz-zero { stroke: var(--warm); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.8; }
.viz-band-perfect { fill: rgba(102,192,244,0.12); }
.viz-band-good { fill: rgba(102,192,244,0.05); }
.viz-hist-axis { position: relative; height: 18px; margin-top: 4px; font-size: 11px; color: var(--text-d); }
.viz-hist-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.viz-hist-axis span:first-child { transform: none; }
.viz-hist-axis span:last-child { transform: translateX(-100%); }

.viz-fret { margin-top: 14px; }
.viz-fret-body { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 6px; }
.viz-fret-strings { display: grid; grid-template-rows: repeat(6, 1fr); font-size: 10px; color: var(--text-d); align-items: center; }
/* D14: doubled. At 108px a string row was 18px tall and the neck read as a
   ribbon; the shapes only become readable once a cell is roughly square. */
.viz-fret-svg { display: block; width: 100%; height: 216px; }
.viz-fret-nums { display: grid; margin-left: 22px; font-size: 9.5px; color: var(--text-d); text-align: center; grid-auto-flow: column; grid-auto-columns: 1fr; }
.viz-fret-nums .is-marker { color: var(--text-m); }
.viz-cell { fill: var(--viz-heat-2); }
/* "Never asked for" is not "asked for and rarely hit" (D, fix pass 3). The
   ramp is inverted -- a rarely-hit position is the PALEST blue -- and a
   never-asked square used to be a faint blue-grey wash, which put the two
   nearly side by side in lightness. An outlined, unfilled square is a
   different KIND of mark rather than a lighter one: it reads as absence at any
   size and it survives greyscale and every colour-vision deficiency. */
.viz-cell-empty {
  fill: none;
  stroke: rgba(255,255,255,0.22);
  stroke-width: 0.5;
}
.viz-heat-0 { fill: var(--viz-heat-0); }
.viz-heat-1 { fill: var(--viz-heat-1); }
.viz-heat-2 { fill: var(--viz-heat-2); }
.viz-heat-3 { fill: var(--viz-heat-3); }
.viz-heat-4 { fill: var(--viz-heat-4); }
span.viz-cell-empty {
  background: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}
span.viz-heat-0 { background: var(--viz-heat-0); }
span.viz-heat-1 { background: var(--viz-heat-1); }
span.viz-heat-2 { background: var(--viz-heat-2); }
span.viz-heat-3 { background: var(--viz-heat-3); }
span.viz-heat-4 { background: var(--viz-heat-4); }
.viz-key { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; vertical-align: middle; }
.viz-key i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.viz-key i.viz-heat-0 { background: var(--viz-heat-0); }
.viz-key i.viz-heat-1 { background: var(--viz-heat-1); }
.viz-key i.viz-heat-2 { background: var(--viz-heat-2); }
.viz-key i.viz-heat-3 { background: var(--viz-heat-3); }
.viz-key i.viz-heat-4 { background: var(--viz-heat-4); }

.viz-strip { margin-top: 14px; }
.viz-strip-svg { display: block; width: 100%; height: 52px; }
.viz-strip-axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--text-d); }

.viz-spark { margin-top: 14px; }
.viz-spark-svg { display: block; width: 100%; height: 56px; }
.viz-spark-line { fill: none; stroke: var(--viz-mark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.viz-spark-axis { display: flex; justify-content: space-between; margin-top: 6px; gap: 8px; }
.viz-spark-axis span { font-size: 11px; color: var(--text-d); text-align: center; min-width: 0; }
.viz-spark-axis b { display: block; font-size: 13px; color: var(--text); }
