/* continuousengineering.press: the press inside the Continuous Engineering family. Indigo and amber are the accents continuous.engineering uses; each book keeps its own cover colour (--book-accent). 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;
  /* colour */
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f0ece2;
  --text: #1c1b19;
  --muted: #55524c;
  --border: #7a756a;
  --rule: #d9d4c7;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --accent-hover: #4338ca;
  --accent-hover-text: #ffffff;
  --link: #4338ca;
  --focus: #4338ca;
  --black: #0a0a0a;
  --on-black: #f4f1ea;
  --orange: #f59e0b;
  --deco: #b45309;
  --danger: #9b1c1c;
  --danger-bg: #fdecec;
  --ok: #17603a;
  --ok-bg: #e8f5ec;
  --todo-bg: #fff4c2;
  --todo-text: #4a3b00;
  /* type */
  --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;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lead: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
  --fs-h3: 1.2rem;
  --fs-h2: clamp(1.45rem, 1.2rem + 1.2vw, 1.9rem);
  --fs-h1: clamp(2rem, 1.5rem + 2.6vw, 3.3rem);
  --lh: 1.6;
  --measure: 40rem;
  /* space: a 4 and 8 point scale, in rem */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --gutter: 1rem;
  --card-pad: 1rem;
  /* shape and touch */
  --tap: 2.75rem;
  --radius-s: 0.3rem;
  --radius: 0.5rem;
  --radius-l: 0.8rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0d0b;
    --surface: #1a1915;
    --surface-2: #24221b;
    --text: #efede7;
    --muted: #b9b5aa;
    --border: #8a8578;
    --rule: #3a372e;
    --accent: #818cf8;
    --accent-text: #0a0a0a;
    --accent-hover: #a5b4fc;
    --accent-hover-text: #0a0a0a;
    --link: #a5b4fc;
    --focus: #a5b4fc;
    --deco: #f59e0b;
    --danger: #ff9b9b;
    --danger-bg: #3a1717;
    --ok: #7fd9a1;
    --ok-bg: #12301f;
    --todo-bg: #4a3b00;
    --todo-text: #ffe9a0;
  }
}
@media (min-width: 40rem) {
  :root { --gutter: 1.5rem; --card-pad: 1.25rem; --fs-base: 1.125rem; }
}

/* base: phone first, one rhythm */
*, *::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: var(--fs-base); line-height: var(--lh); overflow-wrap: break-word; }
img { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: var(--measure); }
main { padding: var(--sp-5) 0 var(--sp-7); }
main:focus { outline: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; text-wrap: balance; }
h1 { font-size: var(--fs-h1); margin: 0 0 var(--sp-4); }
h2 { font-size: var(--fs-h2); margin: var(--sp-7) 0 var(--sp-3); }
h3 { font-size: var(--fs-h3); margin: var(--sp-5) 0 var(--sp-2); }
p, ul, ol, table, dl { margin: 0 0 var(--sp-4); }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: var(--sp-1); }
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: var(--fs-lead); max-width: var(--measure); line-height: 1.5; }
.muted { color: var(--muted); }
.email-text { font-family: var(--sans); font-size: 1.35rem; font-weight: 600; overflow-wrap: anywhere; user-select: all; }
.eyebrow { font-family: var(--sans); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--sp-2); }
.skip-link { position: absolute; left: var(--sp-2); top: -4rem; background: var(--accent); color: var(--accent-text); padding: var(--sp-3) var(--sp-4); z-index: 20; }
.skip-link:focus { top: var(--sp-2); }
.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; }
.subtitle { font-family: var(--serif); font-size: var(--fs-lead); color: var(--muted); margin: 0 0 var(--sp-4); line-height: 1.35; }

/* grid children may shrink below their content, so no column can force the page wider */
.home-hero-grid > *, .book-hero > *, .ce-hero > *, .cta-band > *, .footer-grid > *, .book-card > *, .book-card-lg > *, .toc-grid > *, .bento > * { min-width: 0; }

/* one card system: surface, hairline, radius, padding */
.book-card, .book-card-lg, .bento > div, .channel-list li, .post, .toc-group, .ce-services > div, .resource-card, .aside-note, .author-note { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--card-pad); margin: 0; }
.bento .bento-lead, .resource-card, .aside-note, .author-note { background: var(--surface-2); }

/* one button system: 44px tall, full width on a phone, side by side from 30rem */
.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 2.75rem; padding: var(--sp-2) var(--sp-5); border: 2px solid var(--accent); background: var(--accent); color: var(--accent-text); font-family: var(--sans); font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none; border-radius: var(--radius-s); cursor: pointer; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-hover-text); }
.btn:active { transform: translateY(1px); }
.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: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); margin: var(--sp-5) 0; }
.btn-row .btn { width: 100%; }
.todo { display: inline-block; background: var(--todo-bg); color: var(--todo-text); padding: 0.1rem 0.5rem; border-radius: var(--radius-s); font-size: var(--fs-sm); font-weight: 600; }
.badge { display: inline-block; font-family: var(--sans); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0 0.45rem; margin: 0 0 var(--sp-2); }

/* masthead: near-black in both themes, amber rule; the menu is a details element, no script */
.site-header { position: relative; background: var(--black); color: var(--on-black); border-bottom: 3px solid var(--orange); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.wordmark { display: inline-block; color: var(--on-black); text-decoration: none; padding: var(--sp-1) 0; line-height: 1.1; }
.wm-top { display: block; color: var(--orange); font-family: var(--sans); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.wm-main { display: block; font-family: var(--serif); font-size: 1.35rem; font-weight: 700; }
.site-header :focus-visible { outline-color: var(--orange); }
.nav-list { display: none; list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 0; }
.nav-list a { display: inline-flex; align-items: center; padding: 0 0.7rem; min-height: var(--tap); 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.nav-quiet { font-size: 0.9rem; }
.nav-list a.nav-quiet { border-left: 1px solid #6b665c; margin-left: var(--sp-2); padding-left: var(--sp-4); }
.nav-list a[aria-current="page"], .nav-stack a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 0.15em; font-weight: 600; }
.nav-menu summary { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4); border: 1px solid #6b665c; border-radius: var(--radius-s); color: var(--on-black); font-family: var(--sans); font-weight: 600; cursor: pointer; list-style: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: ""; width: 0.5rem; height: 0.5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.nav-menu[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.nav-stack { position: absolute; left: 0; right: 0; top: 100%; z-index: 15; list-style: none; margin: 0; padding: 0 var(--gutter) var(--sp-3); background: var(--black); border-bottom: 3px solid var(--orange); }
.nav-stack li { margin: 0; border-top: 1px solid #2a2823; }
.nav-stack a { display: flex; align-items: center; min-height: 3rem; color: var(--on-black); font-family: var(--sans); font-size: 1.1rem; text-decoration: none; }

/* footer */
.site-footer { border-top: 1px solid var(--rule); padding: var(--sp-6) 0 var(--sp-7); color: var(--muted); font-family: var(--sans); font-size: var(--fs-sm); }
.site-footer a { color: var(--link); }
.footer-brand { display: flex; align-items: center; gap: var(--sp-3); color: var(--text); font-weight: 600; margin: 0 0 var(--sp-3); }
.footer-brand img { flex: none; }
.footer-brand a { display: inline-flex; align-items: center; min-height: var(--tap); }
.footer-head { font-weight: 700; color: var(--text); margin: 0 0 var(--sp-1); }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-4); }
.footer-note { margin: 0 0 var(--sp-3); }
.footer-grid { display: none; }
.footer-more { margin-top: var(--sp-2); }
.footer-more summary { display: inline-flex; align-items: center; font-weight: 600; color: var(--link); }
.footer-more nav { margin-top: var(--sp-3); }
/* the content diet: secondary blocks that are not the page's job stay off a phone; all of it shows from 40rem */
@media (max-width: 39.99rem) {
  .phone-hide, .card-quote, .channel-list .muted, .excerpt.sample ~ .excerpt.sample { display: none; }
}
.footer-list li { margin: 0; }
.footer-list a { display: flex; align-items: center; min-height: var(--tap); }

/* 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 0 0 1px var(--border), 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: var(--sp-3); 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: dark full-bleed hero (cover between headline and the book's buttons on a phone), large cards, call-to-action band */
.home-hero { background: var(--black); color: var(--on-black); border-bottom: 3px solid var(--orange); margin-top: calc(-1 * var(--sp-5)); padding: var(--sp-6) 0 var(--sp-6); }
.home-hero-grid { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "cover" "feature"; align-items: start; }
.home-hero-intro { grid-area: intro; }
.home-hero-cover { grid-area: cover; justify-self: center; display: block; width: 62%; max-width: 13rem; }
.home-hero-cover .cover { max-width: 100%; box-shadow: 0 0 0 1px #8a8578, 0 14px 40px rgba(245, 158, 11, 0.22); }
.feature-copy { grid-area: feature; }
.home-hero .eyebrow { color: var(--orange); }
.home-hero h1 { color: var(--on-black); max-width: 15ch; }
.home-hero .lede { color: var(--on-black); margin-bottom: 0; }
.home-hero h2 { color: var(--on-black); margin: 0 0 var(--sp-2); }
.home-hero .subtitle { color: #d9d4c7; }
.feature-quote { font-size: 1.3rem; line-height: 1.3; max-width: 30rem; }
.home-hero .btn { background: var(--orange); border-color: var(--orange); color: #0a0a0a; }
.home-hero .btn:hover { background: #fbbf24; border-color: #fbbf24; color: #0a0a0a; }
.home-hero .btn-secondary { background: transparent; border-color: var(--on-black); color: var(--on-black); }
.home-hero .btn-secondary:hover { background: var(--on-black); color: #0a0a0a; }
.home-hero a:focus-visible { outline-color: var(--orange); }
.book-lg-grid, .book-grid { list-style: none; padding: 0; margin: 0 0 var(--sp-6); display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
.book-card-lg { display: grid; gap: var(--sp-4); grid-template-columns: 6rem minmax(0, 1fr); align-items: start; border-top: 4px solid var(--deco); }
.book-card { display: grid; gap: var(--sp-4); grid-template-columns: 5rem minmax(0, 1fr); align-items: start; }
.book-card h3, .book-card-lg h3 { margin: 0; }
.book-card h3 a, .book-card-lg h3 a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--text); text-decoration: none; }
.book-card h3 a:hover, .book-card-lg h3 a:hover { text-decoration: underline; }
.card-cover { display: block; }
.card-cover .cover { max-width: 100%; }
.card-quote { font-style: italic; margin: var(--sp-2) 0; }
.card-links { font-family: var(--sans); font-size: 1rem; margin: var(--sp-2) 0 0; }
.card-links a { display: inline-flex; align-items: center; min-height: var(--tap); }
.cta-band { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); background: #15151f; color: #f4f1ea; border-radius: var(--radius-l); border-left: 6px solid var(--accent); padding: var(--sp-5) var(--sp-4); margin: var(--sp-7) 0; }
.cta-band img { width: 3.5rem; height: 3.5rem; }
.cta-band .eyebrow { color: #f59e0b; }
.cta-band h2 { color: #f4f1ea; margin: 0 0 var(--sp-2); }
.cta-band p { font-family: var(--sans); }
.cta-band .btn { background: #f59e0b; border-color: #f59e0b; color: #0a0a0a; }
.cta-band .btn:hover { background: #fbbf24; border-color: #fbbf24; }
.cta-band .btn-secondary { background: transparent; border-color: #f4f1ea; color: #f4f1ea; }
.cta-band .btn-secondary:hover { background: #f4f1ea; color: #15151f; }
.cta-band :focus-visible { outline-color: #f59e0b; }
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: var(--sp-4); font-family: var(--sans); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--sp-3); margin: 0; }
.steps li a { display: flex; align-items: center; min-height: var(--tap); }
.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: cover, then title, buy or status, then the facts */
.book-hero { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); align-items: start; padding-bottom: var(--sp-2); }
.book-hero > .cover, .book-hero > img { justify-self: center; max-width: 9.5rem; }
.book-info { display: flex; flex-direction: column; }
.book-info .btn-row { order: 2; margin-top: var(--sp-2); }
.book-info .muted { order: 3; }
.book-info .meta { order: 4; }
.meta { font-family: var(--sans); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-1) var(--sp-4); margin: var(--sp-4) 0; max-width: 28rem; font-size: var(--fs-sm); }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.pull-quote { margin: var(--sp-6) 0; padding: var(--sp-5) 0; border-top: 4px solid var(--book-accent, var(--deco)); border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.pull-quote p { font-family: var(--serif); font-size: clamp(1.4rem, 1.1rem + 2vw, 2.3rem); line-height: 1.25; margin: 0 auto; max-width: 44rem; }
.bento { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); margin: var(--sp-4) 0 var(--sp-5); }
.bento h3 { margin: 0 0 var(--sp-1); font-family: var(--sans); font-size: 1.1rem; }
.bento p { margin: 0; }
.excerpt { border-left: 4px solid var(--book-accent, var(--deco)); padding-left: var(--sp-4); margin: var(--sp-5) 0; max-width: var(--measure); }
.excerpt p { font-style: italic; }
.excerpt .source { font-family: var(--sans); font-style: normal; color: var(--muted); font-size: var(--fs-sm); }
.excerpt.sample p { font-style: normal; }
.closing-line { font-family: var(--serif); font-size: 1.3rem; max-width: 36rem; border-left: 4px solid var(--book-accent, var(--deco)); padding-left: var(--sp-4); margin: var(--sp-5) 0; }
.aside-note { max-width: var(--measure); font-family: var(--sans); font-size: var(--fs-sm); }
.channel-list { list-style: none; padding: 0; display: grid; gap: var(--sp-3); max-width: var(--measure); }
.channel-list a { display: inline-flex; align-items: center; min-height: var(--tap); font-family: var(--sans); font-weight: 600; }

/* contents are an accordion: every group is a details element */
.toc-grid { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); margin-top: var(--sp-4); }
.toc-group h3, .toc-group summary { font-family: var(--sans); font-size: 1.05rem; font-weight: 700; margin: 0; }
.toc-group summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-1) 0; cursor: pointer; list-style: none; }
.toc-group summary::-webkit-details-marker { display: none; }
.toc-group summary::after { content: ""; flex: none; width: 0.55rem; height: 0.55rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.toc-group[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.toc { list-style: none; padding: 0; margin: var(--sp-2) 0 0; font-family: var(--sans); font-size: 1rem; }
.toc li { margin: 0 0 var(--sp-2); }
.after-list { font-family: var(--sans); }
.after-list li { margin-bottom: var(--sp-3); }
.resource-grid { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); list-style: none; padding: 0; margin: 0 0 var(--sp-5); }
.resource-card { border-left: 6px solid var(--deco); }
.resource-card h2, .resource-card h3 { margin: 0 0 var(--sp-2); font-size: 1.25rem; }
.resource-card h2 a, .resource-card h3 a { display: inline-flex; align-items: center; min-height: var(--tap); }
.resource-card p { margin: 0 0 var(--sp-2); }
.cta-line { font-family: var(--sans); font-size: 1rem; color: var(--muted); border-top: 1px solid var(--rule); padding-top: var(--sp-3); margin-top: var(--sp-5); max-width: var(--measure); }

/* author: type only */
.author-hero { padding: var(--sp-3) 0 var(--sp-3) var(--sp-4); border-left: 6px solid var(--orange); margin: 0 0 var(--sp-6); }
.author-hero h1 { font-size: clamp(2.6rem, 11vw, 6rem); line-height: 1; letter-spacing: -0.02em; margin: 0 0 var(--sp-2); }
.author-kicker { font-family: var(--sans); font-size: var(--fs-lead); margin: 0; color: var(--muted); }
.author-note { padding-bottom: var(--sp-2); margin: var(--sp-6) 0; }
.author-note h2 { margin-top: 0; }
.author-note .source, .document .source { font-family: var(--sans); color: var(--muted); font-size: var(--fs-sm); }

/* Continuous Engineering page */
.ce-hero { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); background: #15151f; color: #f4f1ea; border-radius: var(--radius-l); padding: var(--sp-5) var(--sp-4); margin: 0 0 var(--sp-6); }
.ce-hero .eyebrow { color: #f59e0b; }
.ce-hero h1, .ce-hero .lede { color: #f4f1ea; }
.ce-hero .btn { background: #f59e0b; border-color: #f59e0b; color: #0a0a0a; }
.ce-hero .btn:hover { background: #fbbf24; border-color: #fbbf24; color: #0a0a0a; }
.ce-hero .btn-secondary { background: transparent; border-color: #f4f1ea; color: #f4f1ea; }
.ce-hero .btn-secondary:hover { background: #f4f1ea; color: #15151f; }
.ce-hero :focus-visible { outline-color: #f59e0b; }
.ce-orbit { width: 7rem; height: 7rem; justify-self: center; }
.statement { font-size: 1.35rem; line-height: 1.4; border-left: 4px solid var(--deco); padding-left: var(--sp-4); }
.ce-services { display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); margin: var(--sp-4) 0; }
.ce-services > div { border-top: 4px solid var(--accent); }
.ce-services dt { font-family: var(--sans); font-weight: 700; margin: 0 0 var(--sp-2); }
.ce-services dd { margin: 0; }

/* work with us: five numbered offers */
.work-hero { padding-bottom: var(--sp-2); }
.offers { counter-reset: offer; list-style: none; padding: 0; display: grid; gap: var(--sp-2); }
.offers li { counter-increment: offer; display: grid; gap: var(--sp-1) var(--sp-4); grid-template-columns: 2.25rem minmax(0, 1fr); padding: var(--sp-4) 0; border-top: 2px solid var(--text); margin: 0; }
.offers li::before { content: counter(offer); font-family: var(--sans); font-size: 2rem; font-weight: 700; line-height: 1; color: var(--deco); grid-row: 1 / span 4; }
.offers h3 { margin: 0; }
.offers p { margin: 0 0 var(--sp-2); max-width: 40rem; }
.offers .for { font-family: var(--sans); color: var(--muted); }

/* documents and the template library */
.document h1 { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.7rem); }
.document h2 { font-size: 1.3rem; margin-top: var(--sp-6); }
.document hr { border: 0; border-top: 1px solid var(--rule); margin: var(--sp-6) 0; }
.library-head { padding-bottom: var(--sp-2); }

/* tables: a phone gets each library row as a labelled card; elsewhere a table scrolls inside its own box with edge shadows */
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
caption { text-align: left; font-weight: 600; padding-bottom: var(--sp-2); }
th, td { text-align: left; vertical-align: top; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--rule); }
thead th { background: var(--surface-2); }
.table-scroll { max-width: 100%; overflow-x: auto; background: linear-gradient(to right, var(--bg) 30%, transparent), linear-gradient(to right, transparent, var(--bg) 70%) 100% 0, linear-gradient(to right, rgba(0, 0, 0, 0.18), transparent), linear-gradient(to left, rgba(0, 0, 0, 0.18), transparent) 100% 0; background-repeat: no-repeat; background-size: 2.5rem 100%, 2.5rem 100%, 0.9rem 100%, 0.9rem 100%; background-attachment: local, local, scroll, scroll; }
.library td, .library th { font-family: var(--sans); font-size: var(--fs-sm); }
.library th[scope="row"] { font-size: 1rem; }
.library a { display: inline-flex; align-items: center; min-height: var(--tap); }
@media (max-width: 39.99rem) {
  .library, .library tbody, .library tr, .library th, .library td, .cards-table, .cards-table tbody, .cards-table tr, .cards-table th, .cards-table td { display: block; width: 100%; }
  .library thead, .cards-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .library caption, .cards-table caption { display: block; }
  .library tr, .cards-table tr { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--sp-3); margin: 0 0 var(--sp-3); }
  .library th, .library td, .cards-table th, .cards-table td { border: 0; padding: var(--sp-1) 0; }
  .cards-table td::before { content: attr(data-label); display: block; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
  /* the library on a phone: a form's name, then its links side by side; no labels (the links say what they are), no empty rows */
  .library tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-5); padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-2); }
  .library th[scope="row"] { flex: 0 0 100%; width: 100%; padding-bottom: 0; }
  .library td { width: auto; padding: 0; }
  .library td[data-label="Used in"], .library td.is-empty { display: none; }
}

/* inline links in running text get a 44px hit area without changing the line (padding on an inline box does not move the lines) */
main p a:not([class]), main dd a:not([class]), main td a:not([class]), main ul:not([class]) > li > a:not([class]) { padding-block: 0.7rem; }
main .library td a:not([class]) { padding-block: 0; }

/* discussion */
.tabs { display: flex; flex-wrap: wrap; gap: var(--sp-2); list-style: none; padding: 0; margin: var(--sp-4) 0 var(--sp-5); }
.tabs li { margin: 0; }
.tabs a { display: inline-flex; align-items: center; min-height: var(--tap); padding: var(--sp-2) var(--sp-4); border: 2px solid var(--border); border-radius: var(--radius-s); 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: var(--sp-4); max-width: 44rem; }
.post-head, .admin-meta { overflow-wrap: anywhere; }
.post-head { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: baseline; margin: 0 0 var(--sp-2); font-size: 1rem; }
.post-author { font-weight: 700; }
.post-badge { font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-s); padding: 0 0.4rem; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 var(--sp-3); }
.post-actions { margin: 0; }
summary { min-height: var(--tap); padding: var(--sp-2) 0; cursor: pointer; }
.flag-count { display: inline-block; background: var(--todo-bg); color: var(--todo-text); padding: 0.1rem 0.5rem; border-radius: var(--radius-s); font-size: var(--fs-sm); font-weight: 600; }
.danger-zone { margin-top: var(--sp-3); }
.danger-zone summary { color: var(--danger); }
.link-button { background: none; border: none; padding: var(--sp-2) 0; min-height: var(--tap); color: var(--link); font: inherit; text-decoration: underline; cursor: pointer; }
.notice { border-left: 5px solid var(--ok); background: var(--ok-bg); padding: var(--sp-3) var(--sp-4); max-width: 44rem; margin: var(--sp-4) 0; }
.notice.error { border-left-color: var(--danger); background: var(--danger-bg); }

/* forms: labels above, large inputs, a visible focus ring */
form.stack { display: grid; gap: var(--sp-4); max-width: 44rem; }
label { display: block; font-weight: 600; margin-bottom: var(--sp-1); }
.hint { font-size: var(--fs-sm); color: var(--muted); margin: var(--sp-1) 0 0; font-weight: 400; }
input[type="text"], input[type="email"], textarea, select { width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-s); padding: var(--sp-3); min-height: var(--tap); }
input[type="text"]:focus-visible, input[type="email"]:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--focus); outline-offset: 1px; }
textarea { min-height: 9rem; resize: vertical; }
.pager { display: flex; gap: var(--sp-4); margin: var(--sp-5) 0; }

/* admin */
.admin-post { border-top: 1px solid var(--rule); padding: var(--sp-4) 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.admin-actions form { margin: 0; }
.btn-small { min-height: var(--tap); padding: var(--sp-2) var(--sp-3); 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); }

/* from a large phone up */
@media (min-width: 30rem) {
  .footer-list { grid-template-columns: minmax(0, 1fr); }
}
/* tablet */
@media (min-width: 40rem) {
  .btn-row { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); max-width: 40rem; }
  main { padding: var(--sp-6) 0 var(--sp-8); }
  .home-hero { margin-top: calc(-1 * var(--sp-6)); padding: var(--sp-7) 0; }
  .book-lg-grid, .book-grid, .resource-grid, .ce-services, .toc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-card-lg { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .footer-short, .footer-more { display: none; }
  .footer-grid { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: var(--sp-4); }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento .bento-lead { grid-column: 1 / -1; }
  .cta-band { grid-template-columns: 5rem minmax(0, 1fr); padding: var(--sp-6); }
  .cta-band img { width: 4.5rem; height: 4.5rem; }
  .library thead th { position: sticky; top: 0; }
  .wm-top { letter-spacing: 0.16em; }
  .wm-main { font-size: 1.5rem; }
}
/* tablet from 48rem (768px): the inline nav without the quiet CE link, two-column heroes */
@media (min-width: 48rem) {
  .nav-menu { display: none; }
  .nav-list { display: flex; }
  .nav-list .nav-quiet-item { display: none; }
  .header-row { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
  .home-hero-grid { grid-template-columns: minmax(0, 1fr) 14rem; grid-template-areas: "intro cover" "feature cover"; column-gap: var(--sp-6); align-items: center; }
  .home-hero-cover { width: 100%; max-width: 14rem; }
  .home-hero h1 { max-width: 16ch; }
  .book-hero { grid-template-columns: 12rem minmax(0, 1fr); gap: var(--sp-6); }
  .book-hero > .cover, .book-hero > img { max-width: 12rem; justify-self: start; }
  .book-info .btn-row, .book-info .muted, .book-info .meta { order: 0; }
  .ce-hero { grid-template-columns: minmax(0, 1fr) 10rem; padding: var(--sp-6); align-items: center; }
  .ce-orbit { width: 9rem; height: 9rem; }
  .offers li { grid-template-columns: 3rem minmax(0, 1fr); }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* desktop from 56rem: the quiet CE link joins the nav, larger covers, three-column contents */
@media (min-width: 56rem) {
  .nav-list .nav-quiet-item { display: list-item; }
  .home-hero-grid { grid-template-columns: minmax(0, 1fr) 17rem; column-gap: var(--sp-8); }
  .home-hero-cover { max-width: 17rem; }
  .book-hero { grid-template-columns: 15rem minmax(0, 1fr); gap: var(--sp-7); }
  .book-hero > .cover, .book-hero > img { max-width: 15rem; }
  .toc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bento { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .bento .bento-lead { grid-column: 1; grid-row: 1 / span 2; }
  .ce-hero { grid-template-columns: minmax(0, 1fr) 12rem; padding: var(--sp-7) var(--sp-6); }
  .ce-orbit { width: 11rem; height: 11rem; }
}
@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, .book-card-lg, .channel-list li, .toc-group, .nav-menu summary { 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; }
}
