/* =========================================================================
   agentic-spec.com — GENERATED FILE (gen-site.md).
   Sources: specs/0300-style.md (+ 0110/0130/0140 page-specific styling).
   Do not hand-edit; regenerate via regen-all.md.
   ========================================================================= */

/* ---- Custom properties (0300-style.md Req 2, 3) ---- */
:root {
  /* Page surfaces */
  --bg: #ffffff;            /* palette-tbd */
  --bg-dark: #0E1419;       /* Req 2: fixed */
  --bg-muted: #f7f7f7;      /* palette-tbd */

  /* Text */
  --fg: #111;               /* palette-tbd */
  --fg-sec: #444;           /* palette-tbd */
  --fg-muted: #888;         /* palette-tbd */
  --fg-inv: #fff;           /* palette-tbd */

  /* Accent (Req 2: fixed) */
  --accent: #32B5D6;
  --accent-hover: #289EBC;
  --accent-light: #D5F0F7;

  /* Badge (Req 2: fixed) */
  --badge-bg: #D14900;

  /* Borders */
  --border: #e5e5e5;        /* palette-tbd */
  --border-subtle: #f0f0f0; /* palette-tbd */

  /* Layout */
  --max-w: 960px;

  /* Fonts (Req 3) */
  --font-display: "Source Serif 4", Georgia, serif;
  --font-logo: "BioRhyme", Georgia, serif;
  --font-body: "Sora", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --font-badge: "Open Sans", Arial, sans-serif;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;   /* Req 20 */
  scrollbar-gutter: stable;
  overflow-anchor: none;
}

body {
  margin: 0;
  min-height: 100vh;         /* Req 12 */
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);  /* Req 3 baseline */
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg-sec);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

main {                       /* Req 24 */
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 24px;
}

main p { margin: 0 0 1em; }  /* Req 3 */

h1, h2, h3 { color: var(--fg); font-weight: 700; line-height: 1.3; margin: 0 0 0.5em; }
h1 { font-size: 28px; }      /* Req 3 mobile/tablet */
h2 { font-size: 22px; }
h3 { font-size: 18px; }

a { color: var(--accent); text-decoration: none; }   /* Req 14 */
a:hover { text-decoration: underline; }

strong { color: var(--fg); }  /* Req 14 */

code { font-family: var(--font-mono); }

[hidden] { display: none !important; }

/* ---- Accessibility primitives (Req 18) ---- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

.sr-only-visual {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
  opacity: 0;
}

#main, #why-this-book { scroll-margin-top: 70px; }

/* ---- Sticky header (Req 5) ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.80);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.scrolled { border-bottom-color: var(--accent-light); }
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---- Logo (Req 6) ---- */
.site-logo {
  font-family: var(--font-logo);
  font-weight: 700;
  color: var(--bg-dark);
  font-size: 14px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.site-logo:hover, .site-logo:focus, .site-logo:active { text-decoration: none; }

/* ---- Desktop nav (Req 7) — hidden on mobile ---- */
.main-nav { display: none; align-items: center; gap: 4px; }
.nav-link {
  font-family: var(--font-body);
  color: var(--fg);
  text-decoration: none;
  padding: 6px 12px 3px;
  border-bottom: 4px solid transparent;
  transition: border-color 0.15s;
}
.nav-link:hover { border-bottom-color: var(--accent); text-decoration: none; }
.nav-link.active { border-bottom-color: var(--accent); font-weight: 600; }
.nav-cta {
  font-family: var(--font-body);
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  margin-left: 8px;
  transition: background 0.15s;
}
.nav-cta:hover { background: var(--accent-hover); text-decoration: none; }

/* ---- Hamburger (Req 8) ---- */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--fg); }

/* ---- Mobile nav overlay (Req 8) ---- */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
}
.mobile-nav-overlay.open { display: flex; flex-direction: column; padding: 20px; }
.mobile-nav-close {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--fg);
  cursor: pointer;
}
.mobile-nav-link {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--fg);
  text-decoration: none;
  padding: 14px 16px;
  min-height: 52px;
  display: flex;
  align-items: center;
  position: relative;
}
.mobile-nav-link:hover { text-decoration: none; }
.mobile-nav-link.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  height: 4px;
  background: var(--accent);
}
.mobile-nav-cta {
  font-family: var(--font-body);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 14px 16px;
  min-height: 52px;
  border-radius: 4px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}
.mobile-nav-cta:hover { text-decoration: none; }

/* ---- Hero (Req 9) — home page only ---- */
.hero {
  position: relative;
  min-height: 100vh;
  background: var(--bg-dark);
  color: var(--fg-inv);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 64px 24px 48px;
}
.hero-aside { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 36px; }
.hero-image { width: 100%; display: flex; justify-content: flex-start; }
.hero-image img { width: 100%; max-width: 200px; height: auto; aspect-ratio: 1068 / 1392; display: block; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-optical-sizing: auto;
  font-size: 32px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--fg-inv);
  margin: 0 0 16px;
}
.hero-subtitle {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: 17px;
  color: var(--accent-hover);
  max-width: 540px;
  margin: 0 0 32px;
  opacity: 0;              /* FOUC guard (Req 9) — typewriter reveals */
  transition: opacity 600ms ease;  /* post-typing fade (Req 17) */
}
.hero-btns { display: flex; flex-direction: column; gap: 24px; opacity: 0; transition: opacity 600ms ease; }

/* ---- Best-seller badge (Req 27) ---- */
.bestseller-badge { margin-top: 10px; font-family: var(--font-badge); text-align: left; }
.bestseller-tag {
  display: inline-block;
  background: var(--badge-bg);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  vertical-align: baseline;
}
.bestseller-cat { margin-left: 5px; vertical-align: baseline; font-size: 12px; font-weight: 400; line-height: 16px; color: #fff; }
.bestseller-src { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; line-height: 16px; color: var(--accent-hover); }

/* ---- Buttons (Req 13) ---- */
.btn-primary, .btn-secondary {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 4px;
  min-width: 220px;
  text-align: center;
  display: inline-block;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn-secondary { background: transparent; border: 1px solid var(--accent); color: var(--accent-hover); }
.btn-secondary:hover { border-color: var(--fg); text-decoration: none; }
.hero .btn-secondary { color: var(--accent); }
.hero .btn-secondary:hover { border-color: #fff; }

/* ---- Section-label pill (Req 10, 11, 17) ---- */
.section-label {
  display: inline-block;
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  margin-bottom: 24px;
  transform-origin: left center;
}
.bubble-text { display: inline-block; }
.section-label.bubble-init { transform: scaleX(0); }
.section-label.bubble-init .bubble-text,
.section-label.bubble-animate .bubble-text { opacity: 0; }
.section-label.bubble-animate { animation: bubble-expand 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.section-label.bubble-animate .bubble-text { animation: bubble-text-appear 400ms ease 250ms forwards; }

@keyframes bubble-expand { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bubble-text-appear { from { opacity: 0; } to { opacity: 1; } }

/* ---- Content reveal (Req 11) ---- */
.section-content-hidden { opacity: 0; transition: opacity 400ms ease; }
.section-content-visible { opacity: 1; }

/* ---- Footer (Req 12) ---- */
.site-footer { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 48px 24px 24px; }
.site-footer p { margin: 0; font-size: 12px; color: var(--fg-sec); text-align: left; }

/* ---- Home-page chat animation (Req 22) ---- */
.chat-flow { max-width: var(--max-w); overflow-anchor: none; min-height: 80vh; }
.chat-input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
  max-width: 480px;
  transition: opacity 600ms;
}
.chat-input-text { flex: 1; font-family: var(--font-body); font-size: 15px; color: var(--fg); min-height: 24px; }
.chat-input-placeholder { color: #bbb; }
.chat-input-send {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: cursor-blink 1s step-end infinite;
}
.chat-question { display: flex; justify-content: flex-end; margin-bottom: 20px; transition: opacity 300ms ease; }
.chat-question-bubble {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 10px 18px;
  border-radius: 18px;
  border-bottom-right-radius: 4px;
  font-size: 15px;
  line-height: 1.5;
  max-width: 80%;
}
.chat-thinking { margin-bottom: 20px; transition: opacity 300ms ease; }
.thinking-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin: 0 3px;
  animation: thinking-bounce 1.4s infinite;
}
.chat-thinking .thinking-dot:nth-child(1) { animation-delay: 0ms; }
.chat-thinking .thinking-dot:nth-child(2) { animation-delay: 200ms; }
.chat-thinking .thinking-dot:nth-child(3) { animation-delay: 400ms; }
.chat-section-label {
  display: inline-block;
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  margin-bottom: 24px;
  transform-origin: left center;
}
.chat-section-label.bubble-animate { animation: bubble-expand 400ms cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.chat-response { margin-bottom: 24px; }
.chat-response p { margin: 0 0 1em; }
.chat-response ul { padding-left: 1em; margin: 0; list-style: disc; }
.chat-response li { font-size: 15px; color: var(--fg-sec); }
.chat-el-fading { opacity: 0 !important; transition: opacity 600ms ease; }
.chat-cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 32px 0 48px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms ease;
}
.chat-cta-buttons.revealed { opacity: 1; pointer-events: auto; }

@keyframes thinking-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }
@keyframes cursor-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ===== PAGE-SPECIFIC, RESPONSIVE & PRINT ===== */

/* ---- About page: chapter headings (0110-page-about.md § Chapter-heading typography) ---- */
.chapter-heading {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
  line-height: 1.3;
  margin-top: 24px;
  margin-bottom: 4px;
}
.chapter-heading:first-of-type { margin-top: 0; }

/* ---- Downloads page: per-category pill spacing (0130-page-downloads.md § Category headings) ---- */
main .section-label ~ .section-label { margin-top: 48px; }

/* ---- Author page (0300-style.md Req 26) — base (mobile/tablet) ---- */
.author-layout { display: flex; flex-direction: column; }
.author-photo { order: -1; margin: 0 auto 8px; max-width: 200px; width: 100%; }
.author-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 630 / 674;
  border-radius: 8px;
}

/* ---- Errata page: TOC tree (0140-page-errata.md § Layout) ---- */
.errata-tree { margin-top: 8px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item { position: relative; }

.toc-node {
  display: inline-block;
  font-family: var(--font-body);
  color: var(--fg);
  text-decoration: none;
  padding: 2px 0;
}
.toc-node:hover { color: var(--accent); text-decoration: none; }
.toc-node:focus-visible { color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }

/* Per-level typography (font size + weight are the only axes of difference) */
.toc-l1 { font-size: 18px; font-weight: 700; }
.toc-l2 { font-size: 15px; font-weight: 600; }
.toc-l3 { font-size: 14px; font-weight: 400; }

/* Chapter-to-chapter spacing between top-level entries; condensed inside subtrees */
.errata-tree > .toc-list > .toc-item { margin-top: 18px; }
.errata-tree > .toc-list > .toc-item:first-child { margin-top: 0; }

/* Connector lines — CSS-drawn, --accent-light, no glyphs; continuous trunk (0140 § connector lines) */
.toc-item > .toc-list { padding-left: 16px; }
.toc-item > .toc-list > .toc-item { padding-left: 16px; }
.toc-item > .toc-list > .toc-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--accent-light);
}
.toc-item > .toc-list > .toc-item:last-child::before { bottom: auto; height: 13px; }
.toc-item > .toc-list > .toc-item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 13px;
  width: 12px;
  border-top: 1px solid var(--accent-light);
}

/* ---- Errata page: submission modal (0140-page-errata.md § Layout) ---- */
.errata-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(14, 20, 25, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.errata-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.errata-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--fg);
  cursor: pointer;
}
.errata-modal-title {
  display: inline-block;
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}
.errata-modal-location {
  margin: 16px 0;
  color: var(--accent);
  font-family: var(--font-body);
  font-weight: 400;
  text-decoration: none;
  background: transparent;
}
.errata-field {
  display: block;
  margin-top: 16px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg);
}
.errata-explanation,
.errata-correction {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 96px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--accent-light);
  border-radius: 6px;
  resize: vertical;
  transition: border-color 0.15s ease;
}
.errata-explanation:focus,
.errata-explanation:focus-visible,
.errata-correction:focus,
.errata-correction:focus-visible {
  border-color: var(--accent);
  outline: none;
}
.errata-counter { margin-top: 6px; font-size: 12px; color: var(--fg-muted); text-align: right; }
.errata-submit {
  margin-top: 20px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.errata-submit:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.errata-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Tablet (Req 1: min-width 600px) ---- */
@media (min-width: 600px) {
  .main-nav { display: flex; }
  .hamburger { display: none; }
  .hero h1 { font-size: 40px; }
  .hero-btns { flex-direction: row; }
  .chat-cta-buttons { flex-direction: row; }
  .nav-link { font-size: 14px; }
}

/* ---- Desktop (Req 1: min-width 961px) ---- */
@media (min-width: 961px) {
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  .section h2 { font-size: 28px; }
  .nav-link { font-size: 15px; }

  .hero h1 { font-size: 48px; }
  .hero-inner { padding: 80px 24px 60px; display: flex; gap: 48px; align-items: flex-start; }
  .hero-aside { margin-bottom: 0; align-items: flex-start; }
  .hero-image { justify-content: flex-start; }
  .hero-image img { max-width: 280px; }
  .bestseller-badge { text-align: left; }

  .chapter-heading { font-size: 17px; }

  .toc-l1 { font-size: 20px; }
  .toc-l2 { font-size: 16px; }
  .toc-l3 { font-size: 15px; }

  .author-layout { flex-direction: row; gap: 32px; align-items: flex-start; }
  .author-bio { flex: 1; }
  .author-photo { order: 0; flex: 0 0 240px; max-width: 240px; margin: 0; }
}

/* ---- Print (Req 21) ---- */
@media print {
  .site-header, .site-footer, .mobile-nav-overlay { display: none !important; }
  body { background: #fff; color: #000; }
}

