/* AI Plumber — Book reader styles (redesign language, matches homepage) */
:root {
  --bg: #050505;
  --surface: #0d0d0d;
  --surface-high: #151515;
  --border: rgba(240, 160, 136, 0.16);
  --border-strong: rgba(240, 160, 136, 0.35);
  --coral: #F0A088;
  --coral-deep: #D9826A;
  --cream: #F4F0E8;
  --muted: #8C8580;
  --muted-dim: #4A4540;
  --teal: #6FD9BE;
  --maxw: 720px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--coral); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 5vw, 2rem);
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 800; letter-spacing: 0.04em; color: var(--coral);
  font-size: 1.05rem; text-decoration: none;
}
.brand .tag { font-family: 'JetBrains Mono', monospace; color: var(--teal); }
.topbar nav { display: flex; align-items: center; gap: 1.25rem; }
.topbar .back {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted);
}
.topbar .cta {
  font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--coral); color: var(--bg);
  padding: 0.55rem 1rem; border-radius: 3px; text-decoration: none;
}
.topbar .cta:hover { background: var(--coral-deep); text-decoration: none; }

/* ---- Reading column ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 5vw, 2rem); }

.eyebrow {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.18em; color: var(--coral);
  margin: 0 0 0.75rem;
}

article h1, .booktitle {
  font-family: 'Inter', sans-serif; font-weight: 800;
  font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.05;
  letter-spacing: -0.02em; text-transform: uppercase; margin: 0 0 1.5rem;
}
.accent { font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 700; text-transform: none; color: var(--coral); }

article h2 {
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.6rem;
  letter-spacing: -0.01em; margin: 3rem 0 1rem; line-height: 1.2;
}
article h3 {
  font-family: 'Fraunces', serif; font-style: italic; color: var(--coral);
  font-size: 1.35rem; margin: 2.25rem 0 0.75rem; font-weight: 700;
}
article h4 {
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.05rem;
  text-transform: uppercase; letter-spacing: 0.02em; margin: 1.75rem 0 0.5rem;
}
article p { margin: 0 0 1.25rem; color: rgba(244, 240, 232, 0.86); }
article strong { color: var(--cream); }
article ul, article ol { margin: 0 0 1.25rem; padding-left: 1.25rem; color: rgba(244, 240, 232, 0.86); }
article li { margin: 0 0 0.5rem; }
article hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
article table { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: 0.92rem; }
article th, article td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
article th { color: var(--coral); font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
blockquote {
  margin: 0 0 1.5rem; padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--coral); color: rgba(244, 240, 232, 0.8); font-style: italic;
}

/* checklist */
article li input[type="checkbox"] { accent-color: var(--coral); margin-right: 0.4rem; }

/* ---- Chapter index (landing) ---- */
.parts { margin-top: 2.5rem; }
.part-label {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.18em; margin: 2rem 0 0.75rem;
}
.toc a {
  display: flex; align-items: baseline; gap: 1rem;
  padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: 4px;
  background: var(--surface); margin-bottom: 0.6rem; text-decoration: none;
  transition: border-color 0.2s;
}
.toc a:hover { border-color: var(--coral); text-decoration: none; }
.toc .num { font-family: 'JetBrains Mono', monospace; color: var(--coral); font-size: 0.8rem; min-width: 2.5rem; }
.toc .ttl { color: var(--cream); font-weight: 600; }
.toc .sub { color: var(--muted); font-size: 0.85rem; }

/* ---- Buttons ---- */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0; }
.btn {
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; padding: 0.8rem 1.25rem;
  border-radius: 3px; text-decoration: none; border: 1px solid var(--border-strong);
}
.btn.primary { background: var(--coral); color: var(--bg); border-color: var(--coral); }
.btn.primary:hover { background: var(--coral-deep); text-decoration: none; }
.btn.ghost { color: var(--cream); background: var(--surface); }
.btn.ghost:hover { border-color: var(--coral); text-decoration: none; }

/* ---- Prev / next ---- */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.pager a { flex: 1; padding: 1rem; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.pager a:hover { border-color: var(--coral); text-decoration: none; }
.pager .dir { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; display: block; margin-bottom: 0.25rem; }
.pager .name { color: var(--cream); font-weight: 600; font-size: 0.95rem; }
.pager .next { text-align: right; }
.pager .spacer { background: none; border: none; }

/* ---- Footer ---- */
.foot { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.8rem; padding: 2.5rem clamp(1rem, 5vw, 2rem); text-align: center; }
.foot a { color: var(--muted); }
.foot .mono { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--muted-dim); margin-top: 0.5rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
