/* ============================================================
   5uGUE Reviewer Dashboard: double-blind static site
   Light theme adapted from the internal dashboard design system.
   ============================================================ */

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

:root {
  --bg:          #f6f8fa;
  --surface:     #ffffff;
  --surface-2:   #f0f3f6;
  --surface-3:   #e6ebf1;
  --border:      #d0d7de;
  --border-light:#afb8c1;

  --text:        #1f2328;
  --text-muted:  #59636e;
  --text-bright: #0d1117;

  --blue:   #0969da;
  --green:  #1a7f37;
  --red:    #cf222e;
  --orange: #bc4c00;
  --purple: #8250df;
  --yellow: #9a6700;
  --cyan:   #0d7d8a;

  --radius:    10px;
  --radius-sm: 6px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

/* === Top bar === */
#topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 24px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { font-weight: 700; font-size: 20px; color: var(--text-bright); letter-spacing: -.5px; }
.brand-sub { color: var(--text-muted); font-size: 13px; }
.blind-tag {
  font-size: 11px; color: var(--yellow);
  border: 1px solid rgba(210,153,34,.4); background: rgba(210,153,34,.08);
  padding: 4px 10px; border-radius: 999px; letter-spacing: .3px;
}

/* === RQ nav === */
#rqnav {
  position: sticky; top: 58px; z-index: 90;
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 24px;
  background: rgba(246,248,250,.88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
#rqnav a {
  font-size: 12px; color: var(--text-muted); text-decoration: none;
  padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
  transition: all .15s;
}
#rqnav a:hover { color: var(--text-bright); border-color: var(--border-light); background: var(--surface-2); }

/* === Layout === */
#content { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }

/* === Intro === */
.intro h1 { font-size: 26px; color: var(--text-bright); letter-spacing: -.6px; margin-bottom: 14px; }
.lede { font-size: 16px; color: var(--text); max-width: 80ch; }
.lede strong, .note strong { color: var(--text-bright); }
.note { color: var(--text-muted); margin-top: 18px; max-width: 85ch; font-size: 13.5px; }
.note a { color: var(--blue); }

.hierarchy {
  display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px;
  margin: 24px 0 4px;
}
.hier-step {
  flex: 1; min-width: 200px;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.hier-k { color: var(--text-bright); font-weight: 600; font-size: 14px; }
.hier-d { color: var(--text-muted); font-size: 12.5px; }
.hier-arrow { align-self: center; color: var(--blue); font-size: 22px; font-weight: 700; }

/* === RQ sections === */
.rq { margin-top: 48px; scroll-margin-top: 120px; }
.rq-head { border-left: 3px solid var(--blue); padding-left: 16px; margin-bottom: 6px; }
.rq-id { color: var(--blue); font-weight: 700; font-size: 13px; letter-spacing: 1px; }
.rq-title { color: var(--text-bright); font-size: 20px; letter-spacing: -.4px; margin-top: 2px; }
.rq-fixed { margin: 10px 0 6px 19px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; font-family: var(--mono);
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 3px 9px;
}
.chip b { color: var(--cyan); font-weight: 500; }
.rq-blurb { color: var(--text-muted); margin: 8px 0 18px 19px; max-width: 88ch; font-size: 13.5px; }

/* === Charts === */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 22px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 6px; }
.chart-card h4 { font-size: 13px; color: var(--text-bright); font-weight: 600; margin-bottom: 6px; }
.plot { width: 100%; height: 300px; }

/* === Trial cards === */
.trials { display: flex; flex-direction: column; gap: 10px; }
.trial {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.trial.pending { opacity: .6; }
.trial-summary {
  display: grid; grid-template-columns: 1.6fr repeat(4, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 14px 18px; cursor: pointer; user-select: none;
  transition: background .12s;
}
.trial-summary:hover { background: var(--surface-2); }
.trial-name { display: flex; flex-direction: column; }
.trial-name b { color: var(--text-bright); font-size: 14.5px; }
.trial-name span { color: var(--text-muted); font-size: 12px; }
.metric { display: flex; flex-direction: column; align-items: flex-start; }
.metric .v { color: var(--text-bright); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric .k { color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; }
.metric.good .v { color: var(--green); }
.caret { color: var(--text-muted); transition: transform .18s; font-size: 12px; }
.trial.open .caret { transform: rotate(90deg); }

/* === Run table (expanded) === */
.runs { display: none; border-top: 1px solid var(--border); padding: 4px 8px 12px; overflow-x: auto; }
.trial.open .runs { display: block; }
table.runtbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.runtbl th, table.runtbl td { padding: 8px 10px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.runtbl th { color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); text-align: right; }
table.runtbl th:first-child, table.runtbl td:first-child { text-align: left; font-family: var(--mono); color: var(--cyan); }
table.runtbl tr.mean td { border-top: 1px solid var(--border-light); color: var(--text-bright); font-weight: 600; background: var(--surface-2); }
table.runtbl tr.mean td:first-child { color: var(--text-bright); }
table.runtbl tbody tr:hover { background: var(--surface-2); }

.pending-badge { font-size: 11px; color: var(--yellow); }

/* === Run drill-down === */
.runs-hint { color: var(--text-muted); font-size: 12px; margin: 4px 6px 10px; }
.run-row.drillable { cursor: pointer; }
.run-row.drillable:hover { background: var(--surface-2); }
.run-row.active { background: var(--surface-3); }
.drill-cell { text-align: left !important; color: var(--text-muted); font-size: 11.5px; white-space: nowrap; }
.drill-cell.muted { color: var(--text-muted); font-style: italic; }
.drill-cell .go { color: var(--blue); margin-left: 4px; }
.run-row.active .drill-cell .go { color: var(--text-bright); }

.rundetail-host { margin: 4px 4px 0; }
.rundetail-host:empty { margin: 0; }
.loading { color: var(--text-muted); font-size: 12.5px; padding: 14px; }

.det-section { margin: 14px 0 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.det-section h5 { font-size: 12.5px; color: var(--text-bright); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.det-section h5 .dim { color: var(--text-muted); font-weight: 400; }
.scroll { max-height: 320px; overflow: auto; }

/* turn timeline */
table.turntbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.turntbl th, table.turntbl td { padding: 6px 10px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.turntbl th { position: sticky; top: 0; background: var(--surface); color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); z-index: 1; }
table.turntbl td.tools { text-align: left; white-space: normal; color: var(--text-muted); font-family: var(--mono); font-size: 11px; max-width: 360px; }
table.turntbl td:first-child, table.turntbl th:first-child { text-align: right; }
table.turntbl tbody tr:hover { background: var(--surface-2); }
.phase { font-size: 10px; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .3px; }
.phase.research { color: var(--cyan); background: rgba(86,212,221,.1); }
.phase.testing { color: var(--orange); background: rgba(240,136,62,.12); }
.hit { color: var(--green); }

/* tests + code */
.tests { padding: 6px; }
.test { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 6px; overflow: hidden; }
.test.crashed { border-left: 3px solid var(--orange); }
.test-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.test-head:hover { background: var(--surface-2); }
.test .caret { color: var(--text-muted); font-size: 10px; transition: transform .15s; }
.test.open .caret { transform: rotate(90deg); }
.tid { color: var(--cyan); font-family: var(--mono); font-size: 11.5px; }
.tname { color: var(--text-bright); font-size: 12.5px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmeta { color: var(--text-muted); font-size: 11px; font-family: var(--mono); white-space: nowrap; }
.cbadge { font-size: 10px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cbadge.pub { color: var(--yellow); background: rgba(210,153,34,.12); }
.cbadge.nonpub { color: var(--orange); background: rgba(240,136,62,.14); }
.cbadge.novel { color: var(--green); background: rgba(63,185,80,.14); }
.cbadge.none { color: var(--text-muted); background: var(--surface-2); }
.cbadge.unclassified { color: var(--red); background: rgba(207,34,46,.10); border: 1px dashed var(--red); }
.test.unclassified .test-head { background: rgba(207,34,46,.05); }
.unclassified-note { margin-bottom: 10px; padding: 9px 11px; font-size: 12px; color: var(--text);
  background: rgba(207,34,46,.06); border: 1px solid var(--border); border-left: 3px solid var(--red);
  border-radius: var(--radius-sm); line-height: 1.5; }
.unclassified-note .k { display: block; color: var(--red); font-size: 11px; text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 4px; font-weight: 600; }
.test-body { display: none; padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.test.open .test-body { display: block; }
.tdesc { color: var(--text); font-size: 12.5px; margin-bottom: 10px; }
.crashsig { margin-bottom: 10px; }
.crashsig .k, .codewrap .k { display: block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.crashsig code { display: block; color: var(--red); font-family: var(--mono); font-size: 11.5px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; overflow-x: auto; }
.codewrap .k .dim { text-transform: none; letter-spacing: 0; color: var(--text-muted); }
pre.code { color: var(--text); font-family: var(--mono); font-size: 11.5px; line-height: 1.5; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; white-space: pre; }

/* findings */
ul.findings { list-style: none; padding: 8px 14px 12px; }
ul.findings li { color: var(--text); font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.findings li:last-child { border-bottom: none; }
.ftype { display: inline-block; color: var(--purple); font-size: 10px; text-transform: uppercase; letter-spacing: .3px; margin-right: 6px; }
.tag { display: inline-block; color: var(--text-muted); font-family: var(--mono); font-size: 10.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin: 2px 0 2px 4px; }

/* === Glossary === */
.glossary { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); scroll-margin-top: 120px; }
.glossary h2 { color: var(--text-bright); font-size: 18px; margin-bottom: 16px; }
.gloss-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 28px; }
.gloss-grid dt { color: var(--text-bright); font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.gloss-grid dd { color: var(--text-muted); font-size: 12.5px; }
.footnote { color: var(--text-muted); font-size: 12px; margin-top: 22px; }

/* === Reviewer note === */
.reviewer-note { margin-top: 56px; padding: 22px 24px; border: 1px solid var(--border);
  border-left: 3px solid var(--orange); border-radius: var(--radius); background: var(--surface-2);
  max-width: 90ch; scroll-margin-top: 120px; }
.reviewer-note h2 { color: var(--text-bright); font-size: 17px; margin-bottom: 12px; }
.reviewer-note p { color: var(--text-muted); font-size: 13.5px; margin-bottom: 12px; }
.reviewer-note p:last-child { margin-bottom: 0; }
.reviewer-note strong { color: var(--text-bright); }
.reviewer-note code { font-family: var(--mono); font-size: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text); }
.reviewer-note ul { margin: 0 0 12px 0; padding-left: 20px; }
.reviewer-note li { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }

@media (max-width: 760px) {
  .trial-summary { grid-template-columns: 1fr auto; row-gap: 10px; }
  .metric { align-items: flex-start; }
}
