/* ---------- Tokens ---------- */
:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-2: #f1ece3;
  --ink: #1f1d1a;
  --ink-2: #4a453e;
  --muted: #736c61;
  --line: #e3dccf;
  --line-strong: #cfc6b6;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e2ece8;
  --link: #24584a;
  --focus: #c26a2e;

  --slop-5: #9c4a1a;   /* pure slop */
  --slop-4: #b0701c;
  --slop-3: #9a8a1e;
  --slop-2: #4f8a52;
  --slop-1: #2e7a8c;   /* human-verified */
  --meter-track: #ebe4d7;

  --ev-research: #2f5d50;
  --ev-mixed: #5d5a2f;
  --ev-standard: #3b4f74;
  --ev-practice: #7a4d2b;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 2px 8px rgba(40, 30, 10, .04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171614;
    --surface: #211f1c;
    --surface-2: #2a2723;
    --ink: #eeebe5;
    --ink-2: #cfc9bf;
    --muted: #a39b8f;
    --line: #36322c;
    --line-strong: #4a453d;
    --accent: #7fbfa9;
    --accent-ink: #10201b;
    --accent-soft: #23332e;
    --link: #8fd0b9;
    --focus: #f0a46a;
    --slop-5: #e07a45;
    --slop-4: #e0a24a;
    --slop-3: #cfc057;
    --slop-2: #7cc282;
    --slop-1: #6cc5d8;
    --meter-track: #34302a;
    --ev-research: #7fbfa9;
    --ev-mixed: #c9c27a;
    --ev-standard: #9db4e0;
    --ev-practice: #e0a77a;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #171614; --surface: #211f1c; --surface-2: #2a2723; --ink: #eeebe5; --ink-2: #cfc9bf;
  --muted: #a39b8f; --line: #36322c; --line-strong: #4a453d; --accent: #7fbfa9; --accent-ink: #10201b;
  --accent-soft: #23332e; --link: #8fd0b9; --focus: #f0a46a; --slop-5: #e07a45; --slop-4: #e0a24a;
  --slop-3: #cfc057; --slop-2: #7cc282; --slop-1: #6cc5d8; --meter-track: #34302a;
  --ev-research: #7fbfa9; --ev-mixed: #c9c27a; --ev-standard: #9db4e0; --ev-practice: #e0a77a; --shadow: none;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin: .2em 0 .3em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; }
p { margin: .5em 0 .9em; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 10; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 1.12rem; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-family: var(--sans); font-size: .95rem; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: .95rem; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

main { padding-top: 20px; padding-bottom: 40px; outline: none; }
.site-footer { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 14px; padding-bottom: 28px; }

/* ---------- Slop meter ---------- */
.meter { --pct: 100%; --c: var(--slop-5); }
.meter.s5 { --c: var(--slop-5); } .meter.s4 { --c: var(--slop-4); } .meter.s3 { --c: var(--slop-3); }
.meter.s2 { --c: var(--slop-2); } .meter.s1 { --c: var(--slop-1); }
.meter-bar { height: 10px; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.meter-fill { height: 100%; width: var(--pct); background: var(--c); border-radius: 999px; transition: width .35s ease; }
.meter-big { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin: 14px 0 18px; }
.meter-big .meter-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.meter-big .meter-title { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.meter-big .meter-num { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; color: var(--c); line-height: 1; }
.meter-big .meter-label { font-weight: 600; color: var(--ink); }
.meter-big .meter-bar { height: 14px; }
.meter-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 5px; }
.meter-mini { width: 92px; flex: none; text-align: right; }
.meter-mini .meter-num { font-size: .78rem; font-weight: 700; color: var(--c); display: block; margin-bottom: 3px; white-space: nowrap; }
.meter-mini .meter-bar { height: 6px; }

/* ---------- Banner ---------- */
.intro { margin-bottom: 6px; }
.intro p { color: var(--ink-2); max-width: 62ch; }

/* ---------- Filters ---------- */
.filters { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 240px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); }
select { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); max-width: 100%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink-2); border-radius: 999px; padding: 4px 11px; font-size: .85rem; cursor: pointer; text-decoration: none; display: inline-block; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"], .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-label { font-size: .8rem; color: var(--muted); margin-right: 2px; }
.active-filter { font-size: .9rem; color: var(--ink-2); }
.linklike { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; }

/* ---------- List ---------- */
.count { color: var(--muted); font-size: .9rem; margin: 4px 2px 10px; }
.cl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cl-row { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.cl-row:hover { border-color: var(--line-strong); }
.cl-row:hover .cl-title { text-decoration: underline; }
.cl-main { flex: 1; min-width: 0; }
.cl-title { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; color: var(--ink); }
.cl-summary { color: var(--ink-2); font-size: .92rem; margin: 2px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl-meta { display: flex; gap: 6px 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center; }
.cat-pill { background: var(--surface-2); padding: 1px 8px; border-radius: 999px; color: var(--ink-2); }
.ev { font-weight: 600; }
.ev-research { color: var(--ev-research); } .ev-mixed { color: var(--ev-mixed); }
.ev-standard { color: var(--ev-standard); } .ev-practice { color: var(--ev-practice); }
.progress-pill { font-variant-numeric: tabular-nums; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ---------- Category grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.card:hover { border-color: var(--line-strong); }
.card h3 { margin: 0 0 4px; font-size: 1.08rem; color: var(--ink); }
.card p { margin: 0 0 10px; color: var(--ink-2); font-size: .9rem; }
.card .meter-mini { width: 100%; text-align: left; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Checklist page ---------- */
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 64ch; }
.meta-line { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.ev-badge { border: 1px solid currentColor; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 8px; }
.toolbar h2 { margin: 0; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: .9rem; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.progress { height: 6px; background: var(--meter-track); border-radius: 999px; overflow: hidden; margin: 4px 0 14px; }
.progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .25s ease; }

.items { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.item { border-top: 1px solid var(--line); padding: 10px 14px; }
.item:first-child { border-top: 0; }
.item-row { display: flex; gap: 12px; align-items: flex-start; }
.item input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.item label { flex: 1; cursor: pointer; }
.item.done label .item-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.item-tools { display: flex; gap: 6px; align-items: center; flex: none; margin-top: 1px; }
.cite { font-size: .75rem; font-weight: 700; text-decoration: none; background: var(--surface-2); border-radius: 5px; padding: 1px 6px; color: var(--link); }
.cite:hover { background: var(--accent-soft); }
.more-btn { font-size: .78rem; border: 1px solid var(--line-strong); background: transparent; border-radius: 6px; padding: 1px 7px; cursor: pointer; color: var(--ink-2); }
.more-btn[aria-expanded="true"] { background: var(--surface-2); }
.item-more { margin: 8px 0 2px 32px; font-size: .92rem; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }

details.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; box-shadow: var(--shadow); }
details.section > summary { cursor: pointer; padding: 12px 16px; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after { content: "+"; font-family: var(--sans); color: var(--muted); font-size: 1.3rem; line-height: 1; }
details.section[open] > summary::after { content: "–"; }
details.section .sec-body { padding: 0 16px 14px; }
.sum-note { font-family: var(--sans); font-weight: 400; font-size: .82rem; color: var(--muted); margin-left: auto; margin-right: 6px; }

.sources { padding-left: 1.4em; margin: 0; }
.sources > li { margin: 0 0 14px; padding-left: 4px; }
.sources > li:target { background: var(--accent-soft); border-radius: 6px; }
.src-cite { margin: 0 0 3px; }
.src-use { margin: 0 0 4px; font-size: .92rem; color: var(--ink-2); }
.src-kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; margin-right: 6px; }
.src-checks { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: .84rem; color: var(--ink-2); margin-top: 4px; }
.src-checks label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.src-checks input { accent-color: var(--accent); }
.ai-note { font-size: .8rem; color: var(--muted); }

.review-steps { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.review-steps label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.review-steps input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.pts { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.field { display: grid; gap: 4px; margin: 10px 0; }
.field input, .field textarea { border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; background: var(--bg); width: 100%; }
.field textarea { min-height: 90px; resize: vertical; }
.why p { max-width: 68ch; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: .9rem; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; }

.prose { max-width: 68ch; }
.prose li { margin-bottom: 6px; }
.score-table { border-collapse: collapse; width: 100%; max-width: 560px; font-size: .92rem; margin: 8px 0 16px; }
.score-table th, .score-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.score-table td:last-child, .score-table th:last-child { text-align: right; white-space: nowrap; }

@media (max-width: 560px) {
  .site-header { position: static; }
  .cl-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .meter-mini { width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; }
  .meter-mini .meter-num { margin: 0; }
  .meter-mini .meter-bar { flex: 1; }
  .item-more { margin-left: 0; }
  .brand-text { font-size: 1rem; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .filters, .btns, .more-btn, .src-checks, .review-section, .skip, .crumbs, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .items, details.section, .meter-big { box-shadow: none; border-color: #bbb; }
  .item { break-inside: avoid; }
  .item-more { display: block !important; background: none; padding: 0 0 0 32px; }
  a { color: #000; }
  .cite { background: none; }
}
