/* Programming Neam — Interactive Book Styles */
:root {
  --red: #BE0027;
  --blue: #0060B6;
  --dark: #333333;
  --bg: #ffffff;
  --bg-secondary: #f6f8fa;
  --text: #24292f;
  --text-secondary: #57606a;
  --border: #d0d7de;
  --sidebar-bg: #f6f8fa;
  --sidebar-width: 280px;
  --topbar-height: 56px;
  --content-max: 800px;
  --code-bg: #f6f8fa;
  --code-border: #d0d7de;
  --shadow: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --text: #c9d1d9;
  --text-secondary: #8b949e;
  --border: #30363d;
  --sidebar-bg: #161b22;
  --code-bg: #161b22;
  --code-border: #30363d;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-height) + 16px); }

body {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}
.topbar-title {
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--red);
  text-decoration: none;
}
.topbar-title:hover { opacity: 0.8; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: Inter, Arial, sans-serif;
  display: flex; align-items: center; gap: 6px;
  transition: all var(--transition);
}
.topbar-btn:hover { border-color: var(--blue); color: var(--blue); }
.search-btn kbd {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: Inter, Arial, sans-serif;
}

/* ── Progress Bar ── */
.progress-bar {
  position: fixed;
  top: var(--topbar-height);
  left: 0; right: 0;
  height: 3px;
  background: var(--border);
  z-index: 99;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--red));
  width: 0%;
  transition: width 0.1s linear;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 90;
  transition: background var(--transition), transform 0.3s ease, border-color var(--transition);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 89;
}
.sidebar-part {
  padding: 0 16px;
  margin-bottom: 4px;
}
.sidebar-part-title {
  font-family: Inter, Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 8px 0 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-part-title::after {
  content: '\25B6';
  font-size: 8px;
  transition: transform 0.2s;
}
.sidebar-part-title.open::after {
  transform: rotate(90deg);
}
.sidebar-chapters {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.sidebar-chapters.open {
  max-height: 2000px;
}
.sidebar-link {
  display: block;
  padding: 5px 12px;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 4px;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-link:hover {
  background: var(--bg);
  color: var(--text);
}
.sidebar-link.active {
  background: var(--blue);
  color: #fff;
  font-weight: 600;
}
.sidebar-link .visited-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--blue);
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Main Content ── */
.main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  margin-top: 2em;
  margin-bottom: 0.5em;
  line-height: 1.3;
  scroll-margin-top: calc(var(--topbar-height) + 20px);
}
h1 { font-size: 2em; margin-top: 0; padding-bottom: 0.3em; border-bottom: 2px solid var(--red); }
h2 { font-size: 1.5em; padding-bottom: 0.2em; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.25em; }
h4 { font-size: 1.1em; }
.heading-anchor {
  opacity: 0;
  margin-left: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8em;
  transition: opacity var(--transition);
}
h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor { opacity: 1; }

p { margin-bottom: 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
blockquote {
  border-left: 4px solid var(--border);
  margin: 1em 0;
  padding: 0.5em 1em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}
ul, ol {
  margin: 0.5em 0 1em 1.5em;
}
li { margin-bottom: 0.3em; }
strong { color: var(--text); }
img { max-width: 100%; border-radius: var(--radius); }

/* ── Code Blocks ── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 2px 6px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1em 0;
  position: relative;
  line-height: 1.5;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85em;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--code-border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 6px 12px;
  font-family: Inter, Arial, sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
}
.code-header + pre {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: Inter, Arial, sans-serif;
  transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--blue); color: var(--blue); }
.copy-btn.copied { border-color: #1a7f37; color: #1a7f37; }

/* Syntax highlighting */
.kw { color: #cf222e; font-weight: 600; }
[data-theme="dark"] .kw { color: #ff7b72; }
.str { color: #0a3069; }
[data-theme="dark"] .str { color: #a5d6ff; }
.num { color: #0550ae; }
[data-theme="dark"] .num { color: #79c0ff; }
.cm { color: #6e7781; font-style: italic; }
[data-theme="dark"] .cm { color: #8b949e; }
.fn { color: #8250df; }
[data-theme="dark"] .fn { color: #d2a8ff; }
.op { color: #cf222e; }
[data-theme="dark"] .op { color: #ff7b72; }
.type { color: #0550ae; font-weight: 600; }
[data-theme="dark"] .type { color: #79c0ff; }

/* ── Callouts ── */
.callout {
  border-left: 4px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  margin: 1.5em 0;
  line-height: 1.6;
}
.callout-title {
  font-family: Inter, Arial, sans-serif;
  font-weight: 700;
  font-size: 0.95em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.callout-title .callout-icon { font-size: 1.1em; }
.callout p { margin-bottom: 0.5em; }
.callout p:last-child { margin-bottom: 0; }

.callout-note {
  border-left-color: #0060B6;
  background: #e8f0fe;
}
.callout-note .callout-title {
  color: #0060B6;
}
[data-theme="dark"] .callout-note {
  background: #1a2d4a;
  border-left-color: #0060B6;
}

.callout-tip {
  border-left-color: #1a7f37;
  background: #dafbe1;
}
.callout-tip .callout-title {
  color: #1a7f37;
}
[data-theme="dark"] .callout-tip {
  background: #1a3a2a;
  border-left-color: #1a7f37;
}

.callout-warning {
  border-left-color: #9a6700;
  background: #fff8c5;
}
.callout-warning .callout-title {
  color: #9a6700;
}
[data-theme="dark"] .callout-warning {
  background: #3a3520;
  border-left-color: #9a6700;
}

.callout-common-mistake {
  border-left-color: #cf222e;
  background: #ffebe9;
}
.callout-common-mistake .callout-title {
  color: #cf222e;
}
[data-theme="dark"] .callout-common-mistake {
  background: #3a1a1a;
  border-left-color: #cf222e;
}

.callout-try-it-yourself {
  border-left-color: #8250df;
  background: #f3e8ff;
}
.callout-try-it-yourself .callout-title {
  color: #8250df;
}
[data-theme="dark"] .callout-try-it-yourself {
  background: #2d1a4a;
  border-left-color: #8250df;
}

.callout-why-this-matters {
  border-left-color: #3730a3;
  background: #e8e7fe;
}
.callout-why-this-matters .callout-title {
  color: #3730a3;
}
[data-theme="dark"] .callout-why-this-matters {
  background: #1a1a4a;
  border-left-color: #3730a3;
}

.callout-real-world-analogy {
  border-left-color: #7c4a1a;
  background: #fef3e2;
}
.callout-real-world-analogy .callout-title {
  color: #7c4a1a;
}
[data-theme="dark"] .callout-real-world-analogy {
  background: #3a2a1a;
  border-left-color: #7c4a1a;
}

.callout-important {
  border-left-color: #9a6700;
  background: #fff8c5;
}
.callout-important .callout-title {
  color: #9a6700;
}
[data-theme="dark"] .callout-important {
  background: #3a3520;
  border-left-color: #9a6700;
}

.callout-key-point {
  border-left-color: #0060B6;
  background: #e8f0fe;
}
.callout-key-point .callout-title {
  color: #0060B6;
}
[data-theme="dark"] .callout-key-point {
  background: #1a2d4a;
  border-left-color: #0060B6;
}

.callout-key-insight {
  border-left-color: #0060B6;
  background: #e8f0fe;
}
.callout-key-insight .callout-title {
  color: #0060B6;
}
[data-theme="dark"] .callout-key-insight {
  background: #1a2d4a;
  border-left-color: #0060B6;
}

.callout-key-design-decision {
  border-left-color: #0060B6;
  background: #e8f0fe;
}
.callout-key-design-decision .callout-title {
  color: #0060B6;
}
[data-theme="dark"] .callout-key-design-decision {
  background: #1a2d4a;
  border-left-color: #0060B6;
}

.callout-design-choice {
  border-left-color: #0060B6;
  background: #e8f0fe;
}
.callout-design-choice .callout-title {
  color: #0060B6;
}
[data-theme="dark"] .callout-design-choice {
  background: #1a2d4a;
  border-left-color: #0060B6;
}

.callout-pro-tip {
  border-left-color: #1a7f37;
  background: #dafbe1;
}
.callout-pro-tip .callout-title {
  color: #1a7f37;
}
[data-theme="dark"] .callout-pro-tip {
  background: #1a3a2a;
  border-left-color: #1a7f37;
}

.callout-edge-case {
  border-left-color: #9a6700;
  background: #fff8c5;
}
.callout-edge-case .callout-title {
  color: #9a6700;
}
[data-theme="dark"] .callout-edge-case {
  background: #3a3520;
  border-left-color: #9a6700;
}

.callout-recommendation {
  border-left-color: #1a7f37;
  background: #dafbe1;
}
.callout-recommendation .callout-title {
  color: #1a7f37;
}
[data-theme="dark"] .callout-recommendation {
  background: #1a3a2a;
  border-left-color: #1a7f37;
}

.callout-looking-ahead {
  border-left-color: #3730a3;
  background: #e8e7fe;
}
.callout-looking-ahead .callout-title {
  color: #3730a3;
}
[data-theme="dark"] .callout-looking-ahead {
  background: #1a1a4a;
  border-left-color: #3730a3;
}


/* ── Diagrams (monospace fallback) ── */
.diagram {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 1.5em 0;
  overflow-x: auto;
  text-align: center;
}
.diagram pre {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-block;
  text-align: left;
  font-size: 0.82em;
  line-height: 1.4;
}
.diagram pre code {
  background: none;
  border: none;
}
[data-theme="dark"] .diagram {
  background: linear-gradient(135deg, #1a2332, var(--bg-secondary));
}

/* ── Box Diagrams ── */
.box-diagram {
  background: linear-gradient(145deg, #f8fafc, #eef2ff);
  border: 1px solid #c7d2de;
  border-radius: 12px;
  padding: 20px;
  margin: 1.5em 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  overflow-x: auto;
}
[data-theme="dark"] .box-diagram {
  background: linear-gradient(145deg, #0f172a, #1e1b4b);
  border-color: #312e81;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.bd-title {
  font-family: Inter, Arial, sans-serif;
  font-weight: 700;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.bd-layout-horizontal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}
.bd-layout-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.bd-layout-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.bd-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}
.bd-box {
  border-radius: 10px;
  padding: 10px 16px;
  border: 2px solid;
  text-align: center;
  min-width: 80px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.bd-box-header {
  font-family: Inter, Arial, sans-serif;
  font-weight: 700;
  font-size: 0.9em;
  margin-bottom: 4px;
}
.bd-box-line {
  font-family: Inter, Arial, sans-serif;
  font-size: 0.82em;
  line-height: 1.4;
}
.bd-c0 { background: #dbeafe; border-color: #2563eb; color: #1e40af; }
.bd-c1 { background: #dcfce7; border-color: #16a34a; color: #166534; }
.bd-c2 { background: #fce7f3; border-color: #db2777; color: #9d174d; }
.bd-c3 { background: #fef3c7; border-color: #d97706; color: #92400e; }
.bd-c4 { background: #e0e7ff; border-color: #4f46e5; color: #3730a3; }
.bd-c5 { background: #ede9fe; border-color: #7c3aed; color: #5b21b6; }
.bd-c6 { background: #ccfbf1; border-color: #0d9488; color: #115e59; }
.bd-c7 { background: #fee2e2; border-color: #dc2626; color: #991b1b; }
[data-theme="dark"] .bd-c0 { background: #1e3a5f; border-color: #60a5fa; color: #93c5fd; }
[data-theme="dark"] .bd-c1 { background: #14532d; border-color: #4ade80; color: #86efac; }
[data-theme="dark"] .bd-c2 { background: #500724; border-color: #f472b6; color: #f9a8d4; }
[data-theme="dark"] .bd-c3 { background: #451a03; border-color: #fbbf24; color: #fde68a; }
[data-theme="dark"] .bd-c4 { background: #312e81; border-color: #818cf8; color: #a5b4fc; }
[data-theme="dark"] .bd-c5 { background: #4c1d95; border-color: #a78bfa; color: #c4b5fd; }
[data-theme="dark"] .bd-c6 { background: #134e4a; border-color: #2dd4bf; color: #5eead4; }
[data-theme="dark"] .bd-c7 { background: #450a0a; border-color: #f87171; color: #fca5a5; }
.bd-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6366f1;
  font-size: 1.1em;
  padding: 4px 6px;
  flex-shrink: 0;
}
[data-theme="dark"] .bd-arrow { color: #818cf8; }
.bd-arrow-down { padding: 6px 0; }
.bd-container { text-align: left; }
.bd-text-line {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  line-height: 1.6;
  padding: 2px 0;
  color: var(--text);
}
@media (max-width: 640px) {
  .bd-layout-horizontal { flex-direction: column; }
  .bd-row { flex-direction: column; }
  .bd-arrow-right { transform: rotate(90deg); }
}

/* ── Tree Diagrams ── */
.tree-diagram {
  background: linear-gradient(145deg, #f0fdf4, #ecfdf5);
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 1.5em 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  text-align: left;
}
[data-theme="dark"] .tree-diagram {
  background: linear-gradient(145deg, #052e16, #14532d);
  border-color: #166534;
}
.tree-content { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 14px; }
.tree-line { padding: 2px 0; white-space: nowrap; line-height: 1.6; }
.tree-line .tc { color: #16a34a; }
[data-theme="dark"] .tree-line .tc { color: #4ade80; }
.tree-icon { margin: 0 6px; font-size: 15px; vertical-align: middle; }
.tree-name { color: var(--text); }
.tree-dir .tree-name { font-weight: 600; }

/* ── Profile Cards ── */
.profile-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 1.5em 0;
}
@media (max-width: 640px) {
  .profile-cards { grid-template-columns: 1fr; }
}
.profile-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: 4px solid var(--pc-accent, #3b82f6);
  border-radius: 12px;
  padding: 24px 20px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}
.profile-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
[data-theme="dark"] .profile-card {
  background: var(--bg-secondary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
[data-theme="dark"] .profile-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}
.pc-icon { font-size: 28px; margin-bottom: 8px; }
.pc-title {
  font-family: 'Inter', var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pc-accent, #3b82f6);
  margin-bottom: 10px;
}
.pc-quote {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 14px;
  padding-left: 12px;
  border-left: 3px solid var(--pc-accent, #3b82f6);
}
.pc-label {
  font-family: 'Inter', var(--font-heading);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.pc-path {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.88rem;
}
.pc-path li {
  padding: 3px 0 3px 18px;
  position: relative;
  color: var(--text);
}
.pc-path li::before {
  content: '\25B8';
  position: absolute;
  left: 0;
  color: var(--pc-accent, #3b82f6);
  font-size: 0.8em;
}
.pc-detail {
  color: var(--text-secondary);
  font-size: 0.85em;
}

/* ── Author Card ── */
.author-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  background: linear-gradient(135deg, var(--bg), var(--bg-secondary));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  margin: 1.5em 0 2em;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
[data-theme="dark"] .author-card {
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.author-avatar {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #0060B6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', var(--font-heading);
  font-weight: 800;
  font-size: 28px;
  color: #fff;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(190,0,39,0.25);
}
.author-info { flex: 1; }
.author-name {
  font-family: 'Inter', var(--font-heading);
  font-weight: 700;
  font-size: 1.3em;
  margin: 0 0 4px;
  color: var(--text);
}
.author-role {
  font-size: 0.95em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.author-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.author-links a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  text-decoration: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all var(--transition);
}
.author-links a:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
@media (max-width: 480px) {
  .author-card { flex-direction: column; align-items: center; text-align: center; }
  .author-links { justify-content: center; }
}

/* ── Ecosystem Grid ── */
.ecosystem-grid {
  margin: 1.5em 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.eco-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--eco-accent, #3b82f6);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="dark"] .eco-section {
  background: var(--bg-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.eco-header {
  font-family: 'Inter', var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--eco-accent, #3b82f6);
  margin-bottom: 12px;
}
.eco-icon { font-size: 1em; margin-right: 4px; }
.eco-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.eco-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.eco-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
[data-theme="dark"] .eco-card {
  background: rgba(255,255,255,0.04);
}
[data-theme="dark"] .eco-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.eco-card-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 2px;
}
.eco-card-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.eco-card-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.eco-card-list li {
  padding: 1px 0 1px 14px;
  position: relative;
}
.eco-card-list li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--eco-accent, #3b82f6);
}
@media (max-width: 480px) {
  .eco-cards { grid-template-columns: 1fr; }
}

/* ── Tables ── */
.table-wrapper {
  overflow-x: auto;
  margin: 1em 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}
thead {
  background: var(--dark);
  color: #fff;
}
[data-theme="dark"] thead {
  background: #21262d;
}
th {
  font-family: Inter, Arial, sans-serif;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.9em;
}
td {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}
tbody tr:hover {
  background: color-mix(in srgb, var(--blue) 8%, var(--bg));
}

/* ── Prev/Next Nav ── */
.chapter-nav {
  display: flex;
  gap: 16px;
  margin-top: 3em;
  padding-top: 2em;
  border-top: 1px solid var(--border);
}
.chapter-nav a {
  flex: 1;
  display: block;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
  font-family: Inter, Arial, sans-serif;
}
.chapter-nav a:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
}
.chapter-nav .nav-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chapter-nav .nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}
.nav-next { text-align: right; }

/* ── Search Modal ── */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.search-overlay.open { display: flex; }
.search-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 560px;
  max-width: 90vw;
  max-height: 60vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.search-input-wrap svg { flex-shrink: 0; color: var(--text-secondary); }
.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text);
  outline: none;
  font-family: Inter, Arial, sans-serif;
}
.search-input::placeholder { color: var(--text-secondary); }
.search-results {
  overflow-y: auto;
  padding: 8px;
  flex: 1;
}
.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  transition: background var(--transition);
  cursor: pointer;
}
.search-result:hover, .search-result.active {
  background: var(--bg-secondary);
}
.search-result-title {
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.search-result-chapter {
  font-size: 12px;
  color: var(--text-secondary);
}
.search-result-preview {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
}

/* ── Back to Top ── */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  z-index: 50;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--red); }

/* ── Reading Time Badge ── */
.reading-time {
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 1.5em;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Index Page — O'Reilly-inspired Cover ── */
/* ══════════════════════════════════════════════════
   NEAM NEON BOOK COVER — Hero Section
   ══════════════════════════════════════════════════ */

/* ── Scene ── */
.hero {
  text-align: center;
  padding: 0;
  background: #06060f;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Ambient glow orbs */
.hero::before {
  content: '';
  position: absolute;
  width: 800px; height: 800px;
  top: -200px; left: -200px;
  background: radial-gradient(circle, rgba(190,0,39,0.12) 0%, transparent 70%);
  animation: orbDrift 20s ease-in-out infinite alternate;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  bottom: -150px; right: -150px;
  background: radial-gradient(circle, rgba(0,96,182,0.10) 0%, transparent 70%);
  animation: orbDrift 18s ease-in-out infinite alternate-reverse;
  pointer-events: none;
}
@keyframes orbDrift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(40px, -30px) scale(1.1); }
  100% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Floating particles */
.hero-particles {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
}
.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}
.p1 { width:3px; height:3px; background:#ff2d55; left:15%; animation-duration:12s; animation-delay:0s; }
.p2 { width:2px; height:2px; background:#3d9eff; left:35%; animation-duration:16s; animation-delay:2s; }
.p3 { width:4px; height:4px; background:#ff2d55; left:55%; animation-duration:14s; animation-delay:4s; }
.p4 { width:2px; height:2px; background:#3d9eff; left:75%; animation-duration:18s; animation-delay:1s; }
.p5 { width:3px; height:3px; background:#8b5cf6; left:25%; animation-duration:15s; animation-delay:3s; }
.p6 { width:2px; height:2px; background:#ff2d55; left:85%; animation-duration:13s; animation-delay:5s; }
@keyframes particleFloat {
  0%   { transform: translateY(110vh) scale(0); opacity: 0; }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* Dot grid */
.hero .hero-particles::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ── Book Wrapper ── */
.book-wrapper {
  position: relative;
  z-index: 2;
  perspective: 1400px;
  margin: 40px auto 0;
  width: 90%;
  max-width: 720px;
}

/* ── 3D Book ── */
.book-3d {
  position: relative;
  display: flex;
  width: 100%;
  transform: rotateY(-4deg) rotateX(1.5deg);
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.23,1,0.32,1);
}
.book-3d:hover {
  transform: rotateY(-1deg) rotateX(0.5deg) scale(1.01);
}

/* ── Spine ── */
.book-spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 28px;
  background: linear-gradient(180deg, #2a0810 0%, #1a0508 50%, #0d0305 100%);
  transform: rotateY(90deg) translateZ(14px) translateX(-14px);
  transform-origin: left center;
  border-right: 1px solid rgba(190,0,39,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.spine-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,45,85,0.7);
  letter-spacing: 4px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}

/* ── Front Cover ── */
.book-front {
  width: 100%;
  min-height: auto;
  background: linear-gradient(170deg, #0d0d1a 0%, #0a0a14 40%, #08080f 100%);
  border: 1px solid rgba(255,45,85,0.15);
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    0 0 60px rgba(190,0,39,0.08),
    0 0 120px rgba(0,96,182,0.05),
    0 30px 80px rgba(0,0,0,0.6),
    inset 0 0 80px rgba(190,0,39,0.03);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: translateZ(14px);
}
/* Neon edge glow */
.book-front::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 2px 8px 8px 2px;
  background: linear-gradient(135deg,
    rgba(255,45,85,0.25) 0%,
    transparent 30%,
    transparent 70%,
    rgba(0,150,255,0.2) 100%);
  z-index: -1;
  filter: blur(1px);
  animation: edgePulse 4s ease-in-out infinite alternate;
}
@keyframes edgePulse {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Surface reflection */
.book-front::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
  pointer-events: none;
}

/* ── Top Band ── */
.book-top-band {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 36px;
  border-bottom: 1px solid rgba(255,45,85,0.12);
  background: linear-gradient(90deg, rgba(190,0,39,0.08), transparent, rgba(0,96,182,0.06));
}
.book-edition {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: rgba(255,45,85,0.6);
  letter-spacing: 3px;
}
.book-version {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 500;
  color: rgba(61,158,255,0.5);
  letter-spacing: 1px;
}

/* ── Terminal Motif ── */
.book-terminal {
  margin: 28px 36px 0;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
}
.terminal-dots {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.tdot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.tdot.red    { background: #ff5f57; }
.tdot.yellow { background: #febc2e; }
.tdot.green  { background: #28c840; }
.terminal-body {
  padding: 12px 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.8;
}
.terminal-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.t-prompt {
  color: rgba(255,45,85,0.8);
  font-weight: 700;
}
.t-cmd {
  color: #e8e8e8;
  font-weight: 600;
}
.t-cursor {
  display: inline-block;
  width: 7px; height: 14px;
  background: rgba(255,45,85,0.7);
  animation: cursorBlink 1s step-end infinite;
  margin-left: 2px;
  vertical-align: middle;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
.t-output { opacity: 0.7; }
.t-neon {
  color: #3d9eff;
  font-size: 0.6rem;
}
.t-text { color: #9ca3af; }

/* ── Title Block ── */
.book-title-block {
  padding: 36px 36px 0;
  text-align: center;
  flex: 0 0 auto;
}
.book-pre-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: rgba(61,158,255,0.5);
  letter-spacing: 4px;
  margin-bottom: 16px;
  text-align: center;
}
.book-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin: 0;
  border: none;
  padding: 0;
}
/* "NEAMCODE" — first word, white */
.title-line-1 {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 2.6em;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.0;
  color: #fff;
  text-shadow: 0 0 40px rgba(255,45,85,0.2), 0 0 80px rgba(255,45,85,0.06);
}
/* "HANDBOOK" — second word, neon gradient */
.title-line-2 {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 2.6em;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.05;
  background: linear-gradient(135deg, #ff2d55 0%, #ff6b8a 35%, #3d9eff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,45,85,0.12));
}
/* "Command the Future" — subtitle line */
.title-the {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.0em;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.4);
  line-height: 1;
  margin-top: 14px;
}

/* ── Neon Divider ── */
.neon-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 60px;
}
.neon-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,45,85,0.5), rgba(61,158,255,0.3), transparent);
  box-shadow: 0 0 6px rgba(255,45,85,0.2);
}

/* ── Subtitle ── */
.book-subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.88rem;
  font-style: italic;
  color: rgba(255,255,255,0.35);
  line-height: 1.7;
  padding: 0 36px;
  text-align: center;
  margin: 0;
}

/* ── Stats Strip ── */
.book-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 24px 36px 0;
  padding: 14px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.bstat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bstat strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ff2d55;
  text-shadow: 0 0 12px rgba(255,45,85,0.3);
}
.bstat span {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.bstat-sep {
  width: 1px; height: 24px;
  background: rgba(255,255,255,0.06);
}

/* ── Author ── */
.book-author-area {
  margin-top: auto;
  padding: 24px 36px 28px;
}
.book-author-rule {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,45,85,0.5), transparent);
  margin: 0 auto 12px;
}
.book-author {
  font-family: 'Inter', Arial, sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 3px;
  text-align: center;
}

/* ── CTA Below Book ── */
.hero-cta {
  position: relative;
  z-index: 2;
  margin: 48px auto 0;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.hero .start-btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 32px;
  background: linear-gradient(135deg, #BE0027 0%, #e6003a 100%);
  color: #fff;
  border-radius: 10px;
  font-family: 'Inter', Arial, sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.23,1,0.32,1);
  box-shadow: 0 4px 20px rgba(190,0,39,0.35), 0 0 40px rgba(190,0,39,0.1);
  border: none;
}
.hero .start-btn:hover {
  transform: translateY(-3px);
  text-decoration: none;
  box-shadow: 0 8px 30px rgba(190,0,39,0.45), 0 0 60px rgba(190,0,39,0.15);
}
.hero .start-btn-alt {
  background: transparent;
  border: 1px solid rgba(61,158,255,0.3);
  color: #3d9eff;
  box-shadow: 0 0 20px rgba(61,158,255,0.05);
}
.hero .start-btn-alt:hover {
  background: rgba(61,158,255,0.08);
  border-color: rgba(61,158,255,0.5);
  box-shadow: 0 0 30px rgba(61,158,255,0.1);
}
.hero-meta {
  position: relative;
  z-index: 2;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1px;
}

/* ── Scroll Indicator ── */
.hero-scroll {
  position: relative;
  z-index: 2;
  margin-top: 40px;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: scrollBounce 2.5s ease-in-out infinite;
}
.scroll-text {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255,255,255,0.2);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hero-scroll svg {
  stroke: rgba(255,255,255,0.2);
}
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* Hide old elements */
.hero-cover, .cover-logo-area, .hero-logo, .hero-terminal-icon,
.cover-band, .cover-title-area, .cover-divider, .cover-bottom,
.cover-stats, .hero-features, .hero-version,
.cover-title, .cover-subtitle, .cover-author, .cover-tag,
.cover-edition, .cover-stat { display: none; }

/* ── Light Theme Overrides ── */
[data-theme="light"] .hero {
  background: #f4f1ee;
}
[data-theme="light"] .hero::before {
  background: radial-gradient(circle, rgba(190,0,39,0.06) 0%, transparent 70%);
}
[data-theme="light"] .hero::after {
  background: radial-gradient(circle, rgba(0,96,182,0.05) 0%, transparent 70%);
}
[data-theme="light"] .hero .hero-particles::before {
  background-image: radial-gradient(rgba(0,0,0,0.06) 1px, transparent 1px);
}
[data-theme="light"] .particle { opacity: 0.3; }
[data-theme="light"] .book-front {
  background: linear-gradient(170deg, #1a1a2a 0%, #12121e 40%, #0e0e18 100%);
}
[data-theme="light"] .hero .start-btn-alt {
  background: var(--blue);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(0,96,182,0.25);
}
[data-theme="light"] .hero .start-btn-alt:hover {
  background: #004a8f;
}
[data-theme="light"] .hero-meta { color: #aaa; }
[data-theme="light"] .scroll-text { color: #aaa; }
[data-theme="light"] .hero-scroll svg { stroke: #bbb; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hero { min-height: 100vh; }
  .book-wrapper { width: 92%; }
  .book-front { min-height: auto; }
  .title-line-1, .title-line-2 { font-size: 2.2em; }
  .title-the { font-size: 1em; }
  .book-3d { transform: rotateY(-3deg) rotateX(1deg); }
}
@media (max-width: 480px) {
  .book-wrapper { width: 95%; }
  .book-front { min-height: auto; }
  .title-line-1, .title-line-2 { font-size: 1.8em; }
  .book-terminal { margin: 20px 20px 0; }
  .book-title-block { padding: 24px 20px 0; }
  .neon-divider { padding: 18px 20px; }
  .book-subtitle { padding: 0 20px; font-size: 0.8rem; }
  .book-stats { margin: 18px 20px 0; }
  .book-author-area { padding: 16px 20px 20px; }
  .hero-cta { flex-direction: column; }
  .hero .start-btn { width: 100%; max-width: 280px; justify-content: center; }
  .book-top-band { padding: 12px 20px; }
}

/* Learning Path */
.learning-path {
  max-width: 900px;
  margin: 3em auto;
  padding: 0 20px;
}
.learning-path h2 {
  text-align: center;
  border: none;
  margin-bottom: 1.5em;
}
.path-nodes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  position: relative;
}
.path-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
  text-align: center;
  position: relative;
  padding: 0 8px;
}
.path-node::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 18px);
  width: calc(100% - 36px);
  height: 2px;
  background: var(--border);
}
.path-node:last-child::after { display: none; }
.path-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Inter, Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.path-label {
  font-family: Inter, Arial, sans-serif;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Chapter Cards */
.parts-grid {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 60px;
}
.part-section {
  margin-bottom: 2.5em;
}
.part-section h3 {
  font-family: Inter, Arial, sans-serif;
  font-size: 1.1em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
  margin-top: 0;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.chapter-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all var(--transition);
  background: var(--bg);
}
.chapter-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateY(-1px);
}
.card-num {
  font-family: Inter, Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--blue);
  min-width: 28px;
}
.card-info { flex: 1; min-width: 0; }
.card-title {
  font-family: Inter, Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  font-family: Inter, Arial, sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.card-check {
  font-size: 16px;
  opacity: 0;
  transition: opacity var(--transition);
}
.chapter-card.visited .card-check { opacity: 1; }

/* ── About Page ── */
.about-content { max-width: var(--content-max); margin: 0 auto; padding: 40px 32px 80px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main {
    margin-left: 0;
  }
  .hamburger {
    display: block;
  }
}

@media (max-width: 640px) {
  .content, .about-content {
    padding: 24px 16px 60px;
  }
  h1 { font-size: 1.6em; }
  h2 { font-size: 1.3em; }
  body { font-size: 16px; }
  .chapter-nav {
    flex-direction: column;
  }
  .cover-title { font-size: 1.5em; }
  .path-nodes { gap: 4px; }
  .path-node { width: 80px; }
  .path-dot { width: 28px; height: 28px; font-size: 12px; }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .search-modal { max-height: 80vh; }
}

/* ── Diagram Figures ── */
.diagram-figure {
  margin: 2em 0;
  text-align: center;
}
.diagram-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 16px;
  background: var(--card-bg, #fff);
}
[data-theme="dark"] .diagram-figure img {
  filter: invert(0.88) hue-rotate(180deg);
  border-color: var(--border);
}
.diagram-figure figcaption {
  margin-top: 8px;
  font-size: 0.85em;
  color: var(--text-muted);
  font-style: italic;
}
.ascii-fallback {
  display: none;
}
@media print {
  .diagram-figure img { filter: none; }
}

/* ── Styled Info Boxes (replaces ASCII box art) ── */
.info-box {
  margin: 1.5em 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.info-box-header {
  padding: 10px 18px;
  font-weight: 700;
  font-size: 0.95em;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
}
.info-box-header.blue   { background: #0060B6; color: #fff; }
.info-box-header.red    { background: #BE0027; color: #fff; }
.info-box-header.green  { background: #1a7f37; color: #fff; }
.info-box-header.purple { background: #8250df; color: #fff; }
.info-box-header.gray   { background: #656d76; color: #fff; }
.info-box-header.amber  { background: #bf8700; color: #fff; }
.info-box-body {
  padding: 16px 20px;
  font-size: 0.92em;
  line-height: 1.7;
}
.info-box-body ul, .info-box-body ol {
  margin: 0.3em 0;
  padding-left: 1.4em;
}
.info-box-body li { margin: 0.25em 0; }
.info-box-body code {
  background: var(--code-bg, #f0f2f5);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}
.info-box-body .sub-label {
  font-weight: 600;
  color: var(--text);
  margin-top: 0.6em;
  display: block;
}
.info-box-body .desc {
  color: var(--text-muted);
  font-size: 0.88em;
  margin-left: 0.5em;
}

/* Comparison panels */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 1.5em 0;
}
@media (max-width: 640px) {
  .comparison-grid { grid-template-columns: 1fr; }
}
.comparison-grid .info-box { margin: 0; }

/* Flow steps */
.flow-steps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1.5em 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.flow-step {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.88em;
  font-weight: 600;
  background: var(--code-bg, #f0f2f5);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.flow-arrow {
  color: var(--text-muted);
  font-size: 1.2em;
  font-weight: 700;
}
.flow-step.highlight {
  background: #0060B6;
  color: #fff;
  border-color: #004a8f;
}

/* Decision grid */
.decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 1.5em 0;
}
.decision-card {
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.decision-card .card-label {
  font-weight: 700;
  font-size: 0.9em;
  margin-bottom: 6px;
}
.decision-card ul {
  margin: 0;
  padding-left: 1.2em;
  font-size: 0.85em;
  color: var(--text-muted);
}
.decision-card ul li { margin: 2px 0; }

/* ══════════════════════════════════════════════════════
   PLAYFUL, SMOOTH & STORYTELLING ENHANCEMENTS
   ══════════════════════════════════════════════════════ */

/* ── Keyframe Animations ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 96, 182, 0.3); }
  50%      { box-shadow: 0 0 20px rgba(0, 96, 182, 0.5); }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Content entrance animation */
.content {
  animation: fadeInUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Topbar Glassmorphism ── */
.topbar {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(208, 215, 222, 0.6) !important;
}
[data-theme="dark"] .topbar {
  background: rgba(13, 17, 23, 0.88) !important;
  border-bottom: 1px solid rgba(48, 54, 61, 0.6) !important;
}
.topbar-btn:hover {
  box-shadow: 0 0 12px rgba(0, 96, 182, 0.2);
  transform: translateY(-1px);
}

/* ── Progress Bar — Thicker + Animated Gradient ── */
.progress-bar {
  height: 4px !important;
}
.progress-fill {
  background: linear-gradient(90deg, var(--blue), #8250df, var(--red), #8250df, var(--blue)) !important;
  background-size: 300% 100% !important;
  animation: gradientShift 4s ease infinite;
}

/* ── Sidebar Emojis (removed) ── */

/* ── Sidebar — Smoother + Active Glow ── */
.sidebar {
  transition: background var(--transition), transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), border-color var(--transition) !important;
}
.sidebar-chapters {
  transition: max-height 0.45s cubic-bezier(0.23, 1, 0.32, 1) !important;
}
.sidebar-link {
  transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1) !important;
  border-radius: 6px !important;
  text-align: left !important;
}
.sidebar-link:hover {
  transform: translateX(3px);
  background: color-mix(in srgb, var(--blue) 8%, var(--bg)) !important;
}
.sidebar-link.active {
  box-shadow: 0 0 12px rgba(0, 96, 182, 0.3);
  position: relative;
}
.sidebar-link.active::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.7;
}

/* ── Heading Enhancements — Gradient Underlines ── */
h1 {
  border-bottom: 3px solid transparent !important;
  border-image: linear-gradient(90deg, var(--red), var(--blue)) 1 !important;
  padding-bottom: 0.4em !important;
}
h2 {
  border-bottom: 2px solid transparent !important;
  border-image: linear-gradient(90deg, color-mix(in srgb, var(--blue) 60%, var(--border)), var(--border)) 1 !important;
}
h1 .heading-anchor, h2 .heading-anchor, h3 .heading-anchor {
  transition: opacity 0.3s, color 0.3s;
}
h1:hover .heading-anchor { color: var(--red); }
h2:hover .heading-anchor { color: var(--blue); }

/* ── Table Enhancements ── */
.table-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin: 1.5em 0;
}
[data-theme="dark"] .table-wrap {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
tbody tr {
  transition: background 0.25s ease, transform 0.2s ease;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--blue) 10%, var(--bg)) !important;
}

/* ── Code Block Enhancements ── */
pre {
  background: linear-gradient(135deg, var(--code-bg), color-mix(in srgb, var(--code-bg) 96%, var(--blue))) !important;
  border-left: 3px solid var(--blue) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}
pre:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.code-header {
  background: linear-gradient(90deg, var(--bg-secondary), color-mix(in srgb, var(--bg-secondary) 95%, var(--blue))) !important;
}
.code-header + pre {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
}

/* ── Callout Enhancements — Soft Shadow + Hover ── */
.callout {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-left-color 0.3s ease;
}
.callout:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transform: translateX(3px);
}
[data-theme="dark"] .callout {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
[data-theme="dark"] .callout:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

/* ── Navigation Cards — Storytelling Style ── */
.chapter-nav {
  border-top: 2px solid transparent !important;
  border-image: linear-gradient(90deg, var(--red), var(--blue)) 1 !important;
  padding-top: 2.5em !important;
}
.chapter-nav a {
  background: var(--bg);
  transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1) !important;
  position: relative;
  overflow: hidden;
  border-radius: 12px !important;
  padding: 20px 24px !important;
}
.chapter-nav a::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--blue), var(--red));
  opacity: 0;
  transition: opacity 0.3s, width 0.3s;
}
.chapter-nav a:hover::before {
  opacity: 1;
  width: 5px;
}
.chapter-nav a:hover {
  border-color: var(--blue) !important;
  box-shadow: 0 6px 24px rgba(0, 96, 182, 0.15);
  transform: translateY(-3px);
}
.chapter-nav .nav-label {
  font-size: 13px !important;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.chapter-nav .nav-title {
  font-size: 16px !important;
  font-weight: 700 !important;
  margin-top: 6px !important;
}
.nav-next:hover .nav-title {
  color: var(--blue);
}
.nav-prev:hover .nav-title {
  color: var(--red);
}

/* ── Back to Top — Playful Rocket ── */
.back-to-top {
  font-size: 20px !important;
  width: 46px !important;
  height: 46px !important;
  background: linear-gradient(135deg, var(--blue), #8250df) !important;
  border-radius: 14px !important;
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.3s !important;
}
.back-to-top.visible {
  animation: pulseGlow 2.5s ease-in-out infinite;
}
.back-to-top:hover {
  background: linear-gradient(135deg, var(--red), #e6003a) !important;
  transform: translateY(-5px) scale(1.08) !important;
  box-shadow: 0 8px 28px rgba(190, 0, 39, 0.35) !important;
}

/* ── Index Page — Chapter Cards Enhancement ── */
.chapter-card {
  transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1) !important;
  border-left: 3px solid transparent !important;
  border-radius: 10px !important;
  position: relative;
  overflow: hidden;
}
.chapter-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, transparent 60%, rgba(0, 96, 182, 0.03));
  pointer-events: none;
  transition: opacity 0.3s;
  opacity: 0;
}
.chapter-card:hover::after { opacity: 1; }
.chapter-card:hover {
  transform: translateY(-4px) scale(1.02) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
}
.card-num {
  font-size: 18px !important;
  min-width: 32px !important;
  transition: transform 0.3s ease;
}
.chapter-card:hover .card-num {
  transform: scale(1.15);
}

/* Per-part colored left borders on cards */
[data-part="Getting Started"] .chapter-card,
.part-section[data-part="Getting Started"] .chapter-card { border-left-color: #BE0027 !important; }
[data-part="Core Skills"] .chapter-card,
.part-section[data-part="Core Skills"] .chapter-card { border-left-color: #0060B6 !important; }
[data-part="Workflow & Configuration"] .chapter-card,
.part-section[data-part="Workflow & Configuration"] .chapter-card { border-left-color: #1a7f37 !important; }
[data-part="Providers & Cost"] .chapter-card,
.part-section[data-part="Providers & Cost"] .chapter-card { border-left-color: #8250df !important; }
[data-part="Advanced Features"] .chapter-card,
.part-section[data-part="Advanced Features"] .chapter-card { border-left-color: #9a6700 !important; }
[data-part="Audience Guides"] .chapter-card,
.part-section[data-part="Audience Guides"] .chapter-card { border-left-color: #cf222e !important; }
[data-part="Walkthroughs"] .chapter-card,
.part-section[data-part="Walkthroughs"] .chapter-card { border-left-color: #3730a3 !important; }
[data-part="Closing"] .chapter-card,
.part-section[data-part="Closing"] .chapter-card { border-left-color: #0d6efd !important; }
[data-part="Appendices"] .chapter-card,
.part-section[data-part="Appendices"] .chapter-card { border-left-color: #656d76 !important; }

/* ── Learning Path Enhancement ── */
.path-dot {
  font-size: 16px !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.path-node:hover .path-dot {
  transform: scale(1.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.path-label {
  transition: color 0.2s;
}
.path-node:hover .path-label {
  color: var(--text);
}

/* ── Part Section Headers — Storytelling Feel ── */
.part-section h3 {
  font-size: 1.2em !important;
  letter-spacing: 0.02em;
  position: relative;
  padding-left: 8px !important;
  transition: color 0.3s;
}
.part-section:hover h3 {
  color: var(--text);
}

/* ── Blockquote — Storytelling Enhancement ── */
blockquote {
  border-left: 4px solid var(--red) !important;
  background: linear-gradient(135deg, var(--bg-secondary), color-mix(in srgb, var(--bg-secondary) 95%, var(--red))) !important;
  border-radius: 0 12px 12px 0 !important;
  padding: 1em 1.5em !important;
  position: relative;
  font-style: italic;
}
blockquote::before {
  content: '\201C';
  position: absolute;
  top: -8px; left: 12px;
  font-size: 3em;
  color: var(--red);
  opacity: 0.15;
  font-family: Georgia, serif;
  line-height: 1;
}

/* ── HR Dividers — Gradient ── */
hr {
  border: none !important;
  height: 2px !important;
  background: linear-gradient(90deg, transparent, var(--border), transparent) !important;
  margin: 2.5em 0 !important;
}

/* ── Links — Subtle Underline Animation ── */
.content a:not(.heading-anchor):not(.nav-prev):not(.nav-next) {
  text-decoration: none;
  background-image: linear-gradient(var(--blue), var(--blue));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease, color 0.3s ease;
  padding-bottom: 1px;
}
.content a:not(.heading-anchor):not(.nav-prev):not(.nav-next):hover {
  background-size: 100% 2px;
  text-decoration: none !important;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 28px 20px 36px;
  margin-top: 3em;
  border-top: 2px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--border), transparent) 1;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
}
.site-footer a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* ── Smooth hover for everything ── */
a, button {
  transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ── Scroll-reveal elements (JS adds .revealed class) ── */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}
.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── Stagger delays for card animations ── */
.chapter-card:nth-child(1)  { transition-delay: 0.00s; }
.chapter-card:nth-child(2)  { transition-delay: 0.05s; }
.chapter-card:nth-child(3)  { transition-delay: 0.10s; }
.chapter-card:nth-child(4)  { transition-delay: 0.15s; }
.chapter-card:nth-child(5)  { transition-delay: 0.20s; }
.chapter-card:nth-child(6)  { transition-delay: 0.25s; }

/* ── Inline code — subtle pill style ── */
code {
  border-radius: 5px !important;
  padding: 2px 7px !important;
  font-size: 0.87em !important;
  transition: background 0.2s;
}
code:hover {
  background: color-mix(in srgb, var(--code-bg) 85%, var(--blue));
}

/* ── List items — smoother ── */
li {
  transition: color 0.2s;
}
ul li::marker {
  color: var(--blue);
}
ol li::marker {
  color: var(--red);
  font-weight: 600;
}

/* ── Image hover ── */
img {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
img:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── Selection Color ── */
::selection {
  background: color-mix(in srgb, var(--blue) 25%, transparent);
  color: var(--text);
}

/* ── Print-friendly: disable animations ── */
@media print {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Reduced motion preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════════════
   SIDEBAR ARROW FIX — hide duplicate HTML arrow span;
   the ::after pseudo-element handles direction.
   ══════════════════════════════════════════════════════ */
.sidebar-part-title .arrow { display: none; }

/* ══════════════════════════════════════════════════════
   MERMAID DIAGRAM CONTAINERS
   ══════════════════════════════════════════════════════ */
.mermaid-wrap {
  margin: 1.8em 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.mermaid-wrap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}
.mermaid-wrap-header .diagram-type {
  color: var(--blue);
  font-weight: 700;
}
.mermaid-inner {
  padding: 20px;
  overflow-x: auto;
  text-align: center;
}
.mermaid-inner pre.mermaid {
  background: transparent !important;
  border: none !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center;
}
[data-theme="dark"] .mermaid svg { filter: invert(0.85) hue-rotate(180deg) brightness(1.1); }

/* ══════════════════════════════════════════════════════
   CHAPTER NAVIGATION BUTTONS
   ══════════════════════════════════════════════════════ */
.chapter-nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 3em 0 1em;
  padding-top: 2em;
  border-top: 2px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.chapter-nav-buttons .nav-spacer { flex: 1; }
a.next-chapter-btn, a.prev-chapter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 10px;
  font-family: Inter, sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.23,1,0.32,1);
  white-space: nowrap;
}
a.next-chapter-btn {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,96,182,0.3);
}
a.next-chapter-btn:hover {
  background: #004a8f;
  transform: translateX(4px);
  box-shadow: 0 6px 20px rgba(0,96,182,0.4);
  color: #fff;
}
a.prev-chapter-btn {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}
a.prev-chapter-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateX(-4px);
}
.btn-chapter-label {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.btn-chapter-title {
  display: block;
  font-weight: 700;
  font-size: 14px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ══════════════════════════════════════════════════════
   CODE BLOCK ENHANCEMENTS — language label
   ══════════════════════════════════════════════════════ */
.code-header .code-lang-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--blue);
  color: #fff;
  margin-right: 8px;
}
.code-header .code-lang-badge.lang-neam   { background: #BE0027; }
.code-header .code-lang-badge.lang-sql    { background: #1a7f37; }
.code-header .code-lang-badge.lang-bash   { background: #6f42c1; }
.code-header .code-lang-badge.lang-json   { background: #9a6700; }
.code-header .code-lang-badge.lang-yaml   { background: #0550ae; }
.code-header .code-lang-badge.lang-python { background: #3d6b9c; }
.code-header .code-lang-badge.lang-diagram { background: #0d8a6e; }

pre code.language-neam,
pre code.language-sql,
pre code.language-bash,
pre code.language-json,
pre code.language-yaml,
pre code.language-python {
  display: block;
  font-size: 0.875em;
  line-height: 1.65;
}

/* ══════════════════════════════════════════════════════
   E-BOOK FRONT PAGE — bigger cover enhancements
   ══════════════════════════════════════════════════════ */
.ebook-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;
  padding: 80px 40px 60px;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  width: 100%;
}
.ebook-cover-col {
  flex: 0 0 auto;
}
.ebook-info-col {
  flex: 1;
  text-align: left;
  color: #e8e8f0;
  max-width: 440px;
}
.ebook-badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.ebook-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255,255,255,0.15);
}
.ebook-badge.red    { background: rgba(190,0,39,0.2);  color: #ff6b8a; border-color: rgba(190,0,39,0.4); }
.ebook-badge.blue   { background: rgba(0,96,182,0.2);  color: #6ab0f5; border-color: rgba(0,96,182,0.4); }
.ebook-badge.green  { background: rgba(26,127,55,0.2); color: #6fdc8c; border-color: rgba(26,127,55,0.4); }
.ebook-badge.purple { background: rgba(130,80,223,0.2);color: #c5a6ff; border-color: rgba(130,80,223,0.4); }
.ebook-info-title {
  font-family: Inter, sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.ebook-info-title span { color: #3d9eff; }
.ebook-info-subtitle {
  font-size: 1rem;
  color: rgba(200,210,230,0.7);
  line-height: 1.6;
  margin-bottom: 28px;
}
.ebook-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.ebook-stat {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
.ebook-stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: #3d9eff;
  display: block;
  line-height: 1;
}
.ebook-stat-label {
  font-size: 11px;
  color: rgba(200,210,230,0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-top: 4px;
}
.ebook-cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.ebook-author-line {
  font-size: 13px;
  color: rgba(200,210,230,0.5);
  font-family: Inter, sans-serif;
}
.ebook-author-line strong { color: rgba(200,210,230,0.85); }

/* Big 3D book for hero */
.book-wrapper-xl {
  perspective: 1600px;
  width: 320px;
}
.book-3d-xl {
  position: relative;
  display: flex;
  width: 100%;
  transform: rotateY(-8deg) rotateX(3deg);
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.23,1,0.32,1);
  filter: drop-shadow(-20px 30px 60px rgba(0,0,0,0.8));
}
.book-3d-xl:hover {
  transform: rotateY(-3deg) rotateX(1deg) scale(1.02);
}
.book-spine-xl {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 32px;
  background: linear-gradient(180deg, #3a0a14 0%, #1e0608 50%, #0d0305 100%);
  transform: rotateY(90deg) translateZ(16px) translateX(-16px);
  transform-origin: left center;
  border-right: 1px solid rgba(190,0,39,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.spine-text-xl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,45,85,0.7);
  letter-spacing: 5px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
}
.book-front-xl {
  width: 100%;
  min-height: 440px;
  background: linear-gradient(165deg, #0e0e20 0%, #080810 50%, #060610 100%);
  border: 1px solid rgba(255,45,85,0.2);
  border-radius: 2px 10px 10px 2px;
  box-shadow:
    0 0 80px rgba(190,0,39,0.12),
    0 0 160px rgba(0,96,182,0.07),
    0 40px 100px rgba(0,0,0,0.7),
    inset 0 0 100px rgba(190,0,39,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: translateZ(16px);
}
.book-front-xl::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 2px 10px 10px 2px;
  background: linear-gradient(135deg, rgba(255,45,85,0.3) 0%, transparent 35%, transparent 65%, rgba(0,150,255,0.25) 100%);
  z-index: -1;
  filter: blur(1px);
  animation: edgePulse 4s ease-in-out infinite alternate;
}
.book-front-xl::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 35%;
  background: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, transparent 100%);
  pointer-events: none;
}
.bxl-topband {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(255,45,85,0.12);
  background: linear-gradient(90deg, rgba(190,0,39,0.1), transparent, rgba(0,96,182,0.08));
}
.bxl-edition {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,45,85,0.7);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.bxl-year {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(61,158,255,0.6);
  letter-spacing: 1px;
}
.bxl-visual {
  margin: 0;
  padding: 0;
  position: relative;
  height: 120px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(10,10,30,0.3) 0%, rgba(5,5,20,0.7) 100%);
}
.bxl-visual-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,96,182,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,96,182,0.12) 1px, transparent 1px);
  background-size: 24px 24px;
}
.bxl-visual-nodes {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.bxl-node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  animation: nodeFloat 3s ease-in-out infinite alternate;
}
.bxl-node::after {
  content: '';
  position: absolute;
  right: -18px;
  top: 50%;
  width: 18px;
  height: 1px;
  background: rgba(61,158,255,0.4);
}
.bxl-node:last-child::after { display: none; }
.bxl-node.n1 { background: rgba(190,0,39,0.25); border: 1px solid rgba(190,0,39,0.5); animation-delay: 0s; }
.bxl-node.n2 { background: rgba(0,96,182,0.25); border: 1px solid rgba(0,96,182,0.5); animation-delay: 0.4s; }
.bxl-node.n3 { background: rgba(26,127,55,0.25); border: 1px solid rgba(26,127,55,0.5); animation-delay: 0.8s; }
.bxl-node.n4 { background: rgba(130,80,223,0.25); border: 1px solid rgba(130,80,223,0.5); animation-delay: 1.2s; }
.bxl-node.n5 { background: rgba(154,103,0,0.25); border: 1px solid rgba(154,103,0,0.5); animation-delay: 1.6s; }
@keyframes nodeFloat {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}
.bxl-visual-caption {
  position: absolute;
  bottom: 8px;
  left: 0; right: 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8.5px;
  color: rgba(61,158,255,0.45);
  letter-spacing: 1.5px;
}
.bxl-pre-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  font-weight: 600;
  color: rgba(61,158,255,0.5);
  letter-spacing: 4px;
  text-align: center;
  padding: 16px 20px 0;
  text-transform: uppercase;
}
.bxl-title {
  padding: 10px 20px 0;
  text-align: center;
}
.bxl-title-line1 {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-shadow: 0 0 40px rgba(255,45,85,0.15);
}
.bxl-title-line2 {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.05;
  background: linear-gradient(135deg, #ff2d55 0%, #ff6b8a 35%, #3d9eff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bxl-title-with {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(200,210,230,0.4);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 4px;
  -webkit-text-fill-color: rgba(200,210,230,0.4);
}
.bxl-neon-divider {
  margin: 12px 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,45,85,0.4), rgba(61,158,255,0.4), transparent);
}
.bxl-subtitle {
  text-align: center;
  font-family: Inter, sans-serif;
  font-size: 0.65rem;
  color: rgba(200,210,230,0.4);
  letter-spacing: 0.08em;
  padding: 0 20px;
  line-height: 1.5;
}
.bxl-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  margin-top: 4px;
}
.bxl-stat {
  text-align: center;
}
.bxl-stat-num {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #3d9eff;
  line-height: 1;
}
.bxl-stat-lbl {
  display: block;
  font-family: Inter, sans-serif;
  font-size: 8.5px;
  color: rgba(200,210,230,0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}
.bxl-divider-sm {
  width: 1px;
  background: rgba(255,255,255,0.08);
  align-self: stretch;
  margin: 4px 0;
}
.bxl-author-area {
  margin-top: auto;
  padding: 12px 24px 16px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: linear-gradient(0deg, rgba(190,0,39,0.06), transparent);
}
.bxl-author-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,45,85,0.3), transparent);
  margin-bottom: 8px;
}
.bxl-author {
  font-family: Inter, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(200,210,230,0.45);
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

@media (max-width: 900px) {
  .ebook-hero { flex-direction: column; gap: 40px; padding: 60px 24px 40px; }
  .ebook-info-col { text-align: center; }
  .ebook-cta-row { justify-content: center; }
  .ebook-stats-grid { max-width: 340px; margin-left: auto; margin-right: auto; }
  .book-wrapper-xl { width: 260px; }
  .book-front-xl { min-height: 360px; }
}
@media (max-width: 480px) {
  .ebook-info-title { font-size: 1.7rem; }
  .ebook-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .book-wrapper-xl { width: 220px; }
  .book-front-xl { min-height: 300px; }
}
