/*
 * Screen styling for the book chapters. The source files are laid out for a
 * 6x9in printed page at 11px; their <style> block is dropped at build time and
 * replaced by this one, which keeps every class name so the boxes, tables and
 * pull quotes still look like the book — just readable on a phone.
 */
:root {
  --bg: #ffffff;
  --fg: #1a1917;
  --muted: #6b645c;
  --line: #e2dad1;
  --card: #fff;
  --teal: #1a6059;
  --teal-deep: #0d2e2a;
  --mint: #3abfb0;
  --gold: #b8860b;
  --red: #8b2020;
  --green: #0e7a5f;
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 17px;
  line-height: 1.72;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 22px auto; }
a { color: var(--teal); }


/* ---------- page frame ---------- */
.crumb, .doc, .doc-page, .pager, .toc-back, .book-head, .toc, .inside, .synopsis {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: 20px;
}
.crumb { padding-block: 18px; font-size: 14px; color: var(--muted); }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

/* ---------- chapter opener ---------- */
.chapter-opener {
  background: var(--teal-deep); color: #fefcf9;
  padding: 34px 24px 28px; border-radius: 14px; margin: 8px 0 30px;
}
.part-label { font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--mint); margin-bottom: 10px; }
.chapter-num { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: rgba(254, 252, 249, .6); margin-bottom: 6px; }
.chapter-title { font-size: clamp(26px, 5.4vw, 36px); font-weight: 600; line-height: 1.15; margin-bottom: 10px; }
.chapter-subtitle { font-size: 16px; line-height: 1.6; color: rgba(254, 252, 249, .8); font-style: italic; margin-bottom: 16px; }
.opener-divider { width: 44px; height: 2px; background: var(--mint); }

/* ---------- body copy ---------- */
h2 {
  font-size: 20px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  color: var(--teal); margin: 40px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
h3 { font-size: 18px; font-weight: 500; margin: 28px 0 8px; }
p { margin: 0 0 16px; }
ul, ol { padding-left: 22px; margin: 0 0 16px; }
li { margin-bottom: 6px; }

/* ---------- the book's boxes ---------- */
.objectives-box { border-left: 3px solid var(--teal); padding: 16px 20px; background: color-mix(in srgb, var(--teal) 7%, transparent); margin: 26px 0; border-radius: 0 10px 10px 0; }
.tip-box { border-left: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 8%, transparent); padding: 16px 20px; margin: 24px 0; border-radius: 0 10px 10px 0; }
.warning-box { border-left: 3px solid var(--red); background: color-mix(in srgb, var(--red) 7%, transparent); padding: 16px 20px; margin: 24px 0; border-radius: 0 10px 10px 0; }
.obj-title, .tip-label, .warn-label, .ds-title, .sum-title, .case-label {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px;
}
.obj-title, .sum-title, .case-label { color: var(--teal); }
.tip-label { color: var(--gold); }
.warn-label { color: var(--red); }

.dark-strip { background: var(--teal-deep); color: #fefcf9; padding: 24px 22px; margin: 30px 0; border-radius: 12px; }
.dark-strip .ds-title { color: var(--mint); }

.case-box { border: 1px solid color-mix(in srgb, var(--teal) 40%, transparent); background: color-mix(in srgb, var(--teal) 5%, transparent); padding: 20px; margin: 28px 0; border-radius: 12px; }
.case-name { font-weight: 700; margin-bottom: 10px; }
.citation { font-style: italic; font-size: 14px; color: var(--muted); margin-top: 8px; }

.pull-quote {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-align: center; padding: 22px 12px; margin: 34px 0;
  font-style: italic; font-size: 21px; line-height: 1.6;
}
.summary-box { border-top: 3px solid var(--teal); padding-top: 22px; margin-top: 40px; }

/* ---------- tables: scroll instead of squeezing on a phone ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 22px 0; display: block; overflow-x: auto; }
thead th { background: var(--teal); color: #fefcf9; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; padding: 10px 12px; text-align: left; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--teal) 4%, transparent); }

/* ---------- chapter navigation ---------- */
.pager { display: flex; gap: 14px; justify-content: space-between; margin: 48px auto 10px; }
.pager-link {
  flex: 1; max-width: 48%; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  font-size: 16px; line-height: 1.35; background: var(--card);
}
.pager-link:hover { border-color: var(--teal); }
.pager-next { text-align: right; }
.pager-link small { display: block; font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.toc-back { text-align: center; margin: 20px auto 0; font-size: 16px; }

/* ---------- book landing ---------- */
.book-head { display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-start; padding-top: 12px; }
.book-cover { width: 220px; flex: none; margin: 0; border-radius: 12px; border: 1px solid var(--line); }
.book-head > div { flex: 1; min-width: 260px; }
.eyebrow { font-size: 12px; letter-spacing: 2.4px; text-transform: uppercase; color: var(--teal); margin: 0 0 8px; }
.book-head h1 { font-size: clamp(30px, 6vw, 44px); line-height: 1.1; margin: 0 0 14px; letter-spacing: -.01em; }
.lede { font-size: 18px; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--line); color: inherit; font-size: 15px; font-weight: 600;
}
.btn:hover { border-color: var(--teal); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }

.inside { margin-top: 48px; }
.inside ul { columns: 2; column-gap: 28px; font-size: 16px; }
@media (max-width: 560px) { .inside ul { columns: 1; } }

.toc { margin-top: 48px; }
.toc h2 { border: 0; padding: 0; }
.toc h3 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin: 32px 0 10px; }
.toc-list { list-style: decimal; padding-left: 26px; }
.toc-list li { margin-bottom: 14px; }
.toc-list a { text-decoration: none; color: inherit; }
.toc-list b { display: block; font-size: 18px; color: var(--teal); }
.toc-list a:hover b { text-decoration: underline; }
.toc-list span { display: block; font-size: 15px; color: var(--muted); line-height: 1.5; }

/* ---------- footer ---------- */

.synopsis { margin-top: 48px; }
.synopsis h2 { border: 0; padding: 0; }
.synopsis p { font-size: 18px; }

/* markdown manuscripts nest one level deeper than the HTML books */
h4 { font-size: 16px; font-weight: 600; margin: 22px 0 6px; color: var(--muted); }
.doc-page blockquote {
  margin: 24px 0; padding: 4px 0 4px 18px;
  border-left: 3px solid var(--teal); color: var(--muted); font-style: italic;
}
.doc-page hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
