/* Shared foundation for the network themes (Oddly Profitable, Shelf Rabbit, The Cart Plot).
   Each theme stylesheet sets the variables below and adds its own layouts. */
:root {
  --bg: #fff; --card: #fff; --ink: #111; --ink-2: #333; --muted: #666; --rule: #ddd; --accent: #333; --accent-ink: #222; --tint: #f3f3f3;
  --display: Georgia, serif; --text: system-ui, sans-serif; --ui: system-ui, sans-serif;
  --wrap: 1200px; --gutter: clamp(16px, 3.2vw, 36px); --radius: 0px; --measure: 68ch;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--text); font-size: 17px; line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
figure { margin: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 20; font-family: var(--ui); }
.skip:focus { left: 8px; }
main { display: block; min-height: 50vh; }

/* Preview banner (admin previews only) */
.preview-banner { background: #2b2b2b; color: #fff; font: 14px/1.4 var(--ui); padding: 10px 0; }
.preview-banner .wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.preview-banner a { color: #fff; font-weight: 600; }

/* Common bits */
.headline { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
.headline a { text-decoration: none; }
.headline a:hover { text-decoration: underline; text-decoration-thickness: 2px; color: inherit; }
.dek { color: var(--ink-2); margin: 0.4em 0 0; }
.meta { font: 13px/1.4 var(--ui); color: var(--muted); margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.kicker { font: 600 12px/1.3 var(--ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); text-decoration: none; }
.kicker-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.format { font: 600 11px/1 var(--ui); letter-spacing: 0.05em; text-transform: uppercase; padding: 4px 6px; border: 1px solid currentColor; border-radius: var(--radius); color: var(--muted); }
.sample-tag { background: var(--tint); padding: 1px 6px; }
.media img { width: 100%; background: var(--tint); border-radius: var(--radius); }
.notice { font-family: var(--ui); color: var(--ink-2); }
.notice.tight { margin-bottom: 8px; }
.spaced { margin-top: 24px; }
.errmsg { white-space: pre-wrap; font-size: 13px; background: var(--tint); padding: 10px; }

/* Search form (header and pages) */
.search-form { display: flex; align-items: center; border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius); }
.search-form input { border: 0; background: transparent; font: 15px var(--ui); padding: 8px 10px; width: 100%; min-width: 0; color: var(--ink); }
.search-form input:focus { outline: none; }
.search-form:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.search-form button { border: 0; background: transparent; padding: 8px 10px; color: var(--ink); cursor: pointer; display: flex; }
.search-form svg { width: 18px; height: 18px; }
.search-page-form { display: flex; gap: 8px; max-width: 560px; margin-top: 14px; }
.search-page-form input { flex: 1; min-width: 0; font: 16px var(--ui); padding: 11px 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); color: var(--ink); }
.search-page-form button, .button { font: 600 15px var(--ui); padding: 11px 18px; border: 0; background: var(--accent); color: #fff; border-radius: var(--radius); cursor: pointer; text-decoration: none; display: inline-block; }

/* Page heads, lists, pagination */
.page-head { padding: clamp(24px, 5vw, 48px) 0 18px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.page-head h1 { font-family: var(--display); font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0; }
.page-head p { color: var(--ink-2); margin: 10px 0 0; max-width: 60ch; }
.river { list-style: none; margin: 0; padding: 0; }
.river li { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.river .headline { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 26px 0 40px; font: 15px var(--ui); }
.pagination a { font-weight: 600; color: var(--accent-ink); }
.pagination .off { color: var(--muted); opacity: 0.6; }

/* Static pages and 404 */
.static { padding-bottom: 56px; }
.static .prose { max-width: var(--measure); }
.notfound { padding: clamp(32px, 7vw, 80px) 0; max-width: 680px; }
.notfound h1 { font-family: var(--display); font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; margin: 0 0 12px; }
.notfound ul { padding-left: 20px; }
.notfound li { margin: 6px 0; }

/* Article body */
.prose { font-size: 1.06rem; }
.prose > * + * { margin-top: 1.05em; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose > * + p, .prose > * + ul, .prose > * + ol { margin-top: 1em; }
.prose h2 { font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 1.75rem); line-height: 1.2; margin: 1.8em 0 0.4em; scroll-margin-top: 20px; }
.prose h3 { font-family: var(--display); font-size: 1.2rem; margin: 1.4em 0 0.3em; }
.prose li { margin: 0.35em 0; }
.prose a { color: var(--accent-ink); }
.prose blockquote { margin: 1.4em 0; padding-left: 18px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.inline-figure { margin: 1.8em 0; }
.inline-figure img { width: 100%; border-radius: var(--radius); background: var(--tint); }
.inline-figure figcaption, .hero figcaption { font: 13px/1.45 var(--ui); color: var(--muted); margin-top: 8px; }
.kind-screenshot img { border: 1px solid var(--rule); }
.credit { opacity: 0.85; }
.table-wrap { overflow-x: auto; margin: 1.6em 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.table-wrap table { border-collapse: collapse; width: 100%; font: 14.5px/1.45 var(--ui); min-width: 520px; }
.table-wrap th, .table-wrap td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table-wrap th { background: var(--tint); font-weight: 600; }
.table-wrap tr:last-child td { border-bottom: 0; }
.cite { font: 600 0.68em/1 var(--ui); margin-left: 1px; }
.cite a { text-decoration: none; color: var(--accent-ink); padding: 0 1px; }
.cite .sep { opacity: 0.6; }
.key-points h2, .faq > h2, .sources h2, .toc h2 { font-family: var(--ui); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 10px; color: var(--muted); }
.key-points ul { margin: 0; padding-left: 18px; }
.key-points li { margin: 6px 0; }
.faq { margin-top: 40px; }
.faq .qa { padding: 14px 0; border-top: 1px solid var(--rule); }
.faq h3 { font-family: var(--display); font-size: 1.1rem; margin: 0 0 4px; }
.faq p { margin: 0; }
.disclosure { font: 14px/1.5 var(--ui); color: var(--ink-2); background: var(--tint); padding: 12px 14px; border-radius: var(--radius); margin: 28px 0 0; }
.disclosure.relationship { border-left: 4px solid var(--accent); margin: 16px 0 0; }
.sample-note { font: 14px var(--ui); background: var(--tint); padding: 10px 12px; }
.sources { margin-top: 36px; padding-top: 20px; border-top: 2px solid var(--ink); font: 14px/1.5 var(--ui); }
.sources ol { padding-left: 22px; margin: 0; }
.sources li { margin: 8px 0; }
.sources li:target { background: var(--tint); }
.sources .src-meta { display: block; color: var(--muted); }
.primary-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-ink); }
.byline { font: 14px/1.5 var(--ui); color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 14px; }
.byline strong { color: var(--ink); }
.toc ol { margin: 0; padding-left: 18px; font: 14px/1.4 var(--ui); }
.toc li { margin: 7px 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Footer */
.site-footer { margin-top: 56px; padding: 36px 0 44px; font: 14px/1.6 var(--ui); }
.foot-links, .foot-social { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot-social { margin-top: 10px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer .fine { margin: 18px 0 0; opacity: 0.8; max-width: 70ch; }

@media (max-width: 720px) {
  body { font-size: 16.5px; }
  .river li { grid-template-columns: minmax(0, 1fr) 104px; gap: 14px; padding: 16px 0; }
  .river .dek { display: none; }
  .search-page-form { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .site-header, .site-footer, .toc, .search-form, .related { display: none !important; } }
