/*
 * SheetShift site styles: one quiet stylesheet shared by every page.
 * System fonts only, light and dark via prefers-color-scheme, no external requests.
 * Author: Claude Code (AI agent) — scaffold; see ATTRIBUTION.md
 */

:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1c1d1f;
  --muted: #5d6066;
  --border: #dcdcd6;
  --accent: #2f5d8a;
  --accent-soft: #e4ecf5;
  --ok: #2d6a3e;
  --ok-soft: #e3f0e6;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --bad: #a23a2e;
  --bad-soft: #f8e5e2;
  --decided: #5b4b8a;
  --decided-soft: #ebe7f5;
  --focus: #2f5d8a;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, 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: #141517;
    --surface: #1c1e21;
    --surface-2: #24272b;
    --text: #e8e8e6;
    --muted: #a0a4ab;
    --border: #34383d;
    --accent: #8db4dc;
    --accent-soft: #1f2d3b;
    --ok: #8cc79b;
    --ok-soft: #1c2d21;
    --warn: #e0b45c;
    --warn-soft: #33291a;
    --bad: #ec9489;
    --bad-soft: #3a211e;
    --decided: #b8a9e6;
    --decided-soft: #2a2540;
    --focus: #8db4dc;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

code, kbd, pre, .mono { font-family: var(--mono); font-size: 0.9em; }
pre { overflow-x: auto; background: var(--surface-2); padding: 12px; border-radius: var(--radius); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin-top: 0.25em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.9em; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--surface); padding: 8px 12px; border-radius: var(--radius);
}
.skip-link:focus { left: 16px; z-index: 10; }

/* ---------------------------------------------------------------- chrome */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  max-width: 1080px; margin: 0 auto; padding: 12px 16px;
}
.brand { font-weight: 650; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 400; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
  color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }

main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }

.site-footer {
  border-top: 1px solid var(--border); color: var(--muted); font-size: 0.875rem;
}
.site-footer .inner { max-width: 1080px; margin: 0 auto; padding: 16px; }

/* ---------------------------------------------------------------- notices */
.notice {
  border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius);
  background: var(--surface); padding: 10px 14px; margin: 0 0 16px; font-size: 0.95rem;
}
.notice.info { border-left-color: var(--accent); }
.notice.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.notice.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.notice p:last-child { margin-bottom: 0; }

.replay-label {
  display: inline-block; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--warn); background: var(--warn-soft);
  border: 1px solid var(--warn); border-radius: 999px; padding: 2px 10px;
}

.empty {
  color: var(--muted); background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}

/* ---------------------------------------------------------------- layout blocks */
.lede { font-size: 1.1rem; color: var(--muted); max-width: 46em; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin: 0 0 16px;
}
.card > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid > .card { margin: 0; }

.section { margin: 32px 0 0; }

/* ---------------------------------------------------------------- headline reconciliation */
.headline { font-size: 1.2rem; line-height: 1.5; margin: 0 0 14px; }
.headline strong { font-variant-numeric: tabular-nums; }

.recon-bar {
  display: flex; height: 14px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.recon-bar > span { display: block; height: 100%; min-width: 0; }
.recon-bar .equal { background: var(--ok); }
.recon-bar .decided { background: var(--decided); }
.recon-bar .unexplained { background: var(--bad); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 0.9rem; color: var(--muted); }
.legend li::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 6px; vertical-align: -1px; background: var(--swatch, var(--muted));
}
.legend .equal { --swatch: var(--ok); }
.legend .decided { --swatch: var(--decided); }
.legend .unexplained { --swatch: var(--bad); }

.stat { font-variant-numeric: tabular-nums; }
.stat .value { display: block; font-size: 1.6rem; font-weight: 650; line-height: 1.2; }
.stat .label { display: block; color: var(--muted); font-size: 0.9rem; }
.stat .source { display: block; font-size: 0.8rem; margin-top: 6px; }

.badge {
  display: inline-block; font-size: 0.8rem; font-weight: 650; letter-spacing: 0.04em;
  border-radius: 999px; padding: 2px 10px; border: 1px solid currentColor; white-space: nowrap;
}
.badge.green { color: var(--ok); background: var(--ok-soft); }
.badge.red { color: var(--bad); background: var(--bad-soft); }
.badge.pending, .badge.neutral { color: var(--muted); background: var(--surface-2); }
.badge.decided { color: var(--decided); background: var(--decided-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }

/* ---------------------------------------------------------------- steps and lists */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: 0 0 12px 40px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 50%; text-align: center; line-height: 28px;
  background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 0.9rem;
}

.plain-list { margin: 0; padding-left: 1.2em; }
.plain-list li { margin: 0 0 4px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.hash { font-family: var(--mono); font-size: 0.8rem; word-break: break-all; }

dl.kv { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- forms (verify / trace) */
form.inline, .controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
label { display: block; font-size: 0.875rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px;
}
input[type="number"] { width: 8em; }
select { min-width: 14em; max-width: 100%; }
textarea { width: 100%; min-height: 12em; font-family: var(--mono); font-size: 0.85rem; }
button { cursor: pointer; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button:disabled { opacity: 0.55; cursor: default; }
@media (prefers-color-scheme: dark) { button { color: #111; } button.secondary { color: var(--text); } }

.status-line { min-height: 1.5em; color: var(--muted); font-size: 0.9rem; }

[hidden] { display: none !important; }

/* ---------------------------------------------------------------- replay timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; margin: 0 0 12px; padding: 0 0 0 18px; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 7px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--muted);
}
.timeline li.kind-commit::before { border-color: var(--accent); background: var(--accent-soft); }
.timeline li.kind-guard_block::before { border-color: var(--bad); background: var(--bad-soft); }
.timeline li.kind-task::before { border-color: var(--decided); background: var(--decided-soft); }
.timeline li.kind-decision::before { border-color: var(--decided); background: var(--decided); }
.timeline li.kind-smoke::before { border-color: var(--ok); }
.timeline li.future { opacity: 0.28; }
.timeline li.current { opacity: 1; }
.timeline li.current .event { border-color: var(--accent); }
.timeline .event { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; }
.timeline .meta { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.timeline .links { font-size: 0.85rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .timeline li { transition: opacity 180ms ease; }
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 600px) {
  h1 { font-size: 1.45rem; }
  .headline { font-size: 1.05rem; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
  .card { padding: 14px 16px; }
}

@media print {
  .site-header, .site-footer, .controls, form { display: none; }
  body { background: #fff; color: #000; }
}
