/* Marrow theme for bs4_book: clean and light (Stripe-like), in the Warrior colorway.
   Class tan #C69B6D, a darker brown #8f5a2a for readable text links, rage red #d1312a. */

:root {
  --ink: #1a1f36;        /* headings */
  --text: #425466;       /* body */
  --muted: #697386;
  --line: #e3e8ee;
  --wash: #f6f9fc;       /* off-white panels */
  --tan: #c69b6d;        /* Warrior class color */
  --brown: #8f5a2a;
  --rage: #d1312a;       /* rage bar red */
  --grad: linear-gradient(90deg, #c69b6d 0%, #b0602f 45%, #d1312a 100%);
}

body { color: var(--text); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }

/* signature gradient band across the top */
body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: 4px;
  background: var(--grad); z-index: 1000;
}

/* headings */
h1, h2, h3, h4 { color: var(--ink); font-weight: 650; letter-spacing: -0.02em; }
main h1 { font-size: 2.6rem; line-height: 1.15; margin-top: 1.5rem; }
main h1 .header-section-number {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
main h2 { font-size: 1.6rem; margin-top: 3rem; }
main h3 { font-size: 1.2rem; margin-top: 2rem; }
.header-section-number { color: var(--muted); font-weight: 500; margin-right: .35em; }

main p, main li { line-height: 1.7; font-size: 1.02rem; }

/* links */
a { color: var(--brown); text-decoration: none; transition: color .15s; }
a:hover { color: var(--rage); text-decoration: none; }
main a { border-bottom: 1px solid rgba(198,155,109,.45); }
main a:hover { border-bottom-color: var(--rage); }

/* left sidebar */
.sidebar-book, .book-toc { background: #fff; }
.sidebar-book { border-right: 1px solid var(--line); }
.sidebar-book .title a, .book .title { color: var(--ink); font-weight: 700; letter-spacing: -0.01em; border: 0; }
.book-toc a { color: var(--text); border-radius: 6px; }
.book-toc a:hover { color: var(--ink); background: #edf1f6; }
.book-toc .active { color: var(--brown) !important; font-weight: 600; }
.book-toc .book-part { color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; font-weight: 600; margin-top: 1rem; }

/* search box */
#search, input[type="search"] { border-radius: 8px; border: 1px solid var(--line); background: #fff; }
#search:focus, input[type="search"]:focus { border-color: var(--tan); box-shadow: 0 0 0 3px rgba(198,155,109,.25); }

/* right "on this page" */
#toc .nav-link { color: var(--muted); border-left: 2px solid transparent; }
#toc .nav-link:hover { color: var(--ink); }
#toc .nav-link.active, #toc .nav-link:focus {
  background: transparent !important; color: var(--ink) !important; font-weight: 600;
  border-left: 2px solid var(--rage); padding-left: .5rem;
}
#toc h2 { color: var(--muted); text-transform: uppercase; font-size: .72rem; letter-spacing: .08em; }

/* figures: soft cards */
.figure, figure { margin: 2rem 0; }
.figure img, figure img {
  border-radius: 12px; background: #fff;
  box-shadow: 0 13px 27px -5px rgba(50,50,93,.18), 0 8px 16px -8px rgba(0,0,0,.2);
}
.caption, figcaption, caption { color: var(--muted); font-size: .88rem; }
main hr { border-top: 1px solid var(--line); }

/* tables: bordered card, quiet header */
main table {
  border-collapse: separate; border-spacing: 0; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: .92rem;
}
main thead th {
  background: var(--wash); color: var(--muted) !important; font-weight: 600;
  text-transform: uppercase; font-size: .72rem; letter-spacing: .06em;
  border-bottom: 1px solid var(--line) !important; border-top: 0 !important;
}
main td, main th { border-color: var(--line) !important; padding: .6rem .85rem !important; }
main tbody tr:hover { background: #fbfaf8; }

/* code */
code { color: var(--brown); background: #f7f3ee; border-radius: 4px; padding: .1em .3em; }
pre { background: var(--wash) !important; border: 1px solid var(--line); border-radius: 10px; }
pre code { background: none; color: var(--ink); padding: 0; }

/* quotes / callouts: gradient rule */
blockquote {
  border: 0; position: relative; padding: .75rem 1.25rem; margin: 1.5rem 0;
  background: var(--wash); border-radius: 0 10px 10px 0; color: var(--text);
}
blockquote::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad);
}

/* prev / next chapter buttons */
.chapter-nav a, .btn {
  border-radius: 999px; border: 1px solid var(--line); background: #fff;
  box-shadow: 0 2px 5px -1px rgba(50,50,93,.15), 0 1px 3px -1px rgba(0,0,0,.2);
}
.btn-primary { background: var(--brown); border-color: var(--brown); color: #fff; }
.btn-primary:hover { background: var(--rage); border-color: var(--rage); }

/* make the top gradient band a little more present */
body::before { height: 5px; }

/* Ko-fi: quiet pill in the sidebar, short card at the end of each chapter */
.kofi-side, .kofi-note a, .kofi-inline {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .9rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  color: #fff !important; background: var(--brown); border: 0 !important;
  box-shadow: 0 2px 5px -1px rgba(50,50,93,.2), 0 1px 3px -1px rgba(0,0,0,.25);
  transition: background .15s, transform .15s;
}
.kofi-side:hover, .kofi-note a:hover, .kofi-inline:hover { background: var(--rage); color: #fff !important; transform: translateY(-1px); }
.kofi-side { margin: 1rem 0 0 .25rem; }
.kofi-note {
  margin: 3rem 0 1.5rem; padding: 1rem 1.25rem; border-radius: 12px;
  background: var(--wash); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.kofi-note p { margin: 0; color: var(--text); font-size: .95rem; }
.kofi-inline { border-bottom: 0 !important; }

/* Plots fit the text column: knitr gives every chart a fixed width (960px at fig.width = 10) that is wider than the
   column, so bs4_book's figure box scrolled sideways. Scale them down instead; they are drawn at 2x, so they stay sharp. */
main img, .figure img, figure img { max-width: 100%; height: auto; }
.figure, figure { overflow-x: visible; }
main .html-widget { max-width: 100%; }

/* "← marrowwow.com" above the book's title */
.site-home { display: inline-block; font-size: .8rem; font-weight: 500; color: var(--muted) !important; margin: .25rem 0 .35rem;
             border: 0 !important; }
.site-home:hover { color: var(--rage) !important; }
