/*
  BACKTRACE: tactical debrief aesthetic
  ---------------------------------------
  Dark-only by design (this product has one identity, not a light/dark toggle).
  Cold charcoal base, phosphor-cyan accent, real CS2 side colors (CT blue / T tan)
  for team identity, and a reserved good-to-critical status scale for grades.

  Structure comes from rule weight, not boxes: a heavy rule opens a data block,
  a hairline closes it, dense tables get thin row dividers. There are no card
  containers (border + background + radius) anywhere in this file on purpose -
  team identity is a colored rule under the roster name, not a dot; the upload
  target is a corner-bracket reticle, not a dashed box.

  Type is two-tier: Rajdhani (squared, technical, close in spirit to Valve's
  own Stratum2, which is not something this project can legally embed) carries
  headlines and titles; Noto Sans carries body prose. Both are self-hosted
  locally (fonts/, SIL OFL licensed), so there is no runtime CDN dependency
  and no build step. All numeric data stays in a monospace face with tabular
  figures - the one typographic bet that doesn't move.

  Palette validated with the dataviz skill's validate_palette.js:
  - team-ct/team-t pass the categorical six-check (lightness band, chroma floor,
    CVD separation, contrast) against this file's --bg.
  - accent + status steps checked for WCAG contrast against --bg and --surface.
*/

@font-face {
  font-family: "Noto Sans";
  src: url("../fonts/NotoSans-Variable.ttf") format("truetype-variations"),
       url("../fonts/NotoSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Rajdhani";
  src: url("../fonts/Rajdhani-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("../fonts/Rajdhani-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Rajdhani";
  src: url("../fonts/Rajdhani-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* surfaces */
  --bg: #0b0d0f;
  --surface: #14171a;
  --surface-raised: #1b1f23;
  --border: #262b30;
  --border-strong: #383f45;

  /* ink */
  --text-primary: #e6e9ea;
  --text-secondary: #8b9296;
  --text-tertiary: #565c60;

  /* brand accent: phosphor cyan, used sparingly for links, primary actions, default trace color */
  --accent: #3ddcc7;
  --accent-dim: rgba(61, 220, 199, 0.14);
  --accent-ink: #06211d;

  /* team identity (categorical, validated pair) */
  --team-ct: #5b8def;
  --team-t: #bf8340;

  /* status scale: fixed, reserved meaning, never reused for identity */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --status-ink: #0b0d0f;

  /* type */
  --font-display: "Rajdhani", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-body: "Noto Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas,
    "Liberation Mono", monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius: 2px;

  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

* , *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-dim); color: var(--text-primary); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

button, input { font: inherit; color: inherit; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- page shell ---------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 2px solid var(--border-strong);
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  text-decoration: none;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.case-id { color: var(--text-secondary); letter-spacing: 0.03em; }

.sample-tag {
  color: var(--status-warning);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.link-quiet {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-strong);
}
.link-quiet:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Player names stay in whatever ink color their context already uses (table */
/* primary, leaderboard primary) - only the hairline underline marks them as */
/* links, so the page doesn't turn into a wall of link-blue names. */
.player-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
}
.player-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- eyebrow / headings ---------- */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 var(--space-2);
}

.heading-1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin: 0;
  color: var(--text-primary);
}

.heading-2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0;
}

.lede {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 46ch;
  margin: var(--space-3) 0 0;
}

/* ---------- landing: hero + dropzone ---------- */

.hero {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-8) 0;
  gap: var(--space-5);
}

.dropzone {
  position: relative;
  width: min(560px, 100%);
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.dropzone-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 0 solid var(--border-strong);
  transition: border-color 150ms ease;
}
.dropzone-corner--tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.dropzone-corner--tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.dropzone-corner--bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.dropzone-corner--br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.dropzone:hover .dropzone-corner,
.dropzone:focus-visible .dropzone-corner,
.dropzone.is-dragover .dropzone-corner {
  border-color: var(--accent);
}

.dropzone-icon {
  width: 34px;
  height: 34px;
  color: var(--text-secondary);
}
.dropzone:hover .dropzone-icon,
.dropzone.is-dragover .dropzone-icon { color: var(--accent); }

.dropzone-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.dropzone-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.file-list {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-align: left;
}
.file-list .file-row:last-child { border-bottom: none; }

.file-name { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-tertiary); }

.file-status {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  transition: color 150ms ease;
}
.file-status[data-status="queued"] { color: var(--text-tertiary); }
.file-status[data-status="reading"] { color: var(--accent); }
.file-status[data-status="done"] { color: var(--status-good); }
.file-status[data-status="failed"] { color: var(--status-critical); }

.cta-row {
  display: flex;
  justify-content: center;
  margin-top: var(--space-2);
}

.btn-primary {
  appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-6);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 150ms ease, transform 150ms ease;
}
.btn-primary:hover:not(:disabled) { opacity: 0.88; }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-tertiary); cursor: not-allowed; }

/* ---------- stat ticker (landing) / summary strip (overview) ---------- */
/* A data strip, not a card: a heavy rule opens it, a hairline closes it. */

.stat-ticker,
.summary-strip {
  width: 100%;
  display: grid;
  border-top: 2px solid var(--border-strong);
  border-bottom: 1px solid var(--border);
}

.stat-ticker { grid-template-columns: repeat(3, 1fr); }
.summary-strip { grid-template-columns: repeat(4, 1fr); margin: var(--space-5) 0; }

.stat-tile {
  padding: var(--space-4) var(--space-4);
  border-left: 1px solid var(--border);
  text-align: center;
}
.stat-tile:first-child { border-left: none; }

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-value.is-critical { color: var(--status-critical); }

.stat-label {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

@media (max-width: 640px) {
  .stat-ticker { grid-template-columns: 1fr; }
  .stat-tile { border-left: none; border-top: 1px solid var(--border); }
  .stat-tile:first-child { border-top: none; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip .stat-tile:nth-child(2) { border-left: 1px solid var(--border); }
  .summary-strip .stat-tile:nth-child(3) { border-left: none; border-top: 1px solid var(--border); }
}

/* ---------- overview: sections ---------- */

.section {
  padding: var(--space-6) 0;
}
.section + .section { border-top: 2px solid var(--border-strong); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.section-note {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
}

/* ---------- leaderboard bars ---------- */
/* Marks anchored to a baseline, per the dataviz mark spec: a hairline track, */
/* a thicker fill rounded only on the data end. Not a rounded progress pill. */

.leaderboard { display: flex; flex-direction: column; gap: var(--space-4); }

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: var(--space-3);
}

.bar-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  position: relative;
  height: 9px;
  border-bottom: 2px solid var(--border);
}

.bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 8px;
  border-radius: 0 3px 3px 0;
  background: var(--status-good);
}
.bar-fill[data-band="warning"] { background: var(--status-warning); }
.bar-fill[data-band="serious"] { background: var(--status-serious); }
.bar-fill[data-band="critical"] { background: var(--status-critical); }

.bar-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .bar-row { grid-template-columns: 96px 1fr 40px; }
}

/* ---------- match sections ---------- */
/* Each match is a record in the report, marked by a heavy opening rule, */
/* not a bordered card with a filled background. */

.match {
  padding-top: var(--space-5);
  border-top: 3px solid var(--border-strong);
  margin-bottom: var(--space-6);
}
.match:first-child { border-top: none; padding-top: 0; }

.match-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}

.match-map {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.match-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: var(--space-3);
}

.match-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.rosters {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 860px) {
  .rosters { grid-template-columns: 1fr; }
}

.roster {
  padding: 0 var(--space-4);
}
.roster:first-child { padding-left: 0; }
.roster:last-child { padding-right: 0; }
.roster + .roster { border-left: 1px solid var(--border); }
@media (max-width: 860px) {
  .roster { padding: 0; }
  .roster + .roster { border-left: none; border-top: 2px solid var(--border-strong); padding-top: var(--space-4); margin-top: var(--space-4); }
}

/* Team identity is a colored rule under the name, not a dot. */
.roster-team {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 3px solid var(--border-strong);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.roster-team[data-side="CT"] { border-bottom-color: var(--team-ct); }
.roster-team[data-side="T"] { border-bottom-color: var(--team-t); }

.roster-result {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0.02em;
}

table.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.roster-table th {
  text-align: right;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0 var(--space-1) var(--space-2);
  border-bottom: 2px solid var(--border-strong);
}
.roster-table th:first-child { text-align: left; }

.roster-table td {
  padding: var(--space-2) var(--space-1);
  text-align: right;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.roster-table td:first-child { text-align: left; color: var(--text-primary); }

.roster-table tbody tr:last-child td { border-bottom: none; }

.roster-table tr.is-flagged td { background: rgba(208, 59, 59, 0.07); }
.roster-table tr.is-serious td { background: rgba(236, 131, 90, 0.06); }

.player-cell { display: flex; align-items: center; gap: var(--space-2); }

.grade-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--status-ink);
  background: var(--status-good);
  white-space: nowrap;
}
.grade-chip[data-band="warning"] { background: var(--status-warning); }
.grade-chip[data-band="serious"] { background: var(--status-serious); }
.grade-chip[data-band="critical"] { background: var(--status-critical); }

.status-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--status-ink);
  white-space: nowrap;
}
.status-tag[data-band="serious"] { background: var(--status-serious); }
.status-tag[data-band="critical"] { background: var(--status-critical); }

.trace-svg { display: block; overflow: visible; }

.expand-toggle {
  appearance: none;
  background: none;
  border: none;
  padding: 0 0 0 var(--space-1);
  cursor: pointer;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
}
.expand-toggle:hover { color: var(--accent); }
.expand-toggle svg { width: 10px; height: 10px; transition: transform 150ms ease; }
.expand-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

.breakdown-row td {
  background: var(--bg) !important;
  padding: 0 !important;
}
.breakdown-row[hidden] { display: none; }

.breakdown {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-5);
}
@media (max-width: 640px) {
  .breakdown { grid-template-columns: 1fr; }
}

.signal {
  display: grid;
  grid-template-columns: 150px 1fr 34px;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.signal-label {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.signal-track {
  position: relative;
  height: 7px;
  border-bottom: 1px solid var(--border);
}

.signal-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 6px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

.signal-value {
  font-size: 11px;
  text-align: right;
  color: var(--text-primary);
  font-weight: 700;
}

.reviewer-notes {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.reviewer-notes .eyebrow { margin-bottom: var(--space-2); }

.reviewer-notes p { margin: 0 0 var(--space-3); }
.reviewer-notes p:last-child { margin-bottom: 0; }
.reviewer-notes strong { color: var(--text-primary); font-weight: 700; }

/* ---------- footer ---------- */

.page-footer {
  padding: var(--space-6) 0 var(--space-8);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  margin-top: var(--space-5);
}

/* Show-more: quiet mono button under paginated lists. */
.more-row {
  display: flex;
  justify-content: center;
  margin-top: var(--space-5);
}
.btn-more {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 20px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.btn-more:hover,
.btn-more:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* Player page: steamid + demo count, replacing the prose lede. */
.player-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin-top: var(--space-3);
  font-size: 13px;
  color: var(--text-secondary);
}
