/* offsite-gap.css: the off-site mention gap ledger and its alternate views. */

/* Semantic colours as theme-aware tokens.
 *
 * The platform's red/amber/green were chosen against the dark ground and are
 * hardcoded across the app. Measured against the light theme's #f4f6fb they
 * come out at 1.5:1 to 2.6:1, well under the 4.5:1 WCAG AA needs for text, so
 * on light mode a "negative" label was decorative rather than readable. These
 * tokens keep the dark values exactly as they are and swap in darker variants
 * for light, all of which clear 5:1. Anything that renders a semantic colour on
 * this page reads them from here, including the inline styles the charts write. */
:root, html[data-theme="dark"] {
  --og-absent: #f87171;
  --og-page-only: #fbbf24;
  --og-present: #34d399;
  --og-muted: #8b95a5;   /* 5.65:1 on the dark card; #6b7280 measured 3.54 */
  --og-uncrawled: #4b5563;
  --og-link: #7c9bff;
}
html[data-theme="light"] {
  --og-absent: #b91c1c;      /* 5.98:1 */
  --og-page-only: #92400e;   /* 6.56:1 */
  --og-present: #047857;     /* 5.07:1 */
  --og-absent-fill: #ef4444;
  --og-page-only-fill: #f59e0b;
  --og-present-fill: #10b981;
  --og-muted: #4b5563;       /* 6.99:1 */
  --og-uncrawled: #374151;   /* 9.53:1 */
  --og-link: #2b4acb;        /* 6.60:1 */
}


.og-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px 80px; }
.og-head { padding: 24px 0 14px; }
.og-h1 { font-size:1.4375rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; margin: 0 0 5px; }
.og-sub { font-size:0.9375rem; color: var(--text-2); line-height: 1.55; margin: 0; max-width: 760px; }

/* ── run bar ─────────────────────────────────────────────────────────────── */
.og-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 18px; }
.og-input { flex: 1; min-width: 190px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 12px; font: inherit; font-size:0.9375rem; }
.og-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.og-btn { background: var(--bg); border: 1px solid var(--border); color: var(--text-2); border-radius: 8px;
  padding: 9px 14px; font: inherit; font-size:0.875rem; font-weight: 700; cursor: pointer; }
.og-btn:hover { color: var(--text); border-color: var(--text-3); }
.og-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.og-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ── verdict ─────────────────────────────────────────────────────────────── */
.og-verdict { border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px;
  background: var(--bg); border-left-width: 3px; }
.og-verdict.bad { border-left-color: var(--og-absent); }
.og-verdict.warn { border-left-color: var(--og-page-only); }
.og-verdict.good { border-left-color: var(--og-present); }
.og-verdict.neutral { border-left-color: var(--text-3); }
.og-verdict-h { font-size:1.125rem; font-weight: 800; color: var(--text); line-height: 1.4; margin: 0 0 5px; }
.og-verdict-s { font-size:0.875rem; color: var(--text-2); line-height: 1.55; margin: 0; }
.og-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.og-stat-n { font-size:1.1875rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.og-stat-l { font-size:0.75rem; color: var(--text-3); }

/* ── view switch ─────────────────────────────────────────────────────────── */
.og-views { display: flex; gap: 2px; background: var(--bg-2, var(--bg)); border: 1px solid var(--border);
  border-radius:8px; padding: 3px; width: fit-content; margin-bottom: 12px; }
.og-view { background: none; border: none; color: var(--text-3); font: inherit; font-size:0.875rem; font-weight: 700;
  padding: 7px 14px; border-radius: 6px; cursor: pointer; }
.og-view.on { background: var(--accent); color: #fff; }
.og-view:not(.on):hover { color: var(--text); }

/* ── ledger ──────────────────────────────────────────────────────────────── */
/* The grid has fixed columns, so between the mobile breakpoint and full width a
 * long source name can push it wider than the viewport. The ledger scrolls
 * inside itself rather than making the whole page scroll sideways. */
.og-ledger { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; overflow-x: auto; }
.og-row-head, .og-row { min-width: 0; }
.og-dom, .og-quote { overflow-wrap: anywhere; }
.og-row-head, .og-row { display: grid; grid-template-columns: 58px 1fr 116px 168px 96px 44px; gap: 12px;
  align-items: center; padding: 11px 16px; }
.og-row-head { background: var(--bg); border-bottom: 1px solid var(--border); font-size:0.75rem; font-weight: 800; color: var(--text-3); }
.og-row { border-bottom: 1px solid var(--border); cursor: pointer; background: none; border-left: 0; border-right: 0;
  border-top: 0; width: 100%; text-align: left; font: inherit; color: var(--text); }
.og-row:last-child { border-bottom: none; }
.og-row:hover { background: var(--bg); }
.og-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.og-score { font-size:1.1875rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.og-dom { font-size:0.9375rem; font-weight: 700; color: var(--text); word-break: break-all; }
.og-meta { font-size:0.75rem; color: var(--text-3); margin-top: 2px; }
.og-pill { display: inline-block; font-size:0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.og-pill.absent { color: var(--og-absent); border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.07); }
.og-pill.page_only { color: var(--og-page-only); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.07); }
.og-pill.in_passage { color: var(--og-present); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.07); }
.og-pill.blocked, .og-pill.unknown { color: var(--text-3); }
.og-tone { font-size:0.8125rem; font-weight: 700; }
.og-tone.neg { color: var(--og-absent); } .og-tone.neu { color: var(--text-2); } .og-tone.pos { color: var(--og-present); }
.og-caret { color: var(--text-3); font-size:0.8125rem; transition: transform .15s; }
.og-row[aria-expanded="true"] .og-caret { transform: rotate(90deg); }
.og-bar-track { height: 4px; background: var(--border); border-radius:4px; overflow: hidden; margin-top: 4px; }
.og-bar-fill { height: 100%; border-radius:4px; }

/* ── evidence drawer ─────────────────────────────────────────────────────── */
.og-drawer { padding: 0 16px 18px; background: var(--bg); border-bottom: 1px solid var(--border); }
.og-drawer-in { border-left: 2px solid var(--accent); padding: 2px 0 2px 14px; }
.og-quote { font-size:0.9375rem; line-height: 1.65; color: var(--text); background: var(--bg-2, rgba(127,127,127,.06));
  border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.og-label { font-size:0.75rem; font-weight: 800;
  color: var(--text-3); margin: 12px 0 4px; }
.og-why { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.og-why-i { font-size:0.8125rem; color: var(--text-2); }
.og-why-i strong { color: var(--text); font-variant-numeric: tabular-nums; }
.og-action { font-size:0.875rem; line-height: 1.6; color: var(--text-2); }

/* ── map + treemap ───────────────────────────────────────────────────────── */
.og-canvas { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--bg); }
.og-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border); font-size:0.8125rem; color: var(--text-3); }
.og-legend span { display: inline-flex; align-items: center; gap: 5px; }
.og-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.og-tile.unaudited { border: 1.5px dashed var(--og-uncrawled); background: transparent !important; }
.og-tile.unaudited .og-tile-n, .og-tile.unaudited .og-tile-c { color: var(--text-2); text-shadow: none; }
.og-tile { position: absolute; border-radius: 6px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--bg); display: flex; flex-direction: column; justify-content: flex-end; padding: 6px 8px; }
.og-tile-n { font-size:0.8125rem; font-weight: 800; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); word-break: break-all; }
.og-tile-c { font-size:0.6875rem; color: rgba(255,255,255,.85); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.og-node { cursor: pointer; }
.og-empty { text-align: center; padding: 44px 20px; color: var(--text-3); font-size:0.9375rem; }

@media (max-width: 860px) {
  .og-row-head { display: none; }
  .og-row { grid-template-columns: 52px 1fr 30px; row-gap: 6px; }
  .og-row > :nth-child(3), .og-row > :nth-child(4) { grid-column: 2; }
  .og-row > :nth-child(5) { display: none; }
}

/* ── type rollup ─────────────────────────────────────────────────────────── */
.og-roll { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--bg); }
.og-roll-r { display: grid; grid-template-columns: 120px 1fr 42px 108px; gap: 10px; align-items: center; padding: 4px 0; }
.og-roll-l { font-size:0.8125rem; font-weight: 700; color: var(--text-2); }
.og-roll-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.og-roll-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.og-roll-p { font-size:0.8125rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.og-roll-y { font-size:0.75rem; color: var(--text-3); }
.og-roll-y.bad { color: var(--og-absent); font-weight: 700; }
.og-roll-y.ok { color: var(--og-present); font-weight: 700; }
@media (max-width: 700px) { .og-roll-r { grid-template-columns: 84px 1fr 38px; } .og-roll-y { grid-column: 2 / -1; } }

/* ── live run strip ──────────────────────────────────────────────────────── */
.og-run { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: var(--bg); }
.og-run-track { height: 5px; background: var(--border); border-radius:4px; overflow: hidden; }
.og-run-fill { height: 100%; background: var(--accent); border-radius:4px; transition: width .35s ease; }
.og-run-label { font-size:0.875rem; color: var(--text-2); margin: 9px 0 11px; }
.og-phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 8px; }
.og-phase { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.og-phase.running { border-color: var(--accent); }
.og-phase.done { opacity: .82; }
.og-phase.failed { border-color: var(--og-absent); }
.og-phase-i { font-size:0.8125rem; font-weight: 800; color: var(--text-3); margin-right: 5px; }
.og-phase.running .og-phase-i { color: var(--accent-ink, var(--accent)); }
.og-phase.done .og-phase-i { color: var(--og-present); }
.og-phase.failed .og-phase-i { color: var(--og-absent); }
.og-phase-l { font-size:0.8125rem; font-weight: 700; color: var(--text); }
.og-phase-t { font-size:0.75rem; color: var(--text-3); float: right; font-variant-numeric: tabular-nums; }
.og-phase-d { font-size:0.75rem; color: var(--text-3); margin-top: 4px; line-height: 1.45; }
@media (prefers-reduced-motion: reduce) { .og-run-fill { transition: none; } }

/* ── ledger controls ─────────────────────────────────────────────────────── */
.og-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.og-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.og-chip { background: var(--bg); border: 1px solid var(--border); color: var(--text-2); border-radius: 20px;
  padding: 5px 11px; font: inherit; font-size:0.8125rem; font-weight: 700; cursor: pointer; }
.og-chip:hover { color: var(--text); }
.og-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.og-chip-n { margin-left: 6px; opacity: .65; font-variant-numeric: tabular-nums; }
.og-sort { margin-left: auto; font-size:0.8125rem; color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; }
.og-select { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius:6px;
  padding: 5px 8px; font: inherit; font-size:0.8125rem; }
.og-tail { font-size:0.8125rem; color: var(--text-3); line-height: 1.55; padding: 10px 4px 0; }

/* ── first-load explainer ────────────────────────────────────────────────── */
.og-intro { border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; background: var(--bg); }
.og-intro-h { font-size:0.8125rem; font-weight: 800; color: var(--text-3); margin-bottom: 8px; }
.og-intro-l { margin: 0; padding-left: 18px; font-size:0.9375rem; line-height: 1.7; color: var(--text-2); }
.og-intro-l li { margin-bottom: 3px; }
.og-intro-g { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.og-intro-g > div { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.og-intro-g strong { display: block; font-size:0.875rem; color: var(--text); margin-bottom: 3px; }
.og-intro-g span { font-size:0.8125rem; color: var(--text-3); line-height: 1.5; }
.og-intro-n { font-size:0.8125rem; color: var(--text-3); line-height: 1.6; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── movement since the last run ─────────────────────────────────────────── */
.og-delta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.og-delta-since { font-size:0.75rem; color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.og-delta-n { font-size:1.125rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.og-delta-from { font-size:0.8125rem; color: var(--text-3); }
.og-delta-tag { font-size:0.8125rem; color: var(--text-2); background: var(--bg-hover);
  border-radius: 6px; padding: 3px 9px; }
.og-delta-tag.ok { color: var(--og-present); }
.og-delta-tag.bad { color: var(--og-absent); }

/* ── who holds the slot ──────────────────────────────────────────────────── */
.og-rivals { display: flex; flex-wrap: wrap; gap: 4px; }
.og-rival { font-size:0.75rem; padding: 2px 7px; border-radius: 4px; background: var(--bg-hover);
  color: var(--text-3); white-space: nowrap; }
/* Named in the passage the engines drew on: the strong case, and visually
   distinct from a mention buried elsewhere on the page. */
.og-rival.strong { background: color-mix(in srgb, var(--og-absent) 14%, transparent);
  color: var(--og-absent); font-weight: 700; }

/* ── corpus discovery: found beyond the tracked prompts ──────────────────── */
.og-corpus { border: 1px solid var(--border); border-radius: 8px; margin-top: 16px; overflow: hidden; }
.og-corpus-head { padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--bg); }
.og-corpus-title { font-size:0.9375rem; font-weight: 800; color: var(--text); line-height: 1.4; }
.og-corpus-sub { font-size:0.8125rem; color: var(--text-3); line-height: 1.6; margin-top: 5px; max-width: 76ch; }
.og-row--corpus { grid-template-columns: 58px 1fr 116px 168px 96px 44px; }
.og-corpus-cat { font-size:0.8125rem; color: var(--text-2); margin-top: 6px; }
.og-corpus-cat strong { color: var(--text); }

/* ── share over time ─────────────────────────────────────────────────────── */
#og-history:empty { display: none; }
#og-history { border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin-top: 14px; background: var(--bg); }
.og-hist { display: flex; align-items: flex-end; gap: 8px; height: 76px; }
.og-hist-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.og-hist-bar { width: 26px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .75; }
.og-hist-col:hover .og-hist-bar { opacity: 1; }
.og-hist-n { font-size:0.75rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.og-hist-d { font-size:0.6875rem; color: var(--text-3); }
.og-hist-note { font-size:0.8125rem; color: var(--text-3); line-height: 1.6; margin-top: 10px; max-width: 72ch; }

/* Field guidance that survives typing. The instructions used to live in
   placeholders, two of which needed ~360px in a 279px input and were cut off
   mid-word. */
.og-hint {
  margin: -4px 0 18px;
  font-size:0.875rem;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 78ch;
}
.og-hint strong { color: var(--text); font-weight: 600; }
