/* ───────────────────────────────────────────────────────────────────
   Design tokens
   ─────────────────────────────────────────────────────────────────── */

:root {
  /* Surfaces */
  --bg:           #fdfcf7;
  --bg-elevated:  #f6f2e8;
  --border:       #e8e3d3;

  /* Text */
  --text:         #2a2724;
  --text-strong:  #1a1816;
  --text-muted:   #6b6862;
  --text-subtle:  #9b9892;

  /* Accent */
  --accent:         #b8421e;
  --accent-hover:   #8a3216;
  --accent-visited: #7a3a4f;

  /* Code */
  --code-bg:      #f6f2e8;
  --code-border:  #e8e3d3;

  /* Type */
  --font-body: 'Source Serif 4', 'Source Serif Pro', Charter, 'Iowan Old Style',
               'Apple Garamond', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas,
               'DejaVu Sans Mono', monospace;

  --text-xs:    0.79rem;
  --text-sm:    0.889rem;
  --text-base:  1rem;
  --text-md:    1.2rem;
  --text-lg:    1.44rem;
  --text-xl:    1.728rem;
  --text-2xl:   2.074rem;

  --leading-tight:  1.2;
  --leading-snug:   1.4;
  --leading-normal: 1.65;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #1a1816;
    --bg-elevated:  #25221e;
    --border:       #34302a;

    --text:         #e8e3d6;
    --text-strong:  #f5f0e2;
    --text-muted:   #a09a8d;
    --text-subtle:  #6b665d;

    --accent:         #e8a978;
    --accent-hover:   #f0bc91;
    --accent-visited: #c79bb0;

    --code-bg:      #25221e;
    --code-border:  #34302a;

    color-scheme: dark;
  }
}

/* ───────────────────────────────────────────────────────────────────
   Self-hosted fonts
   ─────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-serif-4-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-serif-4-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/source-serif-4-semibold.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-regular.woff2') format('woff2');
}

/* ───────────────────────────────────────────────────────────────────
   Reset & base
   ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 19px;
  -webkit-text-size-adjust: 100%;
}
@media (max-width: 480px) {
  html { font-size: 18px; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-feature-settings: 'kern', 'liga', 'onum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ───────────────────────────────────────────────────────────────────
   Layout grid (prose / wide / full-bleed)
   ─────────────────────────────────────────────────────────────────── */

main {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--space-4), 1fr)
    [wide-start] minmax(0, 10rem)
    [prose-start] min(32rem, 100% - var(--space-8)) [prose-end]
    minmax(0, 10rem) [wide-end]
    minmax(var(--space-4), 1fr) [full-end];
  padding: var(--space-16) 0 var(--space-24);
  row-gap: 0;
}

main > * { grid-column: prose; }

main > figure,
main > pre,
main > .wide,
main > table {
  grid-column: wide;
  width: 100%;
  max-width: 52rem;
  justify-self: center;
}

main > .full-bleed {
  grid-column: full;
  max-width: none;
}

/* ───────────────────────────────────────────────────────────────────
   Typography
   ─────────────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  color: var(--text-strong);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-4);
}
h2 {
  font-size: var(--text-lg);
  margin: var(--space-12) 0 var(--space-4);
}
h3 {
  font-size: var(--text-md);
  margin: var(--space-8) 0 var(--space-3);
}
h4 {
  font-size: var(--text-base);
  margin: var(--space-6) 0 var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

p {
  margin: 0 0 1em;
  hyphens: auto;
  -webkit-hyphens: auto;
  hanging-punctuation: first last;
}

p.lead, .lead p, .lead {
  font-size: var(--text-md);
  color: var(--text-strong);
  line-height: 1.5;
  margin-bottom: var(--space-8);
}
.lead p { margin: 0 0 0.5em; }
.lead p:last-child { margin-bottom: 0; }

em { font-style: italic; }
strong { font-weight: 600; color: var(--text-strong); }

small { font-size: var(--text-sm); color: var(--text-muted); }

abbr {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  cursor: help;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-12) auto;
  width: 6rem;
}

/* ───────────────────────────────────────────────────────────────────
   Links
   ─────────────────────────────────────────────────────────────────── */

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color 0.1s ease, text-decoration-thickness 0.1s ease;
}
a:visited { color: var(--accent-visited); }
a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

/* ───────────────────────────────────────────────────────────────────
   Lists
   ─────────────────────────────────────────────────────────────────── */

ul, ol {
  margin: 0 0 1em;
  padding-left: 1.5em;
}
li { margin-bottom: 0.4em; }
li > ul, li > ol { margin: 0.4em 0 0; }

ul.tight, ol.tight,
ul.tight li, ol.tight li {
  margin-bottom: 0;
}
ul.tight, ol.tight { line-height: 1.5; }

/* ───────────────────────────────────────────────────────────────────
   Code
   ─────────────────────────────────────────────────────────────────── */

code, pre, kbd, samp {
  font-family: var(--font-mono);
  font-feature-settings: 'liga' 0;
}

p code, li code, td code, h1 code, h2 code, h3 code, h4 code {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 0.05em 0.35em;
  font-size: 0.88em;
  white-space: nowrap;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: var(--space-4) var(--space-6);
  overflow-x: auto;
  font-size: 0.88em;
  line-height: 1.55;
  margin: var(--space-8) auto;
  -webkit-overflow-scrolling: touch;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}

pre::-webkit-scrollbar { height: 6px; }
pre::-webkit-scrollbar-track { background: transparent; }
pre::-webkit-scrollbar-thumb {
  background: var(--text-subtle);
  border-radius: 3px;
}

/* ───────────────────────────────────────────────────────────────────
   Figures, images, video
   ─────────────────────────────────────────────────────────────────── */

figure {
  margin: var(--space-8) auto;
}
figure img, figure svg, figure video, figure picture {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}
figcaption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: var(--space-3);
  text-align: center;
  font-style: italic;
}

img { max-width: 100%; height: auto; }
svg { max-width: 100%; }

/* ───────────────────────────────────────────────────────────────────
   Tables
   ─────────────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  margin: var(--space-6) auto;
  font-size: 0.95em;
  width: auto;
}
th, td {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: 600;
  border-bottom: 2px solid var(--text-subtle);
  color: var(--text-strong);
}
td.numeric, th.numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ───────────────────────────────────────────────────────────────────
   Blockquote, pull quote, callout
   ─────────────────────────────────────────────────────────────────── */

blockquote {
  border-left: 3px solid var(--border);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--text-muted);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

blockquote.pullquote {
  font-size: var(--text-md);
  color: var(--text-strong);
  border-left-color: var(--accent);
  border-left-width: 3px;
}

.callout {
  background: var(--bg-elevated);
  border-left: 3px solid var(--text-subtle);
  border-radius: 0 4px 4px 0;
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  font-size: 0.95em;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child  { margin-bottom: 0; }
.callout.note    { border-left-color: var(--accent); }
.callout.warning { border-left-color: #b85a1e; }
.callout.tip     { border-left-color: #2a8a5e; }   /* green — non-critical advice / faster way */
.callout.pitfall { border-left-color: #8a2a4f; }   /* deep magenta — "people do this wrong" */

/* ───────────────────────────────────────────────────────────────────
   Post header & footer
   ─────────────────────────────────────────────────────────────────── */

.post-header {
  margin-bottom: var(--space-12);
}
.post-header h1 {
  font-size: var(--text-xl);
  margin: 0 0 var(--space-2);
  line-height: 1.15;
}
.post-header .meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.post-footer {
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
}
.post-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.post-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

/* ───────────────────────────────────────────────────────────────────
   Homepage
   ─────────────────────────────────────────────────────────────────── */

.home-header {
  margin-bottom: var(--space-12);
}
.home-header h1 {
  font-size: var(--text-2xl);
  margin: 0 0 var(--space-2);
  line-height: 1.1;
}
.home-header p {
  color: var(--text-muted);
  font-size: var(--text-md);
  margin: 0 0 var(--space-2);
}
.home-header .links {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.home-header .links a {
  color: var(--text-muted);
}
.home-header .links a:hover {
  color: var(--accent);
}

ul.entry-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-12);
}
ul.entry-list li {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: var(--space-4);
  align-items: baseline;
  padding: var(--space-3) 0;
  margin-bottom: 0;
  line-height: 1.4;
}
ul.entry-list li + li {
  border-top: 1px solid var(--border);
}
ul.entry-list time,
ul.entry-list .bullet {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
ul.entry-list .bullet {
  text-align: left;
  opacity: 0.5;
}
ul.entry-list .entry-body {
  display: block;
}
ul.entry-list .entry-body p {
  margin: 0;
  line-height: 1.4;
}
ul.entry-list a {
  text-decoration: none;
  color: var(--text-strong);
  font-weight: 500;
  display: inline;
}
ul.entry-list .summary {
  display: block;
  margin-top: 0.15em;
}
ul.entry-list a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
ul.entry-list span.summary {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
}

@media (max-width: 480px) {
  ul.entry-list li {
    grid-template-columns: 1fr;
    gap: 0.15em;
  }
  ul.entry-list .bullet { display: none; }
  ul.entry-list time {
    font-size: var(--text-xs);
  }
}

/* ───────────────────────────────────────────────────────────────────
   Misc
   ─────────────────────────────────────────────────────────────────── */

details {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border-radius: 4px;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-strong);
}
details[open] summary { margin-bottom: var(--space-3); }

mark {
  background: rgba(184, 66, 30, 0.15);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 2px;
}

/* ───────────────────────────────────────────────────────────────────
   Phase 2: Skill-level toggle + supporting callouts
   ─────────────────────────────────────────────────────────────────── */

/* === Show/hide engine: data-level attribute form ============================
   Whitespace-tilde matcher: data-level="novice intermediate" is shown for
   BOTH novice and intermediate skills. Hidden when active skill is not in
   the space-separated list. Per RESEARCH.md §Pattern 3 + §Pitfall 2. */
[data-skill="novice"]       [data-level]:not([data-level~="novice"])       { display: none; }
[data-skill="intermediate"] [data-level]:not([data-level~="intermediate"]) { display: none; }
[data-skill="advanced"]     [data-level]:not([data-level~="advanced"])     { display: none; }

/* === Show/hide engine: parallel .lvl-* class form ===========================
   Phase 6a/6b can author with either form. Authoring with classes is cleaner
   inside markdown; authoring with data-level scales to inline spans. Both
   routes converge to the same visible state.
   Per RESEARCH.md §Open Question 2 (recommended: support both). */
[data-skill="novice"]       .lvl-intermediate,
[data-skill="novice"]       .lvl-advanced       { display: none; }
[data-skill="intermediate"] .lvl-novice,
[data-skill="intermediate"] .lvl-advanced       { display: none; }
[data-skill="advanced"]     .lvl-novice,
[data-skill="advanced"]     .lvl-intermediate   { display: none; }

/* Sidebar / page-index entry for page 07 — hidden for advanced.
   Phase 6a/6b will give the sidebar entry the .guide-page-07 class. */
[data-skill="advanced"] .guide-page-07 { display: none; }

/* === Skill toggle (floating segmented pill) ================================
   Top-right desktop, bottom-right mobile. No vh/vw units anywhere — iOS
   Safari 26 viewport quirks per RESEARCH.md §Pitfall 4 + §State of the Art. */
.skill-toggle {
  position: fixed;
  top:   max(env(safe-area-inset-top),   var(--space-3));
  right: max(env(safe-area-inset-right), var(--space-3));
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.skill-toggle-label {
  padding: 0 var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.skill-toggle [role="radio"] {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.375rem 0.75rem;     /* ≥44px tap area achieved together with toggle padding + line-height */
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  line-height: var(--leading-snug);
}
.skill-toggle [role="radio"]:hover {
  background: rgba(0, 0, 0, 0.04);
}
.skill-toggle [role="radio"][aria-checked="true"] {
  background: var(--accent);
  color: #fff;
}
.skill-toggle [role="radio"][aria-checked="true"]:hover {
  background: var(--accent-hover);
}
.skill-toggle [role="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile: relocate toggle to bottom-right where Safari 26 toolbar collapses
   on scroll, avoiding the address-bar collision in landscape mode. */
@media (max-width: 600px) {
  .skill-toggle {
    top: auto;
    bottom: max(env(safe-area-inset-bottom), var(--space-3));
    right: max(env(safe-area-inset-right), var(--space-2));
    font-size: var(--text-xs);
  }
  .skill-toggle [role="radio"] {
    padding: 0.3rem 0.55rem;
  }
}

/* === "Stuck?" sidebar (inline callout in document flow, not a side rail) ====
   Soft amber background, darker amber left-border accent, no icon.
   Literal hex values: no project token matches the warm amber treatment;
   palette decision locked in CONTEXT.md §"Stuck?" sidebar styling. */
.stuck-sidebar {
  background: #fdf6e3;             /* soft amber */
  border-left: 4px solid #c89b3c;  /* darker amber accent */
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  border-radius: 0 0.25rem 0.25rem 0;
  color: #2a2724;                  /* literal — keeps amber legible in dark mode where var(--text) flips light */
}
.stuck-sidebar > :first-child { margin-top: 0; }
.stuck-sidebar > :last-child  { margin-bottom: 0; }
.stuck-sidebar header,
.stuck-sidebar h2,
.stuck-sidebar h3,
.stuck-sidebar h4 {
  font-weight: 600;
  margin-top: 0;
  margin-bottom: var(--space-2);
  color: #1a1816;                  /* literal — see above */
}

/* === "Photos coming" banner (per-section, hand-removable when photos land) ==
   Neutral blue band, single-line, centered. Less prominent than .stuck-sidebar
   (signals "FYI" not "check this"). Literal hex values per CONTEXT.md. */
.photos-coming-banner {
  background: #eef4fb;             /* neutral blue */
  border: 1px solid #d4e2f0;
  border-radius: 0.25rem;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: #4a6c8e;                  /* literal — pairs with the band; reads in both color schemes */
}

/* === Cross-page diagram reference callout (Phase 6a) ======================
   Text-only navigation aid pointing at a diagram canonically embedded on
   another page. CONTEXT-locked: each SVG appears inline on exactly one page;
   other pages reference via this callout (no duplicate <img>). v1 ships
   text-only — Phase 8 polish may add a thumbnail image. */
.diagram-callout {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  background: var(--bg-elevated);
}
.diagram-callout a {
  text-decoration: none;
  color: var(--text-strong);
  display: block;
}
.diagram-callout a:hover { color: var(--accent); }
.diagram-callout strong { display: block; font-size: var(--text-base); }
.diagram-callout span {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* === Calibration calculator (Phase 6b, page 11) ===========================
   Two number inputs (dry, wet) → computed threshold + inline math.
   Auto-mounted by /projects/balcony-irrigation/calibration.js on the
   #calibration-calculator div in 11-calibration.md. Same pattern as page 02's
   planner embed: prose around a JS-mounted region. */
.calibration-calculator {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-4);
  margin: var(--space-6) 0;
}
.calibration-calculator .calc-row {
  display: block;
  margin: var(--space-3) 0;
}
.calibration-calculator label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}
.calibration-calculator .calc-hint {
  font-weight: normal;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.calibration-calculator input[type="number"] {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-base);
  padding: var(--space-2);
  width: 10em;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-strong);
}
.calibration-calculator .calc-output {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-top: 1px solid var(--border);
}
.calibration-calculator .calc-output[data-empty="true"] {
  color: var(--text-muted);
  font-style: italic;
}
.calibration-calculator .calc-result {
  font-size: var(--text-md);
  margin: 0 0 var(--space-2);
}
.calibration-calculator .calc-math {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}
.calibration-calculator .calc-error {
  color: #b85a1e; /* matches .callout.warning border */
  margin: 0;
}
.calibration-calculator .calc-formula {
  font-family: ui-monospace, Menlo, monospace;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-3);
}

/* === Diagnostic flowchart (Phase 6b, page 13) =============================
   CSS-only decision tree. No JS. Plain nested <ol> with left-border styling
   for visual hierarchy. Reflows natively at 320px (no fixed widths, no
   flex-row containers, no horizontal positioning). Anchor links inside
   leaf <li> jump to the matching #fail-* failure-mode section below. */
.diagnostic-flowchart {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-4) var(--space-3);
  margin: var(--space-6) 0;
  background: var(--bg-elevated);
}
.diagnostic-flowchart > ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.diagnostic-flowchart > ol > li {
  padding: var(--space-3) 0 var(--space-3) var(--space-4);
  border-left: 3px solid var(--accent);
  margin-bottom: var(--space-3);
}
.diagnostic-flowchart > ol > li > strong {
  display: block;
  margin-bottom: var(--space-2);
}
.diagnostic-flowchart > ol > li > ol {
  list-style: none;
  padding-left: var(--space-3);
  margin: var(--space-2) 0 0;
}
.diagnostic-flowchart > ol > li > ol > li {
  padding: var(--space-2) 0 var(--space-2) var(--space-3);
  border-left: 2px solid var(--text-muted);
  margin: var(--space-2) 0;
}
.diagnostic-flowchart a[href^="#fail-"] {
  display: inline-block;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: var(--space-2);
}
.diagnostic-flowchart a[href^="#fail-"]:hover {
  color: var(--accent);
}
@media (max-width: 480px) {
  .diagnostic-flowchart {
    padding: var(--space-3) var(--space-2);
  }
  .diagnostic-flowchart > ol > li {
    padding-left: var(--space-3);
  }
  .diagnostic-flowchart > ol > li > ol {
    padding-left: var(--space-2);
  }
  .diagnostic-flowchart a[href^="#fail-"] {
    display: block;
    margin-left: 0;
    margin-top: var(--space-1);
  }
}

/* === Page 07 skip notice (paints when advanced lands directly) =============
   Cooler/calmer than .stuck-sidebar — this is "feel free to skip" not
   "double-check this." The element ships with the [hidden] HTML attribute;
   skill-level.js (Plan 02-02) removes it for advanced. The browser's UA
   stylesheet handles display:none for [hidden] — no explicit rule needed. */
.page-07-skip-notice {
  background: var(--bg-elevated);
  border-left: 3px solid var(--text-muted);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-6) 0;
  border-radius: 0 0.25rem 0.25rem 0;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text);
  text-align: center;
}

/* === Landing-page project sidebar (Phase 7, plan 07-01) =====================
   The 13-page guide-list <aside> embedded inline in
   /content/projects/balcony-irrigation/index.md (Plan 07-03). Bordered card
   chrome — same shape as .stuck-sidebar but cooler tone (it's a navigation
   surface, not a "stuck?" callout). Sits inline in the prose track, not as a
   fixed right-rail. Uses existing design tokens for dark-mode auto-flip. */
.project-sidebar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: var(--space-4);
  margin: var(--space-6) 0;
}
.project-sidebar > :first-child { margin-top: 0; }
.project-sidebar > :last-child { margin-bottom: 0; }
.project-sidebar > h2 {
  font-size: var(--text-base);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

/* === Guide-page list (Phase 7, plan 07-01) ==================================
   The <ol> inside .project-sidebar. No bullet markers, modest row gap, link
   is the primary content with the skill-eligibility tag (.lvl) inline. */
.project-sidebar .guide-page-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.project-sidebar .guide-page-list > li {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  justify-content: space-between;
}
.project-sidebar .guide-page-list > li:last-child {
  border-bottom: 0;
}
.project-sidebar .guide-page-list > li > a {
  font-weight: 600;
}

/* === Skill-eligibility inline tag (Phase 7, plan 07-01) =====================
   Small descriptive label inside each guide-page-list <li>. Token-based for
   dark-mode auto-flip. Subtle — eligibility is descriptive, not primary
   content. */
.lvl {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-variant: small-caps;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* === Cost+time summary table (Phase 7, plan 07-01) ==========================
   Used in /content/projects/balcony-irrigation/index.md (Plan 07-03) for the
   landing-page cost+time summary. Tighter row spacing than the default pipe
   table; right-aligned cost column. */
.cost-time-table {
  border-collapse: collapse;
  width: 100%;
  /* table-layout: fixed prevents long cell text from forcing the table wider
     than its grid track at narrow (320px) viewports; combined with the
     overflow-wrap rule on td/th, long strings like "12V submersible pump +
     3× solenoid valves" wrap inside the cell instead of pushing the table
     past the prose-column width. */
  table-layout: fixed;
  margin: var(--space-4) 0;
  font-size: var(--text-base);
}
.cost-time-table th,
.cost-time-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.cost-time-table th:last-child,
.cost-time-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cost-time-table tfoot td,
.cost-time-table tr.total td {
  font-weight: 600;
  border-top: 2px solid var(--border);
}

/* === Phase 2 dark-mode overrides ============================================
   Selectors that use var(--bg-elevated) / var(--border) / var(--text) / etc.
   already adapt automatically via the design-token block at the top of this
   file. These rules patch the elements that retain LITERAL hex values
   (warm-amber stuck-sidebar, neutral-blue photos-coming-banner) so the
   build-guide reads sensibly when prefers-color-scheme: dark.
   Toggle-radio :hover overlay is also flipped (rgba black → rgba white)
   so the hover is visible against dark surfaces. */
@media (prefers-color-scheme: dark) {
  /* Hover overlay needs light tint on dark surface */
  .skill-toggle [role="radio"]:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  /* Active-state radio: --accent flips to a warm peach in dark mode (see
     :root token block); white text becomes hard to read on light peach.
     Switch to the dark surface color so active is "peach pill, dark text". */
  .skill-toggle [role="radio"][aria-checked="true"] {
    color: var(--bg);
  }
  /* Box shadow softens against dark bg — make it slightly stronger so the
     pill still reads as elevated above the page. */
  .skill-toggle {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  }

  /* Stuck-sidebar: warm amber → deep amber with light text.
     Background sits between --bg and --bg-elevated so it reads as a
     warm-toned panel without overpowering the page in dark mode. */
  .stuck-sidebar {
    background: #3a2e1a;             /* deep amber surface */
    border-left-color: #c89b3c;      /* same accent — reads on both schemes */
    color: #f0e6cf;                  /* warm light text */
  }
  .stuck-sidebar header,
  .stuck-sidebar h2,
  .stuck-sidebar h3,
  .stuck-sidebar h4 {
    color: #fbf1d4;                  /* slightly brighter for headers */
  }

  /* Photos-coming banner: light blue → deep cool-blue with light text */
  .photos-coming-banner {
    background: #1f2a3a;             /* deep cool blue surface */
    border-color: #2c3d54;
    color: #a8c0dc;                  /* cool light text */
  }

  /* Page-07 skip notice already uses --bg-elevated/--text/--text-muted
     which auto-flip; no additional rules needed. Comment retained so future
     maintainers know the omission is intentional. */
}

/* === Build-guide 320px overflow guards (Phase 8, plan 08-04) ================
   Phase 8 STRUCT structural pass surfaced two pages that overflow at 320px:
   build-guide/05-plumbing/ (a generic markdown pipe table) and
   build-guide/11-calibration/ (long inline <code> with multi-clause preset
   summaries). Scope these guards to body.section-build-guide so landing,
   planner, announce, and other surfaces are not affected.

   Fix 1 — generic <table> in build-guide pages: apply table-layout: fixed +
   overflow-wrap on cells, mirroring .cost-time-table from plan 07-05. This
   forces long cell text to wrap inside its grid track instead of pushing the
   table past the viewport.

   Fix 2 — inline <code> spans: relax white-space: nowrap (set globally on
   line 293) when content would overflow, by allowing break-word fallback.
   Long expressions like `n_unused_quarter = (n_six_way_ts × 4) − n_zones`
   wrap at word boundaries instead of forcing a horizontal scrollbar.
   ============================================================================ */
body.section-build-guide table {
  width: 100%;
  table-layout: fixed;
}
body.section-build-guide th,
body.section-build-guide td {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
body.section-build-guide p code,
body.section-build-guide li code,
body.section-build-guide td code {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Fix 3 — Pandoc syntax-highlighted code blocks (<div class="sourceCode">
   wrapping <pre class="sourceCode lang">) ship with `.sourceCode { overflow:
   visible }` from highlight.css, which overrides our bare `pre { overflow-x:
   auto }`. On 320px viewports, long shell command lines (e.g., the calibration
   page's `Lettuce: 14820 (1.85V) | Tomato: …` preset summary) blow past the
   viewport. Re-establish overflow-x: auto so the code block scrolls
   internally instead of pushing the document. */
body.section-build-guide div.sourceCode,
body.section-build-guide pre.sourceCode {
  overflow-x: auto;
  max-width: 100%;
}
