/* === Catppuccin Mocha Palette === */
:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --surface0: #313244;
  --surface1: #45475a;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --blue: #89b4fa;
  --peach: #fab387;
  --red: #f38ba8;
  --green: #a6e3a1;
  --lavender: #b4befe;
  --yellow: #f9e2af;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--base);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: opacity 0.15s;
}
a:hover { opacity: 0.8; }

img, svg { display: block; max-width: 100%; }

/* === Layout === */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Nav === */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--crust);
  border-bottom: 1px solid var(--surface0);
  padding: 0 24px;
}

nav .nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

nav .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

nav .logo svg { width: 28px; height: 28px; }

nav .nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  align-items: center;
}

nav .nav-links a {
  color: var(--subtext);
  font-size: 0.9rem;
  transition: color 0.15s;
}
nav .nav-links a:hover { color: var(--text); opacity: 1; }
body.page-terminal nav .nav-links a[href="/terminal/"],
body.page-mcp nav .nav-links a[href="/mcp-servers/"],
body.page-blog nav .nav-links a[href="/blog/"],
body.page-about nav .nav-links a[href="/about/"],
body.page-contact nav .nav-links a[href="/contact/"],
body.page-typed nav .nav-links a[href="/typed/"] { color: var(--text); }

/* Dropdown menus (Products, About) */
nav .nav-dropdown {
  position: relative;
}
nav .nav-dropdown summary {
  color: var(--subtext);
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
nav .nav-dropdown summary::-webkit-details-marker { display: none; }
nav .nav-dropdown summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 2px;
  transition: transform 0.15s;
}
nav .nav-dropdown[open] summary::after { transform: rotate(180deg); }
nav .nav-dropdown summary:hover { color: var(--text); }
nav .nav-dropdown[open] summary { color: var(--text); }

nav .nav-mega,
nav .nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 200;
}
nav .nav-mega {
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 24px;
  min-width: 0;
}
nav .nav-menu {
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
nav .nav-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
nav .nav-col-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
  margin-bottom: 4px;
}
nav .nav-mega a,
nav .nav-menu a {
  font-size: 0.88rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 1px 5px;
  background: var(--surface0);
  color: var(--subtext);
  border-radius: 3px;
  text-transform: lowercase;
}

nav .nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  width: 32px;
  height: 32px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
nav .nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.15s, opacity 0.15s;
}

/* === Hero === */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
}

.hero .hero-logo { width: 80px; height: 80px; margin: 0 auto 32px; }

.hero h1 {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
}

.hero .subtitle {
  color: var(--subtext);
  font-size: 1.1rem;
  margin-bottom: 40px;
}

.accent-terminal { color: var(--peach); }
.accent-connections { color: var(--red); }
.accent-ai { color: var(--green); }
.accent-blue { color: var(--blue); }

/* === Feature Cards (homepage) === */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 0 24px 60px;
  max-width: 900px;
  margin: 0 auto;
}

.card {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 12px;
  padding: 28px 24px;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--surface1); }

.card h3 {
  font-family: var(--mono);
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.card p {
  color: var(--subtext);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.card .card-link {
  font-size: 0.85rem;
  font-family: var(--mono);
}

/* === Install block (a labelled command card) ===
   Shared by the typed pages. The mcp pages carry their own local copy of this
   under .mcp-install-card; this is the neutral spelling so a page that is not
   about MCP does not borrow an mcp- class name. */
.install-card {
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 16px;
}

.install-card .install-label {
  font-size: 0.85rem;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.install-card pre {
  background: var(--base);
  border: 1px solid var(--surface1);
  border-radius: 6px;
  padding: 12px 14px;
  margin: 10px 0 12px;
  overflow-x: auto;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.45;
}

/* === Download Section === */
.download {
  text-align: center;
  padding: 60px 24px;
  background: var(--mantle);
  border-top: 1px solid var(--surface0);
  border-bottom: 1px solid var(--surface0);
}

.download h2 {
  font-family: var(--mono);
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.download .download-sub {
  color: var(--subtext);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.download-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.15s;
}

.btn-primary {
  background: var(--blue);
  color: var(--crust);
}

.btn-secondary {
  background: var(--surface0);
  color: var(--text);
}

.btn:hover { opacity: 0.85; }

/* Prominent buy CTA used on book landing/launch pages.
   Gradient, soft shadow, lift on hover. Pairs with a price pill
   embedded in the button text (.btn-buy-price). */
.btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue) 0%, #6c8eef 100%);
  color: var(--crust);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 24px rgba(137, 180, 250, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn-buy:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(137, 180, 250, 0.4);
  opacity: 1;
}
.btn-buy-price {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-buy-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}
.btn-buy:hover .btn-buy-arrow { transform: translateX(2px); }
.btn-buy--lg {
  padding: 18px 32px;
  font-size: 1.12rem;
}

/* === Footer === */
footer {
  padding: 48px 24px 32px;
  color: var(--subtext);
  font-size: 0.85rem;
  border-top: 1px solid var(--surface0);
  margin-top: 64px;
}

footer a { color: var(--subtext); }
footer a:hover { color: var(--text); }

footer .footer-grid {
  max-width: 900px;
  margin: 0 auto 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
footer .footer-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
footer .footer-col-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
  margin-bottom: 4px;
}
footer .footer-copyright {
  text-align: center;
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid var(--surface0);
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* === Feature Page Header === */
.page-header {
  padding: 60px 24px 40px;
  text-align: center;
}

.page-header h1 {
  font-family: var(--mono);
  font-size: 2rem;
  margin-bottom: 12px;
}

.page-header p {
  color: var(--subtext);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* === Feature Sections === */
.feature-section {
  padding: 48px 24px;
  border-top: 1px solid var(--surface0);
}

.feature-section:nth-child(even) { background: var(--mantle); }

.feature-section .container { max-width: 900px; margin: 0 auto; }

.feature-section h2 {
  font-family: var(--mono);
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.feature-section p {
  color: var(--subtext);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 720px;
}

.feature-section p + p { margin-top: 12px; }

.feature-section ul {
  color: var(--subtext);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-top: 12px;
  padding-left: 20px;
}

.feature-section li::marker { color: var(--surface1); }

/* === Keyboard Shortcuts Table === */
.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.9rem;
}

.shortcuts-table th,
.shortcuts-table td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--surface0);
}

.shortcuts-table th {
  color: var(--subtext);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.shortcuts-table td:first-child {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--blue);
  white-space: nowrap;
}

/* === Connection Type Grid === */
.connection-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.connection-item {
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 20px;
}

.connection-item h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.connection-item p {
  font-size: 0.85rem;
  color: var(--subtext);
}

/* === Provider Grid (AI page) === */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.provider-item {
  background: var(--base);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 20px;
}

.provider-item h3 {
  font-family: var(--mono);
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.provider-item p {
  font-size: 0.85rem;
  color: var(--subtext);
}

/* === Back Link === */
.back-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--subtext);
  margin-bottom: 16px;
}
.back-link:hover { color: var(--text); opacity: 1; }

/* === Code Copy Button === */
.code-wrap {
  position: relative;
}

/* The house code-block pattern is `.code-wrap > code[style="display: block"]`
   (docs/blog-checklist.md) rather than `<pre>`, so it inherits NO white-space
   handling -- newlines in the markup collapsed to spaces and the block reflowed
   as prose. A 3-line install snippet rendered as one run-on line, which a
   reader would copy and paste as a broken command; 54 multi-line blocks across
   25 pages were affected. `pre` restores the line structure, and `auto` is
   required alongside it: without wrapping, a long unbreakable token (a URN, a
   connection string) would otherwise widen the page itself and give the whole
   document a horizontal scrollbar on mobile. Scoped to code INSIDE .code-wrap
   so `<pre><code>` blocks, which already get this from `<pre>`, are untouched.
   The copy button is positioned against .code-wrap, not this element, so it
   stays pinned while the code scrolls under it. */
.code-wrap code {
  white-space: pre;
  overflow-x: auto;
}

.code-lang {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  font-size: 0.65rem;
  padding: 2px 6px;
  background: var(--surface0);
  color: var(--subtext);
  border-radius: 4px 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  pointer-events: none;
}

.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--surface0);
  border: 1px solid var(--surface1);
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--subtext);
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.code-wrap:hover .copy-btn { opacity: 1; }

.copy-btn:hover {
  color: var(--text);
  background: var(--surface1);
}

.copy-btn svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-btn.copied {
  opacity: 1;
  color: var(--green);
}

/* === Section Label === */
.section-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--blue);
  margin-bottom: 12px;
}

/* === Context Block (code/config display) === */
.context-block {
  background: var(--crust);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 20px 24px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--subtext);
  overflow-x: auto;
}
.context-block .comment { color: var(--surface1); }
.context-block .key { color: var(--blue); }
.context-block .val { color: var(--peach); }

/* === Feature Grid (2-col) === */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.feature-grid .feature-card {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 20px;
  transition: border-color 0.15s;
}
.feature-grid .feature-card:hover { border-color: var(--surface1); }
.feature-grid .feature-card h3 {
  font-family: var(--mono);
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.feature-grid .feature-card p {
  font-size: 0.88rem;
  color: var(--subtext);
  line-height: 1.6;
}

/* === Tag Lists === */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.tag-list .tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 6px 14px;
  border: 1px solid var(--surface0);
  border-radius: 4px;
  color: var(--text);
  background: var(--mantle);
}
.tag-list .tag-accent {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 6px 14px;
  border-radius: 4px;
  background: rgba(137, 180, 250, 0.08);
  border: 1px solid rgba(137, 180, 250, 0.15);
  color: var(--blue);
}

/* === Callout === */
.callout {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--surface0);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  background: var(--mantle);
}
.callout h3 {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.callout p {
  font-size: 0.92rem;
  color: var(--subtext);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* === Architecture Rows === */
.arch-block {
  background: var(--mantle);
  border: 1px solid var(--surface0);
  border-radius: 8px;
  padding: 24px;
  margin-top: 20px;
}
.arch-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.arch-row:last-child { margin-bottom: 0; }
.arch-icon {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--blue);
  background: rgba(137, 180, 250, 0.08);
  border: 1px solid rgba(137, 180, 250, 0.15);
  border-radius: 4px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.arch-text h4 {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.arch-text p {
  font-size: 0.88rem;
  color: var(--subtext);
  line-height: 1.55;
}

/* === Pricing Bar === */
.pricing-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}
.price-card {
  font-family: var(--mono);
  padding: 14px 20px;
  border: 1px solid var(--surface0);
  border-radius: 8px;
  background: var(--mantle);
  font-size: 0.85rem;
  color: var(--subtext);
}
.price-card .amount {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}
.price-card .save {
  color: var(--green);
  font-size: 0.72rem;
}
.trial-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--subtext);
}

/* === Principles === */
.principles { margin-top: 20px; }
.principle {
  padding: 16px 0;
  border-bottom: 1px solid var(--surface0);
}
.principle:last-child { border-bottom: none; }
.principle h4 {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.principle p {
  font-size: 0.9rem;
  color: var(--subtext);
}

/* === Stat Grid === */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.stat-item {
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--surface0);
  border-radius: 8px;
  background: var(--mantle);
}
.stat-item .number {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--blue);
  display: block;
  margin-bottom: 6px;
}
.stat-item .label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--subtext);
}

/* === Price Note (inline) === */
.price-note {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--subtext);
  padding: 8px 16px;
  border: 1px solid var(--surface0);
  border-radius: 6px;
  background: var(--mantle);
  margin-top: 8px;
}
.price-note strong { color: var(--green); font-weight: 600; }

/* === Blog === */
.blog-list {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.blog-list a { color: var(--text); }
.blog-list a:hover { opacity: 0.8; }
.blog-card {
  display: block;
  padding: 28px 0;
  border-bottom: 1px solid var(--surface0);
}
.blog-card:first-child { border-top: 1px solid var(--surface0); }
.blog-card h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.blog-card p {
  color: var(--subtext);
  font-size: 0.9rem;
  line-height: 1.6;
}
.blog-card .blog-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--surface1);
  margin-bottom: 8px;
}

.article {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.article h2 {
  font-family: var(--mono);
  font-size: 1.25rem;
  margin: 40px 0 12px;
}
.article h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  margin: 32px 0 10px;
}
.article p {
  color: var(--subtext);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
}
.article ul, .article ol {
  color: var(--subtext);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
  padding-left: 20px;
}
.article li::marker { color: var(--surface1); }
.article li { margin-bottom: 4px; }
.article strong { color: var(--text); }
.article .cta-box {
  margin: 40px 0;
  padding: 24px;
  border: 1px solid var(--surface0);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  background: var(--mantle);
}
.article .cta-box p { margin-bottom: 8px; }
.article .cta-box p:last-child { margin-bottom: 0; }
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9rem;
}
.article th, .article td {
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--surface0);
}
.article th {
  color: var(--subtext);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.article td { color: var(--subtext); }

/* === Hero Dots === */
.hero-dot { color: var(--subtext); }

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }
  .hero-dot { display: none; }
  .hero { padding: 60px 24px 40px; }

  .cards { grid-template-columns: 1fr; }
  .connection-grid { grid-template-columns: 1fr; }
  .provider-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }

  nav .nav-links { gap: 16px; }
  nav .nav-links a { font-size: 0.8rem; }

  .page-header h1 { font-size: 1.5rem; }

  .shortcuts-table { font-size: 0.8rem; }
  .shortcuts-table th,
  .shortcuts-table td { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .download-buttons { flex-direction: column; align-items: center; }
}

/* Mobile nav drawer + accordion (single set of overrides for all narrow screens) */
@media (max-width: 768px) {
  nav .nav-toggle { display: flex; }
  nav .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--crust);
    border-bottom: 1px solid var(--surface0);
    padding: 16px 24px;
    gap: 12px;
    align-items: stretch;
  }
  nav .nav-links.open { display: flex; }
  nav .nav-mega,
  nav .nav-menu {
    position: static;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 8px 0 8px 16px;
    min-width: 0;
  }
  nav .nav-mega { grid-template-columns: 1fr; gap: 16px; }
  nav .nav-dropdown summary { padding: 4px 0; }

  footer .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* === Yaw Labs promo block === */
/* Sits just above the global footer on the book pages. It links products
   rather than asking for an email -- the book is free to read and gates
   nothing, so a subscribe form on those pages would be the gate coming back in
   through the footer. */

.promo-block {
  margin: 64px 0 0;
  padding: 24px;
  border: 1px solid var(--surface0);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  background: var(--mantle);
  display: grid;
  grid-template-columns: 1fr minmax(280px, 380px);
  gap: 24px;
  align-items: start;
}

.promo-block__eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
  margin: 0 0 6px;
}

.promo-block__title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.4;
}

.promo-block__lede {
  color: var(--subtext);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.6;
}

.promo-block__links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.promo-block__link {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--surface0);
  border-radius: 6px;
  background: var(--base);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.promo-block__link:hover {
  border-color: var(--blue);
  background: var(--surface0);
}
.promo-block__link-name {
  display: block;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.promo-block__link-desc {
  display: block;
  color: var(--subtext);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* === Book chapter pages === */
/* .article carries the prose styling; these add the pieces a book page needs
   that a blog post does not -- a chapter h1, blockquotes (the manuscript uses
   them for asides), the per-chapter header meta, and the prev/next footer. */

.article h1 {
  font-family: var(--mono);
  font-size: 1.6rem;
  line-height: 1.3;
  margin: 0 0 8px;
}
.article h4 {
  font-family: var(--mono);
  font-size: 0.95rem;
  margin: 24px 0 8px;
}
.article blockquote {
  margin: 20px 0;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--surface1);
  color: var(--subtext);
}
.article blockquote p:last-child { margin-bottom: 0; }
.article hr {
  border: 0;
  border-top: 1px solid var(--surface0);
  margin: 32px 0;
}
/* Anchor-linkable headings: the chapter pages are long, and readers deep-link
   into them. Offset so a jumped-to heading is not hidden under the fixed nav. */
.article h2[id], .article h3[id] { scroll-margin-top: 80px; }

.book-eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue);
  margin: 0 0 6px;
}

/* The "on this page" list and the prev/next footer are <nav> elements, which
   is the right landmark for them -- but the site's own header nav is styled
   off the BARE `nav` selector (position: sticky, z-index: 100, a --crust
   background, 24px side padding). Both book navs inherited all of it: the
   on-this-page block rendered as a filled bar that then STUCK to the top of
   the viewport over the chapter text on scroll. Reset explicitly rather than
   narrowing `nav {}` to `body > nav`, which would touch all 83 pages to fix
   two. */
.book-meta,
.chapter-nav {
  position: static;
  z-index: auto;
  background: none;
  border-bottom: 0;
  padding: 0;
}

.book-meta {
  color: var(--subtext);
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 0 0 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--surface0);
}
.book-meta a { color: var(--blue); }

.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 48px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--surface0);
}
.chapter-nav__link {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--surface0);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.chapter-nav__link:hover {
  border-color: var(--blue);
  background: var(--mantle);
}
.chapter-nav__link--next { text-align: right; }
/* Keeps a lone "next" link in the right-hand column instead of letting it
   slide under "previous" -- chapter 1 has no previous, chapter 12 no next. */
.chapter-nav__link--next:only-child { grid-column: 2; }
.chapter-nav__dir {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--subtext);
  margin-bottom: 4px;
}
.chapter-nav__title {
  display: block;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Landing-page table of contents */
.book-toc { display: grid; gap: 4px; margin: 0 0 16px; }
.book-toc__item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--surface0);
  text-decoration: none;
  transition: background 0.15s;
}
.book-toc__item:hover { background: var(--mantle); }
.book-toc__num {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--blue);
  padding-top: 2px;
}
.book-toc__title {
  display: block;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 4px;
}
.book-toc__blurb {
  display: block;
  color: var(--subtext);
  font-size: 0.88rem;
  line-height: 1.6;
}
.book-toc__meta {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--surface1);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 768px) {
  .promo-block {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px;
  }
  .article h1 { font-size: 1.35rem; }
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-nav__link--next { text-align: left; }
  .chapter-nav__link--next:only-child { grid-column: 1; }
  .book-toc__item { grid-template-columns: 40px 1fr; gap: 10px; }
}

