/* Visual language follows csrankings.org: white page, Helvetica/Arial at 14px,
   a light-blue control bar, a two-column body with the selector panel on the
   left and the ranking table on the right, zebra-striped rows, and blue
   triangle-prefixed links. Light only, as there. */

:root {
  --fg: #333;
  --fg-dim: #666;
  --fg-faint: #888;
  --link: #1a5fb4;
  --bg: #fff;
  --bg-alt: #f9f9f9;
  --bar-bg: #ddeeff;
  --bar-border: #c5ddf5;
  --border: #ddd;
  --border-soft: #ececec;
  --sel-bg: #fff3cd;

  --pill-output: #1f77b4;
  --pill-impact: #e07000;
  --pill-disruption: #2e8b3d;
  --pill-generalization: #8b52b5;
  --pill-atypicality: #c23b52;
  --pill-other: #5a6b7a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 40px;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.45 Helvetica, Arial, sans-serif;
}

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 24px;
}

h1 {
  margin: 26px 0 16px;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.banner {
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid #e8cf95;
  border-radius: 4px;
  background: #fff8e2;
  color: #5c4708;
  font-size: 13px;
}

.banner-error {
  border-color: #e6b3b3;
  background: #fdecec;
  color: #7a1f1f;
}

.banner code { font-family: Consolas, Menlo, monospace; font-size: 12.5px; }

/* ---------------------------------------------------------------- controls */

.controlbar {
  padding: 10px 14px 12px;
  border: 1px solid var(--bar-border);
  border-radius: 5px;
  background: var(--bar-bg);
}

.note {
  margin-bottom: 9px;
  color: #24506e;
  font-size: 13.5px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spacer { flex: 1 1 auto; }

.cb-select,
.cb-field input,
#search {
  padding: 5px 8px;
  border: 1px solid #a9c6e0;
  border-radius: 4px;
  background: #fff;
  color: var(--fg);
  font: inherit;
}

.cb-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #24506e;
  font-size: 13px;
}

.cb-field input { width: 66px; }

.year-range { display: inline-flex; align-items: center; gap: 6px; }
.year-dash { color: #24506e; }

#search { min-width: 260px; }
#search:focus, .cb-select:focus { outline: 2px solid #a9c6e0; }

.seg {
  display: inline-flex;
  border: 1px solid #a9c6e0;
  border-radius: 4px;
  overflow: hidden;
}

.seg button {
  padding: 5px 12px;
  border: 0;
  background: #fff;
  color: #24506e;
  font: inherit;
  cursor: pointer;
}

.seg button + button { border-left: 1px solid #a9c6e0; }
.seg button:hover:not(:disabled) { background: #eef6ff; }

.seg button[aria-checked="true"] {
  background: #1a5fb4;
  color: #fff;
  font-weight: 600;
}

.seg button:disabled { opacity: 0.45; cursor: not-allowed; }

.cb-btn {
  padding: 5px 12px;
  border: 1px solid #a9c6e0;
  border-radius: 4px;
  background: #fff;
  color: #24506e;
  font: inherit;
  cursor: pointer;
}

.cb-btn:hover { background: #eef6ff; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ layout */

/* the left panel only holds domain checkboxes now, so it stays narrow and the
   ranking table gets the room */
.layout {
  display: grid;
  grid-template-columns: minmax(190px, 15%) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  margin-top: 18px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
}

/* ------------------------------------------------------------- left panel */

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-title { font-size: 16px; font-weight: 600; }
.panel-hint { color: var(--fg-faint); font-size: 12px; }

.group { margin-bottom: 18px; }

.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.group-actions { display: flex; gap: 8px; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 3px;
  background: var(--pill-other);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill-output         { background: var(--pill-output); }
.pill-impact         { background: var(--pill-impact); }
.pill-disruption     { background: var(--pill-disruption); }
.pill-generalization { background: var(--pill-generalization); }
.pill-atypicality    { background: var(--pill-atypicality); }
.pill-area           { background: #4a7fa5; }
.pill-region         { background: #4a7fa5; }

.row-list { display: flex; flex-direction: column; }

/* one selectable metric: triangle, blue label, control right-aligned */
.opt-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.opt-row:hover { background: var(--bg-alt); }
.opt-row.selected { background: var(--sel-bg); }

.tri {
  width: 12px;
  color: var(--link);
  font-size: 10px;
  cursor: pointer;
  user-select: none;
}

.opt-row .label {
  flex: 1;
  color: var(--link);
  cursor: pointer;
}

.opt-row.selected .label { font-weight: 600; }
.opt-row .label:hover { text-decoration: underline; }
.opt-row input { margin: 0; accent-color: var(--link); cursor: pointer; }

.opt-desc {
  padding: 4px 4px 8px 23px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--fg-dim);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- ranking */

/* the ranking metric is the highlighted column; clicking a header picks it */
.rank-hint { color: var(--fg-faint); font-size: 12px; }

thead th.ranked {
  font-weight: 700;
  color: var(--link);
}

.ranking-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.summary { color: var(--fg-dim); font-size: 13px; }

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 8px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
  color: var(--fg);
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
}

thead th.sortable { text-decoration: underline; }
thead th.left { text-align: left; }
thead th.sorted { font-weight: 700; }
thead th .arrow { display: inline-block; width: 9px; margin-left: 2px; font-size: 9px; }

tbody.inst > tr.inst-row > td {
  padding: 4px 8px;
  text-align: right;
  white-space: nowrap;
}

/* zebra striping, as on csrankings */
tbody.inst:nth-of-type(even) > tr.inst-row > td { background: var(--bg-alt); }
tbody.inst > tr.inst-row { cursor: pointer; }
tbody.inst > tr.inst-row:hover > td { background: #eef6ff; }
tbody.inst.open > tr.inst-row > td { background: #e6f0fa; }

/* these must out-specify the `tbody.inst > tr.inst-row > td` rule above, which
   right-aligns every cell */
tbody.inst > tr.inst-row > td.rank {
  width: 42px;
  text-align: right;
  color: var(--fg);
}

tbody.inst > tr.inst-row > td.inst-name {
  text-align: left;
  white-space: normal;
  min-width: 230px;
}

td.inst-name .tri { display: inline-block; margin-right: 4px; }
td.inst-name a { color: var(--link); text-decoration: none; }
td.inst-name a:hover { text-decoration: underline; }

.inst-sub { margin-left: 6px; color: var(--fg-faint); font-size: 12px; }

td.num { font-variant-numeric: tabular-nums; color: var(--fg); }
td.num.primary { font-weight: 700; }

/* expanded faculty list */
tr.detail > td {
  padding: 0 8px 10px 50px;
  background: #fff;
}

table.faculty { width: 100%; margin-top: 2px; font-size: 13px; }

table.faculty th {
  position: static;
  padding: 3px 6px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-dim);
  text-align: right;
  cursor: default;
  text-decoration: none;
}

table.faculty th:first-child { text-align: left; }

table.faculty td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--border-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.faculty td:first-child { text-align: left; font-variant-numeric: normal; }
table.faculty tr:last-child td { border-bottom: 0; }
table.faculty a { color: var(--link); text-decoration: none; }
table.faculty a:hover { text-decoration: underline; }

.area-tag {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 9px;
  background: #eef1f4;
  font-size: 11px;
  color: var(--fg-faint);
}

.empty { padding: 36px 0; text-align: center; color: var(--fg-faint); }

/* ----------------------------------------------------------------- footer */

.site-footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--fg-faint);
  font-size: 12.5px;
}

.site-footer p { margin: 0 0 4px; }
.hint { color: var(--fg-faint); font-size: 12.5px; }
