/* AlpLab Radar — Swiss Editorial instrument matching alplab.co. */
:root {
  --paper: #FFFFFF;
  --blue: #0D52A1;
  --blue-deep: #0A4383;
  --blue-light: #9DBDE8;
  --soft: color-mix(in srgb, var(--blue) 62%, var(--paper));
  --faint: color-mix(in srgb, var(--blue) 45%, var(--paper));
  --rule: color-mix(in srgb, var(--blue) 22%, var(--paper));
  --rule-strong: color-mix(in srgb, var(--blue) 42%, var(--paper));
  --tint: color-mix(in srgb, var(--blue) 4.5%, var(--paper));
  --tint-strong: color-mix(in srgb, var(--blue) 9%, var(--paper));
  --warn: #9A5B13;
  --warn-bg: #FAF3E8;
  --warn-line: #E0C196;
  --bad: #A63224;
  --bad-bg: #FCF2F0;
  --bad-line: #E2B3AC;
  --sans: "Switzer", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: clamp(1rem, 3vw, 2.5rem);
  --max: 1440px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--blue);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--blue); color: var(--paper); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; border-radius: 0; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible,
textarea:focus-visible, .row:focus-visible, summary:focus-visible, .metric:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
kbd {
  font: 11px var(--mono);
  border: 1px solid var(--rule-strong);
  padding: 1px 5px;
  color: var(--soft);
  background: var(--paper);
}
code {
  font: 12px var(--mono);
  background: var(--tint);
  padding: 1px 5px;
  border: 1px solid var(--rule);
}

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.label {
  font: 600 11px/1.2 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sq {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  background: var(--blue-light);
  vertical-align: baseline;
}

/* ---------- top bar ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 25;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
}
.bar-left { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .sub { font-weight: 500; color: var(--soft); letter-spacing: 0.06em; font-size: 11px; margin-left: 2px; }
.stamp {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav { display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 1.75rem); }
.nav a {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- addbar ---------- */
.addbar {
  position: sticky;
  top: var(--bar-h, 52px);
  z-index: 24;
  background: var(--tint);
  border-bottom: 1px solid var(--rule-strong);
}
.addbar[hidden] { display: none; }
.addbar-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding-block: 10px;
}
.addbar input {
  flex: 2 1 280px;
  min-width: 0;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  outline: none;
}
.addbar input:focus { border-color: var(--blue); }
.addbar #add-note { flex: 1 1 200px; }
.add-hint { flex-basis: 100%; font-size: 12px; color: var(--soft); }

/* ---------- masthead & metrics ---------- */
.masthead {
  padding-block: clamp(1.75rem, 3.6vw, 3rem) clamp(1.25rem, 2.6vw, 2rem);
  border-bottom: 1px solid var(--rule);
}
.eyebrow { color: var(--soft); margin-bottom: 12px; }
.mast-h1 {
  font-weight: 600;
  font-size: clamp(2.1rem, 4.4vw, 3.8rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  max-width: 18ch;
  text-wrap: balance;
}
.mast-copy {
  margin-top: 14px;
  max-width: 56ch;
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.48;
  color: var(--soft);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 2px solid var(--blue);
  border-bottom: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--paper);
}
.metric {
  appearance: none;
  text-align: left;
  background: var(--paper);
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 180ms ease, color 180ms ease;
}
.metric-k {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}
.metric-v {
  font-weight: 600;
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric-d { font-size: 12px; color: var(--faint); }
.metric:hover, .metric.on { background: var(--blue); color: var(--paper); }
.metric:hover .metric-k, .metric.on .metric-k,
.metric:hover .metric-d, .metric.on .metric-d {
  color: color-mix(in srgb, var(--paper) 82%, transparent);
}

/* ---------- sticky controls ---------- */
.controls {
  position: sticky;
  top: var(--bar-h, 52px);
  z-index: 20;
  background: var(--paper);
  border-bottom: 2px solid var(--blue);
}
.controls-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-block: 10px;
}
.ctrl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.ctrl-sub { font-size: 13px; }
.search {
  flex: 1 1 280px;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 0 10px;
}
.search:focus-within { border-color: var(--blue); }
.search svg { width: 15px; height: 15px; fill: none; stroke: var(--soft); stroke-width: 1.8; flex: none; }
.search input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  min-width: 0;
  font-size: 14px;
}
.search input::placeholder { color: var(--faint); }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
}
.seg button {
  border: 0;
  background: var(--paper);
  padding: 6px 12px;
  min-height: 34px;
  cursor: pointer;
  color: var(--soft);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { color: var(--blue); background: var(--tint); }
.seg button.on { background: var(--blue); color: var(--paper); }
.seg button[hidden] { display: none; }

select {
  height: 34px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  padding: 0 10px;
  font-size: 13px;
  color: var(--blue);
  cursor: pointer;
}
.chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--soft);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
}
.chk[hidden] { display: none; }
.chk input { accent-color: var(--blue); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  color: var(--blue);
  padding: 6px 12px;
  min-height: 34px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.btn:hover { border-color: var(--blue); background: var(--tint); text-decoration: none; }
.btn.primary { background: var(--blue); color: var(--paper); border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn[hidden] { display: none; }
.grow { flex: 1; }

/* ---------- split workspace ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(400px, 0.95fr);
  gap: clamp(1rem, 2.5vw, 2rem);
  align-items: start;
  padding-top: 12px;
  padding-bottom: 48px;
}
.listcol { min-width: 0; }
.listhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.kbhint { font-weight: 500; text-transform: none; letter-spacing: 0; }

/* ---------- list ---------- */
.list { list-style: none; padding: 0; }
.day {
  padding: 16px 0 6px;
  border-bottom: 1px solid var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}
.row {
  display: grid;
  grid-template-columns: 102px minmax(0, 1fr);
  gap: 4px 14px;
  padding: 13px 12px 13px 10px;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 120ms ease;
}
.row:hover { background: var(--tint); }
.row.sel { background: var(--tint-strong); border-left-color: var(--blue); }
.row.trashed { opacity: 0.5; }
.row > .badge { grid-row: span 2; justify-self: stretch; align-self: start; margin-top: 2px; }
.title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.title.raw { font-weight: 400; color: var(--soft); }
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--faint);
}
.meta .who { color: var(--soft); font-weight: 500; }
.meta .sep { color: var(--rule-strong); }
.tag {
  border: 1px solid var(--rule);
  padding: 0 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--soft);
  background: var(--paper);
}
.tag.note { border-color: var(--blue); color: var(--blue); }
mark { background: color-mix(in srgb, var(--blue-light) 45%, transparent); color: var(--blue); padding: 0 1px; }

.more {
  display: block;
  width: 100%;
  margin: 16px 0;
  padding: 10px 16px;
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  font-weight: 600;
  cursor: pointer;
}
.more:hover { background: var(--blue); color: var(--paper); border-color: var(--blue); }
.more[hidden] { display: none; }
.nothing {
  padding: 40px 0;
  color: var(--soft);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* ---------- typographic signal badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.b-adopt { background: var(--blue); color: var(--paper); border-color: var(--blue); }
.b-trial { background: var(--tint-strong); color: var(--blue); border-color: var(--blue); }
.b-watch { background: var(--paper); color: var(--soft); border-color: var(--rule-strong); }
.b-verified {
  background: var(--paper);
  color: var(--blue);
  border-color: var(--blue);
  border-left: 3px solid var(--blue-light);
}
.b-partial { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.b-overclaimed, .b-avoid { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.b-none { background: var(--paper); color: var(--faint); border: 1px dashed var(--rule-strong); font-weight: 500; }

/* ---------- sticky detail dossier ---------- */
.detail {
  position: sticky;
  top: var(--sticky-top, 148px);
  max-height: calc(100dvh - var(--sticky-top, 148px) - 20px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--blue);
  padding: 22px 24px 36px;
}
.detail .empty {
  padding: clamp(3rem, 12vh, 8rem) 1rem;
  text-align: center;
  color: var(--faint);
}
.empty-title { font-size: 15px; color: var(--soft); margin-bottom: 12px; }
.empty-keys { font-size: 12px; color: var(--faint); }
.d-close { display: none; }

.d-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.d-head img, .d-head .av {
  width: 40px;
  height: 40px;
  background: var(--tint-strong);
  border: 1px solid var(--rule);
  flex: none;
  object-fit: cover;
}
.d-head .who { flex: 1; min-width: 0; }
.d-head .who b { display: block; font-size: 14.5px; }
.d-head .who span { color: var(--faint); font-size: 12px; }

.box { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.box.eval { margin-top: 16px; padding-top: 0; border-top: 0; }
.box h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.box h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); font-size: 12px; }
.verdict { font-size: 17px; font-weight: 600; line-height: 1.38; margin-top: 10px; }

.kv {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}
.kv dt { color: var(--faint); font-size: 12px; font-weight: 600; padding-top: 1px; }
.kv dd { margin: 0; color: var(--blue); min-width: 0; overflow-wrap: break-word; }

.review {
  background: var(--tint);
  border: 1px solid var(--rule);
  padding: 16px;
}
.review.none { color: var(--soft); font-size: 13.5px; }
.score-row { display: flex; gap: 14px; align-items: baseline; margin-bottom: 8px; }
.score { font: 700 22px var(--sans); font-variant-numeric: tabular-nums; }

.scores {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--rule);
  background: var(--paper);
  margin: 12px 0;
}
.sc-cell {
  padding: 8px 10px;
  border-right: 1px solid var(--rule);
}
.sc-cell:last-child { border-right: 0; }
.sc-cell span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.sc-cell b {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.d-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.55; }
.d-text.thread { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rule-strong); }
.tn { display: block; font: 600 11px var(--mono); color: var(--faint); margin-bottom: 4px; }
.ctx {
  margin: 12px 0;
  border-left: 2px solid var(--rule-strong);
  padding: 8px 12px;
  background: var(--tint);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  color: var(--soft);
}
.ctx-h { font-size: 11.5px; font-weight: 600; color: var(--faint); margin-bottom: 4px; }
.d-media { display: flex; gap: 8px; margin-top: 12px; }
.d-media img { max-height: 180px; max-width: 100%; border: 1px solid var(--rule); }
.d-links { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.d-links a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue); font-weight: 500; }
.d-eng { margin-top: 10px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

.snap {
  font-size: 12.5px;
  color: var(--soft);
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
  background: var(--tint);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  margin-top: 8px;
}
details summary { cursor: pointer; color: var(--soft); font-size: 13px; font-weight: 500; }

textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid var(--rule-strong);
  padding: 9px 11px;
  background: var(--paper);
  outline: none;
  line-height: 1.5;
}
textarea:focus { border-color: var(--blue); }
.note-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--faint); }
.readonly { font-size: 12.5px; color: var(--faint); margin-top: 8px; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--blue);
  color: var(--paper);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast button {
  border: 1px solid var(--paper);
  background: transparent;
  color: var(--paper);
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}

/* ---------- Swiss cobalt footer ---------- */
.sitefoot {
  background: var(--blue);
  color: var(--paper);
  padding-block: 28px;
}
.sitefoot[hidden] { display: none; }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
}
.foot-brand { display: flex; align-items: baseline; gap: 14px; font-size: 12.5px; color: color-mix(in srgb, var(--paper) 78%, transparent); }
.brand-foot { color: var(--paper); font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.foot-links { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; font-weight: 500; }
.foot-links a { border-bottom: 1px solid color-mix(in srgb, var(--paper) 40%, transparent); }
.foot-links a:hover { text-decoration: none; border-bottom-color: var(--paper); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding-top: 4px; }
  .detail {
    position: fixed;
    inset: 0;
    top: 0;
    max-height: none;
    z-index: 40;
    border: 0;
    padding: 16px 16px 60px;
    display: none;
  }
  .detail.open { display: block; }
  .d-close { display: inline-flex; margin-bottom: 14px; }
  .kbhint { display: none; }
}

@media (max-width: 720px) {
  .wide-only, .search kbd, .stamp { display: none; }
  .seg { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc-cell { border-bottom: 1px solid var(--rule); }
  .sc-cell:nth-child(2n) { border-right: 0; }
  .sc-cell:last-child { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .kv { grid-template-columns: 1fr; gap: 4px; }
  .row { grid-template-columns: 88px minmax(0, 1fr); gap: 4px 10px; padding-inline: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .metric, .seg button, .btn, .row { transition: none; }
}
