/* Coffee & Standards — site styles */
:root {
  --cream: #FBF6EE;
  --cream-2: #F4ECDD;
  --paper: #FFFDF8;
  --espresso: #2E1A12;
  --espresso-2: #4A2C1D;
  --mocha: #6B4226;
  --rust: #B8541A;
  --rust-dark: #954114;
  --gold: #D4A574;
  --ink: #1F1710;
  --muted: #6F5B4A;
  --rule: #E4D8C4;
  --shadow: 0 6px 24px rgba(46, 26, 18, 0.08);
  --shadow-lg: 0 14px 40px rgba(46, 26, 18, 0.14);
  --radius: 10px;
  --maxw: 1200px;
  --content-maxw: 720px;
  --serif-display: 'Fraunces', 'Georgia', serif;
  --serif-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--serif-body);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--rust); text-decoration: none; border-bottom: 1px solid transparent; transition: color .15s, border-color .15s; }
a:hover { color: var(--rust-dark); border-bottom-color: var(--rust-dark); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--espresso); color: var(--cream); padding: .5rem 1rem; border-radius: 6px; z-index: 1000; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(46, 26, 18, 0.98);
  color: var(--cream);
  backdrop-filter: saturate(120%) blur(8px);
  border-bottom: 1px solid rgba(212, 165, 116, 0.25);
}
.header-inner { display: flex; align-items: center; gap: 1.5rem; padding: .85rem 1.5rem; }
.brand { display: flex; align-items: center; gap: .85rem; color: var(--cream); border-bottom: none; }
.brand:hover { color: var(--gold); }
.brand-mark { color: var(--gold); display: inline-flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-family: var(--serif-display); font-weight: 700; font-size: 1.2rem; letter-spacing: .01em; }
.brand-sub { font-family: var(--sans); font-size: .72rem; color: var(--gold); letter-spacing: .06em; text-transform: uppercase; }
.top-nav { margin-left: auto; display: flex; gap: 1.75rem; font-family: var(--sans); font-size: .92rem; }
.top-nav a { color: var(--cream); opacity: .82; border-bottom: none; }
.top-nav a:hover { color: var(--gold); opacity: 1; }
.menu-toggle { display: none; background: none; border: none; color: var(--cream); font-size: 1.5rem; cursor: pointer; }

/* ---------- Layout: sidebar + content ---------- */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; display: grid; grid-template-columns: 280px 1fr; gap: 3rem; align-items: start; }
.page-home .layout, .page-contents .layout { grid-template-columns: 1fr; gap: 0; padding: 0; max-width: none; }
.page-home .sidebar, .page-contents .sidebar { display: none; }

.sidebar { position: sticky; top: 72px; max-height: calc(100vh - 72px); overflow-y: auto; padding: 2rem 0; font-family: var(--sans); font-size: .9rem; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
.sidebar-title { font-family: var(--serif-display); font-size: .78rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; font-weight: 600; }
.nav-section { margin-bottom: 1.5rem; }
.nav-section h3 { font-family: var(--sans); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mocha); margin: 0 0 .5rem; font-weight: 600; }
.nav-section ul { list-style: none; padding: 0; margin: 0; }
.nav-section li { margin: 0; }
.nav-section a {
  display: block; padding: .4rem .6rem; color: var(--espresso-2);
  border-radius: 6px; border-bottom: none; border-left: 2px solid transparent;
  font-size: .88rem; line-height: 1.4;
}
.nav-section a:hover { background: var(--cream-2); color: var(--espresso); }
.nav-section a.active { background: var(--cream-2); color: var(--rust-dark); border-left-color: var(--rust); font-weight: 600; }
.nav-section .chnum { display: inline-block; min-width: 1.5em; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Chapter content ---------- */
.content { padding: 2.5rem 0 4rem; min-width: 0; }
.chapter { max-width: var(--content-maxw); }
.chapter-head { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.eyebrow { font-family: var(--sans); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--rust); margin: 0 0 .5rem; font-weight: 600; }
.chapter-number { font-family: var(--serif-display); font-size: 1rem; color: var(--mocha); margin: 0 0 .25rem; font-style: italic; }
.chapter-head h1 { font-family: var(--serif-display); font-size: 2.4rem; line-height: 1.15; margin: 0; color: var(--espresso); font-weight: 600; letter-spacing: -0.01em; }

.prose { font-family: var(--serif-body); }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif-display); color: var(--espresso); font-weight: 600; line-height: 1.25; margin-top: 2em; margin-bottom: .6em; letter-spacing: -0.01em; }
.prose h1 { font-size: 1.9rem; }
.prose h2 { font-size: 1.55rem; border-bottom: 1px solid var(--rule); padding-bottom: .3em; }
.prose h3 { font-size: 1.2rem; color: var(--espresso-2); }
.prose h4 { font-size: 1.05rem; color: var(--mocha); }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.2em 1.3em; padding: 0; }
.prose li { margin-bottom: .4em; }
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2.5em 0; }
.prose blockquote {
  border-left: 3px solid var(--rust);
  padding: .25em 1.2em;
  margin: 1.5em 0;
  color: var(--espresso-2);
  font-style: italic;
  background: var(--cream-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose strong { color: var(--espresso); }
.prose em { color: var(--espresso-2); }
.prose code { background: var(--cream-2); padding: 1px 6px; border-radius: 4px; font-size: .9em; font-family: 'SF Mono', Consolas, monospace; color: var(--rust-dark); }
.prose pre { background: var(--espresso); color: var(--cream); padding: 1rem 1.2rem; border-radius: var(--radius); overflow-x: auto; font-size: .9em; }
.prose pre code { background: transparent; color: inherit; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .94em; }
.prose th, .prose td { text-align: left; padding: .6em .8em; border-bottom: 1px solid var(--rule); }
.prose th { background: var(--cream-2); font-family: var(--sans); font-weight: 600; color: var(--espresso); }
.prose a { border-bottom: 1px solid rgba(184, 84, 26, .3); }
.prose a:hover { border-bottom-color: var(--rust); }

/* Task lists (GitHub-style `- [ ]` / `- [x]`) — hide bullet, style checkbox */
.prose ul:has(input[type="checkbox"]) { list-style: none; padding-left: .25rem; margin-left: 0; }
.prose li:has(> input[type="checkbox"]) { list-style: none; padding-left: 0; margin-bottom: .55em; display: flex; align-items: flex-start; gap: .7rem; line-height: 1.55; }
.prose li > input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 1.1em; height: 1.1em; flex: 0 0 auto; margin: .25em 0 0;
  border: 1.5px solid var(--mocha); border-radius: 3px; background: var(--paper);
  cursor: pointer; transition: all .12s; position: relative;
}
.prose li > input[type="checkbox"]:hover { border-color: var(--rust); }
.prose li > input[type="checkbox"]:checked { background: var(--rust); border-color: var(--rust); }
.prose li > input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 30%; top: 8%; width: 30%; height: 60%;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Practice Tips callout */
.practice-tips {
  margin: 3rem 0 1rem;
  padding: 1.5rem 1.8rem 1.6rem;
  background: linear-gradient(180deg, #FBF1DF 0%, #F4E4C6 100%);
  border: 1px solid var(--gold);
  border-left: 5px solid var(--rust);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.practice-tips h2 {
  font-family: var(--serif-display);
  font-size: 1.25rem;
  margin: 0 0 .9rem;
  color: var(--espresso);
  border: none;
  padding: 0;
  letter-spacing: .01em;
}
.practice-tips ol, .practice-tips ul { margin: 0 0 0 1.3rem; padding: 0; }
.practice-tips li { margin-bottom: .55em; font-size: .98rem; line-height: 1.55; color: var(--espresso-2); }
.practice-tips li::marker { color: var(--rust); font-weight: 700; }
.practice-tips p { margin: 0; font-style: italic; color: var(--mocha); }

/* Pager */
.pager {
  margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.pager a { display: flex; flex-direction: column; padding: 1rem 1.2rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); border-bottom-width: 1px; font-family: var(--sans); transition: all .15s; }
.pager a:hover { border-color: var(--rust); transform: translateY(-1px); box-shadow: var(--shadow); }
.pager a span { font-size: .8rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: .3rem; }
.pager a strong { color: var(--espresso); font-weight: 600; font-family: var(--serif-display); font-size: 1.02rem; }
.pager-next { text-align: right; }

/* ---------- Home page ---------- */
.page-home .content, .page-contents .content { padding: 0; max-width: none; }
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #2E1A12 0%, #4A2C1D 55%, #6B4226 100%);
  color: var(--cream);
  padding: 5.5rem 1.5rem 5rem;
  border-bottom: 4px solid var(--gold);
}
.hero-inner { max-width: 860px; margin: 0 auto; position: relative; z-index: 2; text-align: center; }
.hero-eyebrow { font-family: var(--sans); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-size: .82rem; margin: 0 0 1rem; }
.hero-title { font-family: var(--serif-display); font-size: clamp(2.8rem, 6vw, 4.8rem); margin: 0; line-height: 1; font-weight: 700; letter-spacing: -0.02em; color: #FFF; }
.hero-subtitle { font-family: var(--serif-display); font-size: clamp(1.1rem, 2.2vw, 1.5rem); margin: 1rem 0 1.8rem; color: var(--gold); font-style: italic; font-weight: 400; }
.hero-lede { max-width: 620px; margin: 0 auto 2.2rem; font-size: 1.12rem; color: rgba(251, 246, 238, .88); line-height: 1.6; }
.hero-ctas { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-block; padding: .85rem 1.6rem; border-radius: 999px; font-family: var(--sans); font-weight: 600; font-size: .95rem; letter-spacing: .01em; border: 2px solid transparent; transition: all .15s; border-bottom: 2px solid transparent; }
.btn-primary { background: var(--rust); color: #FFF; border-color: var(--rust); }
.btn-primary:hover { background: var(--rust-dark); border-color: var(--rust-dark); color: #FFF; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--cream); border-color: rgba(212, 165, 116, .5); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.hero-art { position: absolute; inset: 0; pointer-events: none; opacity: .12; }
.coffee-ring { position: absolute; border: 3px solid var(--gold); border-radius: 50%; top: 15%; right: -5%; width: 340px; height: 340px; }
.coffee-ring.ring-2 { width: 180px; height: 180px; top: auto; bottom: -5%; right: auto; left: 5%; border-color: var(--cream); }
.hero-cup { position: absolute; right: 8%; bottom: 12%; color: var(--gold); transform: scale(3.2); opacity: .35; }

.blurb { background: var(--paper); padding: 4rem 1.5rem; border-bottom: 1px solid var(--rule); }
.blurb-inner { max-width: 680px; margin: 0 auto; font-size: 1.08rem; color: var(--espresso-2); }
.blurb-heading {
  font-family: var(--serif-display);
  font-size: 2rem;
  text-align: center;
  margin: 0 0 1.8rem;
  color: var(--espresso);
  font-weight: 600;
  letter-spacing: -0.01em;
  border: none;
  padding: 0;
}
.blurb-inner p:first-of-type { font-size: 1.15rem; }

.parts-grid { padding: 4.5rem 1.5rem; max-width: 1180px; margin: 0 auto; }
.section-title { font-family: var(--serif-display); font-size: 2.2rem; text-align: center; margin: 0 0 .5rem; color: var(--espresso); font-weight: 600; letter-spacing: -0.01em; }
.section-lede { text-align: center; color: var(--muted); max-width: 560px; margin: 0 auto 3rem; font-size: 1.02rem; }
.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.part-card {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.8rem 1.6rem; transition: transform .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.part-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--rust), var(--gold)); }
.part-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.part-eyebrow { font-family: var(--sans); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--rust); margin: 0 0 .4rem; font-weight: 600; }
.part-card h3 { font-family: var(--serif-display); font-size: 1.25rem; margin: 0 0 1.2rem; color: var(--espresso); line-height: 1.25; font-weight: 600; }
.part-chapters { list-style: none; padding: 0; margin: 0; }
.part-chapters li { margin: 0; }
.part-chapters a { display: flex; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--rule); color: var(--espresso-2); font-family: var(--sans); font-size: .92rem; line-height: 1.35; align-items: baseline; }
.part-chapters li:last-child a { border-bottom: none; }
.part-chapters a:hover { color: var(--rust); }
.part-chapters .n { color: var(--rust); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 1.4em; }

.extras { margin-top: 2.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.extra-link { display: flex; flex-direction: column; padding: 1.2rem 1.4rem; background: var(--cream-2); border-radius: var(--radius); color: var(--espresso); border-bottom: none; transition: all .15s; }
.extra-link:hover { background: var(--espresso); color: var(--cream); transform: translateY(-2px); }
.extra-link strong { font-family: var(--serif-display); font-size: 1.05rem; margin-bottom: .2rem; }
.extra-link span { font-family: var(--sans); font-size: .85rem; opacity: .8; }

.pull-quote { background: var(--espresso); color: var(--cream); padding: 4rem 1.5rem; }
.pull-quote blockquote {
  max-width: 780px; margin: 0 auto; font-family: var(--serif-display); font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  line-height: 1.4; font-style: italic; text-align: center; border: none; padding: 0; background: none;
}
.pull-quote cite { display: block; font-size: 1rem; color: var(--gold); font-style: normal; font-family: var(--sans); letter-spacing: .08em; margin-top: 1.5rem; text-transform: uppercase; }

/* ---------- Contents page ---------- */
.toc-full { max-width: 760px; }
.toc-part { margin-bottom: 2.5rem; }
.toc-part h2 { font-family: var(--serif-display); font-size: 1.4rem; color: var(--espresso); margin: 0 0 .8rem; padding-bottom: .4rem; border-bottom: 2px solid var(--rust); display: flex; align-items: baseline; gap: .8rem; font-weight: 600; }
.toc-part-num { font-size: .75rem; font-family: var(--sans); letter-spacing: .15em; text-transform: uppercase; color: var(--rust); font-weight: 600; }
.toc-part ol { list-style: none; padding: 0; margin: 0; }
.toc-part li { margin: 0; }
.toc-part a { display: flex; gap: 1rem; padding: .7rem .5rem; border-bottom: 1px solid var(--rule); color: var(--espresso-2); border-radius: 4px; font-family: var(--serif-body); font-size: 1.02rem; }
.toc-part a:hover { background: var(--cream-2); color: var(--rust); }
.toc-part .n { color: var(--rust); font-weight: 600; min-width: 1.6em; font-variant-numeric: tabular-nums; }
.toc-part .t { flex: 1; }

/* ---------- About page ---------- */
.about-author .prose p { font-size: 1.08rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--espresso); color: rgba(251, 246, 238, .75); padding: 2.5rem 0; margin-top: 4rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; font-family: var(--sans); font-size: .88rem; }
.footer-note { color: var(--gold); opacity: .75; font-size: .82rem; margin: 0; }
.footer-inner p { margin: 0; }
.footer-links { margin: 0; }
.footer-links a {
  display: inline-flex; align-items: center; gap: .45rem;
  color: var(--gold); border-bottom: none;
  font-family: var(--sans); font-size: .9rem;
  padding: .35rem .8rem; border: 1px solid rgba(212, 165, 116, .35); border-radius: 999px;
  transition: all .15s;
}
.footer-links a:hover { background: var(--gold); color: var(--espresso); border-color: var(--gold); }

.author-links { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.author-links .btn { display: inline-flex; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--paper); padding: 1.5rem; z-index: 40; max-height: none;
    transform: translateX(-100%); transition: transform .2s;
    border-right: 1px solid var(--rule); width: 85%; max-width: 340px;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: block; }
  .top-nav { display: none; }
  .content { padding: 2rem 0 3rem; }
  .chapter-head h1 { font-size: 1.9rem; }
  .hero { padding: 3.5rem 1.5rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .brand-sub { display: none; }
  .brand-title { font-size: 1.05rem; }
  .hero-title { font-size: 2.4rem; }
  .section-title { font-size: 1.7rem; }
}

/* Cover page */
.covers-page .cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 3rem;
  margin: 2.5rem 0 2rem;
  align-items: start;
}
.covers-page .cover-figure {
  margin: 0;
  text-align: center;
}
.covers-page .cover-figure img {
  width: 100%;
  max-width: 460px;
  height: auto;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--rule);
  background: var(--espresso);
  display: block;
  margin: 0 auto;
}
.covers-page .cover-figure figcaption {
  font-family: var(--sans);
  font-size: .85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 1rem;
}
.covers-page .cover-downloads {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.covers-page .cover-spec {
  margin-top: 1.5rem;
  font-size: .95rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.part-card-appendix .part-chapters .n {
  font-style: italic;
  color: var(--rust);
}

.top-nav .top-nav-linkedin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(212, 165, 116, 0.12);
  color: var(--gold);
  border-bottom: none;
  margin-left: .25rem;
  transition: background .15s, color .15s;
}
.top-nav .top-nav-linkedin:hover { background: var(--gold); color: var(--espresso); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.top-nav .top-nav-pdf {
  display: inline-flex;
  align-items: center;
  padding: .35rem .7rem;
  border-radius: 4px;
  background: var(--rust);
  color: var(--cream);
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: 1px;
  border-bottom: none;
  margin-left: .25rem;
  transition: background .15s;
}
.top-nav .top-nav-pdf:hover { background: var(--rust-dark); color: var(--cream); }
