/* Shared dark theme (Claude.ai-style). Dark only: no light mode, no toggle. */
:root {
  color-scheme: dark;

  --bg: #262624;
  --bg-sidebar: #1f1e1d;
  --surface: #30302e;
  --surface-2: #3a3936;
  --border: #4a4945;
  --text: #faf9f5;
  --text-muted: #c2c0b6;
  --text-faint: #9a988f;
  --accent: #d97757;
  --accent-strong: #c96442;
  --accent-soft: rgba(217, 119, 87, .14);
  --accent-text: #f0a58a;

  /* callout colours: [accent, background] */
  --c-note: #7fa6d6;      --c-note-bg: rgba(127, 166, 214, .10);
  --c-info: #6fb8c4;      --c-info-bg: rgba(111, 184, 196, .10);
  --c-tip: #78b890;       --c-tip-bg: rgba(120, 184, 144, .10);
  --c-success: #8fc272;   --c-success-bg: rgba(143, 194, 114, .10);
  --c-warning: #d9a441;   --c-warning-bg: rgba(217, 164, 65, .11);
  --c-danger: #d8645a;    --c-danger-bg: rgba(216, 100, 90, .11);
  --c-important: #d97757; --c-important-bg: rgba(217, 119, 87, .12);
  --c-question: #a78bd0;  --c-question-bg: rgba(167, 139, 208, .10);
  --c-example: #b59ad6;   --c-example-bg: rgba(181, 154, 214, .10);
  --c-quote: #9a988f;     --c-quote-bg: rgba(154, 152, 143, .09);

  --font-serif: ui-serif, Georgia, "Times New Roman", serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 8px;
  --measure: 72ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.7;
}

a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

::selection { background: var(--accent-soft); color: var(--text); }

/* ---------- prose ---------- */
.prose { max-width: var(--measure); }

.prose h1, .prose h2, .prose h3, .prose h4 {
  font-family: var(--font-sans);
  line-height: 1.25;
  letter-spacing: -.01em;
}
.prose h2 { font-size: 1.6rem; margin: 2.6rem 0 .8rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.25rem; margin: 2rem 0 .6rem; color: var(--text); }
.prose h4 { font-size: 1.05rem; margin: 1.5rem 0 .5rem; color: var(--text-muted); }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.5rem; margin: 0 0 1rem; }
.prose li { margin: .25rem 0; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--text); font-weight: 650; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

/* ==highlight== */
mark {
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: .05em .3em;
  border-radius: 4px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ---------- code ---------- */
code, pre { font-family: var(--font-mono); }
code {
  font-size: .86em;
  background: var(--surface-2);
  padding: .12em .4em;
  border-radius: 4px;
}
pre {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: .84rem;
  line-height: 1.5;
  margin: 0 0 1.2rem;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 1.3rem; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-family: var(--font-sans); font-size: .93rem; line-height: 1.5; }
th, td { padding: .6rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); color: var(--text); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }

/* ---------- blockquote ---------- */
blockquote {
  margin: 0 0 1.2rem;
  padding: .6rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}
blockquote > :last-child { margin-bottom: 0; }

/* ---------- callouts ---------- */
.callout {
  --c: var(--c-note);
  --c-bg: var(--c-note-bg);
  margin: 0 0 1.3rem;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-left: 4px solid var(--c);
  background: var(--c-bg);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .95rem;
  line-height: 1.6;
  color: var(--text);
}
.callout-note { --c: var(--c-note); --c-bg: var(--c-note-bg); }
.callout-info { --c: var(--c-info); --c-bg: var(--c-info-bg); }
.callout-tip, .callout-hint { --c: var(--c-tip); --c-bg: var(--c-tip-bg); }
.callout-success { --c: var(--c-success); --c-bg: var(--c-success-bg); }
.callout-warning, .callout-caution { --c: var(--c-warning); --c-bg: var(--c-warning-bg); }
.callout-danger, .callout-error { --c: var(--c-danger); --c-bg: var(--c-danger-bg); }
.callout-important { --c: var(--c-important); --c-bg: var(--c-important-bg); }
.callout-question { --c: var(--c-question); --c-bg: var(--c-question-bg); }
.callout-example { --c: var(--c-example); --c-bg: var(--c-example-bg); }
.callout-quote { --c: var(--c-quote); --c-bg: var(--c-quote-bg); }

.callout-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem .95rem;
  font-weight: 650;
  color: var(--c);
  list-style: none;
}
.callout-title::-webkit-details-marker { display: none; }
.callout-title::before { content: "ℹ"; font-weight: 700; }
.callout-tip > .callout-title::before, .callout-hint > .callout-title::before { content: "✦"; }
.callout-success > .callout-title::before { content: "✓"; }
.callout-warning > .callout-title::before, .callout-caution > .callout-title::before { content: "⚠"; }
.callout-danger > .callout-title::before, .callout-error > .callout-title::before { content: "✕"; }
.callout-important > .callout-title::before { content: "!"; }
.callout-question > .callout-title::before { content: "?"; }
.callout-example > .callout-title::before { content: "◆"; }
.callout-quote > .callout-title::before { content: "❝"; }

details.callout > summary { cursor: pointer; }
details.callout > summary::after { content: "▸"; margin-left: auto; transition: transform .15s; color: var(--text-faint); }
details.callout[open] > summary::after { transform: rotate(90deg); }

.callout-body { padding: 0 .95rem .75rem; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p { margin: 0 0 .6rem; }
.callout-body ul, .callout-body ol { margin-bottom: .6rem; }
.callout-body .table-wrap { margin-bottom: .6rem; }

/* ---------- chips, links ---------- */
.chip {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: .75rem;
  padding: .12rem .6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid rgba(217, 119, 87, .3);
}

.broken-link {
  color: var(--text-faint);
  border-bottom: 1px dashed var(--text-faint);
  cursor: help;
}
.img-missing {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: .85rem;
  color: var(--text-faint);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: .4rem .8rem;
}

pre.mermaid { background: var(--surface); text-align: center; }

kbd {
  font-family: var(--font-mono);
  font-size: .8em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: .05em .4em;
}
