/* ============================================================
   Calquify Guides CSS — v1.0
   /assets/css/guides.css
   Used by: guide-template.php, compare-template.php, data-template.php
   Brand: Space Grotesk headings | DM Sans body | Purple #7C3AED
   DO NOT inline this — include via <link> in guide pages
   ============================================================ */

:root {
  --purple:        #7C3AED;
  --purple-dark:   #6D28D9;
  --purple-light:  #A78BFA;
  --violet:        #1E0A4C;
  --lavender:      #F0EFFF;
  --lavender-mid:  #EDE9FE;
  --lavender-deep: #DDD6FE;
  --white:         #FFFFFF;
  --grey-mid:      #9CA3AF;
  --grey-dark:     #4B5563;
  --ink:           #111827;
  --muted:         #6B7280;
  --muted2:        #9CA3AF;
  --border:        rgba(124,58,237,0.12);
  --border-strong: rgba(124,58,237,0.22);
  --shadow:        0 4px 24px rgba(124,58,237,0.08);
  --shadow-lg:     0 16px 48px rgba(124,58,237,0.14);
  --green:         #10B981;
  --amber:         #F59E0B;
  --red:           #EF4444;
  --max:           1200px;
  --r:             16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "DM Sans", sans-serif;
  background: #FAFAFA;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }

/* ─── Guide Hero ─── */
.g-hero {
  background: var(--lavender);
  border-bottom: 1px solid var(--border);
  padding: 40px 24px 36px;
}
.g-hero-inner {
  max-width: var(--max);
  margin: 0 auto;
}
.g-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.g-breadcrumb a {
  color: var(--purple);
  text-decoration: none;
}
.g-breadcrumb a:hover { text-decoration: underline; }
.g-breadcrumb-sep { color: var(--muted2); }

.g-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.g-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--lavender-deep);
  color: var(--purple);
  padding: 4px 12px;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.g-date {
  font-size: 13px;
  color: var(--muted);
}
.g-read-time {
  font-size: 13px;
  color: var(--muted);
}
.g-confidence {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
}
.g-confidence.high   { background: #ECFDF5; color: #065F46; }
.g-confidence.medium { background: #FEF3C7; color: #92400E; }
.g-confidence.low    { background: #FEF2F2; color: #991B1B; }

.g-h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 800;
  color: var(--violet);
  letter-spacing: -0.8px;
  line-height: 1.1;
  margin-bottom: 14px;
}
.g-intro {
  font-size: 17px;
  color: var(--grey-dark);
  max-width: 760px;
  line-height: 1.65;
  margin-bottom: 20px;
}
.g-keypoints {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.g-kp {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--grey-dark);
}
.g-kp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
}

/* ─── Page layout ─── */
.g-layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 24px 80px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  align-items: start;
}
.g-main { min-width: 0; }
.g-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 84px;
}

/* ─── Section base ─── */
.g-section {
  margin-bottom: 32px;
}
.g-section-heading {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--violet);
  letter-spacing: -0.4px;
  margin-bottom: 14px;
  margin-top: 36px;
  line-height: 1.2;
}
.g-section-heading:first-child { margin-top: 0; }

.g-p {
  font-size: 15px;
  color: var(--grey-dark);
  line-height: 1.75;
  margin-bottom: 14px;
}

/* ─── Section: Formula ─── */
.g-formula-card {
  background: var(--violet);
  border-radius: var(--r);
  padding: 24px;
  margin: 20px 0;
}
.g-formula-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--purple-light);
  margin-bottom: 10px;
}
.g-formula-latex {
  font-size: clamp(14px, 1.8vw, 20px);
  color: #fff;
  text-align: center;
  padding: 16px 0;
  overflow-x: auto;
  max-width: 100%;
}
.g-formula-plain {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin-top: 12px;
  line-height: 1.6;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 12px;
}
.g-variables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  overflow: hidden;
}
.g-var {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0;
}
.g-var:last-child {
  border-bottom: 0;
}
.g-var-sym {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--purple-light);
  padding: 12px 16px;
  border-right: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  text-align: center;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.g-var-def {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  padding: 12px 16px;
  line-height: 1.5;
}

/* ─── Section: Examples ─── */
.g-examples { display: grid; gap: 14px; margin: 16px 0; }
.g-example {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.g-example-head {
  background: var(--lavender);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.g-example-badge {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--purple);
  background: var(--lavender-deep);
  padding: 3px 10px;
  border-radius: 999px;
}
.g-example-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--violet);
}
.g-example-body { padding: 14px 16px; }
.g-example-input {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--purple);
  background: var(--lavender);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  display: inline-block;
}
.g-example-output {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--violet);
  margin-bottom: 6px;
}
.g-example-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── Section: Steps ─── */
.g-steps { display: grid; gap: 10px; margin: 16px 0; }
.g-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.g-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), #A855F7);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.g-step-label {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  color: var(--violet);
  font-size: 14px;
  margin-bottom: 4px;
}
.g-step-body {
  font-size: 14px;
  color: var(--grey-dark);
  line-height: 1.6;
}

/* ─── Section: Table ─── */
.g-table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--r);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.g-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}
.g-table th {
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted2);
  padding: 12px 16px;
  text-align: left;
  background: var(--lavender);
  border-bottom: 1px solid var(--border);
}
.g-table td {
  font-size: 14px;
  color: var(--grey-dark);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.g-table tr:last-child td { border-bottom: 0; }
.g-table tr:hover td { background: #FAFAFF; }
.g-table td.highlight {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--violet);
}

/* ─── Section: FAQ ─── */
.g-faq {
  display: grid;
  gap: 0;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.g-faq-item {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  transition: background 0.15s;
}
.g-faq-item:last-child {
  border-bottom: 0;
}
.g-faq-item:hover {
  background: var(--lavender);
}
.g-faq-q {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  color: var(--violet);
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 12px;
  padding-left: 14px;
  border-left: 3px solid var(--purple);
}
.g-faq-a {
  font-size: 14px;
  color: var(--grey-dark);
  line-height: 1.8;
  padding-left: 14px;
}

/* ─── Section: Warning / Callout ─── */
.g-warning {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-left: 4px solid var(--amber);
  border-radius: var(--r);
  padding: 14px 16px;
  margin: 16px 0;
}
.g-warning-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #92400E;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.g-warning-body {
  font-size: 14px;
  color: #78350F;
  line-height: 1.65;
}

/* ─── Section: Calculator Embed CTA ─── */
.g-calc-cta {
  background: linear-gradient(135deg, var(--violet), #321174);
  border-radius: var(--r);
  padding: 24px;
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.g-calc-cta-text h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.g-calc-cta-text p {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}
.g-calc-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--purple);
  color: #fff;
  padding: 11px 22px;
  border-radius: 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.g-calc-cta-btn:hover { background: var(--purple-dark); }

/* ─── Sources section ─── */
.g-sources {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px;
  margin: 24px 0;
}
.g-sources-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted2);
  margin-bottom: 10px;
}
.g-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.g-source-item:last-child { border-bottom: 0; }
.g-source-item a {
  color: var(--purple);
  text-decoration: none;
  font-weight: 500;
}
.g-source-item a:hover { text-decoration: underline; }
.g-source-date {
  color: var(--muted2);
  font-size: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

/* ─── Sidebar cards ─── */
.g-sidebar-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow);
}
.g-sidebar-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted2);
  margin-bottom: 12px;
}
.g-sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--grey-dark);
  gap: 8px;
  transition: color 0.12s;
  text-decoration: none;
}
.g-sidebar-link:last-child { border-bottom: 0; padding-bottom: 0; }
.g-sidebar-link:hover { color: var(--purple); }
.g-sidebar-link-arrow { color: var(--purple); flex-shrink: 0; }

.g-sidebar-fact {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.g-sidebar-fact:last-child { border-bottom: 0; }
.g-sidebar-fact-icon { color: var(--green); flex-shrink: 0; margin-top: 1px; }

/* ─── Tags ─── */
.g-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.g-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--purple);
  background: var(--lavender);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 3px 10px;
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
  .g-layout {
    grid-template-columns: 1fr;
  }
  .g-sidebar {
    position: relative;
    top: auto;
  }
}
@media (max-width: 600px) {
  .g-hero { padding: 28px 16px 24px; }
  .g-layout { padding: 24px 16px 60px; gap: 24px; }
  .g-h1 { font-size: 26px; }
  .g-intro { font-size: 15px; }
  .g-formula-card { padding: 16px; }
  .g-calc-cta { flex-direction: column; }
}

/* ─── TOC ─── */
.g-toc {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple);
  border-radius: var(--r);
  padding: 18px 20px;
  margin: 0 0 28px;
}
.g-toc-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted2);
  margin-bottom: 12px;
}
.g-toc-list {
  list-style: none;
  display: grid;
  gap: 6px;
}
.g-toc-item { }
.g-toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--grey-dark);
  text-decoration: none;
  transition: color 0.12s;
}
.g-toc-link:hover { color: var(--purple); }
.g-toc-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--lavender);
  color: var(--purple);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

/* ─── Quick Reference ─── */
.g-quick-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.g-quick-ref-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow);
}
.g-quick-ref-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted2);
  margin-bottom: 6px;
}
.g-quick-ref-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--violet);
  line-height: 1.2;
}
.g-quick-ref-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ─── Chart ─── */
.g-chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  margin: 16px 0;
  display: grid;
  gap: 10px;
}
.g-chart-row {
  display: grid;
  grid-template-columns: 140px 1fr 80px;
  align-items: center;
  gap: 10px;
}
.g-chart-label {
  font-size: 13px;
  color: var(--grey-dark);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-chart-track {
  background: var(--lavender);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.g-chart-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--purple);
  transition: width 0.4s ease;
}
.g-chart-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--violet);
  text-align: right;
}
.g-chart-note {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ─── Mistakes ─── */
.g-mistakes {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.g-mistake-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.g-mistake-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 6px;
}
.g-mistake-fix {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
}

/* ─── Edge Cases ─── */
.g-edge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.g-edge-card {
  background: var(--lavender);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.g-edge-case {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--violet);
  margin-bottom: 6px;
}
.g-edge-body {
  font-size: 13px;
  color: var(--grey-dark);
  line-height: 1.6;
}
.g-edge-example {
  margin-top: 8px;
}
.g-edge-example code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  background: rgba(124,58,237,0.08);
  color: var(--purple);
  padding: 2px 7px;
  border-radius: 5px;
}

/* ─── Methodology ─── */
.g-methodology {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  margin: 20px 0;
}
.g-methodology-code {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  background: var(--lavender);
  color: var(--violet);
  padding: 10px 14px;
  border-radius: 10px;
  margin: 10px 0;
  white-space: pre-wrap;
}
.g-methodology-note {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 8px;
}

/* ─── Citation ─── */
.g-citation-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  margin: 20px 0;
}
.g-citation-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--violet);
  margin-bottom: 10px;
}
.g-citation-formats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.g-citation-formats span {
  background: var(--lavender);
  color: var(--purple);
  padding: 4px 12px;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
}
.g-citation-url {
  font-size: 13px;
  margin-bottom: 6px;
}
.g-citation-url a {
  color: var(--purple);
  text-decoration: none;
}
.g-citation-url a:hover { text-decoration: underline; }
.g-citation-date {
  font-size: 12px;
  color: var(--muted2);
}

/* ─── Bottom CTA ─── */
.g-bottom-cta {
  background: linear-gradient(135deg, var(--violet), #321174);
  border-radius: var(--r);
  padding: 24px;
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.g-bottom-cta-text h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.g-bottom-cta-text p {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
}

/* ─── Practical Context ─── */
.g-practical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.g-practical-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.g-practical-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--violet);
  margin-bottom: 5px;
}
.g-practical-body {
  font-size: 13px;
  color: var(--grey-dark);
  line-height: 1.6;
}

/* ─── Reference Chart (styled table variant) ─── */
.g-ref-table td:first-child {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: var(--purple);
  font-weight: 600;
}

@media (max-width: 600px) {
  .g-chart-row { grid-template-columns: 100px 1fr 60px; }
  .g-quick-ref-grid { grid-template-columns: 1fr 1fr; }
  .g-bottom-cta { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════
   PREMIUM SECTION STYLES — COLOR SYSTEM v2
   Each section type has its own visual identity
   ═══════════════════════════════════════════════════ */

/* ─── TOC — clean bordered card ─── */
.g-toc {
  background: #fff;
  border: 1px solid rgba(124,58,237,0.15);
  border-left: 4px solid #7C3AED;
  border-radius: 16px;
  padding: 20px 22px;
  margin: 0 0 28px;
}
.g-toc-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #7C3AED;
  margin-bottom: 14px;
}
.g-toc-list {
  list-style: none;
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.g-toc-item { padding: 0; }
.g-toc-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #4B5563;
  text-decoration: none;
  transition: color 0.12s;
}
.g-toc-link:hover { color: #7C3AED; }
.g-toc-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #F0EFFF;
  color: #7C3AED;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ─── Quick Reference — violet stat cards ─── */
.g-quick-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.g-quick-ref-card {
  background: #fff;
  border: 1px solid rgba(124,58,237,0.15);
  border-top: 3px solid #7C3AED;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.07);
}
.g-quick-ref-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #9CA3AF;
  margin-bottom: 6px;
}
.g-quick-ref-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #1E0A4C;
  line-height: 1.2;
  margin-bottom: 4px;
}
.g-quick-ref-note {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.5;
}

/* ─── Chart — white card with colored bars ─── */
.g-chart-card {
  background: #fff;
  border: 1px solid rgba(124,58,237,0.12);
  border-radius: 16px;
  padding: 20px;
  margin: 16px 0 24px;
  display: grid;
  gap: 14px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.06);
}
.g-chart-row {
  display: grid;
  grid-template-columns: 120px 1fr 80px;
  align-items: center;
  gap: 12px;
}
.g-chart-label {
  font-size: 13px;
  font-weight: 600;
  color: #4B5563;
}
.g-chart-track {
  background: #F0EFFF;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}
.g-chart-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}
.g-chart-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #1E0A4C;
  text-align: right;
}
.g-chart-note {
  font-size: 12px;
  color: #9CA3AF;
  border-top: 1px solid rgba(124,58,237,0.1);
  padding-top: 10px;
  margin-top: 4px;
}

/* ─── Mistakes — red/green treatment ─── */
.g-mistakes {
  display: grid;
  gap: 10px;
  margin: 16px 0 24px;
}
.g-mistake-card {
  background: #fff;
  border: 1px solid rgba(239,68,68,0.15);
  border-left: 4px solid #EF4444;
  border-radius: 14px;
  padding: 14px 16px;
}
.g-mistake-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #991B1B;
  margin-bottom: 6px;
}
.g-mistake-card p {
  font-size: 13px;
  color: #6B7280;
  margin: 0 0 8px;
  line-height: 1.6;
}
.g-mistake-fix {
  font-size: 13px;
  font-weight: 600;
  color: #065F46;
  background: #ECFDF5;
  border-radius: 8px;
  padding: 6px 10px;
  display: inline-block;
}

/* ─── Edge Cases — blue/teal treatment ─── */
.g-edge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.g-edge-card {
  background: #EFF6FF;
  border: 1px solid rgba(59,130,246,0.2);
  border-top: 3px solid #3B82F6;
  border-radius: 14px;
  padding: 16px;
}
.g-edge-case {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #1E40AF;
  margin-bottom: 8px;
}
.g-edge-body {
  font-size: 13px;
  color: #374151;
  line-height: 1.65;
}
.g-edge-example {
  margin-top: 10px;
}
.g-edge-example code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  background: rgba(59,130,246,0.1);
  color: #1D4ED8;
  padding: 3px 8px;
  border-radius: 6px;
  display: block;
}

/* ─── Methodology — light green treatment ─── */
.g-methodology {
  background: #F0FDF4;
  border: 1px solid rgba(16,185,129,0.2);
  border-left: 4px solid #10B981;
  border-radius: 14px;
  padding: 18px 20px;
  margin: 16px 0 24px;
}
.g-methodology p { margin-bottom: 10px; }
.g-methodology-code {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  background: rgba(16,185,129,0.08);
  color: #065F46;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 10px 0;
  white-space: pre-wrap;
}
.g-methodology-note {
  font-size: 12px;
  color: #6B7280;
  margin-top: 8px;
  font-style: italic;
}

/* ─── Citation — neutral clean card ─── */
.g-citation-card {
  background: #FAFAFA;
  border: 1px solid rgba(124,58,237,0.12);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 16px 0 24px;
}
.g-citation-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #1E0A4C;
  margin-bottom: 10px;
}
.g-citation-formats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.g-citation-formats span {
  background: #F0EFFF;
  color: #7C3AED;
  padding: 4px 12px;
  border-radius: 999px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.g-citation-url {
  font-size: 13px;
  color: #7C3AED;
  margin-bottom: 6px;
  word-break: break-all;
}
.g-citation-url a { color: #7C3AED; text-decoration: none; }
.g-citation-url a:hover { text-decoration: underline; }
.g-citation-date {
  font-size: 12px;
  color: #9CA3AF;
}

/* ─── Bottom CTA ─── */
.g-bottom-cta {
  background: linear-gradient(135deg, #1E0A4C, #321174);
  border-radius: 16px;
  padding: 24px;
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.g-bottom-cta-text h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}
.g-bottom-cta-text p {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin: 0;
}

/* ─── Checklist ─── */
.g-checklist {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 12px 0 24px;
  padding: 0;
}
.g-checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: #4B5563;
}
.g-checklist li span:first-child {
  color: #10B981;
  flex-shrink: 0;
  margin-top: 1px;
  font-weight: 700;
}

/* ─── Section subheading ─── */
.g-section-subheading {
  font-size: 15px;
  color: #6B7280;
  margin-bottom: 16px;
  margin-top: -8px;
}

/* ─── Responsive fixes ─── */
@media (max-width: 600px) {
  .g-chart-row { grid-template-columns: 90px 1fr 60px; gap: 8px; }
  .g-quick-ref-grid { grid-template-columns: 1fr 1fr; }
  .g-bottom-cta { flex-direction: column; }
  .g-edge-grid { grid-template-columns: 1fr; }
}

/* ─── Formula card — prevent oversized KaTeX rendering ─── */
.g-formula-latex {
  font-size: clamp(14px, 2vw, 20px) !important;
  overflow-x: auto !important;
  max-width: 100% !important;
  padding: 12px 0 !important;
  text-align: center !important;
}
.katex-display {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100% !important;
  font-size: 1em !important;
}
.katex {
  font-size: 1.1em !important;
}