/* LeadGen for Home Services — Modern plain CSS (Mintlify-inspired) */
:root {
  --primary: #0f766e;        /* Teal for trust + growth */
  --primary-dark: #0d5f57;
  --primary-light: #14b8a6;
  --text: #111827;
  --text-muted: #4b5563;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e5e7eb;
  --sidebar-bg: #f8fafc;
  --card-bg: #ffffff;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --max-width: 1280px;
  --sidebar-width: 260px;
  --toc-width: 220px;
  --header-height: 60px;

  /* Breakpoints (keep --bp-mobile in sync with MOBILE_BREAKPOINT in app.js) */
  --bp-mobile: 720px;
  --bp-tablet: 1024px;
  --bp-desktop: 1280px;

  /* Dark mode variables */
  --dm-bg: #0f172a;
  --dm-bg-subtle: #1e2937;
  --dm-text: #e2e8f0;
  --dm-text-muted: #94a3b8;
  --dm-border: #334155;
  --dm-card-bg: #1e2937;
  --dm-sidebar-bg: #1e2937;
}

/* Dark theme class (toggled via JS) */
body.theme-dark {
  --text: var(--dm-text);
  --text-muted: var(--dm-text-muted);
  --bg: var(--dm-bg);
  --bg-subtle: var(--dm-bg-subtle);
  --border: var(--dm-border);
  --sidebar-bg: var(--dm-sidebar-bg);
  --card-bg: var(--dm-card-bg);
  color: var(--dm-text);
  background: var(--dm-bg);
}

/* Dark mode overrides for visibility */
body.theme-dark .hero {
  background: linear-gradient(to bottom, #1e2937, #0f172a);
}
body.theme-dark .hero h1,
body.theme-dark .hero p {
  color: var(--dm-text);
}
body.theme-dark .callout.tip {
  background: #064e3b;
  color: #a7f3d0;
}
body.theme-dark .callout.warning {
  background: #78350f;
  color: #fed7aa;
}
body.theme-dark .sidebar-anchor.active {
  background: var(--dm-sidebar-bg);
  color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}
body.theme-dark .sidebar-page.active {
  background: var(--dm-sidebar-bg);
  color: var(--primary-light);
}

body.theme-dark .card,
body.theme-dark .value-card {
  background: var(--dm-card-bg);
  border-color: var(--dm-border);
  color: var(--dm-text);
}

body.theme-dark .card a,
body.theme-dark .value-card a {
  color: var(--primary-light);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.header-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
  max-width: 280px;
}

.logo-text--short {
  display: none;
}

.logo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

.search-container {
  flex: 1;
  max-width: 420px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: var(--bg-subtle);
  transition: border-color 0.1s, box-shadow 0.1s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
  background: var(--bg);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-actions .header-quickstart {
  flex-shrink: 1;
  min-width: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.1s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

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

.btn-secondary:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

/* Main layout container */
.docs-layout {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  overflow-y: auto;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  font-size: 0.9rem;
}

.sidebar nav {
  padding-right: 4px;
}

.sidebar-group {
  margin-bottom: 16px;
}

.sidebar-anchors {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-trade-filter {
  margin-bottom: 14px;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-trade-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.trade-filter-select,
.sidebar-trade-select {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.sidebar-section {
  margin-bottom: 6px;
}

.sidebar-section-summary {
  list-style: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  user-select: none;
}

.sidebar-section-summary::-webkit-details-marker {
  display: none;
}

.sidebar-section-chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s ease;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-section[open] .sidebar-section-chevron {
  transform: rotate(180deg);
}

.sidebar-section-summary:hover {
  color: var(--text);
  background: rgba(0,0,0,0.03);
}

.sidebar-section-list {
  list-style: none;
  padding: 4px 0 8px;
  margin: 0;
}

.sidebar-sublist {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
}

.sidebar-page-child {
  padding-left: 38px !important;
  font-size: 0.85rem;
}

.sidebar-page.parent-active {
  color: var(--primary);
  font-weight: 500;
}

.sidebar-item[hidden] {
  display: none;
}

.sidebar-group-title {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
  margin-bottom: 4px;
}

.nav-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.nav-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.nav-breadcrumb a:hover {
  text-decoration: underline;
}

.nav-breadcrumb-current {
  color: var(--text);
  font-weight: 500;
}

.nav-breadcrumb-sep {
  opacity: 0.5;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--header-height);
  background: rgba(0, 0, 0, 0.35);
  z-index: 99;
}

.sidebar-backdrop.visible {
  display: block;
}

body.sidebar-open {
  overflow: hidden;
}

body.theme-dark .sidebar-section-summary:hover {
  background: rgba(255,255,255,0.04);
}

.sidebar-anchor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 500;
  margin-bottom: 2px;
}

.sidebar-anchor:hover {
  background: rgba(0,0,0,0.04);
  text-decoration: none;
}

.sidebar-anchor.active {
  background: white;
  box-shadow: var(--shadow);
  font-weight: 600;
}

.sidebar-page {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 20px;
  border-radius: var(--radius);
  color: var(--text-muted);
  margin-bottom: 1px;
}

.sidebar-page:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text);
  text-decoration: none;
}

.sidebar-page.active {
  color: var(--primary);
  background: white;
  font-weight: 500;
}

.sidebar details {
  margin-bottom: 4px;
}

.sidebar summary {
  list-style: none;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}

.sidebar summary:hover {
  background: rgba(0,0,0,0.03);
}

.sidebar summary::-webkit-details-marker {
  display: none;
}

.sidebar details[open] summary {
  color: var(--primary);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 2px 0 8px;
}

.sidebar li {
  margin: 1px 0;
}

/* Main content */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 80px;
  max-width: 780px; /* comfortable reading width */
}

.article-header {
  margin-bottom: 24px;
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 8px;
}

.article-description {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 6px;
}

.article-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
  font-weight: 500;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 300;
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  position: fixed;
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  overflow: visible;
}

/* Content typography */
.article-content h2 {
  font-size: 1.35rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.article-content h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.article-content p,
.article-content ul,
.article-content ol {
  margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
  padding-left: 1.25rem;
}

.article-content li {
  margin-bottom: 0.35rem;
}

.article-content strong {
  font-weight: 600;
}

/* Callouts */
.callout {
  padding: 14px 18px;
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
  background: var(--bg-subtle);
  margin: 1.25rem 0;
}

.callout-title {
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout.tip {
  border-left-color: #059669;
  background: #ecfdf5;
}

.callout.warning {
  border-left-color: #d97706;
  background: #fffbeb;
}

.callout.info {
  border-left-color: var(--primary);
}

/* Video container */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  background: #111;
  border-radius: var(--radius-lg);
  margin: 1.25rem 0;
  box-shadow: var(--shadow-md);
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Cards & Templates */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 1.25rem 0;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, box-shadow 0.1s;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.template-block {
  background: #0f172a;
  color: #e0f2fe;
  border-radius: var(--radius);
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-wrap;
  margin: 12px 0;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0.85;
}

.copy-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.2);
}

/* Tables */
.article-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.article-content img,
.article-content .video-container iframe {
  max-width: 100%;
  height: auto;
}

.article-content pre.code-block,
.article-content .template-block {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Interactive tool grids */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.tool-grid input,
.tool-grid select {
  width: 100%;
  padding: 6px;
}

.scorecard-form select {
  width: 100%;
  padding: 6px;
}

.tool-result-card {
  padding: 8px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

/* Right TOC */
.toc {
  width: var(--toc-width);
  padding: 32px 16px 16px 20px;
  font-size: 0.85rem;
  position: sticky;
  top: var(--header-height);
  height: fit-content;
  align-self: start;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
}

.toc-title {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li {
  margin: 4px 0;
}

.toc a {
  color: inherit;
  display: block;
  padding: 2px 0;
}

.toc a:hover {
  color: var(--primary);
  text-decoration: none;
}

.toc a.active {
  color: var(--primary);
  font-weight: 500;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: auto;
}

/* Landing page specific */
.hero {
  padding: 72px 20px 48px;
  text-align: center;
  background: linear-gradient(to bottom, #f8fafc, #ffffff);
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 8px;
}

.hero-title-row h1 {
  margin: 0;
}

.hero-lead {
  font-size: 1.15rem;
}

.hero-accent {
  color: var(--primary);
}

.hero-cta-primary,
.hero-cta-secondary {
  font-size: 1rem;
  padding: 14px 26px;
}

.landing-trade-filter {
  margin-bottom: 12px;
}

.hero-trades-line {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-badge-wrap {
  margin-top: 8px;
}

.landing-guides {
  max-width: 1100px;
  margin: 0 auto 60px;
  padding: 0 20px;
}

.landing-guides .section-title-sub {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-muted);
}

.guide-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Inline TOC fallback (tablet / when right rail hidden) */
.toc-inline {
  display: none;
  margin-bottom: 1.5rem;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.toc-inline-summary {
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  list-style: none;
}

.toc-inline-summary::-webkit-details-marker {
  display: none;
}

.toc-inline ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.toc-inline li {
  margin: 4px 0;
}

.toc-inline .toc-h3 {
  padding-left: 12px;
}

.toc-inline a {
  color: var(--text-muted);
  text-decoration: none;
}

.toc-inline a:hover {
  color: var(--primary);
  text-decoration: underline;
}

body.theme-dark .toc-inline {
  background: var(--dm-bg-subtle);
  border-color: var(--dm-border);
}

.hero h1 {
  font-size: 2.75rem;
  margin: 0 0 12px;
  font-weight: 800;
  line-height: 1.1;
}

.hero p {
  max-width: 580px;
  margin: 0 auto 28px;
  font-size: 1.15rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.value-props {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.value-card {
  padding: 20px;
}

.value-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.featured-grid {
  max-width: var(--max-width);
  margin: 0 auto 60px;
  padding: 0 20px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* Landing: social proof + new-visitor hint */
.social-proof-strip {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  align-items: stretch;
}

.social-proof-stat {
  flex: 1 1 160px;
  max-width: 240px;
  padding: 14px 18px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.social-proof-stat strong {
  display: block;
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.social-proof-stat span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.social-proof-stat a {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
}

.social-proof-stat a:hover {
  text-decoration: underline;
}

.landing-hint {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 16px;
  color: var(--text-muted);
  margin-top: 12px;
}

.landing-hint a {
  color: var(--primary);
  font-weight: 500;
}

.hero-badge {
  display: inline-block;
  background: #ecfdf5;
  color: #047857;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

body.theme-dark .social-proof-stat {
  background: var(--dm-bg-subtle);
  border-color: var(--dm-border);
}

body.theme-dark .social-proof-stat strong {
  color: var(--primary-light);
}

body.theme-dark .social-proof-stat span {
  color: var(--dm-text-muted);
}

body.theme-dark .hero-badge {
  background: #064e3b;
  color: #a7f3d0;
}

/* Share bar + case study snapshot */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 1.5rem 0 0;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.share-bar-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-right: 4px;
}

.share-bar .btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

.share-snapshot {
  margin-top: 1rem;
  padding: 14px 16px;
  border-color: var(--primary);
  border-width: 1px;
  border-left-width: 4px;
}

.share-snapshot-stat {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.share-snapshot-blurb {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

body.theme-dark .share-bar {
  background: var(--dm-bg-subtle);
  border-color: var(--dm-border);
}

body.theme-dark .share-snapshot {
  background: var(--dm-card-bg);
  border-color: var(--primary-light);
}

body.theme-dark .share-snapshot-stat {
  color: var(--primary-light);
}

body.theme-dark .share-snapshot-blurb {
  color: var(--dm-text-muted);
}

.share-bar .btn-share-feedback {
  color: var(--primary);
  font-weight: 600;
}

/* Video placeholder (no broken embeds) */
.video-placeholder {
  text-align: center;
  padding: 28px 20px;
  background: var(--bg-subtle);
  border-style: dashed;
}

.video-placeholder-icon {
  color: var(--primary);
  margin-bottom: 8px;
}

.video-placeholder-title {
  margin: 0 0 6px;
  font-size: 1rem;
}

.video-placeholder-text {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.video-placeholder-chapters {
  font-size: 0.8rem;
  text-align: left;
}

.chapter-pill {
  display: inline-block;
  margin: 4px 6px 0 0;
  padding: 2px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

body.theme-dark .video-placeholder {
  background: var(--dm-bg-subtle);
}

body.theme-dark .chapter-pill {
  background: var(--dm-card-bg);
  border-color: var(--dm-border);
  color: var(--dm-text-muted);
}

/* Search modal result focus */
.search-result-item:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: var(--bg-subtle);
}

body.theme-dark .search-result-item:focus {
  background: var(--dm-bg-subtle);
}

/* Mobile */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 1.1rem;
  color: var(--text);
  cursor: pointer;
}

body.theme-dark .mobile-menu-btn {
  color: #ffffff;
  border-color: var(--dm-border);
}

@media (max-width: 1024px) {
  .toc {
    display: none;
  }

  .toc-inline {
    display: block;
  }

  .main-content {
    max-width: 100%;
    padding: 24px 20px 80px;
  }
}

@media (min-width: 721px) and (max-width: 1024px) {
  .docs-layout {
    --sidebar-width: 220px;
  }

  .main-content {
    padding: 24px 16px 80px;
  }

  .social-proof-stat {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (max-width: 900px) {
  .logo {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 720px) {
  .sidebar {
    display: none;
    position: fixed;
    z-index: 100;
    top: var(--header-height);
    left: 0;
    height: calc(100vh - var(--header-height));
    width: 82%;
    max-width: 300px;
    box-shadow: var(--shadow-md);
    animation: sidebar-slide-in 0.2s ease;
  }

  @keyframes sidebar-slide-in {
    from { transform: translateX(-8px); opacity: 0.92; }
    to { transform: translateX(0); opacity: 1; }
  }

  .sidebar.open {
    display: block;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .header-inner {
    gap: 8px;
  }

  .logo {
    max-width: none;
  }

  .logo-text--full {
    display: none;
  }

  .logo-text--short {
    display: inline;
  }

  .header-actions .header-quickstart {
    display: none;
  }

  .search-container {
    flex: 1;
    max-width: none;
    min-width: 0;
  }

  .search-input {
    min-height: 44px;
    font-size: 0.85rem;
  }

  #theme-toggle {
    min-width: 44px;
    min-height: 44px;
    padding: 8px;
  }

  .hero {
    padding: 48px 16px 36px;
  }

  .hero-title-row {
    flex-direction: column;
    gap: 8px;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .guide-links .btn {
    flex: 1 1 100%;
    justify-content: center;
    min-height: 44px;
  }

  .main-content {
    padding: 20px 16px 88px;
  }

  .floating-cta {
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    right: max(12px, env(safe-area-inset-right, 12px));
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  body.has-share-bar .floating-cta {
    bottom: max(5.5rem, calc(5.5rem + env(safe-area-inset-bottom, 0px)));
  }
}

@media (max-width: 480px) {
  .search-input::placeholder {
    color: transparent;
  }

  .search-container .search-icon::after {
    content: "Search";
    margin-left: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .social-proof-stat {
    flex: 1 1 100%;
    max-width: none;
  }

  .article-title {
    font-size: 1.5rem;
  }
}

/* Misc */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 600;
  vertical-align: middle;
}

body.theme-dark .badge {
  background: #064e3b;
  color: #a7f3d0;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Delightful enhancements for 100x UX */
.progress-container {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  margin: 12px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--primary-light));
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(15, 118, 110, 0.3);
}

/* Micro-interactions */
.card, .btn, .sidebar-page, .sidebar-anchor {
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), 
              box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.btn:hover {
  transform: translateY(-1px);
}

.sidebar-page:hover, .sidebar-anchor:hover {
  transform: translateX(2px);
}

/* Smooth scroll and focus */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .article-content > *,
  #score-result .card,
  .sidebar {
    animation: none !important;
  }

  .sidebar-page:hover,
  .sidebar-anchor:hover,
  .floating-cta:hover {
    transform: none;
  }
}

/* Subtle animations */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-content > * {
  animation: fadeInUp 0.4s ease forwards;
}

.article-content > *:nth-child(2) { animation-delay: 0.05s; }
.article-content > *:nth-child(3) { animation-delay: 0.1s; }

/* Interactive checklist styles */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  user-select: none;
}

.checklist-item input[type="checkbox"] {
  margin-top: 4px;
  accent-color: var(--primary);
}

.checklist-item.completed {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Tool / scorecard enhancements */
#score-result .card {
  animation: fadeInUp 0.3s ease;
}

.success-card {
  background: #ecfdf5;
  border-color: #10b981;
}

body.theme-dark .success-card {
  background: #064e3b;
  border-color: #10b981;
  color: #a7f3d0;
}

body.theme-dark .success-card h3,
body.theme-dark .success-card p,
body.theme-dark .success-card ul,
body.theme-dark .success-card a {
  color: #a7f3d0;
}

/* Accessibility: visible keyboard focus */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:focus-visible,
.sidebar-anchor:focus-visible,
.sidebar-page:focus-visible,
.sidebar-section-summary:focus-visible,
.toc a:focus-visible,
.search-result-item:focus-visible,
.copy-btn:focus-visible,
.mobile-menu-btn:focus-visible,
.floating-cta:focus-visible,
.trade-filter-select:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.toc a.active:focus-visible {
  color: var(--primary);
}

body.theme-dark .callout.info {
  background: #1e3a5f;
  color: #bfdbfe;
  border-left-color: #60a5fa;
}

body.theme-dark .badge {
  background: #064e3b;
  color: #a7f3d0;
}

/* Utility */
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }

/* Print toolbar (screen only) */
.print-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 1rem;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.print-toolbar .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.print-toolbar-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1 1 200px;
}

body.theme-dark .print-toolbar {
  background: var(--dm-bg-subtle);
  border-color: var(--dm-border);
}

/* Print friendly for checklists and deliverables */
@media print {
  .sidebar,
  .toc,
  .site-header,
  .header-actions,
  .mobile-menu-btn,
  .search-container,
  .progress-container,
  .floating-cta,
  .share-bar,
  .share-snapshot,
  .nav-breadcrumb,
  .print-toolbar,
  .callout,
  button,
  .btn {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt;
    line-height: 1.45;
  }

  .docs-layout,
  .main-content {
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .article-header {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #0f766e;
  }

  .article-title {
    font-size: 18pt !important;
    color: #111 !important;
  }

  .article-description,
  .article-meta {
    color: #444 !important;
  }

  .article-content h2 {
    margin-top: 0;
    padding-top: 0.25rem;
    font-size: 14pt;
    color: #0f766e;
  }

  .article-content h2:not(:first-of-type) {
    break-before: page;
    page-break-before: always;
  }

  .article-content h3 {
    font-size: 12pt;
    margin-top: 0.75rem;
    color: #111;
  }

  .article-content p,
  .article-content li {
    color: #111 !important;
  }

  .article-content a {
    color: #111 !important;
    text-decoration: none;
  }

  .checklist-item {
    break-inside: avoid;
    page-break-inside: avoid;
    padding: 4px 0;
  }

  .checklist-item.completed {
    text-decoration: none;
    opacity: 1;
  }

  .checklist-item input[type="checkbox"] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 1.5px solid #333;
    accent-color: #0f766e;
  }

  .article-content ul {
    margin-left: 0;
    padding-left: 0;
    list-style: none;
  }

  .article-content ul li {
    margin-bottom: 4px;
  }

  @page {
    margin: 0.75in;
  }
}

/* Floating CTA */
.floating-cta {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary);
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  font-weight: 600;
  z-index: 100;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.floating-cta:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(15, 118, 110, 0.3);
  text-decoration: none;
  color: white;
}
