/* The Coach in Your Pocket — book interior (Quiet Ledger)
   Typeset reading + print edition. Used by the full book reader and the sample. */

:root{
  --paper:#FBFAF7; --paper-tint:#F3F1EB; --paper-card:#FFFFFF;
  --ink:#2A2A28; --ink-soft:#54524B; --ink-mute:#6E6B64; --hairline:#ECE8DF;
  --terracotta:#C6613F; --terracotta-tint:#FFF6F2; --terracotta-deep:#8A5A44; --terracotta-hover:#6F4636;
  --green:#12A277; --green-deep:#0E7D5C; --blue:#40638F; --amber:#E0A94E;
  --font-display:"Fraunces",Georgia,serif;
  --font-body:"Newsreader",Georgia,"Times New Roman",serif;
  --font-mono:"IBM Plex Mono",ui-monospace,Menlo,Consolas,monospace;
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--paper); color:var(--ink);
  font-family:var(--font-body); font-optical-sizing:auto;
  font-size:19px; line-height:1.66; font-weight:400;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
.page{max-width:44rem; margin:0 auto; padding:clamp(2rem,5vw,4.5rem) clamp(1.15rem,5vw,2rem) 5rem}

/* Loading + error states */
#status{max-width:44rem; margin:4rem auto; padding:0 1.5rem; font-family:var(--font-mono); color:var(--ink-mute); font-size:.9rem}
#status a{color:var(--terracotta)}

/* Headings */
h1,h2,h3,h4{font-family:var(--font-display); font-weight:600; line-height:1.08; letter-spacing:-0.012em; color:var(--ink)}
h1{font-size:clamp(2.4rem,6vw,3.6rem); line-height:1.0; margin:.2em 0 .1em}
/* the title block: h1 + subtitle h3 + em tagline */
h1 + h3{font-family:var(--font-display); font-weight:500; font-size:clamp(1.15rem,2.6vw,1.5rem); color:var(--terracotta-deep); letter-spacing:0; margin:.2rem 0 .2rem}
h2{font-size:clamp(1.55rem,3.4vw,2rem); margin:2.8rem 0 .3rem; padding-top:.4rem}
h2::after{content:""; display:block; width:52px; height:3px; background:var(--terracotta); border-radius:2px; margin-top:.55rem}
h3{font-size:1.28rem; margin:1.9rem 0 .3rem}
h4{font-size:1.05rem; font-family:var(--font-body); font-weight:700; margin:1.5rem 0 .2rem; color:var(--ink)}

p{margin:0 0 1.05rem}
strong{font-weight:700}
em{font-style:italic}
a{color:var(--terracotta-deep); text-underline-offset:2px; text-decoration-thickness:.06em}

/* Opening drop cap (added by JS to the first body paragraph) */
p.dropcap::first-letter{
  font-family:var(--font-display); font-weight:600; float:left;
  font-size:3.9em; line-height:.78; padding:.06em .09em 0 0; color:var(--terracotta);
}

/* Lead subtitle italic line right under the title */
.page > p > em:only-child{color:var(--ink-soft)}

/* Blockquotes → the "honest note" device */
blockquote{
  margin:1.6rem 0; padding:1.1rem 1.3rem; background:var(--terracotta-tint);
  border-left:3px solid var(--terracotta); border-radius:0 10px 10px 0;
}
blockquote p{margin:0 0 .6rem; color:var(--terracotta-deep); font-size:.97em}
blockquote p:last-child{margin:0}
blockquote strong{color:var(--terracotta-deep)}

/* Conversation snippet — "a buddy you text, not a dusty app" (static in the book) */
.chat{margin:1.6rem 0; padding:1.05rem 1.25rem; background:var(--paper-card); border:1px solid var(--hairline); border-radius:12px; break-inside:avoid}
.chat p{margin:0}
.chat .you{font-family:var(--font-mono); font-size:.9em; color:var(--ink); padding-left:1.15rem; text-indent:-1.15rem}
.chat .you::before{content:"\203A  "; color:var(--terracotta); font-weight:700}
.chat .coach{color:var(--ink-soft); padding-left:1rem; border-left:2px solid var(--terracotta-tint); margin-top:.45rem}
.chat .coach + .you{margin-top:.95rem}
.chat .fig{font-family:var(--font-mono); color:var(--ink); font-weight:500; font-variant-numeric:tabular-nums}

/* Lists */
ul,ol{margin:0 0 1.15rem; padding-left:1.3rem}
li{margin:.35rem 0}
li::marker{color:var(--terracotta)}

/* Inline + block code */
code{font-family:var(--font-mono); font-size:.86em; background:var(--paper-tint); padding:.12em .35em; border-radius:5px; color:var(--ink)}
pre{background:#2A2A28; color:#F4EFE6; padding:1rem 1.15rem; border-radius:10px; overflow-x:auto; margin:1.3rem 0; font-size:.82rem; line-height:1.55}
pre code{background:none; color:inherit; padding:0; font-size:inherit}

/* Tables — the honest comparison */
table{width:100%; border-collapse:collapse; margin:1.6rem 0; font-size:.9rem; font-family:var(--font-body)}
th,td{text-align:left; padding:.6rem .7rem; border-bottom:1px solid var(--hairline); vertical-align:top}
thead th{font-family:var(--font-body); font-weight:700; font-size:.78rem; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); border-bottom:2px solid var(--terracotta)}
tbody tr:nth-child(even){background:var(--paper-tint)}
td:first-child,th:first-child{font-weight:600}

/* Figures */
img{display:block; max-width:100%; height:auto; margin:1.6rem auto; border:1px solid var(--hairline); border-radius:12px; background:#fff}

hr{border:0; height:1px; background:var(--hairline); margin:2.4rem 0}

/* Footnotes (markdown-it-footnote) */
.footnotes{margin-top:3rem; padding-top:1.2rem; border-top:2px solid var(--terracotta); font-size:.82rem; color:var(--ink-soft)}
.footnotes ol{padding-left:1.2rem}
.footnotes li{margin:.5rem 0}
.footnotes p{margin:0; word-break:break-word}
.footnote-ref a{font-family:var(--font-mono); font-size:.72em; text-decoration:none; padding:0 .1em; color:var(--terracotta)}
.footnote-backref{text-decoration:none}

/* Contents block spacing */
h2#contents + ol, .page > ol:first-of-type{line-height:1.9}

/* Reading-progress + print button (screen only) */
.toolbar{position:fixed; top:0; left:0; right:0; height:3px; z-index:50; background:transparent}
.toolbar .bar{height:100%; width:0; background:var(--terracotta); transition:width .1s linear}
.printbtn{position:fixed; right:1rem; bottom:1rem; z-index:50; background:var(--terracotta-deep); color:#fff; border:0; border-radius:10px; padding:.7rem 1rem; font-family:var(--font-body); font-weight:600; font-size:.9rem; cursor:pointer; box-shadow:0 4px 14px rgba(0,0,0,.14)}
.printbtn:hover{background:var(--terracotta-hover)}

/* Sample cutoff CTA */
.cutoff{margin:2.5rem 0 0; padding:1.6rem; text-align:center; background:var(--paper-card); border:1px solid var(--hairline); border-radius:14px}
.cutoff h3{margin:.2rem 0 .5rem}
.cutoff .buy{display:inline-block; margin-top:.6rem; background:var(--terracotta-deep); color:#fff; text-decoration:none; font-family:var(--font-body); font-weight:600; padding:.8rem 1.4rem; border-radius:10px}
.cutoff .buy:hover{background:var(--terracotta-hover)}

/* ---------- PRINT ---------- */
@media print{
  @page{ size:A4; margin:20mm 18mm; }
  body{background:#fff; font-size:11pt; line-height:1.5}
  .page{max-width:none; padding:0}
  .toolbar,.printbtn,.cutoff{display:none !important}
  h1,h2,h3,h4{break-after:avoid}
  pre,blockquote,table,img,figure{break-inside:avoid}
  pre{background:#f4f1ea; color:#26251f; border:1px solid #ddd}
  a{color:var(--ink); text-decoration:none}
  img{border-color:#ddd}
  h2{break-before:auto}
}
