/* Public REE Explorer ("Lab Window") -- static, read-only.
   Light theme aligned with the just-the-docs site. Mobile-first. */

:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-2: #eef1f5;
  --border: #d8dde4;
  --text: #1b1f24;
  --text-muted: #5c6770;
  --accent: #2f5fd0;
  --accent-soft: #e8effb;

  /* Evidence state palette -- deliberately calm, not triumphal. */
  --supported: #2e7d4f;
  --supported-bg: #e6f4ec;
  --weakened: #b3402f;
  --weakened-bg: #fae9e6;
  --mixed: #b5740a;
  --mixed-bg: #fbf0dd;
  --unresolved: #5c6770;
  --unresolved-bg: #eceff3;
  --superseded: #7a6aa8;
  --superseded-bg: #efebf8;

  --radius: 8px;
  --maxw: 1080px;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---- Header ---- */
header.site {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
header.site .wrap { padding-top: 18px; padding-bottom: 14px; }
header.site h1 { margin: 0 0 4px; font-size: 1.5rem; }
header.site .tagline { margin: 0; color: var(--text-muted); font-size: 0.98rem; max-width: 70ch; }
header.site .meta { margin-top: 10px; font-size: 0.8rem; color: var(--text-muted); }
header.site .meta a { text-decoration: none; }

.banner {
  background: var(--accent-soft);
  border: 1px solid #c7d8f5;
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: #234;
}

/* ---- Tabs ---- */
nav.tabs {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 2px;
}
nav.tabs button {
  appearance: none; border: none; background: none;
  padding: 12px 14px; font-size: 0.95rem; cursor: pointer;
  color: var(--text-muted); border-bottom: 3px solid transparent;
}
nav.tabs button:hover { color: var(--text); }
nav.tabs button[aria-selected="true"] {
  color: var(--accent); border-bottom-color: var(--accent); font-weight: 600;
}

main { padding: 22px 0 64px; }
section[role="tabpanel"] { outline: none; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { font-size: 1.02rem; margin: 22px 0 8px; }
.lead { color: var(--text-muted); max-width: 74ch; }

/* ---- Orientation ---- */
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface);
}
.card h3 { margin-top: 0; }
.card p { margin: 0; }
.note-list { margin: 8px 0 0; padding-left: 18px; }
.note-list li { margin: 4px 0; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.stat {
  flex: 1 1 130px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; background: var(--surface); text-align: center;
}
.stat .n { font-size: 1.6rem; font-weight: 700; display: block; }
.stat .l { font-size: 0.78rem; color: var(--text-muted); }

/* ---- Controls ---- */
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.controls input[type="search"] {
  flex: 1 1 220px; min-width: 160px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.92rem;
}
.controls select {
  padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.9rem; background: var(--bg);
}
.count-line { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 10px; }

/* ---- Badges ---- */
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.badge.supported { color: var(--supported); background: var(--supported-bg); }
.badge.weakened  { color: var(--weakened);  background: var(--weakened-bg); }
.badge.mixed     { color: var(--mixed);     background: var(--mixed-bg); }
.badge.unresolved{ color: var(--unresolved);background: var(--unresolved-bg); }
.badge.superseded{ color: var(--superseded);background: var(--superseded-bg); }
.badge.pass { color: var(--supported); background: var(--supported-bg); }
.badge.fail { color: var(--weakened); background: var(--weakened-bg); }
.badge.error { color: var(--mixed); background: var(--mixed-bg); }
.badge.muted { color: var(--text-muted); background: var(--surface-2); }

/* ---- Item list (claims / experiments) ---- */
.item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; background: var(--bg); }
.item > summary {
  list-style: none; cursor: pointer; padding: 11px 14px;
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.item > summary::-webkit-details-marker { display: none; }
.item > summary:hover { background: var(--surface); }
.item .id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.item .title { flex: 1 1 280px; }
.item .sub { font-size: 0.78rem; color: var(--text-muted); }
.item .body { padding: 4px 14px 14px; border-top: 1px solid var(--surface-2); }
.kv { font-size: 0.86rem; margin: 6px 0; }
.kv b { color: var(--text-muted); font-weight: 600; }
.deps a, .chip {
  display: inline-block; font-family: ui-monospace, monospace; font-size: 0.78rem;
  background: var(--surface-2); border-radius: 5px; padding: 1px 6px; margin: 2px 3px 2px 0;
  text-decoration: none; color: var(--text);
}
.summary-text { font-size: 0.88rem; color: var(--text); margin: 8px 0 0; }
.caveat { font-size: 0.82rem; color: var(--weakened); margin: 6px 0 0; }

/* ---- Mechanism map ---- */
.fn-group { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.fn-group > summary { cursor: pointer; padding: 12px 14px; font-weight: 600; }
.fn-group .members { padding: 4px 14px 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.mech-chip {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 9px; font-size: 0.82rem; background: var(--surface);
  display: flex; gap: 6px; align-items: center;
  max-width: 100%; overflow-wrap: anywhere; min-width: 0;
}
.mech-chip .id { font-family: ui-monospace, monospace; color: var(--accent); white-space: nowrap; }

/* ---- Contribution ---- */
.contrib { display: grid; gap: 12px; grid-template-columns: 1fr; }
.contrib .card a.btn {
  display: inline-block; margin-top: 8px; padding: 7px 12px;
  background: var(--accent); color: #fff; border-radius: var(--radius);
  text-decoration: none; font-size: 0.88rem;
}

.disclaimer {
  border-left: 3px solid var(--mixed); background: var(--mixed-bg);
  padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.86rem; margin: 14px 0;
}

.loading, .empty { color: var(--text-muted); padding: 24px 0; text-align: center; }

footer.site { border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; }
footer.site .wrap { padding: 18px 16px; }

@media (min-width: 720px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .contrib { grid-template-columns: 1fr 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181d; --surface: #1d2127; --surface-2: #262b32; --border: #333a43;
    --text: #e6e9ee; --text-muted: #9aa4b0; --accent: #6ea0ff; --accent-soft: #1f2a3f;
    --supported-bg:#16301f; --weakened-bg:#3a1d18; --mixed-bg:#33270f;
    --unresolved-bg:#22272e; --superseded-bg:#241f33;
  }
  .banner { border-color: #34466b; }
}
