/* Atomic books — shared layout for Atomic Chunks / Modules / Systems.
   Paste BODY content only (the <main class="page"> wrapper). The Book Page
   template adds the document shell, loads this file, and sets the palette via
   a body class: body.book--chunks (default) / .book--modules / .book--systems.
   To recolor a book, edit only its palette block below. */

:root {
  --ink: #1e252b;
  --muted: #6e6559;
  --paper: #f4ead8;
  --parchment: #fff8ec;
  --card: #fffaf2;
  --slate: #16232e;
  --slate-2: #223444;
  --copper: #b86f35;
  --copper-dark: #8e4f25;
  --line: #e4d2b9;
  --soft: #f2e2ca;
  --shadow: 0 18px 45px rgba(22, 35, 46, 0.16);
  --radius: 22px;
  /* themeable bits */
  --accent-ring: rgba(184,111,53,.13);
  --page-bg:
    radial-gradient(circle at top left, rgba(184,111,53,.24), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(22,35,46,.16), transparent 34rem),
    linear-gradient(135deg, #1a2a36 0%, #223444 28%, #f3e4cd 28.2%, #fbf1e1 100%);
  --page-bg-mobile: linear-gradient(180deg, #16232e 0%, #223444 210px, #f6ead9 210px, #fbf1e1 100%);
  --activity-bg: linear-gradient(135deg, #16232e 0%, #243848 100%);
}

/* ---------- BOOK PALETTES (edit colors here) ---------- */
/* Atomic Chunks — copper (same as :root defaults) */
body.book--chunks {
  --copper: #b86f35; --copper-dark: #8e4f25;
  --accent-ring: rgba(184,111,53,.13);
  --page-bg:
    radial-gradient(circle at top left, rgba(184,111,53,.24), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(22,35,46,.16), transparent 34rem),
    linear-gradient(135deg, #1a2a36 0%, #223444 28%, #f3e4cd 28.2%, #fbf1e1 100%);
  --page-bg-mobile: linear-gradient(180deg, #16232e 0%, #223444 210px, #f6ead9 210px, #fbf1e1 100%);
  --activity-bg: linear-gradient(135deg, #16232e 0%, #243848 100%);
}
/* Atomic Modules — emerald */
body.book--modules {
  --copper: #2f8f6f; --copper-dark: #1f6f54;
  --accent-ring: rgba(47,143,111,.15);
  --page-bg:
    radial-gradient(circle at top left, rgba(47,143,111,.24), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(19,36,29,.18), transparent 34rem),
    linear-gradient(135deg, #13241d 0%, #1f6f54 28%, #e3efe9 28.2%, #f4faf7 100%);
  --page-bg-mobile: linear-gradient(180deg, #13241d 0%, #1f6f54 210px, #e7f2ec 210px, #f4faf7 100%);
  --activity-bg: linear-gradient(135deg, #10261f 0%, #1f6f54 100%);
}
/* Atomic Systems — indigo */
body.book--systems {
  --copper: #5b6cf0; --copper-dark: #3a45c4;
  --accent-ring: rgba(91,108,240,.16);
  --page-bg:
    radial-gradient(circle at top left, rgba(91,108,240,.22), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(20,23,51,.18), transparent 34rem),
    linear-gradient(135deg, #171a33 0%, #2a3170 28%, #e8eafb 28.2%, #f5f6fe 100%);
  --page-bg-mobile: linear-gradient(180deg, #171a33 0%, #2a3170 210px, #ecedfb 210px, #f5f6fe 100%);
  --activity-bg: linear-gradient(135deg, #141733 0%, #2a3170 100%);
}

/* ---------- SHARED LAYOUT ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  line-height: 1.68;
}
.page { max-width: 1180px; margin: 0 auto; padding: 28px 22px 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; color: #fff7ea; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 850; letter-spacing: -0.02em; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--copper); color: #fff8ec; box-shadow: 0 12px 30px rgba(0,0,0,.22); font-size: 19px; }
.lesson-pill { border: 1px solid rgba(255,248,236,.28); background: rgba(255,248,236,.1); padding: 8px 13px; border-radius: 999px; color: rgba(255,248,236,.86); font-size: 14px; white-space: nowrap; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(290px, .85fr); gap: 28px; align-items: stretch; margin-bottom: 28px; }
.hero-card, .side-card, .content-card, .activity-card { background: rgba(255,250,242,.96); border: 1px solid rgba(228,210,185,.95); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-card { padding: clamp(30px, 5vw, 58px); position: relative; overflow: hidden; background: linear-gradient(135deg, rgba(255,250,242,.98), rgba(246,232,210,.96)); }
.hero-card::after { content: ""; position: absolute; right: -86px; bottom: -86px; width: 230px; height: 230px; border-radius: 50%; border: 34px solid var(--accent-ring); }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--copper-dark); font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .13em; margin-bottom: 12px; }
.eyebrow::before { content: ""; width: 30px; height: 2px; background: var(--copper); border-radius: 999px; }
h1 { font-size: clamp(40px, 7vw, 76px); line-height: .92; letter-spacing: -.06em; margin: 0 0 18px; max-width: 760px; color: var(--slate); }
.subtitle { font-size: clamp(18px, 2.2vw, 24px); line-height: 1.45; color: #4f473e; max-width: 690px; margin: 0; }
.side-card { padding: 26px; background: rgba(255,248,236,.94); }
.side-card h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -.02em; color: var(--slate); }
.lesson-goals { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 12px; }
.lesson-goals li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; color: var(--muted); }
.check { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #f2dfc6; color: var(--copper-dark); font-weight: 900; }
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; background: rgba(255,248,236,.92); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 10px 28px rgba(22,35,46,.08); }
.toc strong { display: block; margin-bottom: 10px; color: var(--slate); letter-spacing: -.01em; }
.toc a { display: block; color: #564d43; text-decoration: none; padding: 9px 0; border-top: 1px solid rgba(228,210,185,.92); font-size: 15px; font-weight: 700; }
.toc a:hover { color: var(--copper-dark); }
.toc .small-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; line-height: 1.45; }
.content-card { padding: clamp(24px, 4vw, 48px); background: var(--parchment); }
.section { padding: 12px 0 34px; border-bottom: 1px solid var(--line); scroll-margin-top: 12px; }
.section:last-child { border-bottom: 0; }
h2 { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.1; letter-spacing: -.04em; margin: 0 0 16px; color: var(--slate); }
p { margin: 0 0 18px; font-size: 18px; }
.lead { font-size: 22px; line-height: 1.45; color: var(--slate); font-weight: 650; }
.callout { margin: 24px 0; padding: 22px; border-radius: 18px; background: var(--soft); border: 1px solid #dfc49e; font-size: 18px; }
.callout strong { display: block; font-size: 15px; text-transform: uppercase; letter-spacing: .12em; color: var(--copper-dark); margin-bottom: 8px; }
.chunk-card { margin: 24px 0; border-left: 7px solid var(--copper); background: #fffdf8; border-radius: 16px; padding: 24px; box-shadow: 0 8px 24px rgba(22,35,46,.07); }
.chunk-card .label { color: var(--copper-dark); text-transform: uppercase; font-size: 12px; font-weight: 950; letter-spacing: .13em; margin-bottom: 8px; }
.chunk-card p { font-size: 20px; line-height: 1.45; margin: 0; color: var(--slate); font-weight: 750; }
.activity-card { margin-top: 28px; padding: clamp(24px, 4vw, 42px); background: var(--activity-bg); color: #fff8ec; border-color: rgba(255,248,236,.18); }
.activity-card h2 { color: #fff8ec; }
.activity-card p { color: rgba(255,248,236,.86); }
.prompt-box { background: rgba(255,248,236,.1); border: 1px solid rgba(255,248,236,.2); border-radius: 18px; padding: 20px; margin-top: 18px; }
.prompt-box ol { margin: 0; padding-left: 22px; color: rgba(255,248,236,.92); }
.next { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.next__links { order: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.next__part { order: 2; text-align: center; color: var(--muted); font-size: 14px; font-weight: 800; letter-spacing: .04em; }
.next__links a { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,248,236,.6); color: var(--slate); text-decoration: none; font-size: 16px; font-weight: 750; line-height: 1.32; transition: border-color .15s; }
.next__links a:hover { border-color: var(--copper); }
.next__links a .dir { color: var(--copper-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.next__next { text-align: right; align-items: flex-end; }
@media (max-width: 880px) {
  html { scroll-padding-top: 12px; }
  body { line-height: 1.78; background: var(--page-bg-mobile); }
  .page { padding: 20px 14px 56px; }
  .hero, .layout { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .brand { font-size: 19px; }
  .lesson-pill { font-size: 16px; white-space: normal; }
  .hero-card { padding: 30px 22px; }
  h1 { font-size: clamp(44px, 15vw, 60px); line-height: .98; }
  .subtitle { font-size: 24px; line-height: 1.5; }
  .side-card { padding: 22px; }
  .side-card h2 { font-size: 24px; }
  .side-card p, .lesson-goals li { font-size: 22px; line-height: 1.62; }
  .toc { position: static; padding: 22px; }
  .toc strong { font-size: 26px; margin-bottom: 16px; color: var(--slate); }
  .toc a { font-size: 27px; line-height: 1.38; padding: 20px 0; color: var(--slate); font-weight: 900; }
  .toc .small-note { font-size: 20px; line-height: 1.55; }
  .content-card { padding: 26px 20px; }
  .section { padding: 18px 0 34px; scroll-margin-top: 12px; }
  h2 { font-size: clamp(32px, 8.5vw, 40px); line-height: 1.14; }
  p { font-size: 24px; line-height: 1.8; }
  .lead { font-size: 27px; line-height: 1.58; }
  .callout { font-size: 24px; line-height: 1.7; padding: 22px; }
  .callout strong { font-size: 15px; }
  .chunk-card { padding: 22px; }
  .chunk-card p { font-size: 26px; line-height: 1.54; }
  .activity-card { padding: 28px 20px; }
  .activity-card p, .prompt-box li { font-size: 24px; line-height: 1.72; }
  .next__links { grid-template-columns: 1fr; }
  .next__part { font-size: 18px; }
  .next__links a { font-size: 20px; }
  .next__next { text-align: left; align-items: flex-start; }
}

/* ---------- BOOK PAGE CHROME (theme header + footer, auto-colored per book) ---------- */
.book-header { background: var(--slate); }
.book-header__inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 22px; flex-wrap: wrap; }
.book-header__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff8ec; font-weight: 850; letter-spacing: -.02em; font-size: 18px; }
.book-header__mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--copper); color: #fff8ec; font-weight: 900; font-size: 14px; }
.book-header__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.book-header__pill { border: 1px solid rgba(255,248,236,.28); background: rgba(255,248,236,.1); padding: 6px 12px; border-radius: 999px; color: rgba(255,248,236,.9); font-size: 13px; }
.book-header__menu { color: #fff8ec; text-decoration: none; font-weight: 700; font-size: 14px; border: 1px solid rgba(255,248,236,.3); padding: 7px 13px; border-radius: 8px; }
.book-header__menu:hover { background: #fff8ec; color: var(--slate); }
.book-footer { background: var(--slate); color: rgba(255,248,236,.7); text-align: center; font-size: 13px; padding: 16px 22px; }
@media (max-width: 880px) {
  .book-header__inner { padding: 8px 14px; }
  .book-header__brand { font-size: 17px; }
}


/* ===== Front-matter & Part page layout fix — added 2026-07-08 =====
   Dedication, Contents and Part landing pages have no .side-card and no
   sidebar .toc, so the two-column chapter grids (.hero / .layout) stranded
   their content in one narrow column with an empty gap on the right. These
   rules collapse those specific grids to a single centered column, and give
   Book 1's otherwise-unstyled <ul class="part-chapters"> the same tidy list
   treatment as the TOC. Chapter pages, and the Modules/Systems Part heroes,
   keep their .side-card / direct-child .toc, so they are NOT affected.
   To revert this change, delete everything between these two markers. */

/* Desktop only: collapse to a single centered column on pages lacking a
   .side-card / direct-child .toc. Screens <=880px already stack to one
   column via the theme's own media query, so scoping this to wider screens
   avoids overriding that (a fixed-max grid track could overflow a phone). */
@media (min-width: 881px) {
  .hero:not(:has(> .side-card)),
  .layout:not(:has(> .toc)) {
    grid-template-columns: minmax(0, 880px);
    justify-content: center;
  }
}

/* Book 1 Part pages place .content-card directly inside .page (no .layout).
   max-width only caps width, so it is safe at every screen size. */
.page > .content-card {
  max-width: 880px;
  margin-inline: auto;
}

/* Book 1 Part pages: style the otherwise-unstyled chapter list like the TOC */
.part-chapters {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}
.part-chapters li { margin: 0; }
.part-chapters li + li { border-top: 1px solid rgba(228, 210, 185, .92); }
.part-chapters a {
  display: block;
  padding: 12px 2px;
  color: #564d43;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
}
.part-chapters a:hover { color: var(--copper-dark); }
/* ===== end front-matter & Part page fix ===== */


/* ===== Cover / title page — added 2026-07-08 ===== */
.cover-author {
  margin: 22px 0 0;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .02em;
  color: var(--copper-dark);
}
.cover-cta {
  text-align: center;
  margin: 26px 0 4px;
}
.start-reading {
  display: inline-block;
  background: var(--copper);
  color: #fff8ec;
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .01em;
  padding: 16px 36px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: background .15s ease, transform .15s ease;
}
.start-reading:hover { background: var(--copper-dark); transform: translateY(-1px); }
/* ===== end cover / title page ===== */
