/* continuousengineering.press: Direction A, Editorial. Copper is the cover's #c8763a; darker copper for text on paper. One stylesheet, fonts self-hosted from /fonts, no external requests.
   Contrast pairs are checked by tests/check_site.py. */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/SourceSerif4-Regular.ttf") format("truetype"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/SourceSerif4-It.ttf") format("truetype"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/SourceSerif4-Semibold.ttf") format("truetype"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/SourceSerif4-Bold.ttf") format("truetype"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/SourceSans3-Regular.ttf") format("truetype"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/SourceSans3-Semibold.ttf") format("truetype"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/SourceSans3-Bold.ttf") format("truetype"); }
:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f0ece2;
  --text: #1c1b19;
  --muted: #55524c;
  --border: #7a756a;
  --rule: #d9d4c7;
  --accent: #0a0a0a;
  --accent-text: #f4f1ea;
  --accent-hover: #944a1b;
  --accent-hover-text: #ffffff;
  --link: #944a1b;
  --focus: #944a1b;
  --black: #0a0a0a;
  --on-black: #f4f1ea;
  --orange: #c8763a;
  --danger: #9b1c1c;
  --danger-bg: #fdecec;
  --ok: #17603a;
  --ok-bg: #e8f5ec;
  --todo-bg: #fff4c2;
  --todo-text: #4a3b00;
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0d0b;
    --surface: #1a1915;
    --surface-2: #24221b;
    --text: #efede7;
    --muted: #b9b5aa;
    --border: #8a8578;
    --rule: #3a372e;
    --accent: #c8763a;
    --accent-text: #0a0a0a;
    --accent-hover: #e0a070;
    --accent-hover-text: #0a0a0a;
    --link: #e0a070;
    --focus: #e0a070;
    --danger: #ff9b9b;
    --danger-bg: #3a1717;
    --ok: #7fd9a1;
    --ok-bg: #12301f;
    --todo-bg: #4a3b00;
    --todo-text: #ffe9a0;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--serif); font-size: 1.125rem; line-height: 1.65; }
.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 1rem; }
.measure { max-width: 42rem; }
main { padding: 2.5rem 0 3rem; }
main:focus { outline: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.18; margin: 2.25rem 0 0.75rem; }
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); margin-top: 0; }
h2 { font-size: clamp(1.5rem, 4vw, 1.9rem); }
h3 { font-size: 1.25rem; }
p, ul, ol, table, dl { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: 0.35rem; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 0.15em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
.lede { font-size: 1.3rem; max-width: 40rem; }
.muted { color: var(--muted); }
.eyebrow { font-family: var(--sans); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.skip-link { position: absolute; left: 0.5rem; top: -4rem; background: var(--accent); color: var(--accent-text); padding: 0.75rem 1rem; z-index: 10; }
.skip-link:focus { top: 0.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* masthead and footer: near-black in both themes, orange rule */
.site-header { background: var(--black); color: var(--on-black); border-bottom: 4px solid var(--orange); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1.5rem; padding-top: 0.75rem; padding-bottom: 0.7rem; }
.wordmark { display: inline-block; color: var(--on-black); text-decoration: none; padding: 0.3rem 0; line-height: 1.1; }
.wm-top { display: block; color: var(--orange); font-family: var(--sans); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; }
.wm-main { display: block; font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.site-header :focus-visible { outline-color: var(--orange); }
.nav-list { display: flex; flex-wrap: wrap; gap: 0 0.25rem; list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 0; }
.nav-list a { display: inline-block; padding: 0.6rem 0.6rem; min-height: 2.75rem; color: var(--on-black); font-family: var(--sans); text-decoration: none; }
.nav-list a:hover { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 0.15em; }
.nav-list a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 0.15em; font-weight: 600; }
.site-footer { border-top: 1px solid var(--rule); padding: 1.5rem 0 2.5rem; color: var(--muted); font-family: var(--sans); font-size: 1rem; }
.site-footer a { color: var(--link); }

/* buttons */
.btn { display: inline-block; min-height: 2.75rem; padding: 0.7rem 1.3rem; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-text); font-family: var(--sans); font-size: 1rem; font-weight: 600; text-decoration: none; border-radius: 0.3rem; cursor: pointer; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-hover-text); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--text); }
.btn-secondary:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-disabled { border-style: dashed; background: transparent; color: var(--muted); border-color: var(--border); cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.25rem 0; }
.todo { display: inline-block; background: var(--todo-bg); color: var(--todo-text); padding: 0.1rem 0.5rem; border-radius: 0.25rem; font-size: 0.9rem; font-weight: 600; }

/* cover: the real front cover image, or a typographic stand-in when a book has none */
.cover { display: block; width: 100%; max-width: 15rem; height: auto; border: 0; box-shadow: 0 1px 0 var(--rule), 0 8px 24px rgba(0, 0, 0, 0.18); }
.cover-sm { max-width: 6rem; }
.cover-text { aspect-ratio: 2 / 3; background: var(--black); color: var(--on-black); border-left: 6px solid var(--orange); padding: 0.9rem 0.8rem; display: flex; flex-direction: column; justify-content: space-between; font-family: var(--serif); }
.cover-title { font-size: 1.1rem; line-height: 1.1; font-weight: 700; overflow-wrap: anywhere; }
.cover-author { font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange); }
.cover-sm .cover-title { font-size: 0.8rem; }
.cover-sm .cover-author { font-size: 0.55rem; }

/* home: statement, featured book, catalog */
.hero-statement { padding: 0.5rem 0 1.5rem; }
.hero-statement h1 { max-width: 18ch; }
.feature { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: center; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 2.5rem 0; margin: 1rem 0 0; }
.feature h2 { margin-top: 0; }
.feature .subtitle { margin-bottom: 1rem; }
.book-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
.book-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.4rem; padding: 1.25rem; display: grid; gap: 1rem; grid-template-columns: 6rem 1fr; align-items: start; margin: 0; }
.book-card h3 { margin: 0 0 0.25rem; }
.book-card h3 a { color: var(--text); text-decoration: none; }
.book-card h3 a:hover { text-decoration: underline; }
.badge { display: inline-block; font-family: var(--sans); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.45rem; margin: 0 0 0.5rem; }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 1rem; font-family: var(--sans); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.5rem 1fr; gap: 0.75rem; margin: 0; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 2px solid var(--text); border-radius: 50%; font-weight: 700; color: var(--text); }

/* book page */
.book-hero { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: start; padding-bottom: 1rem; }
.subtitle { font-family: var(--serif); font-size: 1.35rem; color: var(--muted); margin: 0 0 1rem; }
.meta { font-family: var(--sans); display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1.25rem; margin: 1.25rem 0; max-width: 28rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.pull-quote { margin: 2.5rem 0; padding: 2rem 1rem; border-top: 4px solid var(--book-accent, var(--orange)); border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.pull-quote p { font-family: var(--serif); font-size: clamp(1.5rem, 4.5vw, 2.4rem); line-height: 1.25; margin: 0 auto; max-width: 44rem; }
.bento { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1rem 0 2rem; }
.bento > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.4rem; padding: 1.1rem; }
.bento .bento-lead { background: var(--surface-2); }
.bento h3 { margin: 0 0 0.35rem; font-family: var(--sans); font-size: 1.15rem; }
.bento p { margin: 0; }
.excerpt { border-left: 4px solid var(--book-accent, var(--orange)); padding-left: 1.25rem; margin: 2rem 0; max-width: 42rem; }
.excerpt p { font-style: italic; }
.excerpt .source { font-family: var(--sans); font-style: normal; color: var(--muted); font-size: 1rem; }
.closing-line { font-family: var(--serif); font-size: 1.4rem; max-width: 36rem; border-left: 4px solid var(--book-accent, var(--orange)); padding-left: 1rem; margin: 2rem 0; }
.aside-note { background: var(--surface-2); border-radius: 0.4rem; padding: 1rem 1.25rem; max-width: 42rem; font-family: var(--sans); }
.channel-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; max-width: 42rem; }
.channel-list li { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.4rem; padding: 0.9rem 1.1rem; margin: 0; }
.channel-list a { font-family: var(--sans); font-weight: 600; }

/* tables */
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
caption { text-align: left; font-weight: 600; padding-bottom: 0.5rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border: 1px solid var(--rule); }
thead th { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }

/* discussion */
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1rem 0 1.5rem; }
.tabs li { margin: 0; }
.tabs a { display: inline-block; min-height: 2.75rem; padding: 0.6rem 1rem; border: 2px solid var(--border); border-radius: 0.4rem; color: var(--text); text-decoration: none; background: var(--surface); }
.tabs a[aria-current="page"] { border-color: var(--accent); background: var(--surface-2); font-weight: 700; }
.posts { list-style: none; padding: 0; display: grid; gap: 1rem; max-width: 44rem; }
.post { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.5rem; padding: 1rem 1.1rem; margin: 0; }
.post-head, .admin-meta { overflow-wrap: anywhere; }
.post-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; margin: 0 0 0.5rem; font-size: 1rem; }
.post-author { font-weight: 700; }
.post-badge { font-size: 0.85rem; border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.4rem; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 0.75rem; }
.post-actions { margin: 0; }
summary { min-height: 2.75rem; padding: 0.5rem 0; cursor: pointer; }
.flag-count { display: inline-block; background: var(--todo-bg); color: var(--todo-text); padding: 0.1rem 0.5rem; border-radius: 0.25rem; font-size: 0.9rem; font-weight: 600; }
.danger-zone { margin-top: 0.75rem; }
.danger-zone summary { color: var(--danger); }
.link-button { background: none; border: none; padding: 0.5rem 0; min-height: 2.75rem; color: var(--link); font: inherit; text-decoration: underline; cursor: pointer; }
.notice { border-left: 5px solid var(--ok); background: var(--ok-bg); padding: 0.75rem 1rem; max-width: 44rem; margin: 1rem 0; }
.notice.error { border-left-color: var(--danger); background: var(--danger-bg); }
form.stack { display: grid; gap: 1rem; max-width: 44rem; }
label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.hint { font-size: 0.95rem; color: var(--muted); margin: 0.25rem 0 0; font-weight: 400; }
input[type="text"], textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 0.4rem; padding: 0.6rem 0.75rem; min-height: 2.75rem; }
textarea { min-height: 9rem; resize: vertical; }
.pager { display: flex; gap: 1rem; margin: 1.5rem 0; }

/* admin */
.admin-post { border-top: 1px solid var(--rule); padding: 1rem 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.admin-actions form { margin: 0; }
.btn-small { min-height: 2.75rem; padding: 0.45rem 0.9rem; font-size: 1rem; }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); text-decoration: underline; }

/* utility and discussion text uses the sans */
label, input, textarea, select, table, summary, .hint, .notice, .tabs, .pager, .post, .admin-post, .link-button, .btn-small { font-family: var(--sans); }

@media (min-width: 40rem) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento .bento-lead { grid-column: 1 / -1; }
}
@media (min-width: 52rem) {
  .feature { grid-template-columns: 15rem 1fr; gap: 3rem; }
  .book-hero { grid-template-columns: 15rem 1fr; gap: 3rem; }
  .bento { grid-template-columns: 2fr 1fr 1fr; }
  .bento .bento-lead { grid-column: 1; grid-row: 1 / span 2; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .btn, .tabs a, .post, .book-card, .channel-list li { border: 2px solid CanvasText; }
  .cover { border: 2px solid CanvasText; }
  .site-header { border-bottom-color: CanvasText; }
}
@media print {
  .site-header, .site-footer, .skip-link, form { display: none; }
  body { background: #fff; color: #000; }
}
