/* hn-formal loop dashboard. Human-written, not touched by the loop.
   No external origins; system fonts only. */
:root {
  color-scheme: light dark;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #efede8;
  --text: #1c1b19;
  --muted: #5d5a53;
  --line: #d9d6cf;
  --accent: #b4441a;
  --accent-text: #ffffff;
  --proven: #1f6f4a;
  --proven-bg: #dff3e7;
  --checked: #275e9c;
  --checked-bg: #dde9f8;
  --trusted: #7a5a12;
  --trusted-bg: #f6ebcc;
  --fail: #a32d2d;
  --fail-bg: #f8dede;
  --ok: #1f6f4a;
  --ok-bg: #dff3e7;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --surface: #1e2026;
    --surface-2: #272a31;
    --text: #e8e6e1;
    --muted: #a39f96;
    --line: #363942;
    --accent: #e8703f;
    --accent-text: #15161a;
    --proven: #7bd3a3;
    --proven-bg: #1d3a2c;
    --checked: #8fb8ea;
    --checked-bg: #1f3350;
    --trusted: #e6c26a;
    --trusted-bg: #44361a;
    --fail: #f08c8c;
    --fail-bg: #4a2222;
    --ok: #7bd3a3;
    --ok-bg: #1d3a2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: 0.92em; background: var(--surface-2); padding: 0.05em 0.35em; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 16px; }
[hidden] { display: none !important; }

/* header / footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { margin: 0; font-weight: 650; font-size: 1.05rem; }
.brand a { color: inherit; text-decoration: none; }
.brand-sub { color: var(--muted); font-weight: 400; }
.site-header nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.95rem; }
.site-header nav a { color: var(--text); text-decoration: none; }
.site-header nav a:hover { color: var(--accent); text-decoration: underline; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 0 0 6px; }

/* hero */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 12px; }
.lede { max-width: 72ch; margin: 0 0 24px; font-size: 1.05rem; color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stats dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin: 20px 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); margin: 8px 0; }
.error { color: var(--fail); margin: 8px 0; }

/* current release */
.current { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .current { grid-template-columns: 1fr; } }
.shot { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.shot-missing { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 0.9rem; background: var(--surface-2); }
.release-meta { margin: 0; display: grid; grid-template-columns: max-content 1fr; column-gap: 16px; row-gap: 6px; font-size: 0.95rem; }
.release-meta dt { color: var(--muted); }
.release-meta dd { margin: 0; overflow-wrap: anywhere; }
.release-id { font-family: var(--mono); font-size: 0.9em; }
.score { display: inline-flex; align-items: center; gap: 10px; }
.score meter { width: 120px; height: 10px; }
.score-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.axioms { display: flex; gap: 6px; flex-wrap: wrap; }
.axioms code { background: var(--proven-bg); color: var(--proven); }
.axioms code.axiom-bad { background: var(--fail-bg); color: var(--fail); }
.t2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 0; }
.t2 div { background: var(--surface-2); border-radius: 6px; padding: 6px 8px; }
.t2 dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.t2 dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.notes { margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; white-space: pre-wrap; }
.actions { margin-top: 14px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.95rem; }

/* gallery */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.gallery li { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.gallery .shot, .gallery .shot-missing { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); aspect-ratio: 375 / 600; object-fit: cover; object-position: top; }
.gallery .shot-missing { aspect-ratio: 375 / 600; }
.gallery .score meter { width: 64px; }
.gallery .card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.gallery .card-id { font-family: var(--mono); font-size: 0.78rem; overflow-wrap: anywhere; }
.gallery .card-date { color: var(--muted); }
.gallery .is-current { outline: 2px solid var(--accent); outline-offset: -2px; }
.gallery .badge-current { align-self: flex-start; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-text); background: var(--accent); padding: 1px 6px; border-radius: 4px; }

/* runs table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table.runs { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 720px; }
table.runs th, table.runs td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.runs th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
table.runs .num { text-align: right; font-variant-numeric: tabular-nums; }
table.runs .mono { font-family: var(--mono); font-size: 0.86em; }
table.runs tr.run-row.is-open td { border-bottom-color: transparent; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-fail { background: var(--fail-bg); color: var(--fail); }
.pill-warn { background: var(--trusted-bg); color: var(--trusted); }
.pill-muted { background: var(--surface-2); color: var(--muted); }
.toggle { font: inherit; font-size: 0.85rem; color: var(--accent); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.toggle:hover { border-color: var(--accent); }
.toggle[aria-expanded="true"] { background: var(--surface-2); }
tr.details-row td { background: var(--surface-2); padding: 10px 14px 14px; }
table.cands { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.cands th, table.cands td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.cands th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
table.cands td.err { font-family: var(--mono); font-size: 0.8em; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 60ch; }

/* claims */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col .span { grid-column: 1 / -1; margin-bottom: 0; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.claim ul { padding-left: 20px; margin: 10px 0 0; }
.claim li { margin: 6px 0; }
.claim-sub { color: var(--muted); font-size: 0.9rem; margin: 6px 0 0; }
.mt { margin-top: 22px; }
.tag { display: inline-block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }
.tag-proven { background: var(--proven-bg); color: var(--proven); }
.tag-checked { background: var(--checked-bg); color: var(--checked); }
.tag-trusted { background: var(--trusted-bg); color: var(--trusted); }

@media (prefers-reduced-motion: no-preference) {
  .toggle { transition: border-color 120ms ease; }
}
