/* Shared stylesheet for Kraken interview-prep HTML guides */

:root {
  --bg: #fdfcf8;
  --bg-elev: #ffffff;
  --bg-code: #1f2228;
  --text: #1a1a1a;
  --text-muted: #5a5a5a;
  --text-faint: #8a8a8a;
  --border: #e6e3dc;
  --border-strong: #d4d0c5;
  --accent: #c9572c;
  --accent-soft: #fdf0e9;
  --accent-text: #8a3a1c;
  --tip-bg: #f0f7f0;
  --tip-border: #4a8a4a;
  --tip-text: #2d5a2d;
  --warn-bg: #fdf5e6;
  --warn-border: #c98c2c;
  --warn-text: #8a5a1c;
  --insight-bg: #eef3f9;
  --insight-border: #3a6fa8;
  --insight-text: #1f4670;
  --danger-bg: #fbecec;
  --danger-border: #b84a4a;
  --danger-text: #883030;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #1a1c20;
  --bg-elev: #23262c;
  --bg-code: #0f1115;
  --text: #e8e6e0;
  --text-muted: #a8a6a0;
  --text-faint: #707070;
  --border: #353840;
  --border-strong: #454850;
  --accent: #e87b4a;
  --accent-soft: #2a1f17;
  --accent-text: #f4a87a;
  --tip-bg: #1a2a1a;
  --tip-border: #5aa05a;
  --tip-text: #a8d4a8;
  --warn-bg: #2a2218;
  --warn-border: #d4a04a;
  --warn-text: #e4c478;
  --insight-bg: #182028;
  --insight-border: #5a8ec0;
  --insight-text: #a0c4e4;
  --danger-bg: #2a1818;
  --danger-border: #c46a6a;
  --danger-text: #e89090;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1240px;
  margin: 0 auto;
  gap: 48px;
  padding: 0 24px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: static; max-height: none; padding: 16px 0; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: none; }
  .sidebar.open nav { display: block; }
  .mobile-toc-toggle { display: block; }
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: 32px 0;
  font-size: 14px;
}

.sidebar h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  font-weight: 700;
  margin: 24px 0 10px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}
.sidebar nav > h2:first-child { margin-top: 0; }

.sidebar ol, .sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar .step-list { counter-reset: step; }

.sidebar a {
  display: block;
  padding: 6px 12px;
  margin: 2px 0;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sidebar a:hover { color: var(--text); background: var(--bg-elev); }
.sidebar a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

.sidebar .step-list a {
  counter-increment: step;
  padding-left: 36px;
  position: relative;
}
.sidebar .step-list a::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 6px;
  width: 18px;
  height: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar .step-list a.active::before { background: var(--accent); color: white; border-color: var(--accent); }

.mobile-toc-toggle {
  display: none;
  margin: 16px 0;
  padding: 8px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

main { padding: 48px 0 96px; max-width: 760px; }

.hero { margin-bottom: 48px; }
.hero .eyebrow {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.hero .subtitle {
  font-size: 20px;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.45;
}
.meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.meta-row span { display: flex; align-items: center; gap: 6px; }

h2 {
  font-size: 28px;
  line-height: 1.25;
  margin: 64px 0 16px;
  letter-spacing: -0.01em;
  font-weight: 700;
  scroll-margin-top: 24px;
}
h2 .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 600;
  margin-right: 12px;
  vertical-align: middle;
}
h2 .step-time {
  font-size: 14px;
  color: var(--text-faint);
  font-weight: 400;
  margin-left: 12px;
  vertical-align: middle;
}
h3 { font-size: 20px; margin: 32px 0 12px; font-weight: 600; }

p { margin: 16px 0; }
p code, li code, td code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-text);
}
ul, ol { padding-left: 24px; }
li { margin: 6px 0; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 600; }
em { color: var(--text-muted); }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
th { background: var(--bg-elev); font-weight: 600; }
tr:last-child td { border-bottom: 0; }

/* Code blocks */
.code-wrap {
  position: relative;
  margin: 20px 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #2a2d34;
  border-bottom: 1px solid #3a3d44;
  color: #a0a4ac;
  font-family: var(--mono);
  font-size: 12px;
}
[data-theme="dark"] .code-header { background: #1a1d22; border-bottom-color: #2a2d32; }
.code-header .filename { display: flex; align-items: center; gap: 8px; }
.code-header .dot { width: 10px; height: 10px; border-radius: 50%; background: #4a4d54; }
.copy-btn {
  background: transparent;
  border: 1px solid #4a4d54;
  color: #c0c4cc;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { background: #3a3d44; color: white; border-color: #6a6d74; }
.copy-btn.copied { background: #2d6a4a; color: white; border-color: #2d6a4a; }
pre {
  margin: 0;
  padding: 16px 18px;
  background: var(--bg-code) !important;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
}
pre code { background: transparent !important; padding: 0 !important; border: 0 !important; color: #e8e6e0; font-family: var(--mono) !important; }

/* Callouts */
.callout {
  margin: 24px 0;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
  font-size: 15.5px;
  line-height: 1.55;
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout .callout-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.callout.tip { background: var(--tip-bg); border-left-color: var(--tip-border); }
.callout.tip .callout-label { color: var(--tip-text); }
.callout.warn { background: var(--warn-bg); border-left-color: var(--warn-border); }
.callout.warn .callout-label { color: var(--warn-text); }
.callout.insight { background: var(--insight-bg); border-left-color: var(--insight-border); }
.callout.insight .callout-label { color: var(--insight-text); }
.callout.danger { background: var(--danger-bg); border-left-color: var(--danger-border); }
.callout.danger .callout-label { color: var(--danger-text); }

/* Tabs */
.tabs {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}
.tab-buttons {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-button {
  flex: 0 0 auto;
  padding: 10px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab-button:hover { color: var(--text); }
.tab-button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display: none; padding: 4px 18px; }
.tab-pane.active { display: block; }
.tab-pane .code-wrap { box-shadow: none; }

/* Collapsible cards (used for exercises, problems, Q&A) */
.collapse-card {
  margin: 12px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.collapse-card > summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  list-style: none;
}
.collapse-card > summary::-webkit-details-marker { display: none; }
.collapse-card > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.2s;
  flex: 0 0 22px;
}
.collapse-card[open] > summary::before { content: "−"; }
.collapse-card > summary:hover { background: var(--bg); }
.collapse-card .item-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.collapse-card-body { padding: 0 18px 18px; border-top: 1px solid var(--border); }

/* Solution / answer reveal */
.reveal {
  margin: 12px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.reveal > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent-soft);
  user-select: none;
  list-style: none;
}
.reveal > summary::-webkit-details-marker { display: none; }
.reveal > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.2s;
}
.reveal[open] > summary::before { transform: rotate(90deg); }
.reveal-body { padding: 14px 18px; }
.reveal-body > *:first-child { margin-top: 0; }
.reveal-body > *:last-child { margin-bottom: 0; }

/* Drill-mode toggle bar */
.drill-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  margin: 24px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.drill-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.drill-bar .toggle {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 100px;
  transition: background 0.2s;
}
.drill-bar .toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.drill-bar input[type="checkbox"] { display: none; }
.drill-bar input[type="checkbox"]:checked + .toggle { background: var(--accent); }
.drill-bar input[type="checkbox"]:checked + .toggle::after { transform: translateX(16px); }
.drill-bar .progress {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-muted);
}

body.drill-mode .reveal:not([data-force-open]) > summary { background: var(--bg); color: var(--text); border-bottom: 1px dashed var(--border); }
body.drill-mode .reveal:not([data-force-open]) > summary::before { content: "🤔 "; }
body.drill-mode .reveal:not([data-force-open])[open] > summary { background: var(--tip-bg); color: var(--tip-text); }
body.drill-mode .reveal:not([data-force-open]) .reveal-body { display: none; }
body.drill-mode .reveal:not([data-force-open])[open] .reveal-body { display: block; }

/* Practice tracker */
.practice-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.practice-check:hover { border-color: var(--accent); color: var(--accent); }
.practice-check.done { background: var(--tip-bg); border-color: var(--tip-border); color: var(--tip-text); }
.practice-check.done::before { content: "✓ "; }

/* Tag chips */
.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 6px;
}
.tag.hash { background: #f0e9f7; border-color: #d4c0e0; color: #6a3a8a; }
.tag.string { background: #e9f4f7; border-color: #b8d8e0; color: #2a6a80; }
.tag.array { background: #f7f0e9; border-color: #e0d0b8; color: #804a2a; }
.tag.sort { background: #e9f7ec; border-color: #b8e0c4; color: #2a8042; }
.tag.dfs { background: #f7e9ec; border-color: #e0b8c0; color: #802a3a; }
.tag.window { background: #ecf7e9; border-color: #c4e0b8; color: #428042; }
.tag.prefix { background: #f7f7e9; border-color: #e0e0b8; color: #808042; }
.tag.pointers { background: #e9eef7; border-color: #b8c4e0; color: #2a4a80; }

[data-theme="dark"] .tag { background: var(--bg); }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 16px 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  margin: 8px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.checklist li:hover { border-color: var(--border-strong); }
.checklist li.checked { background: var(--tip-bg); border-color: var(--tip-border); }
.checklist li.checked .check-label { text-decoration: line-through; opacity: 0.65; }
.checklist .check-box {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: all 0.15s;
}
.checklist li.checked .check-box { background: var(--tip-border); border-color: var(--tip-border); }
.checklist li.checked .check-box::after { content: "✓"; color: white; font-weight: 700; font-size: 14px; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.card {
  padding: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card .card-title { font-weight: 600; font-size: 16px; margin: 0 0 6px; color: var(--text); }
.card .card-time { font-size: 12px; color: var(--text-faint); margin-bottom: 8px; }
.card .card-desc { margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.5; }
.card a.card-link { color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; }
.card a.card-link:hover { text-decoration: underline; }

/* Theme toggle */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  font-size: 18px;
  z-index: 100;
}
.theme-toggle:hover { transform: scale(1.05); }

/* Talking-point quote */
.talking-point {
  margin: 32px 0;
  padding: 24px 28px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 16px;
  line-height: 1.65;
}
.talking-point .label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 12px;
}
.talking-point p { margin: 0; color: var(--text); font-style: italic; }

/* Diagram (ASCII-ish flow) */
.flow {
  margin: 20px 0;
  padding: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}

/* Section nav (jump between Q&A sections) */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin: 0 0 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.section-nav a {
  padding: 4px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.section-nav a:hover { color: var(--text); border-color: var(--border-strong); }
.section-nav a.active { background: var(--accent); color: white; border-color: var(--accent); }

footer {
  margin-top: 96px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
}
footer a { color: var(--text-muted); }

@media print {
  .sidebar, .theme-toggle, .copy-btn, .mobile-toc-toggle, .drill-bar, .section-nav { display: none !important; }
  .layout { grid-template-columns: 1fr; padding: 0; }
  main { max-width: 100%; padding: 0; }
  .code-wrap { box-shadow: none; border: 1px solid #ddd; }
  pre { font-size: 11px; }
  body { font-size: 12px; }
  h2 { font-size: 18px; }
  .collapse-card[open], .reveal[open] { page-break-inside: avoid; }
  .collapse-card > summary::before, .reveal > summary::before { display: none; }
  details:not([open]) > summary { page-break-inside: avoid; }
  details:not([open]) ~ * { display: block !important; }
  body.drill-mode .reveal .reveal-body { display: block !important; }
}

/* =================================================================
   Catalog / navigation shell (homepage + folder indexes)
   ================================================================= */

/* Wider variant of the layout for catalog pages — gives card grids
   more room than the 760px article column used by deep pages. */
.layout.layout-wide { max-width: 1320px; }
.layout.layout-wide main { max-width: none; }

/* Injected Site nav (lives at the top of every .sidebar nav). */
.site-nav {
  margin-bottom: 24px;
  padding: 8px 4px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.site-nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-weight: 700;
  padding: 6px 12px 8px;
}
.site-nav-home {
  font-weight: 600;
  margin-bottom: 8px !important;
}
.site-nav-topic {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 12px 12px 4px;
  margin-top: 4px;
}
.sidebar .site-nav-guide { font-size: 13px; }

/* Breadcrumb row above the hero on guide index pages. */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--text-faint); }
.crumbs [aria-current="page"] { color: var(--text); font-weight: 500; }

/* Sticky topic-chip row used on the homepage just below the hero. */
.topic-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 0;
  margin: 0 0 24px;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.topic-chips a {
  padding: 6px 14px;
  border-radius: 100px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.topic-chips a:hover {
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
}
.topic-chips a.active {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

/* Filter bar for the homepage card grid. */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
}
.filter-bar input[type="search"] {
  flex: 1;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-bar input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.filter-bar .filter-count {
  font-size: 13px;
  color: var(--text-faint);
  min-width: 80px;
  text-align: right;
}

/* Shared catalog primitives (hoisted from per-page inline styles). */
.section-label {
  margin: 40px 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.topic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 48px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 72px; /* clear the sticky topic-chips row when jumped to */
}
.topic-head h2 { margin: 0; font-size: 22px; }
.topic-head .count {
  font-size: 12px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  margin: 8px 0 40px;
}
.guide-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
}
.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
  text-decoration: none;
}
.guide-card.featured { border-color: var(--accent); background: var(--accent-soft); }
.guide-card .number {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.guide-card .name { font-size: 17px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.guide-card .desc { font-size: 14px; color: var(--text-muted); line-height: 1.55; flex: 1; margin: 0; }
.guide-card .tags,
.guide-card .meta { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Format badges (one primary per card) + tag chips (zero-to-N sub-topics). */
.badge.format-prep      { background: var(--accent-soft);  color: var(--accent-text); }
.badge.format-build     { background: var(--tip-bg);       color: var(--tip-text); }
.badge.format-deepdive  { background: var(--insight-bg);   color: var(--insight-text); }
.badge.format-reference { background: var(--bg-elev);      color: var(--text-muted); border: 1px solid var(--border); }
.badge.format-notes     { background: var(--warn-bg);      color: var(--warn-text); }
.badge.tag {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 500;
}

/* Quick-access tiles still used by folder indexes. */
.quick-access {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.quick-access a {
  display: block;
  padding: 14px 18px;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
}
.quick-access a:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.quick-access a .sub { display: block; font-size: 11px; font-weight: 400; opacity: 0.9; margin-top: 4px; }

/* Topic chips collapse to a horizontal scroller on narrow screens
   so they don't dominate the viewport when stacked. */
@media (max-width: 700px) {
  .topic-chips { flex-wrap: nowrap; overflow-x: auto; padding: 10px 0; }
  .topic-chips a { flex: 0 0 auto; }
}

