/* The manual keeps a paper palette independent of the product page. */
.guide {
  color-scheme: light;
  --bg: #f6f3eb;
  --paper: #fcfaf4;
  --ink: #202821;
  --muted: #555e55;
  --accent: #215b48;
  --line: #d4d5c7;
  --tint: #eaece0;
  --manual-mono: var(--mono, ui-monospace, SFMono-Regular, Consolas, monospace);
  background: var(--bg);
  color: var(--ink);
}

.guide :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.guide :target { scroll-margin-block-start: 24px; }
.guide .site-header { position: static; background: var(--bg); }
.guide .site-footer { background: var(--bg); }
.guide .site-footer a { font-size: .875rem; }
.guide .skip-link { background: var(--paper); }

.guide-kicker, .guide-number {
  color: var(--accent);
  font: 600 .75rem/1.5 var(--manual-mono);
  letter-spacing: .06em;
}
.guide-kicker { margin: 0 0 12px; }
.guide-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.guide-deck { max-width: 38rem; margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.8; }

/* Inside the manual: chapter rail, reading column, then section rail. */
.guide-shell {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) minmax(0, 5fr);
  align-items: start;
  gap: clamp(20px, 4vw, 56px);
  padding-block: clamp(32px, 6vw, 76px) clamp(56px, 8vw, 112px);
}
.guide-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(9rem, 11rem);
  align-items: start;
  gap: 32px clamp(20px, 4vw, 56px);
}
.chapter-heading { grid-column: 1 / -1; padding: 16px 0 26px; border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); }
.chapter-heading h1 { margin: 0 0 .3em; font-size: clamp(2.5rem, 5.5vw, 4.75rem); letter-spacing: -.04em; }
.chapter-rail, .section-rail { position: sticky; top: 24px; min-width: 0; }
.chapter-rail { border-top: 3px solid var(--accent); padding-top: 12px; }
.section-rail { grid-column: 2; grid-row: 2; padding-inline-start: 12px; border-inline-start: 1px solid var(--line); }
.chapter-rail ol, .section-rail ol, .cover-jumps ul, .cover-ledger ol { list-style: none; padding: 0; margin: 0; }
.chapter-rail a, .section-rail a, .cover-jumps a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 8px 6px;
  color: var(--ink);
  font-size: .875rem;
  line-height: 1.45;
  text-decoration: none;
}
.chapter-rail li { border-bottom: 1px solid var(--line); }
.chapter-rail a[aria-current="page"] { background: var(--tint); color: var(--accent); box-shadow: inset 3px 0 var(--accent); font-weight: 750; }
.chapter-rail a:hover, .section-rail a:hover, .cover-jumps a:hover { color: var(--accent); text-decoration: underline; }
.guide-main > .guide-text { grid-column: 1; grid-row: 2; }

/* Cover spread: an opening page facing a ruled chapter ledger. */
.guide-cover { padding-block: clamp(32px, 6vw, 76px) clamp(56px, 8vw, 112px); }
.cover-spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .95fr);
  border-block-start: 3px solid var(--accent);
  border-block-end: 1px solid var(--line);
}
.cover-heading, .cover-ledger { padding-block: clamp(24px, 4.5vw, 64px); }
.cover-heading { padding-inline-end: clamp(20px, 5vw, 72px); }
.cover-heading h1 { margin: 0 0 .32em; font-size: clamp(2.8rem, 6.5vw, 6rem); line-height: 1.07; letter-spacing: -.055em; }
.cover-heading .guide-deck { max-width: 29rem; }
.cover-jumps { margin-top: clamp(24px, 4vw, 48px); }
.cover-jumps ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.cover-jumps li { border-top: 1px solid var(--line); }
.cover-jumps a { padding-inline: 0; }
.cover-ledger { padding-inline: clamp(16px, 4vw, 54px); border-inline: 1px solid var(--line); background: var(--paper); }
.cover-ledger h2 { margin: 0 0 18px; font-size: 1.65rem; }
.cover-ledger li { border-top: 1px solid var(--line); }
.cover-ledger li:last-child { border-bottom: 1px solid var(--line); }
.cover-ledger a {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  padding: 12px 4px;
  color: var(--ink);
  text-decoration: none;
}
.cover-ledger a:hover { background: var(--tint); }
.cover-ledger a:hover strong { text-decoration: underline; }
.cover-ledger a > :last-child { color: var(--accent); }
.cover-ledger strong { font-size: 1.12rem; }
.cover-ledger small { display: block; color: var(--muted); font-size: .875rem; line-height: 1.55; }
.guide-cover .guide-text { max-width: 47rem; margin-inline: auto; margin-block-start: clamp(40px, 7vw, 88px); }

/* Reading matter: numbered sections take the place of decorative cards. */
.guide-text { min-width: 0; max-width: 47rem; line-height: 1.85; }
.guide-text section + section { margin-block-start: clamp(40px, 6vw, 68px); }
.guide-text section { padding-block-start: 18px; border-top: 1px solid var(--line); }
.guide-text section:target { border-top-color: var(--accent); }
.guide-text h2 { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 12px; font-size: clamp(1.35rem, 2.5vw, 1.85rem); line-height: 1.35; }
.guide-text h3 { margin-block: 1.55em .4em; }
.guide-text :is(ol, ul) { padding-inline-start: 1.6em; }
.guide-text li + li { margin-block-start: .45em; }
.guide-text li::marker { color: var(--accent); }
.guide-text dt { margin-block-start: 1em; }
.guide-text dd { margin-inline-start: 0; color: var(--muted); }
.guide-text :is(code, kbd) { border-radius: 0; background: var(--tint); padding: .1em .25em; font: .92em var(--manual-mono); }
.guide-text kbd { border: 1px solid var(--line); }
.guide-text pre { padding: 12px 16px; border: 1px solid var(--line); background: var(--tint); white-space: pre-wrap; overflow-wrap: anywhere; }
.guide-text pre code { padding: 0; }

/* Keep both navigation lists in flow when sticking would cramp the page. */
@media (max-height: 620px) {
  .chapter-rail, .section-rail { position: static; }
}
@media (max-width: 960px) {
  .guide-main { grid-template-columns: minmax(0, 1fr); }
  .section-rail { position: static; grid-column: auto; grid-row: auto; border: 0; padding: 0; }
  .section-rail ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
  .section-rail li { border-top: 1px solid var(--line); }
  .guide-main > .guide-text { grid-column: auto; grid-row: auto; }
}
@media (max-width: 700px) {
  .guide-shell, .cover-spread { grid-template-columns: minmax(0, 1fr); }
  .chapter-rail { position: static; }
  .chapter-rail ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 8px; }
  .chapter-heading { border-top: 0; padding-top: 0; }
  .cover-heading { padding-inline-end: 0; }
  .cover-ledger { border-top: 1px solid var(--line); }
}
@media (max-width: 375px) {
  .chapter-rail ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
