/* Cairnbook app */
/* Cairnbook 2: crisp white canvas, navy sidebar, one blue accent, IBM Plex. */
:root {
	--paper: #FFFFFF; --side: #F6F7F9; --raise: #FFFFFF; --hover: #F1F3F6;
	--ink: #0F1728; --ink-2: #475467; --ink-3: #667085; --line: #E4E7EC; --line-2: #D0D5DD;
	--pine: #1F5FD6; --pine-2: #1A50B8; --pine-t: #EAF1FD;
	--amber: #B54708; --amber-t: #FEF0C7; --red: #B42318; --red-t: #FEE4E2; --ok: #067647; --ok-t: #DCFAE6;
	--mark: #FFE58F;
	--nav: #0E1A2E; --nav-2: #16243B; --nav-ink: #E6EAF2; --nav-ink-2: #98A2B3; --nav-line: rgba(255,255,255,.08);
	--serif: 'IBM Plex Serif', Georgia, serif;
	--sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
	--mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
	--side-w: 272px; --ease: cubic-bezier(.2,.7,.1,1);
	color-scheme: light;
}
:root[data-theme=dark] {
	--paper: #0C1322; --side: #111A2C; --raise: #111A2C; --hover: #18233A;
	--ink: #E6EAF2; --ink-2: #B4BCCB; --ink-3: #8792A6; --line: #1F2B42; --line-2: #2C3A55;
	--pine: #6E9EFF; --pine-2: #8DB2FF; --pine-t: #16284A;
	--amber: #FDB022; --amber-t: #3A2A0B; --red: #F97066; --red-t: #3D1714; --ok: #47CD89; --ok-t: #0F2E20;
	--mark: #5C4A0C; --nav: #070D19; --nav-2: #0F182A;
	color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) {
	--paper: #0C1322; --side: #111A2C; --raise: #111A2C; --hover: #18233A;
	--ink: #E6EAF2; --ink-2: #B4BCCB; --ink-3: #8792A6; --line: #1F2B42; --line-2: #2C3A55;
	--pine: #6E9EFF; --pine-2: #8DB2FF; --pine-t: #16284A;
	--amber: #FDB022; --amber-t: #3A2A0B; --red: #F97066; --red-t: #3D1714; --ok: #47CD89; --ok-t: #0F2E20;
	--mark: #5C4A0C; --nav: #070D19; --nav-2: #0F182A; color-scheme: dark;
} }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; border-radius: 4px; }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Logo: a small cairn of three stones */
.cairn { display: inline-flex; flex-direction: column; align-items: center; gap: 1.5px; width: 16px; }
.cairn i { display: block; height: 4px; background: var(--pine); border-radius: 3px; }
.cairn i:nth-child(1) { width: 7px; } .cairn i:nth-child(2) { width: 11px; } .cairn i:nth-child(3) { width: 15px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font: 600 15px/1 var(--sans); letter-spacing: -.01em; text-decoration: none; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); border-right: 1px solid var(--line); padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 4px; }
.side__ws { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; }
.side__ws b { font-weight: 600; font-size: 14px; line-height: 1.25; }
.side__ws small { display: block; color: var(--ink-3); font-size: 12px; }
.side__search { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 7px 10px; border: 1px solid var(--line-2); background: var(--raise); border-radius: 7px; color: var(--ink-3); cursor: pointer; font-size: 13.5px; margin-bottom: 8px; }
.side__search kbd { font: 500 11px var(--sans); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 9px; border-radius: 6px; text-decoration: none; color: var(--ink-2); font-size: 14px; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item[aria-current] { background: var(--raise); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line); }
.nav-item .ct { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.side__h { font: 600 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 16px 9px 6px; display: flex; justify-content: space-between; align-items: center; }
.side__h button { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.side__h button:hover { color: var(--ink); }
.lock { font-size: 12px; color: var(--ink-3); }
.tree { list-style: none; margin: 0; padding: 0; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); margin-left: 12px; }
.tree a { display: block; padding: 4px 9px; border-radius: 5px; text-decoration: none; color: var(--ink-2); font-size: 13.5px; line-height: 1.35; }
.tree a:hover { background: var(--hover); color: var(--ink); }
.tree a[aria-current] { background: var(--pine-t); color: var(--ink); font-weight: 500; }
.side__foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.who { display: flex; align-items: center; gap: 10px; padding: 8px 9px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--pine); color: var(--paper); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.who b { display: block; font-size: 13px; font-weight: 500; }
.who small { color: var(--ink-3); font-size: 12px; text-transform: capitalize; }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 28px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span[aria-hidden] { color: var(--line-2); }
.top__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; }
.progress-bar { position: fixed; left: 0; top: 0; height: 2px; background: var(--pine); z-index: 60; width: 0; transition: width .15s linear; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--raise); cursor: pointer; font-size: 13.5px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn--primary { background: var(--pine); border-color: var(--pine); color: #fff; }
:root[data-theme=dark] .btn--primary { color: #12201C; }
.btn--primary:hover { background: var(--pine-2); border-color: var(--pine-2); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--hover); color: var(--ink); border-color: transparent; }
.btn--danger { color: var(--red); }
.btn[disabled] { opacity: .5; cursor: default; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--raise); }
.field textarea { height: auto; padding: 10px 11px; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-t); }
.err { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.note { font-size: 13px; color: var(--ink-3); }

/* Content areas */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 40px 96px; }
.wrap--wide { max-width: 1240px; }
.wrap--read { max-width: 1120px; }
.h1 { font: 500 34px/1.15 var(--serif); letter-spacing: -.015em; margin: 0 0 8px; text-wrap: balance; }
.h2 { font: 600 18px/1.3 var(--sans); margin: 0 0 12px; letter-spacing: -.005em; }
.lede { color: var(--ink-2); font-size: 16px; max-width: 62ch; margin: 0 0 24px; }
.eyebrow { font: 600 11.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: 10px; background: var(--raise); padding: 18px 20px; }
.panel h3 { font: 600 14px/1.3 var(--sans); margin: 0 0 12px; display: flex; justify-content: space-between; align-items: baseline; }
.panel h3 small { color: var(--ink-3); font-weight: 400; font-size: 12.5px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list a, .list .row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; text-decoration: none; font-size: 14px; align-items: baseline; }
.list a:hover b { text-decoration: underline; }
.list b { font-weight: 500; }
.list small { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.empty { color: var(--ink-3); font-size: 14px; padding: 6px 0; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 20px; background: var(--side); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--verified { background: var(--ok-t); color: var(--ok); }
.badge--due { background: var(--amber-t); color: var(--amber); }
.badge--expired { background: var(--red-t); color: var(--red); }
.badge--unowned, .badge--unverified { background: var(--side); color: var(--ink-3); }
.badge--lock::before { display: none; }

/* Page view */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 56px; }
.page-head { margin-bottom: 26px; }
.page-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--ink-3); }
.page-meta b { color: var(--ink-2); font-weight: 500; }
.doc { font: 400 18.5px/1.68 var(--serif); max-width: 38rem; font-variant-numeric: oldstyle-nums; hanging-punctuation: first; }
.doc > :first-child { margin-top: 0; }
.doc p { margin: 0 0 .9em; }
.doc h1, .doc h2, .doc h3 { font-family: var(--sans); letter-spacing: -.01em; line-height: 1.3; font-variant-numeric: lining-nums; scroll-margin-top: 70px; }
.doc h2 { font-size: 22px; font-weight: 600; margin: 1.8em 0 .5em; }
.doc h3 { font-size: 18px; font-weight: 600; margin: 1.5em 0 .4em; }
.doc a { color: var(--pine); text-decoration-thickness: 1px; text-underline-offset: .18em; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 1em; }
.doc li { margin-bottom: .3em; }
.doc li:has(> input[type=checkbox]) { list-style: none; margin-left: -1.3em; }
.doc input[type=checkbox] { accent-color: var(--pine); margin-right: 6px; }
.doc blockquote { margin: 1.4em 0; padding-left: 18px; border-left: 2px solid var(--line-2); color: var(--ink-2); font-style: italic; }
.doc table { width: 100%; border-collapse: collapse; margin: 1.2em 0 1.6em; font: 400 14.5px/1.45 var(--sans); font-variant-numeric: tabular-nums lining-nums; }
.doc th, .doc td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-weight: 600; border-bottom-color: var(--line-2); }
.doc code { font: 13.5px var(--mono); background: var(--side); padding: 1px 5px; border-radius: 4px; }
.doc pre { background: var(--side); padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 13.5px; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.callout { margin: 1.3em 0; padding: 12px 16px; border-radius: 8px; background: var(--pine-t); font: 400 15.5px/1.55 var(--sans); }
.callout p { margin: 0 0 .5em; } .callout p:last-child { margin: 0; }
.callout--warning { background: var(--amber-t); }
.missing-link { color: var(--red); border-bottom: 1px dashed currentColor; cursor: help; }
.side-meta { position: sticky; top: 76px; align-self: start; font-size: 13px; display: flex; flex-direction: column; gap: 22px; }
.side-meta h4 { font: 600 11.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.side-meta ol, .side-meta ul { list-style: none; margin: 0; padding: 0; }
.side-meta li a { display: block; padding: 3px 0; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.side-meta li a:hover, .side-meta li a.on { color: var(--ink); }
.side-meta li a.on { box-shadow: inset 2px 0 0 var(--pine); padding-left: 9px; }
.verify-box { border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; background: var(--raise); }
.verify-box p { margin: 6px 0 10px; color: var(--ink-2); line-height: 1.45; }
.children { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 18px; max-width: 38rem; }
.children a { display: block; padding: 8px 0; text-decoration: none; border-bottom: 1px solid var(--line); }
.children a b { font-weight: 500; display: block; }
.children a span { color: var(--ink-3); font-size: 13.5px; }
.backlinks { margin-top: 30px; max-width: 38rem; font-size: 14px; color: var(--ink-2); }
.backlinks a { color: var(--pine); margin-right: 12px; }

/* Archive */
.shelf-decade { margin-top: 36px; }
.shelf-decade h2 { font: 500 22px/1 var(--serif); margin: 0 0 16px; display: flex; gap: 12px; align-items: baseline; }
.shelf-decade h2 small { font: 400 13px var(--sans); color: var(--ink-3); }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 20px; }
.cover { text-decoration: none; display: block; }
.cover__img { aspect-ratio: 3 / 4; border-radius: 3px; background: #E8E1CF; box-shadow: 0 1px 2px rgba(40, 30, 10, .12), 0 8px 18px -8px rgba(40, 30, 10, .35); overflow: hidden; position: relative; transition: transform .35s var(--ease), box-shadow .35s; }
.cover:hover .cover__img { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(40, 30, 10, .14), 0 14px 26px -10px rgba(40, 30, 10, .4); }
.cover__img img { width: 100%; height: 100%; object-fit: cover; }
.cover__fallback { position: absolute; inset: 0; padding: 14px 12px; display: flex; flex-direction: column; justify-content: space-between; text-align: center; color: #3B2F1C; background: linear-gradient(#EFE8D6, #E4DAC2); font-family: var(--serif); }
.cover__fallback b { font-weight: 500; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.cover__fallback span { font-size: 11px; letter-spacing: .1em; font-variant-caps: all-small-caps; }
.cover p { margin: 10px 0 0; font-size: 13px; line-height: 1.35; }
.cover p small { display: block; color: var(--ink-3); font-size: 12px; }
.stats { display: flex; gap: 28px; margin: 6px 0 4px; font-size: 13.5px; color: var(--ink-2); }
.stats b { display: block; font: 500 24px/1.1 var(--serif); color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.issue-head { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; margin-bottom: 34px; }
.vol { font: 500 13px/1 var(--serif); letter-spacing: .12em; font-variant-caps: all-small-caps; color: var(--ink-3); }
.contents { max-width: 46rem; border-top: 1px solid var(--ink); }
.contents__section { font: 600 11.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 18px 0 8px; }
.contents a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.contents a b { font: 500 17px/1.35 var(--serif); }
.contents a:hover b { text-decoration: underline; text-decoration-thickness: 1px; }
.contents a .pg { font: 400 13px var(--serif); color: var(--ink-3); font-variant-numeric: oldstyle-nums; }
.contents a span { grid-column: 1 / -1; color: var(--ink-2); font-size: 13.5px; }
.lockpill { font-size: 11.5px; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 7px; margin-left: 8px; font-family: var(--sans); font-weight: 400; vertical-align: 2px; }
.reader-head { max-width: 38rem; margin-bottom: 30px; }
.reader-head .h1 { font-size: 38px; }
.byline { font: 400 17px/1.4 var(--serif); color: var(--ink-2); font-style: italic; margin: 6px 0 14px; }
.doc--article > p:first-child::first-letter { float: left; font-size: 3.7em; line-height: .86; padding: 6px 8px 0 0; font-weight: 500; }
.source { max-width: 38rem; margin-top: 40px; padding: 16px 18px; background: var(--side); border-radius: 9px; font-size: 13.5px; color: var(--ink-2); }
.source p { margin: 0 0 6px; }
.source code { font: 12.5px var(--mono); white-space: pre-wrap; word-break: break-word; }
.prevnext { max-width: 38rem; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.prevnext a { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; text-decoration: none; font-size: 13px; color: var(--ink-3); }
.prevnext a b { display: block; font: 500 15px/1.35 var(--serif); color: var(--ink); margin-top: 2px; }
.prevnext a:last-child { text-align: right; }
.gate { max-width: 38rem; padding: 22px 24px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raise); }
.gate p { margin: 0 0 14px; color: var(--ink-2); }
.hits { position: sticky; top: 60px; z-index: 15; display: inline-flex; gap: 8px; align-items: center; padding: 6px 8px 6px 14px; border-radius: 22px; background: var(--ink); color: var(--paper); font-size: 13px; margin-bottom: 20px; box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .4); }
.hits button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: inherit; cursor: pointer; }
.hits button:hover { background: rgba(255, 255, 255, .26); }
mark.cur { background: var(--pine); color: #fff; }

/* Search */
.palette-back { position: fixed; inset: 0; background: rgba(20, 18, 14, .35); z-index: 90; display: flex; justify-content: center; align-items: flex-start; padding-top: 11vh; }
.palette { width: min(680px, calc(100% - 32px)); background: var(--raise); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 17px; background: transparent; outline: none; }
.palette__body { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette__foot { display: flex; justify-content: space-between; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.hit { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.hit[aria-selected=true], .hit:hover { background: var(--hover); }
.hit__meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.hit__title { font-weight: 500; font-size: 14.5px; }
.hit__ex { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.palette__h { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 10px 12px 4px; font-weight: 600; }
.search-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
.facets h4 { font: 600 11.5px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.facets div { margin-bottom: 22px; }
.facets a { display: flex; justify-content: space-between; padding: 4px 8px; margin: 0 -8px; border-radius: 6px; text-decoration: none; font-size: 13.5px; color: var(--ink-2); }
.facets a:hover { background: var(--hover); }
.facets a[aria-current] { background: var(--pine-t); color: var(--ink); font-weight: 500; }
.facets small { color: var(--ink-3); }
.searchbar { display: flex; gap: 10px; margin-bottom: 22px; }
.searchbar input { flex: 1; height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--raise); font-size: 16px; }
.searchbar input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px var(--pine-t); }
.results .hit { padding: 14px 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.results .hit:hover { background: none; }
.results .hit:hover .hit__title { text-decoration: underline; }
.results .hit__title { font: 500 17px/1.35 var(--serif); }
.results .hit__ex { font-size: 14px; }
.didyoumean { padding: 16px 18px; background: var(--side); border-radius: 9px; margin-bottom: 16px; font-size: 14px; }
.didyoumean a { color: var(--pine); margin-right: 14px; }

/* Editor */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--raise); min-height: 64vh; }
.editor-grid textarea { width: 100%; height: 100%; min-height: 64vh; border: 0; border-right: 1px solid var(--line); resize: none; padding: 20px; font: 14px/1.65 var(--mono); background: var(--raise); outline: none; }
.editor-preview { padding: 22px 26px; overflow-y: auto; max-height: 76vh; }
.editor-title { width: 100%; border: 0; background: transparent; font: 500 32px/1.2 var(--serif); padding: 0; margin-bottom: 10px; outline: none; }
.editor-summary { width: 100%; border: 0; background: transparent; font-size: 15px; color: var(--ink-2); padding: 0; margin-bottom: 16px; outline: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--side); }
.toolbar + .editor-grid { border-radius: 0 0 10px 10px; }
.toolbar button, .toolbar select { height: 30px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.toolbar button:hover { background: var(--raise); border-color: var(--line); color: var(--ink); }
.slash { position: absolute; z-index: 40; width: 240px; background: var(--raise); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .35); padding: 4px; }
.slash button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.slash button small { display: block; color: var(--ink-3); font-size: 12px; }
.slash button[aria-selected=true], .slash button:hover { background: var(--hover); }
.savebar { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.savebar input { flex: 1; height: 34px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--raise); }

/* History */
.diff { font: 13.5px/1.6 var(--mono); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--raise); }
.diff div { padding: 1px 14px; white-space: pre-wrap; word-break: break-word; }
.diff .add { background: var(--ok-t); } .diff .add::before { content: '+ '; color: var(--ok); }
.diff .del { background: var(--red-t); text-decoration: line-through; text-decoration-color: rgba(163, 56, 43, .4); } .diff .del::before { content: '- '; color: var(--red); }
.diff .same { color: var(--ink-3); } .diff .same::before { content: '  '; }
.diff .gap { color: var(--ink-3); background: var(--side); text-align: center; font-family: var(--sans); font-size: 12px; }

/* Admin */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; background: var(--raise); padding: 16px 18px; }
.kpi small { font-size: 12.5px; color: var(--ink-3); }
.kpi b { display: block; font: 500 32px/1.1 var(--serif); margin: 4px 0 2px; font-variant-numeric: lining-nums tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--ink-2); }
.trustbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--side); margin-top: 10px; }
.trustbar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
canvas.chart { width: 100%; height: 120px; display: block; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 0 10px 8px 0; border-bottom: 1px solid var(--line-2); }
.table td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table select { height: 30px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--raise); padding: 0 6px; }
.flash { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 100; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth__box { width: min(420px, 100%); }
.auth__box .brand { margin-bottom: 26px; }
.sample { margin-top: 24px; padding: 16px 18px; border: 1px dashed var(--line-2); border-radius: 10px; }
.sample p { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); }
.sample div { display: flex; gap: 8px; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 1100px) { .page-grid { grid-template-columns: minmax(0, 1fr); } .side-meta { position: static; } .kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
	.shell { grid-template-columns: 1fr; }
	.side { position: fixed; inset: 0 auto 0 0; width: 86%; max-width: 320px; z-index: 80; transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
	.side.open { transform: none; }
	.menu-btn { display: inline-flex; }
	.top { padding: 0 16px; }
	.wrap { padding: 22px 18px 80px; }
	.grid2, .grid3, .search-layout, .issue-head { grid-template-columns: 1fr; }
	.editor-grid { grid-template-columns: 1fr; }
	.editor-preview { display: none; }
	.doc { font-size: 17.5px; }
	.h1, .reader-head .h1 { font-size: 28px; }
	.issue-head .cover { max-width: 160px; }
	.shelf { grid-template-columns: repeat(2, 1fr); }
}
.top .menu-btn { display: none; }
@media (max-width: 860px) { .top .menu-btn { display: inline-flex; } }

/* ---------- Cairnbook 2 overrides ---------- */
body { font-size: 14.5px; letter-spacing: -.003em; }
.h1 { font: 600 28px/1.2 var(--sans); letter-spacing: -.02em; }
.reader-head .h1 { font: 500 34px/1.2 var(--serif); letter-spacing: -.01em; }
.lede { font-size: 15.5px; }
.eyebrow, .side__h, .palette__h, .facets h4, .side-meta h4, .contents__section, .index__group { text-transform: none !important; letter-spacing: 0 !important; font: 500 12.5px/1.2 var(--sans) !important; color: var(--ink-3) !important; }
.vol { font: 500 12.5px/1.2 var(--sans); letter-spacing: 0; font-variant-caps: normal; color: var(--ink-3); }

/* Navy sidebar */
.side { background: var(--nav); border-right: 0; color: var(--nav-ink); }
.side .brand { color: #fff; }
.side .cairn i { background: #6E9EFF; }
.side__ws b { color: #fff; }
.side__ws small, .side__h { color: var(--nav-ink-2) !important; }
.side__ws .avatar { background: #2B3B57 !important; }
.side__search { background: var(--nav-2); border-color: var(--nav-line); color: var(--nav-ink-2); }
.side__search kbd { border-color: var(--nav-line); color: var(--nav-ink-2); }
.side .nav-item { color: #C3CBD8; }
.side .nav-item:hover { background: var(--nav-2); color: #fff; }
.side .nav-item[aria-current] { background: #1D2E4B; color: #fff; box-shadow: inset 2px 0 0 #6E9EFF; font-weight: 500; }
.side .nav-item .ct { color: var(--nav-ink-2); }
.side .tree ul { border-left-color: var(--nav-line); }
.side .tree a { color: #A9B3C4; }
.side .tree a:hover { background: var(--nav-2); color: #fff; }
.side .tree a[aria-current] { background: #1D2E4B; color: #fff; }
.side__foot { border-top-color: var(--nav-line); }
.side .who b { color: #fff; } .side .who small { color: var(--nav-ink-2); }
.side .avatar { background: #1F5FD6; color: #fff; }
.side .btn--primary { background: #1F5FD6; border-color: #1F5FD6; color: #fff; }
.side .lock { color: var(--nav-ink-2); }

/* Top bar */
.top { background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--line); height: 54px; }

/* Buttons: squarer, product-like */
.btn { border-radius: 6px; height: 34px; font-weight: 500; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.btn--primary { color: #fff; }
.btn--ghost { box-shadow: none; }

/* Panels and lists */
.panel { border-radius: 8px; padding: 16px 18px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.panel h3 { font: 600 14px/1.3 var(--sans); }
.grid3 .panel h3[style] { font: 600 16px/1.3 var(--sans) !important; }
.kpi { border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.kpi b { font: 600 28px/1.15 var(--sans); letter-spacing: -.02em; }
.stats b { font: 600 22px/1.15 var(--sans); letter-spacing: -.01em; }
.badge { border-radius: 6px; font-size: 12px; padding: 2px 7px; }

/* Wiki pages in sans; archive essays keep a serif reading face */
.doc { font: 400 15.5px/1.72 var(--sans); max-width: 44rem; font-variant-numeric: normal; }
.doc h2 { font-size: 20px; margin: 1.9em 0 .55em; }
.doc h3 { font-size: 16.5px; }
.doc blockquote { font-style: normal; }
.doc--article { font: 400 18px/1.75 var(--serif); max-width: 38rem; }
.doc--article > p:first-child::first-letter { float: none; font-size: inherit; line-height: inherit; padding: 0; font-weight: inherit; }
.byline { font: 500 15px/1.4 var(--sans); font-style: normal; color: var(--ink-2); }
.callout { border-radius: 6px; border-left: 3px solid var(--pine); background: var(--pine-t); font-size: 14.5px; }
.callout--warning { border-left-color: var(--amber); background: var(--amber-t); }
.children a b, .prevnext a b { font-family: var(--sans); font-weight: 500; font-size: 15px; }

/* Archive: keep the covers, make the frame product-like */
.shelf-decade h2 { font: 600 18px/1 var(--sans); letter-spacing: -.01em; }
.contents { border-top: 1px solid var(--line-2); }
.contents a b { font: 500 16px/1.35 var(--sans); }
.contents a .pg { font: 400 13px var(--mono); }
.cover__img { border-radius: 4px; box-shadow: 0 1px 2px rgba(16, 24, 40, .1), 0 8px 16px -8px rgba(16, 24, 40, .25); }

/* Search */
.palette { border-radius: 10px; }
.palette input { font-size: 16px; }
.results .hit__title { font: 600 16px/1.35 var(--sans); }
.hit__title { font-weight: 600; }
.searchbar input { border-radius: 8px; height: 42px; font-size: 15px; }

/* Editor */
.editor-title { font: 600 28px/1.2 var(--sans); letter-spacing: -.02em; }
.editor-grid, .toolbar { border-radius: 8px; }

/* Auth */
.auth { background: var(--side); }
.auth__box { background: var(--raise); border: 1px solid var(--line); border-radius: 12px; padding: 32px 30px; box-shadow: 0 12px 32px -16px rgba(16, 24, 40, .18); }
.auth .brand { color: var(--ink); }
