:root {
  color-scheme: light;
  --ink: #17201f;
  --muted: #64706d;
  --paper: #f7f4ec;
  --surface: #fffdf7;
  --line: #d8d5ca;
  --mono: "IBM Plex Mono", monospace;
  --sans: "IBM Plex Sans", sans-serif;
  --serif: "Newsreader", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); }
a { color: inherit; }
.book-bar { position: sticky; top: 0; z-index: 20; min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 10px 3vw; background: rgba(255, 253, 247, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.book-bar__author { display: flex; align-items: center; gap: 10px; text-decoration: none; width: max-content; }
.book-bar__author img { border-radius: 50%; object-fit: cover; }
.book-bar__author span { display: grid; }
.book-bar__author strong { font-family: var(--serif); font-size: 17px; }
.book-bar__author small, .book-bar__label { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.book-bar__back { justify-self: end; font-size: 13px; font-weight: 600; text-underline-offset: 4px; }
.reading-progress { position: fixed; z-index: 30; top: 67px; left: 0; width: 100%; height: 3px; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--accent); }
.book-layout { display: grid; grid-template-columns: minmax(210px, 25vw) minmax(0, 1fr); max-width: 1380px; margin: 0 auto; }
.contents { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 116px); overflow: auto; margin: 52px 30px 0; padding: 0 16px 24px 0; border-right: 1px solid var(--line); }
.contents__title { margin: 0 0 16px; color: var(--accent); font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; }
.contents ol { margin: 0; padding: 0; list-style: none; }
.contents li + li { border-top: 1px solid rgba(216, 213, 202, .65); }
.contents a { display: block; padding: 10px 8px; color: var(--muted); font-size: 12px; line-height: 1.35; text-decoration: none; border-left: 2px solid transparent; }
.contents a:hover, .contents a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); }
.contents__status { display: flex; align-items: center; gap: 7px; margin: 22px 8px; color: var(--muted); font-size: 11px; }
.contents__status span { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }
.book { min-width: 0; background: var(--surface); border-inline: 1px solid var(--line); }
.hero { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; padding: clamp(72px, 10vw, 150px) clamp(28px, 8vw, 112px); border-bottom: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 55%); }
.eyebrow, .chapter__number { margin: 0 0 22px; color: var(--accent); font: 500 11px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: 0; }
h1 { max-width: 800px; font-size: clamp(52px, 8vw, 104px); line-height: .92; text-wrap: balance; }
.hero__subtitle { margin: 18px 0 0; color: var(--accent); font: 500 clamp(22px, 3vw, 34px)/1.15 var(--serif); }
.hero__lede { max-width: 680px; margin: 38px 0 0; font: 500 clamp(19px, 2vw, 25px)/1.45 var(--serif); }
.hero__meta { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 50px; color: var(--muted); font: 11px/1.4 var(--mono); }
.premise { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 34px clamp(28px, 8vw, 112px); background: var(--ink); color: white; }
.premise p { margin: 0; font: 600 20px/1.3 var(--serif); }
.premise span { color: #c9d0ce; font-size: 13px; line-height: 1.6; }
.chapter { max-width: 900px; min-height: 62vh; padding: clamp(70px, 10vw, 130px) clamp(28px, 8vw, 112px); border-bottom: 1px solid var(--line); }
.chapter h2 { max-width: 720px; font-size: clamp(38px, 5vw, 66px); line-height: 1; text-wrap: balance; }
.chapter__intro { max-width: 720px; margin: 30px 0; font: 500 clamp(20px, 2.2vw, 27px)/1.48 var(--serif); }
.principles { max-width: 720px; margin: 45px 0 0; padding: 0; list-style: none; counter-reset: point; }
.principles li { position: relative; padding: 17px 10px 17px 44px; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.55; counter-increment: point; }
.principles li::before { content: counter(point, decimal-leading-zero); position: absolute; left: 0; color: var(--accent); font: 11px/1.8 var(--mono); }
.field-manual { max-width: 1040px; background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.technical-section { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 20px; margin-top: 58px; padding-top: 28px; border-top: 1px solid var(--line); }
.technical-section > span { color: var(--accent); font: 500 11px/1.4 var(--mono); }
.technical-section h3 { max-width: 720px; margin: 0; font: 600 clamp(26px, 3vw, 38px)/1.08 var(--serif); letter-spacing: 0; }
.technical-section p { max-width: 760px; margin: 18px 0 24px; font-size: 15px; line-height: 1.72; }
.technical-section pre { max-width: 100%; margin: 0; padding: 20px; overflow-x: auto; color: #edf2ef; background: #1c2624; border-left: 4px solid var(--accent); font: 12px/1.65 var(--mono); tab-size: 2; }
.technical-section code { font: inherit; }
.source-grid { display: grid; gap: 1px; margin-top: 45px; background: var(--line); border: 1px solid var(--line); }
.source-grid a { display: grid; gap: 6px; padding: 20px; background: var(--surface); text-decoration: none; }
.source-grid a:hover { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.source-grid strong { font: 600 15px/1.35 var(--serif); }
.source-grid span { color: var(--muted); font: 10px/1.3 var(--mono); text-transform: uppercase; }
.book-footer { display: grid; grid-template-columns: 1fr 1.6fr; gap: 30px; padding: 45px clamp(28px, 8vw, 112px); background: var(--ink); color: #eef1ee; }
.book-footer div { display: grid; gap: 5px; }
.book-footer span, .book-footer p { color: #aeb9b6; font-size: 12px; line-height: 1.5; }
.book-footer p { margin: 0; }
.book-footer a { grid-column: 1 / -1; width: max-content; color: white; text-underline-offset: 4px; }
@media (max-width: 850px) {
  .book-bar { grid-template-columns: 1fr auto; }
  .book-bar__label { display: none; }
  .book-layout { display: block; }
  .contents { position: relative; top: auto; max-height: none; margin: 0; padding: 14px 18px; overflow-x: auto; border: 0; border-bottom: 1px solid var(--line); }
  .contents__title, .contents__status { display: none; }
  .contents ol { display: flex; width: max-content; }
  .contents li + li { border: 0; }
  .contents a { padding: 7px 12px; border: 0; border-bottom: 2px solid transparent; }
  .contents a[aria-current="true"] { border-bottom-color: var(--accent); }
  .book { border: 0; }
  .hero { min-height: 65vh; }
  .premise { grid-template-columns: 1fr; gap: 12px; }
  .chapter { min-height: 0; }
  .technical-section { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
}
@media (max-width: 540px) {
  .book-bar__author small { display: none; }
  .book-bar__author img { width: 34px; height: 34px; }
  .book-bar__back { font-size: 11px; }
  .reading-progress { top: 61px; }
  h1 { font-size: clamp(43px, 14vw, 66px); }
  .hero__meta { display: grid; }
  .technical-section { display: block; }
  .technical-section > span { display: block; margin-bottom: 10px; }
  .technical-section pre { margin-inline: -12px; padding: 16px 14px; font-size: 11px; }
  .book-footer { grid-template-columns: 1fr; }
  .book-footer a { grid-column: auto; }
}
@media print {
  .book-bar, .reading-progress, .contents { display: none; }
  .book-layout { display: block; }
  .book { border: 0; }
  .hero, .chapter { min-height: 0; break-after: page; }
  .chapter { max-width: none; }
  .technical-section { break-inside: avoid; }
  .technical-section pre { white-space: pre-wrap; color: var(--ink); background: transparent; border: 1px solid var(--line); }
  a { text-decoration: none; }
}
