/* book.css: styling for the Yo Odin book pages on nofuss.co.za.
   Layered on top of the site's /styles.css; uses its theme custom properties so light/dark
   mode "just works" via html[data-theme="dark"]. Shipped as a static file, no build step. */

.book {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 4px;
}

.book article {
  line-height: 1.7;
  font-size: 1.22rem;
}

.book article h1 {
  margin: 0.2em 0 0.6em;
  line-height: 1.2;
}
.book article h2 {
  margin: 2em 0 0.6em;
  padding-bottom: 0.2em;
  border-bottom: 2px solid var(--color-secondary);
}
.book article h3 { margin: 1.6em 0 0.5em; }
.book article p { margin: 0 0 1em; }
.book article ul,
.book article ol { margin: 0 0 1em; padding-left: 1.4em; }
.book article li { margin: 0.3em 0; }

.book article hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 2rem 0;
}
html[data-theme="dark"] .book article hr { border-top-color: #313244; }

/* Inline code and code blocks */
.book code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.book pre {
  background: var(--color-code-bg);
  border: 1px solid #e0e0e0;
  border-left: 3px solid var(--color-secondary);
  border-radius: 0 6px 6px 0;
  padding: 14px 16px;
  overflow-x: auto;               /* wide code scrolls inside its box */
  margin: 0 0 1.2em;
  line-height: 1.5;
}
html[data-theme="dark"] .book pre { border-color: #313244; }
.book pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 1.03rem;
  white-space: pre;
}

/* Callouts (markdown blockquotes: Why / Gotcha / Odin note) */
.book blockquote {
  margin: 0 0 1.2em;
  padding: 0.6em 1em;
  background: #f9f9f9;
  border-left: 4px solid var(--color-secondary);
  border-radius: 0 6px 6px 0;
}
html[data-theme="dark"] .book blockquote { background: #181825; }
.book blockquote p:last-child { margin-bottom: 0; }
.book blockquote pre { margin-top: 0.6em; }

/* Tables */
.book .table-wrap { overflow-x: auto; margin: 0 0 1.2em; }
.book table { border-collapse: collapse; width: 100%; font-size: 1.14rem; }
.book th, .book td {
  border: 1px solid #e0e0e0;
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
html[data-theme="dark"] .book th,
html[data-theme="dark"] .book td { border-color: #313244; }
.book th { background: var(--color-code-bg); }

/* Chapter prev/next/contents navigation */
.book-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 1.5em 0;
}
.book-nav .spacer { flex: 1; }
.book-nav a {
  border: 1px solid var(--color-secondary);
  border-radius: 3px;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--color-secondary);
  font-size: 0.95rem;
}
.book-nav a:hover { background: var(--color-secondary); color: #fff; }
.book-nav .eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 1em;
}

/* Landing page table of contents */
.toc { list-style: none; padding: 0; margin: 1.5em 0; }
.toc li {
  margin: 0;
  border-left: 3px solid var(--color-secondary);
  background: #f9f9f9;
  border-radius: 0 4px 4px 0;
  padding: 10px 14px;
  margin-bottom: 8px;
}
html[data-theme="dark"] .toc li { background: #181825; }
.toc li .n {
  display: inline-block;
  min-width: 4.0em;
  font-weight: 700;
  color: var(--color-secondary);
}
.toc li a { text-decoration: none; font-weight: 600; }
.toc li a:hover { text-decoration: underline; }
.toc li .blurb { display: block; font-size: 0.9rem; color: #777; margin-top: 2px; }
html[data-theme="dark"] .toc li .blurb { color: #9aa; }

/* Call-to-action row on the landing page */
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 1.5em 0; }
.cta {
  display: inline-block;
  border-radius: 4px;
  padding: 10px 18px;
  text-decoration: none;
  font-weight: 600;
}
.cta.primary { background: var(--color-secondary); color: #fff; }
.cta.primary:hover { filter: brightness(1.08); }
.cta.secondary { border: 1px solid var(--color-secondary); color: var(--color-secondary); }
.cta.secondary:hover { background: var(--color-secondary); color: #fff; }

.pill {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
