/* LEAD Knowledge Center — layout & component styles */

:root {
  --navy: #1f4e79;
  --blue: #2e75b6;
  --light-blue: #d6e4f0;
  --pale-blue: #edf2f9;
  --white: #ffffff;
  --bg-surface: #f8f9fa;
  --text-primary: #333333;
  --text-secondary: #666666;
  --coral: #e17055;
  --teal: #0d9488;
  --purple: #6c5ce7;
  --callout-bg: #fff8e1;
  --callout-border: #f0c040;
  --critical-bg: #fef2f2;
  --critical-border: #dc2626;
  --border-light: #e2e8f0;
  --content-max-width: 1200px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Calibri, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-surface);
}

h1,
h2,
h3 {
  font-family: Georgia, serif;
  color: var(--navy);
}

h1 {
  font-size: 32px;
  margin-top: 0;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

a {
  color: var(--blue);
}

a:hover {
  text-decoration: underline;
}

/* ——— Callouts ——— */

.callout,
.callout-insight,
.callout-critical,
.callout-new {
  border-left-width: 4px;
  border-left-style: solid;
  padding: 1rem;
  margin-block: 0.75rem;
}

.callout-insight {
  border-color: var(--coral);
  background: var(--callout-bg);
}

.callout-critical {
  border-color: var(--critical-border);
  background: var(--critical-bg);
}

.callout-new {
  border-color: var(--coral);
  background: var(--callout-bg);
}

.callout-new .badge {
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ——— Badge ——— */

.badge {
  display: inline-block;
  background: var(--coral);
  color: var(--white);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* ——— Citation ——— */

.citation {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ——— Formula ——— */

.formula-block {
  background: #f5f5f5;
  border-left: 3px solid var(--blue);
  padding: 1rem;
  font-family: "SF Mono", "Fira Code", Consolas, monospace;
  margin: 1rem 0;
}

/* ——— Worked example ——— */

.worked-example {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  margin: 1rem 0;
}

.worked-example-header,
.we-header {
  background: var(--pale-blue);
  padding: 0.5rem 1rem;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
}

.worked-example-body,
.we-body {
  padding: 1.25rem;
}

/* ——— Tables ——— */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-size: 14px;
}

table tbody th {
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  text-align: left;
  vertical-align: top;
}

table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  vertical-align: top;
}

table tbody tr:nth-child(even) {
  background: var(--pale-blue);
}

table tbody tr:nth-child(even) th {
  background: var(--pale-blue);
}

.comparison-table th[data-col="lead"] {
  background: var(--blue);
}

.comparison-table th[data-col="reach"] {
  background: var(--purple);
}

.comparison-table th[data-col="mssp"] {
  background: var(--teal);
}

.comparison-table th[data-col="lead"],
.comparison-table th[data-col="reach"],
.comparison-table th[data-col="mssp"] {
  color: var(--white);
}

.comparison-table td.hidden-col,
.comparison-table th.hidden-col {
  display: none;
}

/* ——— Details / FAQ accordion ——— */

details {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--white);
}

details summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  color: var(--navy);
  list-style: none;
}

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

details summary:hover {
  background: var(--pale-blue);
}

details[open] summary {
  border-bottom: 1px solid var(--border-light);
}

details > div {
  padding: 12px 16px;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ——— Sidebar nav sections ——— */

.nav-section {
  border-bottom: 1px solid var(--border-light);
}

.nav-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 16px;
  margin: 0;
  border: none;
  border-left: 3px solid transparent;
  background: var(--bg-surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--navy);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-section-header:hover {
  background: var(--pale-blue);
  border-left-color: var(--blue);
}

.nav-section-header::before {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1.25rem;
  text-align: center;
  opacity: 0.7;
}

[data-section="lead"] > .nav-section-header::before { content: "\1F4D6"; }
[data-section="compare"] > .nav-section-header::before { content: "\1F4CA"; }
[data-section="tools"] > .nav-section-header::before { content: "\2699\FE0F"; }
[data-section="glossary"] > .nav-section-header::before { content: "\1F524"; }

.nav-section-header::after {
  content: "›";
  font-size: 1.1rem;
  font-weight: 400;
  margin-left: auto;
  opacity: 0.45;
  transition: transform 0.3s ease;
  transform: rotate(90deg);
  display: inline-block;
}

.nav-section.collapsed .nav-section-header::after {
  transform: rotate(0deg);
}

.nav-section-links {
  list-style: none;
  margin: 0;
  padding: 4px 0 8px;
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.35s ease;
  opacity: 1;
}

.nav-section.collapsed .nav-section-links {
  max-height: 0;
  opacity: 0;
  padding: 0;
}

.nav-section-links a {
  display: block;
  padding: 7px 16px 7px 38px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13.5px;
  border-radius: 6px;
  margin: 1px 10px 1px 8px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-section-links a:hover {
  background: var(--pale-blue);
  color: var(--navy);
  text-decoration: none;
}

.nav-section-links a.active {
  background: var(--light-blue);
  color: var(--navy);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--blue);
}

/* ——— Cards ——— */

.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 1.25rem;
  border: 1px solid var(--border-light);
}

.stat-card {
  text-align: center;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 11rem;
}

.stat-card .stat-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.12;
}

.stat-number--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.stat-number--stacked .stat-num {
  font-size: 2.5rem;
  line-height: 1;
}

.stat-number--stacked .stat-num-title {
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
  color: var(--navy);
}

.stat-card .stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 0.65rem;
  line-height: 1.45;
  max-width: 22rem;
}

/* ——— CTA (in-page component; shell also has .cta-bar) ——— */

.cta-bar {
  background: var(--light-blue);
  padding: 1rem 2rem;
  text-align: center;
  margin-top: 2rem;
  border-radius: 8px;
}

.cta-bar a {
  color: var(--navy);
  font-weight: 600;
  margin-left: 0.35rem;
}

.ai-disclaimer {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ——— Layout shell ——— */

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border-light);
  border-left: 4px solid var(--navy);
  overflow-y: auto;
  z-index: 200;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 2px solid var(--blue);
  background: linear-gradient(170deg, var(--pale-blue) 0%, var(--white) 100%);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  gap: 0;
}

.sidebar-brand:hover {
  text-decoration: none;
}

.sidebar-brand:hover .brand-acronym {
  letter-spacing: 0.18em;
}

.brand-acronym {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--navy);
  line-height: 1.1;
  transition: letter-spacing 0.25s ease;
}

.brand-full {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.3;
  margin-top: 0.2rem;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.3;
  margin-top: 0.1rem;
}

.sidebar-brand.active {
  border-left: 3px solid var(--blue);
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

.sidebar-nav {
  padding-bottom: 1rem;
}

#main {
  margin-left: 280px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 24px;
  height: 56px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

#hamburger {
  display: none;
  padding: 8px 12px;
  font-size: 1.25rem;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: transparent;
  color: var(--white);
  cursor: pointer;
}

#hamburger:hover {
  background: rgba(255, 255, 255, 0.15);
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.topbar-lead {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--white);
}

.topbar-desc {
  font-size: 0.85rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.02em;
}

.topbar-credit {
  margin-left: auto;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.topbar-credit a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease;
}

.topbar-credit a:hover {
  color: var(--white);
}

#breadcrumbs {
  padding: 12px 24px 0;
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  font-size: 14px;
  color: var(--text-secondary);
}

#breadcrumbs a {
  color: var(--blue);
  text-decoration: none;
}

#breadcrumbs a:hover {
  text-decoration: underline;
}

.bc-sep {
  margin: 0 0.35rem;
  color: var(--text-secondary);
}

#content {
  flex: 1;
  padding: 24px;
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.btn-link {
  display: inline-block;
  margin: 0 0.75rem 0.75rem 0;
  padding: 0.5rem 1.25rem;
  background: var(--blue);
  color: var(--white) !important;
  text-decoration: none !important;
  border-radius: 6px;
  font-weight: 600;
}

.btn-link:hover {
  filter: brightness(1.05);
}

.stat-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card-grid--hub .card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-grid--hub .card > h3 {
  min-height: 3.35rem;
  margin: 0 0 0.65rem;
  line-height: 1.25;
}

.card-grid--hub .card > h3 a {
  display: inline;
}

.card-grid--hub .card > p:last-of-type {
  margin-top: auto;
  margin-bottom: 0;
  padding-top: 0.5rem;
}

.table-wrap tbody tr.alt td {
  background: var(--pale-blue);
}

.table-settlement-summary th,
.table-settlement-summary td {
  vertical-align: top;
  font-size: 0.9rem;
  line-height: 1.4;
}

.table-settlement-summary th {
  white-space: normal;
}

.faq-section {
  margin-top: 2rem;
}

.comparison-toggle-bar {
  margin-bottom: 1rem;
}

.comparison-toggle-bar .toggle-btn.active {
  border-color: var(--blue);
  background: var(--pale-blue);
  font-weight: 600;
  color: var(--navy);
}

.shared-elements-banner {
  margin-bottom: 1.5rem;
}

.shared-elements-banner ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

#glossary-search {
  width: 100%;
  max-width: 480px;
  padding: 10px 12px;
  font: inherit;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  margin-bottom: 1rem;
}

.glossary-jump {
  margin-bottom: 1.5rem;
  font-size: 14px;
}

.glossary-jump a,
.glossary-jump-link {
  margin-right: 0.25rem;
  color: var(--blue);
  cursor: pointer;
}

.glossary-jump-link {
  text-decoration: underline;
}

.glossary-jump-link:hover {
  color: var(--navy);
}

.glossary-term {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.decision-tree .dt-panel {
  margin-bottom: 1rem;
}

.decision-tree button.dt-option,
.decision-tree button.dt-restart {
  margin-right: 0.5rem;
  margin-bottom: 0.35rem;
}

/* Flowchart */
.flowchart {
  padding: 1rem 0;
}

.fc-node {
  background: var(--pale-blue);
  border: 2px solid var(--blue);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
  max-width: 480px;
}

.fc-start {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 1rem;
  border-color: var(--navy);
}

.fc-result {
  background: var(--white);
  border-color: var(--teal);
  text-align: left;
}

.fc-result strong {
  color: var(--navy);
}

.fc-branches {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 2rem;
  border-left: 2px solid var(--border-light);
  margin: 0.25rem 0 0.25rem 1.5rem;
}

.fc-branch {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.fc-arrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0;
}

.fc-arrow::before {
  content: "→ ";
}

#main > .cta-bar {
  max-width: var(--content-max-width);
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 48px);
}

.site-footer {
  padding: 1.5rem 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-light);
  background: var(--white);
}

.site-footer a {
  margin-left: 0.75rem;
  color: var(--blue);
}

/* ——— Comparison toggle buttons (content) ——— */

.toggle-btn {
  padding: 8px 14px;
  margin: 0 6px 8px 0;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.toggle-btn:hover {
  background: var(--pale-blue);
}

.toggle-btn.active {
  border-color: var(--blue);
  background: var(--pale-blue);
  font-weight: 600;
  color: var(--navy);
}

/* ——— Decision tree / tools ——— */

.dt-node[hidden],
.mssp-result[hidden],
.lead-mssp-result[hidden] {
  display: none !important;
}

/* ——— Responsive ——— */

.sidebar-backdrop {
  display: none;
}

@media (max-width: 767px) {
  #hamburger {
    display: inline-block;
  }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(15, 23, 42, 0.4);
    cursor: pointer;
  }

  #main {
    margin-left: 0;
  }

  .topbar-desc {
    display: none;
  }

  .topbar-credit {
    display: none;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 20px;
  }
}

