/* ============================================================
   Hands-On RAG for Production — book site
   Clean editorial: paper-white, serif headlines, one teal accent
   ============================================================ */

:root {
  --paper:      #fbfaf8;
  --paper-2:    #f3f1ec;
  --ink:        #1b1a17;
  --ink-soft:   #4a4843;
  --ink-faint:  #6f6c65;
  --line:       #e4e0d8;
  --teal:       #0f766e;
  --teal-dark:  #0b574f;
  --teal-tint:  #e6f1ef;
  --white:      #ffffff;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1080px;
  --r:    14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 250, 248, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 600; }
.brand:hover { color: var(--ink); }
.brand-mark {
  font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .08em;
  color: var(--white); background: var(--teal);
  padding: 5px 8px; border-radius: 7px;
}
.brand-text { font-family: var(--serif); font-size: 17px; }
@media (max-width: 560px) { .brand-text { display: none; } }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a { color: var(--ink-soft); font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--ink); }
.nav-cta {
  color: var(--white) !important; background: var(--teal);
  padding: 9px 18px; border-radius: 999px;
}
.nav-cta:hover { background: var(--teal-dark); }
@media (max-width: 820px) { .nav { display: none; } }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }
@media (max-width: 820px) { .nav-toggle { display: flex; } }

.nav-mobile { display: none; flex-direction: column; padding: 8px 24px 18px; border-bottom: 1px solid var(--line); background: var(--paper); }
.nav-mobile.open { display: flex; }
.nav-mobile a { padding: 12px 0; color: var(--ink-soft); font-weight: 500; border-bottom: 1px solid var(--line); }
.nav-mobile a:last-child { border-bottom: 0; color: var(--teal); }

/* ---------- Hero ---------- */
.hero { padding: 84px 0 72px; overflow: hidden; }
.hero-inner { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 64px; align-items: center; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; color: var(--ink-faint); text-transform: uppercase; margin: 0 0 18px; }
.hero h1 { font-size: clamp(42px, 6vw, 72px); line-height: 1.02; margin: 0 0 22px; }
.subtitle { font-family: var(--serif); font-style: italic; font-size: clamp(20px, 2.4vw, 26px); color: var(--ink-soft); margin: 0 0 22px; }
.lede { font-size: 18px; color: var(--ink-soft); max-width: 32em; margin: 0 0 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 28px; }
.byline { font-size: 15px; color: var(--ink-faint); margin: 0; }
.byline strong { color: var(--ink); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; padding: 13px 26px; border-radius: 999px; transition: transform .12s ease, background .2s ease, border-color .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-dark); color: var(--white); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-faint); }

/* ---------- Book cover mockup ---------- */
.hero-cover { display: flex; justify-content: center; }
.book {
  position: relative; width: 300px; aspect-ratio: 3 / 4;
  border-radius: 4px 8px 8px 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 22px 48px -14px rgba(27,26,23,.45);
  transform: rotate(-2deg); transition: transform .35s ease;
}
.book:hover { transform: rotate(0deg) translateY(-4px); }
.book-cover {
  width: 300px; height: auto; border-radius: 10px;
  box-shadow: 0 30px 60px -20px rgba(15,40,40,.45), 0 10px 20px -10px rgba(0,0,0,.2);
  transform: rotate(-2deg);
  transition: transform .25s ease;
}
.book-cover:hover { transform: rotate(0deg) translateY(-4px); }
.book-spine { position: absolute; inset: 0 auto 0 0; width: 12px; border-radius: 4px 0 0 4px; background: linear-gradient(90deg, var(--teal-dark), var(--teal)); }
.book-face {
  position: absolute; inset: 0; padding: 30px 26px 26px 30px;
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line); border-left: 0;
  border-radius: 0 8px 8px 0;
  background-image: linear-gradient(180deg, #ffffff 0%, #fcfbf9 100%);
}
.book-pub { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--teal); margin: 0 0 auto; }
.book-title { font-family: var(--serif); font-size: 30px; line-height: 1.06; color: var(--ink); margin: 12px 0 14px; }
.book-sub { font-size: 12.5px; color: var(--ink-faint); line-height: 1.4; margin: 0 0 16px; }
.book-rule { height: 3px; width: 46px; background: var(--teal); border-radius: 2px; margin-bottom: 14px; }
.book-authors { font-family: var(--serif); font-size: 14px; color: var(--ink-soft); margin: 0; }

/* ---------- Sections ---------- */
.section { padding: 84px 0; }
.section-alt { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kicker { font-family: var(--mono); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); margin: 0 0 12px; }
.section-title { font-size: clamp(28px, 4vw, 42px); line-height: 1.1; margin: 0 0 24px; max-width: 16em; }
.prose { font-size: 18px; color: var(--ink-soft); max-width: 44em; }
.prose p { margin: 0 0 18px; }
.prose-center { margin-left: auto; margin-right: auto; text-align: center; }

/* ---------- Learn grid ---------- */
.learn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 44px; }
.learn-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 26px 24px; transition: transform .15s ease, box-shadow .2s ease; }
.learn-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(27,26,23,.35); }
.learn-card h3 { font-size: 20px; margin: 0 0 10px; color: var(--ink); }
.learn-card p { margin: 0; font-size: 15.5px; color: var(--ink-soft); line-height: 1.6; }
@media (max-width: 860px) { .learn-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .learn-grid { grid-template-columns: 1fr; } }

/* ---------- Praise ---------- */
.praise-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-top: 40px; }
.praise-col { display: flex; flex-direction: column; gap: 20px; }
.quote-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px 26px 24px;
  margin: 0;
}
.quote-card blockquote {
  font-family: var(--serif); font-size: 17px; font-style: italic;
  line-height: 1.6; color: var(--ink);
  margin: 0;
}
.quote-card figcaption { margin-top: 18px; }
.quote-name { display: block; font-weight: 600; font-size: 15px; color: var(--ink); }
.quote-role { display: block; font-size: 14px; color: var(--ink-faint); line-height: 1.4; }
@media (max-width: 720px) { .praise-grid { grid-template-columns: 1fr; } }

/* ---------- Table of contents ---------- */
.toc { list-style: none; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.toc li { display: flex; align-items: baseline; gap: 18px; padding: 18px 4px; border-bottom: 1px solid var(--line); }
.toc-num { font-family: var(--mono); font-size: 14px; color: var(--teal); min-width: 26px; }
.toc-name { font-family: var(--serif); font-size: 18px; color: var(--ink); flex: 1; }
.toc-note { margin-top: 20px; }
.toc-link { font-size: 13px; font-weight: 600; color: var(--teal); text-decoration: none; white-space: nowrap; border-bottom: 1px solid transparent; }
.toc-link:hover { border-bottom-color: currentColor; }
.toc-none { font-size: 13px; color: var(--ink-faint); white-space: nowrap; }
@media (max-width: 720px) { .toc { grid-template-columns: 1fr; } }

/* ---------- Code section ---------- */
.code-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.code-copy .prose { margin-bottom: 28px; }
.code-window { background: #14181d; border-radius: var(--r); overflow: hidden; box-shadow: 0 24px 50px -20px rgba(27,26,23,.5); }
.code-bar { display: flex; gap: 8px; padding: 14px 16px; background: #1c2127; border-bottom: 1px solid #262c33; }
.code-bar span { width: 11px; height: 11px; border-radius: 50%; background: #3a424b; }
.code-bar span:nth-child(1) { background: #ec6a5e; }
.code-bar span:nth-child(2) { background: #f4bf4f; }
.code-bar span:nth-child(3) { background: #61c554; }
.code-body { margin: 0; padding: 22px 22px 26px; font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: #d6dde4; overflow-x: auto; }
.c-com { color: #6b7681; font-style: italic; }
.c-kw  { color: #7cc7ff; }
.c-str { color: #a3e3a0; }
@media (max-width: 820px) { .code-inner { grid-template-columns: 1fr; gap: 36px; } }

/* ---------- Authors ---------- */
.authors { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 40px; }
.author { display: flex; gap: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.author-initials { flex: 0 0 56px; height: 56px; border-radius: 50%; background: var(--teal-tint); color: var(--teal-dark); font-family: var(--serif); font-weight: 600; font-size: 20px; display: grid; place-items: center; }
.author-body h3 { font-size: 21px; margin: 4px 0 10px; color: var(--ink); }
.author-body p { margin: 0; font-size: 15.5px; color: var(--ink-soft); line-height: 1.6; }
@media (max-width: 720px) { .authors { grid-template-columns: 1fr; } }

/* ---------- Buy ---------- */
.buy { text-align: center; }
.buy .kicker, .buy .section-title { text-align: center; }
.buy .section-title { margin-left: auto; margin-right: auto; }
.store-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 44px 0 28px; text-align: left; }
.store { display: flex; flex-direction: column; gap: 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 24px 26px; transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease; }
.store:hover { transform: translateY(-3px); border-color: var(--teal); box-shadow: 0 16px 32px -20px rgba(15,118,110,.5); }
.store-name { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); }
.store-sub { font-size: 14px; color: var(--ink-faint); font-weight: 500; }
.isbn { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); margin: 0; }
@media (max-width: 820px) { .store-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .store-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding: 54px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.footer-title { font-family: var(--serif); font-size: 22px; margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 26px; }
.footer-nav a { color: #c9c6bf; font-size: 15px; font-weight: 500; }
.footer-nav a:hover { color: var(--white); }
.footer-fine { font-size: 13.5px; color: #8d8a83; margin: 0; }

/* ---------- Responsive hero ---------- */
@media (max-width: 880px) {
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .hero-cover { order: -1; }
  .book, .book-cover { width: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .btn:hover, .book:hover, .learn-card:hover, .store:hover { transform: none; }
}
