/* Research Scores. The same layout as /verification/ (top bar, cards, segmented control, tables)
   on a light background. Light only. */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-raised: rgba(20, 33, 58, 0.04);
  --surface-hover: rgba(20, 33, 58, 0.07);
  --border: rgba(20, 33, 58, 0.14);
  --border-strong: rgba(20, 33, 58, 0.3);
  --text: #14213a;
  --text-2: #43546e;
  --text-3: #5d6d85;
  --accent: #0b73b8;
  --accent-soft: rgba(11, 115, 184, 0.12);
  --ok: #0f7a4f;
  --warn: #9a5b00;
  --err: #b42318;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 14px rgba(20, 33, 58, 0.08);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* the model colours of /verification/ (dataviz reference palette) */
  --m-windcore: #3987e5;
  --m-gfs: #c98500;
  --m-ecmwf: #d55181;
  --m-aifs: #008300;
  --m-mean3: #9085e9;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font: 13px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p, figure, ul { margin: 0; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--text-3); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; min-height: 60px;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark { width: 30px; height: 30px; color: var(--accent); flex: none; }
.brand-text h1 { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.brand-text p { font-size: 11px; color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.updated { color: var(--text-3); font-size: 11px; margin-right: 4px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-raised); color: var(--text);
  font-weight: 600; font-size: 12px; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; }

.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-raised);
}
.segmented button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font-weight: 600; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.segmented button:hover { color: var(--text); background: var(--surface-hover); }
.segmented button[aria-checked="true"] { color: #fff; background: var(--accent); }

main { max-width: 1320px; margin: 0 auto; padding: 16px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
#studies { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.card-head h2 { font-size: 15px; font-weight: 700; }
.sub { color: var(--text-2); font-size: 12px; }
.card > .sub { margin-bottom: 10px; }
.intro { color: var(--text-2); font-size: 12px; max-width: 80ch; }
.foot { color: var(--text-3); font-size: 11px; margin-top: 8px; }
.foot a { margin-right: 4px; }
ul.plain { padding-left: 18px; color: var(--text-2); font-size: 12px; }
ul.plain li { margin-bottom: 5px; }
ul.plain b, ul.plain i { color: var(--text); }

.note {
  border: 1px solid rgba(154, 91, 0, .4); background: #fff6e0; color: #6b4400;
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px;
}

/* tables */
.table-wrap { overflow-x: auto; }
table.score { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.score th, table.score td { padding: 6px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.score th:first-child, table.score td:first-child { text-align: left; white-space: normal; min-width: 150px; }
table.score thead th { color: var(--text-2); font-weight: 600; font-size: 11px; vertical-align: bottom; }
table.score tr.group th { text-align: left; color: var(--text); font-size: 12px; font-weight: 700; background: var(--surface-raised); padding-top: 8px; }
table.score tr.group th small { color: var(--text-3); font-weight: 500; margin-left: 6px; }
table.score tbody tr:hover td { background: var(--surface-raised); }
table.score td.na { color: var(--text-3); }
.mname { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.flag { font-weight: 700; }
.flag.ok { color: var(--ok); }
.flag.drift { color: var(--err); }
.flag.few { color: var(--text-3); font-weight: 500; }

/* trend lines */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0 6px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px 18px; }
.chart figcaption { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.chart figcaption small { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: rgba(20, 33, 58, .1); }
.chart .axis text { fill: var(--text-3); font-size: 10px; }
.chart path.series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .empty { fill: var(--text-3); font-size: 12px; }

/* not scored yet */
.missing { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.missing h3 { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.missing li b { color: var(--text); }

@media (max-width: 900px) {
  main { padding: 12px 16px 30px; }
  .topbar { padding: 10px 16px; }
  table.score th:first-child, table.score td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 130px; }
  table.score tr.group th { position: static; }
}

.tag { color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 18px; }
