/* Delacroix manual. No scripts, no inline styles, system fonts only. */

:root {
  --bg: #fdfcfa;
  --bg-soft: #f4f2ee;
  --text: #1d1c1a;
  --muted: #64605a;
  --rule: #e2ded7;
  --link: #9a3412;
  --link-hover: #7c2d12;
  --accent: #c2410c;
  --code-bg: #f1eee8;
  --callout-bg: #fbf4ec;
  --measure: 70ch;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18171a;
    --bg-soft: #212024;
    --text: #e9e6e1;
    --muted: #a39e96;
    --rule: #34323a;
    --link: #fdba74;
    --link-hover: #fed7aa;
    --accent: #fb923c;
    --code-bg: #26252a;
    --callout-bg: #2a2420;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 0.5rem; background: var(--bg); padding: 0.25rem 0.5rem; }

/* header */
.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 0.75rem 1.5rem;
  background: var(--bg-soft);
}
.site-name { margin: 0; font-size: 0.95rem; font-weight: 600; }
.site-name a { color: var(--text); text-decoration: none; }
.site-name .version { color: var(--muted); font-weight: 400; }

/* layout */
.layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.sidebar { font-size: 0.9rem; }
.sidebar-inner { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow-y: auto; }
.page-toc { margin-top: 2rem; }
.nav-heading {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sidebar ul, .mobile-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a, .mobile-nav li a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid transparent;
  color: var(--text);
  text-decoration: none;
}
.sidebar li a:hover, .mobile-nav li a:hover { color: var(--link); }
.sidebar li a.current, .mobile-nav li a.current {
  border-left-color: var(--accent);
  color: var(--link);
  font-weight: 600;
}
.page-toc li a { color: var(--muted); padding-top: 0.2rem; padding-bottom: 0.2rem; }

.mobile-nav { display: none; }

main { max-width: var(--measure); min-width: 0; }

/* text */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 650; scroll-margin-top: 1rem; }
h1 { font-size: 2.1rem; margin: 0 0 1.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; margin: 2.75rem 0 0.75rem; padding-top: 0.25rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
h4 { font-size: 1rem; margin: 1.5rem 0 0.4rem; }
p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: 0.25rem 0; }
li > ul, li > ol { margin: 0.25rem 0 0.5rem; }
strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

code, kbd, pre {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}
code {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.35;
}
pre code { background: none; padding: 0; font-size: 0.85em; }

img { max-width: 100%; height: auto; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.93rem; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.45rem 0.75rem 0.45rem 0; text-align: left; vertical-align: top; }
th { font-weight: 600; border-bottom-width: 2px; }
.align-center { text-align: center; }
.align-right { text-align: right; }
.align-left { text-align: left; }

/* callouts and quotes */
blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}
blockquote.callout { background: var(--callout-bg); border-left-color: var(--accent); color: var(--text); border-radius: 0 6px 6px 0; }
blockquote p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 650; margin-bottom: 0.35rem; }

/* previous / next */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
.pager a { text-decoration: none; font-weight: 600; }
.pager a span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.pager .next { margin-left: auto; text-align: right; }

.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem 1.5rem 2rem;
  text-align: center;
}

/* phone width: the sidebar folds into a Contents disclosure */
@media (max-width: 52rem) {
  body { font-size: 16px; }
  .layout { display: block; padding: 1.25rem 16px 2rem; }
  .sidebar { display: none; }
  .site-header { padding: 0.65rem 16px; }
  .mobile-nav {
    display: block;
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem 16px;
  }
  .mobile-nav summary { cursor: pointer; font-weight: 600; padding: 0.25rem 0; }
  .mobile-nav nav { padding: 0.5rem 0; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.3rem; }
}

@media print {
  .sidebar, .mobile-nav, .pager, .skip { display: none; }
  .layout { display: block; }
}
