/* ================================================================
   Learning Tracker — Shared Chapter Styles
   Used by all pages under chapters/*/* (two levels deep).
   Loaded via: <link rel="stylesheet" href="../../assets/learning.css">
   ================================================================ */

/* ==== Theme variables ==== */
:root {
  --bg: #f6f5f1; --bg-elev: #ffffff; --bg-subtle: #efede8;
  --text: #1d252c; --text-muted: #5c6770;
  --accent: #255a7e; --accent-soft: rgba(37,90,126,0.08);
  --border: rgba(29,37,44,0.12); --shadow: 0 4px 18px rgba(29,37,44,0.08);
  --radius: 10px; --font: 'STIX Two Text', Georgia, serif;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.25s ease;
}
[data-theme="dark"] {
  --bg: #0f141b; --bg-elev: #151b23; --bg-subtle: #1c232d;
  --text: #e8edf2; --text-muted: #9aa6b1;
  --accent: #5fb3d9; --accent-soft: rgba(95,179,217,0.12);
  --border: rgba(232,237,242,0.09); --shadow: 0 4px 18px rgba(0,0,0,0.35);
}

/* ==== Base ==== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.75; transition: background var(--transition), color var(--transition); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 860px; margin: 0 auto; padding: 0 1.5rem; }

/* ==== Header ==== */
.site-header { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.5rem; max-width: 860px; margin: 0 auto; }
.back-link { font-family: var(--font-sans); font-size: 0.86rem; font-weight: 600; color: var(--text-muted); }
.back-link:hover { color: var(--text); text-decoration: none; }
.theme-toggle { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 0.4rem 0.7rem; font-size: 0.8rem; cursor: pointer; font-family: var(--font-sans); }

/* ==== Chapter header ==== */
.chapter-head { padding: 3.5rem 0 2rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.chapter-kicker { font-family: var(--font-sans); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.6rem; }
.chapter-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin-bottom: 0.8rem; }
.chapter-deck { color: var(--text-muted); font-size: 1.05rem; max-width: 640px; }
.chapter-progress { margin-top: 1.4rem; display: flex; align-items: center; gap: 0.8rem; }
.chapter-progress .bar { flex: 1; max-width: 280px; height: 7px; background: var(--bg-subtle); border-radius: 4px; overflow: hidden; }
.chapter-progress .fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.chapter-progress .lbl { font-family: var(--font-sans); font-size: 0.78rem; color: var(--text-muted); }

/* ==== Content ==== */
.chapter-body section { margin-bottom: 2.5rem; scroll-margin-top: 5rem; }
.chapter-body h2 { font-size: 1.5rem; margin-bottom: 0.7rem; }
.chapter-body h3 { font-size: 1.15rem; margin: 1.4rem 0 0.5rem; }
.chapter-body p, .chapter-body li { font-size: 1rem; color: var(--text); }
.chapter-body p + p { margin-top: 0.9rem; }
.chapter-body ul, .chapter-body ol { padding-left: 1.4rem; }
.chapter-body li + li { margin-top: 0.4rem; }
.chapter-body blockquote { margin: 1.3rem 0; padding: 0.6rem 1.1rem; border-left: 3px solid var(--accent); background: var(--bg-subtle); font-style: italic; }
.chapter-body pre { overflow-x: auto; margin: 1.2rem 0; padding: 1.1rem; background: #202a33; color: #f7f5ef; border-radius: 6px; font: 0.85rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.chapter-body figure { margin: 1.4rem 0; }
.chapter-body figure img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.chapter-body figcaption { margin-top: 0.4rem; color: var(--text-muted); font-family: var(--font-sans); font-size: 0.78rem; }

/* ==== Concept ladder ==== */
.ladder { display: grid; gap: 0.6rem; margin: 1.2rem 0; }
.rung { display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.9rem 1.1rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; }
.rung .num { font-family: var(--font-sans); font-weight: 800; color: var(--accent); min-width: 1.6rem; }
.rung h4 { font-family: var(--font-sans); font-size: 0.95rem; margin-bottom: 0.2rem; }
.rung p { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

/* ==== Topic checklist (syncs with the tracker) ==== */
.topic-check { list-style: none; padding: 0; }
.topic-check li { margin: 0.5rem 0; }
.topic-check label { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; padding: 0.55rem 0.8rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px; }
.topic-check input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.topic-check input:checked + span { text-decoration: line-through; text-decoration-color: var(--accent); color: var(--text-muted); }

/* ==== Prev / next navigation ==== */
.chapter-nav { display: flex; justify-content: space-between; gap: 1rem; margin: 3rem 0; flex-wrap: wrap; }
.chapter-nav a { font-family: var(--font-sans); font-size: 0.86rem; font-weight: 600; padding: 0.7rem 1.1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev); }
.chapter-nav a:hover { border-color: var(--accent); text-decoration: none; }

/* ==== Author note (templates only — delete when publishing) ==== */
.author-note { margin: 2rem 0 0; padding: 1rem 1.2rem; background: #f5eddd; border: 1px solid rgba(138,91,53,0.25); border-left: 3px solid #8a5b35; color: #3f4b55; font-family: var(--font-sans); font-size: 0.84rem; border-radius: 6px; }

/* ==== Footer ==== */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; text-align: center; color: var(--text-muted); font-size: 0.84rem; }

/* ==== Markdown-rendered chapters ==== */
.chapter-body > h2 { font-size: 1.5rem; margin: 2.4rem 0 0.7rem; }
.chapter-body > h2:first-child { margin-top: 0; }
.chapter-body > h3 { font-size: 1.15rem; margin: 1.4rem 0 0.5rem; }
.chapter-body > p + p { margin-top: 0.9rem; }
.chapter-body > blockquote { margin: 1.3rem 0; padding: 0.6rem 1.1rem; border-left: 3px solid var(--accent); background: var(--bg-subtle); font-style: italic; }
.chapter-body > pre { overflow-x: auto; margin: 1.2rem 0; padding: 1.1rem; background: #202a33; color: #f7f5ef; border-radius: 6px; font: 0.85rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Markdown task lists ("- [ ]") styled like the topic checklist */
.chapter-body ul:has(input[type="checkbox"]) { list-style: none; padding-left: 0; }
.chapter-body li:has(> input[type="checkbox"]) {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.8rem; margin: 0.5rem 0;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
}
.chapter-body li > input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.chapter-body li > input[type="checkbox"]:checked { color: var(--text-muted); }
.chapter-body li:has(> input:checked) { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--accent); }
