/* Fitz & Pop Labs.
 *
 * Branding rules this file encodes:
 *   • The chrome is Fitz & Pop's, not the client's. Accent is the brand blue
 *     from the logo (#5b85d8), stepped for contrast per theme. The previous
 *     build wore Pink Soup's pink, which made the platform look like it
 *     belonged to one client.
 *   • The top banner is a neutral charcoal in BOTH themes, so a client's cover
 *     art never fights it and the next game needs no restyling.
 *   • Dark is the default. Light is a deliberate second theme with its own
 *     steps, not an inverted flip.
 *
 * Chart tokens are declared as custom properties in both themes and read at
 * render time by charts.js, so a chart follows the theme rather than baking in
 * one set of hexes.
 */

/* ── Dark: the default ───────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  --banner:      #17171a;          /* neutral in both themes, on purpose */
  --banner-ink:  #ffffff;
  --banner-dim:  #a9a8a2;
  --banner-line: rgba(255,255,255,.13);

  --page:        #0d0d0d;
  --surface-1:   #1a1a19;
  --surface-2:   #212120;
  --hairline:    rgba(255,255,255,.11);

  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;

  --grid: #2c2c2a;
  --axis: #383835;

  --accent:      #5b85d8;          /* brand blue — 5.36:1 on the dark page */
  --accent-ink:  #86b6ef;          /* links */
  --btn:         #3d68bd;          /* white label reads 5.37:1 */
  --btn-hover:   #4a76cc;
  --btn-ghost-b: rgba(91,133,216,.45);
  --accent-wash: rgba(91,133,216,.12);

  /* ordinal one-hue ramp, validated against the dark surface */
  --seq-1: #86b6ef;
  --seq-2: #3987e5;
  --seq-3: #184f95;
  --cat-1: #3987e5;
  --cat-2: #d95926;

  --good:     #0ca30c;
  --warning:  #fab219;
  --critical: #e66767;
  --ok-wash:   rgba(12,163,12,.16);
  --miss-wash: rgba(230,103,103,.16);
  --wait-wash: rgba(250,178,25,.16);
  --neutral-wash: rgba(255,255,255,.08);
}

/* ── Light: selected, not flipped ────────────────────────────────────────── */
:root[data-theme="light"] {
  color-scheme: light;

  --banner:      #232326;
  --banner-ink:  #ffffff;
  --banner-dim:  #b8b7b1;
  --banner-line: rgba(255,255,255,.15);

  --page:        #f7f7f5;
  --surface-1:   #fffdfe;
  --surface-2:   #fbfaf8;
  --hairline:    rgba(11,11,11,.11);

  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #767570;

  --grid: #e1e0d9;
  --axis: #c3c2b7;

  --accent:      #355faf;
  --accent-ink:  #355faf;          /* 6.08:1 on the light surface */
  --btn:         #3d68bd;
  --btn-hover:   #2f57a4;
  --btn-ghost-b: rgba(61,104,189,.35);
  --accent-wash: rgba(61,104,189,.09);

  --seq-1: #86b6ef;
  --seq-2: #2a78d6;
  --seq-3: #104281;
  --cat-1: #2a78d6;
  --cat-2: #eb6834;

  --critical: #c62f2f;
  --ok-wash:   #dff3df;
  --miss-wash: #fbe3e3;
  --wait-wash: #fdf0d4;
  --neutral-wash: #eeecea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
}
a { color: var(--accent-ink); }

/* ── Banner ──────────────────────────────────────────────────────────────── */
.top {
  background: var(--banner);
  color: var(--banner-ink);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 62px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--banner-line);
}
.top .brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--banner-ink); }
.top .brand img { height: 30px; width: auto; display: block; }
.top .brand .mark {
  font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding-left: 11px; border-left: 1px solid var(--banner-line); color: var(--banner-ink);
}
/* One logo file per colourway; the banner is dark in both themes, so the white
   mark is always the right one — the blue master ships for future light chrome. */
.top .brand img.on-dark { display: block; }
.top .brand img.on-light { display: none; }

.top nav { display: flex; gap: 16px; }
.top nav a { color: var(--banner-dim); text-decoration: none; font-size: 14px; }
.top nav a:hover, .top nav a[aria-current] { color: var(--banner-ink); }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--banner-dim); }
.top .who img.avatar { width: 26px; height: 26px; border-radius: 50%; }
.top form { margin: 0; }
.top .who button, .top .theme {
  background: none; border: 1px solid var(--banner-line); color: var(--banner-dim);
  padding: 5px 10px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px;
}
.top .who button:hover, .top .theme:hover { color: var(--banner-ink); border-color: var(--banner-dim); }
.top .theme { display: inline-flex; align-items: center; gap: 6px; }

main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 28px; }

footer.foot {
  max-width: 1180px; margin: 0 auto; padding: 0 20px 46px;
  color: var(--text-muted); font-size: 12.5px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
footer.foot img { height: 20px; opacity: .75; }

/* ── Cards & type ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card > h2 {
  margin: 0 0 4px;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .11em;
  color: var(--accent-ink);
}
.card > h2 + .lede { margin: 0 0 16px; color: var(--text-secondary); font-size: 14px; max-width: 80ch; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--text-muted); font-size: 13px; }
.sec { color: var(--text-secondary); font-size: 14px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; color: var(--text-secondary); }

/* ── Controls ────────────────────────────────────────────────────────────── */
.controls { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
select, input[type=text], input[type=number], input[type=email] {
  font: inherit; padding: 8px 10px; border: 1px solid var(--hairline);
  border-radius: 8px; background: var(--surface-2); color: var(--text-primary);
}
input::placeholder { color: var(--text-muted); }
button, .btn {
  font: inherit; font-weight: 600; padding: 8px 15px; border-radius: 8px; cursor: pointer;
  background: var(--btn); color: #fff; border: 1px solid var(--btn);
  text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
button:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--accent-ink); border-color: var(--btn-ghost-b); }
button.ghost:hover, .btn.ghost:hover { background: var(--accent-wash); }
button.small, .btn.small { padding: 5px 10px; font-size: 13px; }
button.danger { background: transparent; color: var(--critical); border-color: var(--critical); }
button.danger:hover { background: var(--miss-wash); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { border-bottom: 1px solid var(--grid); padding: 7px 9px; text-align: left; vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface-2); }

/* ── Pills & findings ────────────────────────────────────────────────────── */
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok      { background: var(--ok-wash);      color: var(--good); }
.pill.miss    { background: var(--miss-wash);    color: var(--critical); }
.pill.wait    { background: var(--wait-wash);    color: var(--warning); }
.pill.neutral { background: var(--neutral-wash); color: var(--text-secondary); }
.pill.suits   { background: var(--ok-wash);      color: var(--good); }
.pill.dud     { background: var(--neutral-wash); color: var(--text-muted); }
.pill.bad     { background: var(--miss-wash);    color: var(--critical); }
.pill.sweet   { background: var(--wait-wash);    color: var(--warning); }
.pill.win     { background: var(--wait-wash);    color: var(--warning); }
.pill.role    { background: var(--accent-wash);  color: var(--accent-ink); }

.finding { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.finding:last-child { border-bottom: 0; }
.finding .dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; }
.finding.good .dot { background: var(--good); }
.finding.warning .dot { background: var(--warning); }
.finding h4 { margin: 0 0 3px; font-size: 14px; }
.finding p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }

/* ── Layout helpers ──────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }

/* ── Stat tiles ──────────────────────────────────────────────────────────── */
.tile { border: 1px solid var(--hairline); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.tile .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.tile .v { font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .n { font-size: 12.5px; color: var(--text-muted); }

/* ── The subject under test ──────────────────────────────────────────────── */
/* The client's own artwork is framed and labelled as the thing being examined,
   rather than dressed as the identity of the page. */
.subject {
  display: flex; gap: 16px; align-items: center;
  border: 1px solid var(--hairline); border-radius: 10px;
  background: var(--surface-2); padding: 12px 14px;
}
.subject .shot {
  width: 132px; flex: 0 0 132px; border-radius: 7px; display: block;
  border: 1px solid var(--hairline); background: #fff;
}
.subject .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 3px; }
.subject h3 { margin: 0 0 2px; font-size: 17px; }

/* ── Charts ──────────────────────────────────────────────────────────────── */
.chart { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 10px; padding: 14px; }
.chart h3 { margin: 0 0 2px; font-size: 14px; }
.chart .sub { margin: 0 0 10px; font-size: 12.5px; color: var(--text-secondary); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--text-secondary); }
.chart .legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart details { margin-top: 10px; }
.chart summary { font-size: 12.5px; color: var(--accent-ink); cursor: pointer; }

#tip {
  position: fixed; z-index: 40; pointer-events: none; opacity: 0;
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--hairline); border-radius: 8px;
  padding: 7px 10px; font-size: 12.5px; box-shadow: 0 8px 26px rgba(0,0,0,.35);
  transition: opacity .08s; max-width: 260px;
}
#tip b { display: block; margin-bottom: 2px; }

/* ── Card gallery ────────────────────────────────────────────────────────── */
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.gal figure { margin: 0; }
.gal img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--hairline); }
.gal figcaption { font-size: 12px; margin-top: 5px; line-height: 1.35; }
.gal .lt { color: var(--text-muted); }

.potcard { border: 1px solid var(--hairline); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.potcard header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.potcard header img { width: 46px; border-radius: 6px; border: 1px solid var(--hairline); }
.potcard header h4 { margin: 0; font-size: 14px; }
.potcard ul { list-style: none; margin: 0; padding: 0; }
.potcard li { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; }
.potcard li img { width: 26px; border-radius: 4px; }
.potcard li .nm { flex: 1; }
.potcard .tot { margin-top: 8px; font-weight: 700; font-size: 16px; }

.log {
  max-height: 320px; overflow: auto;
  font: 12.5px/1.55 ui-monospace, Menlo, Consolas, monospace;
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: 8px; padding: 10px;
}
.log div { padding: 1px 0; border-bottom: 1px dotted var(--grid); }
.log .t { color: var(--text-muted); }

.note {
  background: var(--accent-wash); border-left: 3px solid var(--accent);
  padding: 10px 13px; border-radius: 0 8px 8px 0; font-size: 13.5px;
}
.flash {
  background: var(--ok-wash); border-left: 3px solid var(--good);
  padding: 10px 13px; border-radius: 0 8px 8px 0; margin-bottom: 16px; font-size: 14px;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login { max-width: 430px; margin: 8vh auto; }
.login .card { padding: 26px 26px 22px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login .btn, .login button { width: 100%; margin-bottom: 9px; text-align: center; }
.login hr { border: 0; border-top: 1px solid var(--grid); margin: 18px 0 14px; }

.seatrow { display: flex; gap: 8px; flex-wrap: wrap; }
.seatrow .field { min-width: 118px; }

@media (max-width: 640px) {
  main { padding: 16px 13px 24px; }
  .card { padding: 15px 14px; }
  .subject { flex-direction: column; align-items: flex-start; }
  .subject .shot { width: 108px; flex: 0 0 auto; }
}
