/* Claude Code Toolkit — canonical stylesheet (ADR-0009: ONE stylesheet, duplicated markup).
   Design system: "Hairline Grid" — see drafts/DESIGN.md.
   Monochrome white + one teal; Space Grotesk display, system body, mono code;
   structure from 1px rules and whitespace — zero cards, zero shadows.
   This sheet now owns EVERY component on all 9 pages (per-tool CSS files deleted,
   completing RECONCILE.md residuals 1–2). */

:root {
  color-scheme: light;
  --color-bg: #ffffff;
  --color-text: #111418;
  --color-muted: #4e555b;          /* 7.57:1 on white */
  --color-accent: #0f766e;         /* teal — 5.47:1 on white; never a background wash */
  --color-accent-deep: #0c5d56;
  --color-accent-ink: #ffffff;
  --color-surface: #f7f8f8;
  --color-border: #d9dde0;         /* the hairline — always 1px */
  --color-code-bg: #f1f3f3;
  --color-term-bg: #111418;        /* the fake-terminal preview (content, not chrome) */
  --color-term-text: #d6dbdd;
  --color-error: #b42318;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --space: 1rem;
  --pad: clamp(1rem, 3.5vw, 2.5rem);
  --radius: 4px;
  --max-width: 1100px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

/* ── The hairline column ──────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem var(--pad) 1.5rem;
}
@media (min-width: 1140px) {
  .container, .site-nav { border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border); }
}

/* Readable measure inside the wide column; tables/code/grids run full width */
main p, main ul, main ol, main dl { max-width: 75ch; }
.tool-list, .toc ol, footer p { max-width: none; }

h1, h2, h3, h4, legend, summary {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
h1 { margin: 0.75rem 0 0; font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.1rem); }
h2 { margin-top: 2.25rem; font-size: 1.25rem; }
h3 { margin-top: 1.5rem; font-size: 1.05rem; }
.tagline { color: var(--color-muted); margin: 0.4rem 0 0; }

/* Section rules: every reference h2 opens with a hairline */
main h2 {
  border-top: 1px solid var(--color-border);
  padding-top: 1.4rem;
  margin-top: 2.75rem;
}
.output-head h2, .toc h2, .tool-card h2, .tool-card h3,
#tool .output-head h2 { border-top: 0; padding-top: 0; margin-top: 0; }

a {
  color: var(--color-accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 100ms, text-decoration-color 100ms;
}
a:hover { color: var(--color-accent-deep); }

code, pre, kbd {
  font-family: var(--mono);
  font-size: 0.9em;
}
code {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.1em 0.35em;
}
pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; border: none; padding: 0; }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Anchor targets clear the sticky nav */
[id] { scroll-margin-top: 7rem; }

/* ── Toolkit nav (static duplicated markup, ADR-0009) ─────────────── */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.1rem;
  padding: 0.65rem var(--pad);
  max-width: var(--max-width);
  margin: 0 auto;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
  background: var(--color-bg);
}
@media (min-width: 720px) {
  .site-nav { position: sticky; top: 0; z-index: 20; }
}
.site-nav a {
  text-decoration: none;
  color: var(--color-accent);
  border-bottom: 2px solid transparent;
  padding-bottom: 1px;
  transition: color 100ms, border-color 100ms;
}
.site-nav a:hover { color: var(--color-accent-deep); border-bottom-color: var(--color-border); }
.site-nav a[aria-current="page"] {
  color: var(--color-text);
  font-weight: 600;
  border-bottom-color: var(--color-accent);
}
.site-nav .nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.site-nav .nav-brand::before { content: "❯ "; color: var(--color-accent); font-family: var(--mono); }

/* ── Tool panel: a ruled band, not a box ──────────────────────────── */
#tool {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 0 1.5rem;
  margin: 1.25rem 0;
}
#tool h2 { border-top: 0; padding-top: 0; margin-top: 1.75rem; }
#tool h2:first-child { margin-top: 0; }

/* ── Forms ────────────────────────────────────────────────────────── */
label { display: block; margin: 0.9rem 0 0.3rem; font-weight: 600; font-size: 0.95rem; }

input, select, button, textarea {
  font: inherit;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  max-width: 100%;
  background: var(--color-bg);
  color: var(--color-text);
}
input[type="text"], input[type="number"], textarea, select {
  font-family: var(--mono);
  font-size: 0.9rem;
}
input[type="text"], input[type="number"], textarea { width: 100%; }
select { width: 100%; }
.options-row select { width: auto; }
textarea { resize: vertical; line-height: 1.5; }

fieldset {
  border: 1px solid var(--color-border);
  border-radius: 0;
  margin: 1rem 0 0;
  padding: 0.5rem 1rem 1rem;
}
legend { font-size: 0.95rem; padding: 0 0.4rem; }
.legend-note, .label-note, .hint-inline { font-family: var(--font); font-weight: 400; color: var(--color-muted); font-size: 0.8125rem; letter-spacing: 0; }

button {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border: 1px solid var(--color-accent);
  cursor: pointer;
  font-weight: 600;
  min-height: 44px;   /* a11y: touch target (WCAG 2.5.5) */
  transition: background-color 100ms, border-color 100ms, color 100ms;
}
button:hover:not(:disabled) { background: var(--color-accent-deep); border-color: var(--color-accent-deep); }
button.ghost, button.secondary, .try-preset, .chips button {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-border);
  font-weight: 500;
}
button.ghost:hover:not(:disabled), button.secondary:hover:not(:disabled),
.try-preset:hover:not(:disabled), .chips button:hover:not(:disabled) {
  background: transparent;
  color: var(--color-accent-deep);
  border-color: var(--color-accent);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.copied, .copy-btn.copied, #copy-btn.copied { background: var(--color-accent-deep); border-color: var(--color-accent-deep); color: var(--color-accent-ink); }

/* Shared small-text roles */
.hint, .path-hint, .fragment-note, .output__hint, .sub-label, .chips-label { color: var(--color-muted); font-size: 0.85rem; font-weight: 400; }
.hint.warn { color: var(--color-error); }
.warn, .field-error { color: var(--color-error); font-size: 0.8125rem; margin: 0.25rem 0 0; }

/* Inline choice labels (radios / checkboxes across generators) */
label.inline, label.radio, label.check, .check {
  font-weight: 400;
  font-size: 1rem;
  margin: 0.3rem 0;
}
label.inline, .check { display: inline-flex; align-items: center; gap: 0.4rem; }
label.radio, label.check { display: block; }
label.radio input, label.check input { margin-right: 0.45rem; }
label.inline { margin-right: 1.25rem; }
.radio-row { display: grid; gap: 0.25rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
#rules .rule { min-width: 15rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-accent); }

.field { margin-bottom: 1rem; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 1.25rem;
}
.builder-actions { margin-top: var(--space); display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* Quick-add chips (settings) — blocky mono keys, not pills */
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; margin-top: 0.375rem; }
.chips button { font-family: var(--mono); font-size: 0.8125rem; padding: 0.25rem 0.7rem; }

/* ── Statusline maker ─────────────────────────────────────────────── */
.catalog { display: grid; gap: 0.15rem; margin: 0.5rem 0 0; }
.catalog-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
}
.catalog-item:hover { background: var(--color-surface); }
.catalog-item input[type="checkbox"] { margin: 0; }
.catalog-item label { display: inline; margin: 0; font-weight: 600; cursor: pointer; }
.catalog-item .hint { font-size: 0.85rem; }

.selected-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.selected-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-size: 0.9rem;
}
.selected-list .grow { flex: 1; }
.selected-list button {
  padding: 0.1rem 0.5rem;
  font-size: 0.85rem;
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  font-weight: 400;
  min-width: 44px;   /* a11y: touch target */
  min-height: 44px;
}
.selected-list button:hover:not(:disabled) { background: transparent; color: var(--color-accent); border-color: var(--color-accent); }

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  margin-top: 1rem;
}
.options-row label { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.options-row select { padding: 0.25rem 0.5rem; }

/* Fake terminal preview — the one dark surface (it is content) */
.term {
  background: var(--color-term-bg);
  color: var(--color-term-text);
  font-family: var(--mono);
  font-size: 0.9rem;
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-top: 0.5rem;
  overflow-x: auto;
  white-space: nowrap;
}
.term .dim { opacity: 0.55; }

/* Output tabs — ruled underline, no boxes */
.tabs { display: flex; gap: 1.5rem; margin-top: 1.25rem; border-bottom: 1px solid var(--color-border); }
.tabs button {
  background: transparent;
  color: var(--color-muted);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.4rem 0.1rem;
  margin-bottom: -1px;
  font-weight: 600;
  min-height: 44px;   /* a11y: touch target */
}
.tabs button:hover:not(:disabled) { background: transparent; color: var(--color-text); }
.tabs button[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-accent); }
.tab-panel { border: 0; background: transparent; padding: 0.85rem 0 0; margin: 0; }

/* ── Code block + copy button ─────────────────────────────────────── */
.codeblock { position: relative; margin: 0.75rem 0; }
.codeblock pre { margin: 0; padding-top: 3.4rem; }  /* clear the 44px copy button */
.codeblock .copy-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  padding: 0.2rem 0.9rem;
  font-size: 0.8rem;
  min-height: 44px;   /* a11y: touch target */
}
.copy-btn { font-size: 0.8125rem; padding: 0.3rem 0.9rem; white-space: nowrap; }

/* ── Generator outputs — unified light code blocks ────────────────── */
.output, .output-block { margin-top: 1.25rem; }
.output-head, .output__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}
.output-head { margin-top: var(--space); }
.output-head h2 { margin: 0; font-size: 1.05rem; }
.output__bar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.3rem 0.3rem 0.3rem 0.75rem;
}
.output__filename, .output__path { font-family: var(--mono); font-size: 0.8125rem; color: var(--color-muted); overflow-wrap: anywhere; }
.output__bar button { padding: 0.25rem 0.75rem; font-size: 0.8125rem; }

#out, #output, #fragment-out, #cli {
  background: var(--color-code-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0.5rem 0 0;
  white-space: pre;
}
#out { min-height: 12rem; }
.output__bar + #out, .output__bar + #output { margin-top: 0; border-radius: 0 0 var(--radius) var(--radius); }

/* ── Hooks builder extras ─────────────────────────────────────────── */
.event-info { font-size: 0.85rem; color: var(--color-muted); margin: 0.25rem 0 0; min-height: 2.6em; }
.event-info .badge { margin-left: 0.4em; }
.badge--blocks { color: var(--color-text); border-color: var(--color-text); }
.try-preset { font-size: 0.8rem; padding: 0.2rem 0.6rem; }

/* ── Verified-against line (ADR-0011) ─────────────────────────────── */
.verified {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-family: var(--mono);
}
.verified::before { content: "✓ "; color: var(--color-accent); }

/* ── On this page (hairline list) ─────────────────────────────────── */
.toc {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 0.85rem 0 1rem;
  margin: 2rem 0 0;
}
.toc-label {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-muted);
}
.toc ol { margin: 0; padding: 0; list-style: none; columns: 14rem; column-gap: 2.5rem; font-family: var(--mono); font-size: 0.85rem; }
.toc li { break-inside: avoid; }
.toc a { text-decoration: none; display: inline-block; padding: 0.2rem 0; }
.toc a:hover { text-decoration: underline; }

/* Dormant offer slot (ADR-0006/0010) — ships in markup, stays hidden. */
#offer-slot[hidden], [hidden] { display: none; }

/* ── Reference tables: ruled rows only ────────────────────────────── */
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 0.5rem 0 1rem; }
th, td {
  text-align: left;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  background: none;
}
th {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}
.table-scroll, .table-wrap { overflow-x: auto; }
td code, th code { overflow-wrap: anywhere; word-break: break-word; }

/* ── FAQ ──────────────────────────────────────────────────────────── */
details {
  border: 0;
  border-top: 1px solid var(--color-border);
  border-radius: 0;
  padding: 0.65rem 0;
  margin: 0;
}
details:last-of-type { border-bottom: 1px solid var(--color-border); }
summary { cursor: pointer; font-weight: 600; font-size: 1rem; }
summary:hover { color: var(--color-accent); }
.faq dt { font-weight: 600; margin-top: 1.1rem; }
.faq dd { margin: 0.25rem 0 0; }

/* ── Good/bad example pair (skill-md) ─────────────────────────────── */
.example-pair { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .example-pair { grid-template-columns: 1fr 1fr; } }
.example-pair > div { min-width: 0; }  /* grid min-content trap: let pres scroll, not the page */
.example-pair pre { margin: 0; }
.example-label { font-size: 0.8125rem; font-weight: 600; margin: 0 0 0.25rem; font-family: var(--mono); }
.example-bad .example-label { color: #b91c1c; }
.example-good .example-label { color: #15803d; }

/* ── Toolkit index: ruled grid, no cards ──────────────────────────── */
.tool-list {
  list-style: none;
  padding: 1px 0 0 1px;   /* room for the cards' -1px border overlap */
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 0;
}
.tool-card {
  background: var(--color-bg);
  padding: 1rem 1.25rem 1.15rem;
  border: 1px solid var(--color-border);
  border-radius: 0;
  margin: -1px 0 0 -1px;  /* hairlines collapse to 1px between cells */
}
.tool-card h2, .tool-card h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.tool-card h3 a { text-decoration: none; }
.tool-card h3 a:hover { text-decoration: underline; }
.tool-card p { margin: 0; color: var(--color-muted); font-size: 0.92rem; }
.tool-card .path { font-family: var(--mono); font-size: 0.78rem; color: var(--color-muted); margin-bottom: 0.35rem; }
.tool-card.soon { background: var(--color-surface); opacity: 1; }
.tool-card.soon h3 { color: var(--color-muted); }
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.05rem 0.5rem;
  color: var(--color-muted);
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* ── Footer: hairline-top, all mono ───────────────────────────────── */
footer {
  color: var(--color-muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  border-top: 1px solid var(--color-border);
  margin-top: 2.5rem;
}
footer a { color: var(--color-accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
footer .fineprint { font-size: 0.72rem; }
