@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #f1ede4;
  --white: #ffffff;
  --ink: #111111;
  --body: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e0d8;
  --border-light: #f0ece6;
  --accent: #c2410c;
  --accent-light: #fff7ed;
  --accent-border: #fed7aa;
  --green: #059669;
  --sidebar-width: 260px;
}

html { scroll-behavior: smooth; }
body { font-family: 'DM Sans', sans-serif; background: var(--cream); color: var(--body); line-height: 1.8; }

/* ── SITE NAV ── */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: rgba(255,255,255,0.97); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px;
}
.site-nav .logo { font-family: 'Playfair Display', serif; font-size: 17px; color: var(--ink); text-decoration: none; }
.site-nav .logo span { color: var(--accent); }
.site-nav .nav-links { display: flex; gap: 28px; align-items: center; }
.site-nav .nav-links a { font-size: 13px; color: var(--muted); text-decoration: none; transition: color 0.2s; }
.site-nav .nav-links a:hover { color: var(--accent); }
.site-nav .nav-cta { font-size: 12px; font-weight: 500; color: var(--accent); border: 1px solid var(--accent-border); background: var(--accent-light); padding: 7px 16px; border-radius: 100px; text-decoration: none; transition: all 0.2s; }
.site-nav .nav-cta:hover { background: var(--accent); color: white; }

/* ── CHAPTER LAYOUT ── */
.chapter-layout { display: flex; min-height: 100vh; padding-top: 56px; }

.sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  position: fixed; top: 56px; left: 0; bottom: 0;
  background: var(--white); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 32px 0;
}
.sidebar-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 0 24px; margin-bottom: 12px; margin-top: 24px; }
.sidebar-label:first-child { margin-top: 0; }
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 9px 24px; font-size: 13px; color: var(--muted); text-decoration: none; transition: all 0.15s; border-left: 2px solid transparent; }
.sidebar-link:hover { color: var(--ink); background: var(--cream); }
.sidebar-link.active { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); font-weight: 500; }
.sidebar-num { font-size: 10px; color: var(--faint); font-weight: 500; min-width: 20px; }
.sidebar-link.active .sidebar-num { color: var(--accent); }

.chapter-main { margin-left: var(--sidebar-width); flex: 1; max-width: 760px; padding: 64px 64px 96px; }

/* ── CHAPTER HEADER ── */
.chapter-header { margin-bottom: 48px; padding-bottom: 36px; border-bottom: 1px solid var(--border); }
.chapter-eyebrow { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); font-weight: 500; margin-bottom: 14px; }
.chapter-header h1 { font-family: 'Playfair Display', serif; font-size: clamp(30px, 3.5vw, 44px); font-weight: 700; color: var(--ink); line-height: 1.1; margin-bottom: 18px; }
.chapter-header .lead { font-size: 17px; line-height: 1.85; color: var(--body); max-width: 580px; }

/* ── PROGRESS BAR ── */
#read-progress { position: fixed; top: 56px; left: var(--sidebar-width); right: 0; height: 2px; background: var(--border); z-index: 100; }
#read-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.1s; }

/* ── TYPOGRAPHY ── */
.prose { font-size: 16px; line-height: 1.9; color: var(--body); margin-bottom: 24px; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose em { font-style: italic; }

.pull-quote { border-left: 3px solid var(--accent); padding: 18px 28px; margin: 40px 0; background: var(--accent-light); border-radius: 0 12px 12px 0; }
.pull-quote p { font-family: 'Playfair Display', serif; font-size: 19px; font-style: italic; color: var(--ink); line-height: 1.55; }

.section-hed { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: var(--ink); margin: 48px 0 16px; line-height: 1.2; }
.section-divider { width: 36px; height: 2px; background: var(--accent); margin: 32px 0; }

/* ── CARDS ── */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 32px 0; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 24px; transition: all 0.2s; position: relative; overflow: hidden; }
.card::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); transform: scaleX(0); transform-origin: left; transition: transform 0.3s; }
.card:hover { border-color: var(--accent-border); box-shadow: 0 4px 20px rgba(194,65,12,0.07); }
.card:hover::after { transform: scaleX(1); }
.card-icon { font-size: 22px; margin-bottom: 12px; }
.card h3 { font-family: 'Playfair Display', serif; font-size: 15px; color: var(--ink); margin-bottom: 8px; line-height: 1.3; }
.card p { font-size: 13px; color: #4b5563; line-height: 1.75; }

/* ── DIAGRAM ── */
.diagram-card { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 28px 28px 18px; margin: 32px 0; }
.diagram-eyebrow { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 500; margin-bottom: 14px; }
.diagram-card canvas { display: block; width: 100%; }
.diagram-caption { font-size: 12px; color: var(--faint); text-align: center; margin-top: 12px; line-height: 1.6; }

/* ── STEPS ── */
.steps { display: flex; margin: 32px 0; }
.step { flex: 1; background: var(--white); border: 1px solid var(--border); padding: 18px 12px; text-align: center; }
.step + .step { margin-left: -1px; }
.step:first-child { border-radius: 12px 0 0 12px; }
.step:last-child { border-radius: 0 12px 12px 0; }
.step-num { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 500; margin-bottom: 6px; }
.step-icon { font-size: 18px; margin-bottom: 6px; }
.step h4 { font-size: 11px; font-weight: 500; color: var(--ink); margin-bottom: 4px; line-height: 1.3; }
.step p { font-size: 10px; color: var(--muted); line-height: 1.55; }

/* ── AGENT CARDS ── */
.agent-card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 24px; margin-bottom: 14px; display: flex; gap: 18px; transition: all 0.2s; }
.agent-card:hover { border-color: var(--accent-border); box-shadow: 0 2px 16px rgba(194,65,12,0.06); }
.agent-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.agent-body h4 { font-size: 15px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.agent-body p { font-size: 13px; color: #4b5563; line-height: 1.75; margin-bottom: 10px; }
.agent-try { font-size: 12px; color: var(--accent); font-weight: 500; border: 1px solid var(--accent-border); background: var(--accent-light); border-radius: 100px; padding: 4px 14px; display: inline-block; }

/* ── RISK CARDS ── */
.risk-card { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; padding: 20px 24px; margin-bottom: 14px; }
.risk-card h4 { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 7px; }
.risk-card p { font-size: 13px; color: var(--body); line-height: 1.75; }

/* ── GETTING STARTED TABS ── */
.tab-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 0; }
.tab-btn { padding: 8px 16px; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--white); border: 1px solid var(--border); border-radius: 100px; cursor: pointer; transition: all 0.2s; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
.tab-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.tab-btn:hover:not(.active) { background: var(--accent-light); color: var(--accent); border-color: var(--accent-border); }
.tab-content { display: none; margin-top: 24px; }
.tab-content.active { display: block; }
.tab-intro { font-size: 15px; line-height: 1.85; color: var(--body); margin-bottom: 24px; }

/* ── PROMPT EXAMPLES ── */
.prompt-example { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; margin-bottom: 12px; }
.prompt-example h5 { font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.prompt-example h5 span { font-size: 16px; }
.prompt-text { background: var(--cream); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; font-size: 13px; color: var(--body); line-height: 1.75; margin-bottom: 8px; font-style: italic; }
.prompt-why { font-size: 12px; color: var(--muted); line-height: 1.65; }

/* ── CHAPTER NAV ── */
.chapter-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border); }
.chapter-nav a { display: flex; flex-direction: column; text-decoration: none; max-width: 220px; }
.chapter-nav a.prev { align-items: flex-start; }
.chapter-nav a.next { align-items: flex-end; text-align: right; }
.chapter-nav .nav-dir { font-size: 11px; color: var(--faint); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.chapter-nav .nav-title { font-size: 14px; font-weight: 500; color: var(--accent); }
.chapter-nav .nav-title:hover { text-decoration: underline; }

/* ── CLOSE ── */
.page-footer { background: var(--ink); padding: 64px 40px; text-align: center; margin-top: 0; }
.page-footer p { font-size: 13px; color: #6b7280; margin-top: 12px; }
.page-footer a { color: var(--accent-border); text-decoration: none; }
.footer-logo { font-family: 'Playfair Display', serif; font-size: 20px; color: #f5f0e8; }
.footer-logo span { color: var(--accent-border); }
