/* ========================================
   Bostadshjälpen.se — Professional Design System
   Swedish Housing & Finance Platform
   ======================================== */

@import "tailwindcss";

/* Styles are applied through these global classes. */


:root {
  /* Colors — Blue Professional Theme */
  --primary: #1e3a5f;
  --primary-light: #2d4a7c;
  --primary-dark: #0f2540;
  --accent: #d4af37;
  --accent-light: #e8c560;
  --accent-dark: #b8942e;
  --accent-text: #8a6d1a;

  /* Semantic Colors */
  --success: #059669;
  --success-light: #10b981;
  --warning: #d97706;
  --warning-light: #f59e0b;
  --danger: #dc2626;
  --danger-light: #ef4444;
  --info: #2563eb;
  --info-light: #3b82f6;

  /* Evidence Grades */
  --evidence-a: #1e40af;
  --evidence-a-bg: #eff6ff;
  --evidence-b: #059669;
  --evidence-b-bg: #ecfdf5;
  --evidence-c: #d97706;
  --evidence-c-bg: #fffbeb;
  --evidence-d: #475569;
  --evidence-d-bg: #f8fafc;

  /* Layout scales */
  --menu-width: 1240px;
  --calculator-width: 1040px;
  --article-width: 780px;
  --header-height: 72px;

  /* Category Colors */
  --cat-bolan: #1e40af;
  --cat-bolan-bg: #eff6ff;
  --cat-bolan-border: #bfdbfe;
  --cat-varme: #ea580c;
  --cat-varme-bg: #fff7ed;
  --cat-varme-border: #fed7aa;
  --cat-bostadsbidrag: #d97706;
  --cat-bostadsbidrag-bg: #fffbeb;
  --cat-bostadsbidrag-border: #fde68a;
  --cat-el: #ca8a04;
  --cat-el-bg: #fefce8;
  --cat-el-border: #fef08a;
  --cat-bredband: #7c3aed;
  --cat-bredband-bg: #faf5ff;
  --cat-bredband-border: #e9d5ff;
  --cat-byggratt: #059669;
  --cat-byggratt-bg: #ecfdf5;
  --cat-byggratt-border: #a7f3d0;
  --cat-renovering: #059669;
  --cat-renovering-bg: #ecfdf5;
  --cat-renovering-border: #a7f3d0;

  /* Neutrals */
  --bg: #fafafa;
  --bg-warm: #f5f5f0;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing & Sizing */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ========================================
   Dark Mode
   ======================================== */

[data-theme="dark"] {
  --primary: #e2e8f0;
  --primary-light: #f1f5f9;
  --primary-dark: #0f2540;
  --accent: #e8c560;
  --accent-light: #f0d888;
  --accent-dark: #d4af37;
  --accent-text: #1e293b;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --evidence-a: #3b82f6;
  --evidence-a-bg: #1e3a5f;
  --evidence-b: #10b981;
  --evidence-b-bg: #064e3b;
  --evidence-c: #f59e0b;
  --evidence-c-bg: #78350f;
  --evidence-d: #94a3b8;
  --evidence-d-bg: #1e293b;

  --cat-bolan: #3b82f6;
  --cat-bolan-bg: #1e3a5f;
  --cat-bolan-border: #1e40af;
  --cat-varme: #fb923c;
  --cat-varme-bg: #7c2d12;
  --cat-varme-border: #ea580c;
  --cat-bostadsbidrag: #f59e0b;
  --cat-bostadsbidrag-bg: #78350f;
  --cat-bostadsbidrag-border: #d97706;
  --cat-el: #eab308;
  --cat-el-bg: #713f12;
  --cat-el-border: #ca8a04;
  --cat-bredband: #a78bfa;
  --cat-bredband-bg: #4c1d95;
  --cat-bredband-border: #7c3aed;
  --cat-byggratt: #10b981;
  --cat-byggratt-bg: #064e3b;
  --cat-byggratt-border: #059669;
  --cat-renovering: #10b981;
  --cat-renovering-bg: #064e3b;
  --cat-renovering-border: #059669;

  --bg: #0a0f1a;
  --bg-warm: #111827;
  --bg-card: #1a2332;
  --bg-muted: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #1e293b;
  --border-light: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.6);
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
}

@media (max-width: 768px) {
  html { font-size: 15px; }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 1rem;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

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

a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Focus states */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Selection */
::selection {
  background: var(--accent);
  color: var(--primary-dark);
}

/* ========================================
   Layout
   ======================================== */

.container {
  max-width: var(--article-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  width: 100%;
  max-width: var(--menu-width);
  margin: 0 auto;
  padding: 0 32px;
}

/* Shared page-width contract: menus/listings are widest, calculators are
   slightly narrower, and reading views stay focused and consistent. */
.page-width-calculator {
  width: 100%;
  max-width: var(--calculator-width);
  margin-inline: auto;
}

.page-width-article {
  width: 100%;
  max-width: var(--article-width);
  margin-inline: auto;
}

.site-main {
  width: 100%;
  max-width: var(--menu-width);
  margin-inline: auto;
  padding-inline: 32px;
}

.site-main > .hero {
  margin-inline: -32px;
}

@media (max-width: 1024px) {
  .site-main { padding-inline: 24px; }
  .site-main > .hero { margin-inline: -24px; }
}

@media (max-width: 640px) {
  .site-main { padding-inline: 16px; }
  .site-main > .hero { margin-inline: -16px; }
}

@media (max-width: 1024px) {
  .container-wide { padding: 0 24px; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .container-wide { padding: 0 16px; }
}

/* ========================================
   Header / Navigation
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

[data-theme="dark"] .site-header {
  background: rgba(10,15,26,0.95);
  border-bottom-color: var(--border);
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

.site-header .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-header-inner {
  gap: 24px;
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.site-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
  align-items: center;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-warm);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--primary);
  background: var(--bg-warm);
}

.nav-plain-link {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 8px;
}

.nav-plain-link:hover {
  color: var(--text);
  background: var(--bg-warm);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Dropdown Menu */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.nav-dropdown-trigger:hover {
  color: var(--text);
  background: var(--bg-warm);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 50;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown.is-open .nav-dropdown-trigger svg {
  transform: rotate(180deg);
}

.nav-dropdown-trigger svg {
  transition: transform var(--transition-fast);
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-dropdown-menu a:hover {
  background: var(--bg-warm);
  color: var(--primary);
  text-decoration: none;
  padding-left: 20px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 768px) {
  .site-header {
    height: auto;
    min-height: var(--header-height);
  }

  .site-header-inner {
    min-height: var(--header-height);
    flex-wrap: wrap;
  }

  .mobile-menu-btn { display: flex; }

  .mobile-menu-btn .close-icon { display: none; }
  .mobile-menu-btn[aria-expanded="true"] .menu-icon { display: none; }
  .mobile-menu-btn[aria-expanded="true"] .close-icon { display: block; }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-left: 0;
    padding: 8px 0 16px;
  }

  .nav-links.mobile-open { display: flex; }
  .nav-links .btn { justify-content: center; }
  .nav-plain-link { display: block; }

  .nav-dropdown-menu {
    position: static;
    display: none;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    padding: 0 0 4px 16px;
    background: transparent;
  }

  .nav-dropdown.is-open .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
  }

  .nav-dropdown-menu a,
  .nav-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
    text-align: left;
    min-height: 44px;
  }

  .header-actions { margin-left: auto; }
  .header-actions .btn-outline { display: none; }
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.05rem;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  color: white;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-primary:active {
  transform: translateY(0);
}

[data-theme="dark"] .btn-primary {
  background: var(--accent);
  color: var(--primary-dark);
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--accent-light);
  color: var(--primary-dark);
}

.btn-accent {
  background: var(--accent);
  color: var(--primary-dark);
  font-weight: 700;
}

.btn-accent:hover {
  background: var(--accent-light);
  color: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
  background: var(--bg-muted);
}

[data-theme="dark"] .btn-outline {
  border-color: var(--border);
}

[data-theme="dark"] .btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-muted);
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 8px 12px;
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ========================================
   Cards
   ======================================== */

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.card > p:last-of-type {
  flex: 1;
}

.card h3,
.card h4 {
  color: var(--text);
  text-wrap: balance;
}

.card p {
  color: var(--text-muted);
  text-wrap: pretty;
}

.card:hover,
.card:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.card:where(a):hover,
.card:where(a):focus-visible {
  color: inherit;
  text-decoration: none;
  transform: translateY(-2px);
}

.card-padded {
  padding: 20px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  font-size: 1.25rem;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.card h3 a {
  color: var(--text);
}

.card h3 a:hover {
  color: var(--primary);
}

.card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Category Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-blue { background: var(--cat-bolan-bg); color: var(--cat-bolan); }
.badge-orange { background: var(--cat-varme-bg); color: var(--cat-varme); }
.badge-amber { background: var(--cat-bostadsbidrag-bg); color: var(--cat-bostadsbidrag); }
.badge-yellow { background: var(--cat-el-bg); color: var(--cat-el); }
.badge-purple { background: var(--cat-bredband-bg); color: var(--cat-bredband); }
.badge-green { background: var(--cat-byggratt-bg); color: var(--cat-byggratt); }
.badge-emerald { background: var(--cat-renovering-bg); color: var(--cat-renovering); }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-slate { background: var(--bg-muted); color: var(--text-muted); }
.badge-rose { background: #ffe4e6; color: #be123c; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-teal { background: #ccfbf1; color: #0d9488; }
.badge-violet { background: #f3e8ff; color: #a21caf; }

[data-theme="dark"] .badge-blue { background: var(--cat-bolan-bg); color: var(--cat-bolan); }
[data-theme="dark"] .badge-orange { background: var(--cat-varme-bg); color: var(--cat-varme); }
[data-theme="dark"] .badge-amber { background: var(--cat-bostadsbidrag-bg); color: var(--cat-bostadsbidrag); }
[data-theme="dark"] .badge-yellow { background: var(--cat-el-bg); color: var(--cat-el); }
[data-theme="dark"] .badge-purple { background: var(--cat-bredband-bg); color: var(--cat-bredband); }
[data-theme="dark"] .badge-green { background: var(--cat-byggratt-bg); color: var(--cat-byggratt); }
[data-theme="dark"] .badge-emerald { background: var(--cat-renovering-bg); color: var(--cat-renovering); }
[data-theme="dark"] .badge-red { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-slate { background: var(--bg-muted); color: var(--text-muted); }
[data-theme="dark"] .badge-rose { background: #78182e; color: #fda4af; }
[data-theme="dark"] .badge-indigo { background: #312e81; color: #c7d2fe; }
[data-theme="dark"] .badge-teal { background: #134e4a; color: #5eead4; }
[data-theme="dark"] .badge-violet { background: #581c87; color: #f0abfc; }

/* ========================================
   Forms
   ======================================== */

.input,
.select,
.textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--text);
  transition: all var(--transition-fast);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.input::placeholder {
  color: var(--text-light);
}

.label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-label,
.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
}

.checkbox-label input,
.radio-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.help-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.error-message {
  font-size: 0.95rem;
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 12px 16px;
  line-height: 1.5;
  margin-top: 6px;
}

.input-error {
  border-color: var(--danger) !important;
}

.input-error:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent) !important;
}

/* Calculator Form */
.calculator-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
}

.calculator-form .form-group {
  margin-bottom: 0;
}

.calculator-form .form-group > .label {
  margin-bottom: 8px;
}

.calculator-form .error-message[hidden] {
  display: none;
}

.calculator-panel .result-value {
  color: var(--primary);
}

.calculator-panel .result-card {
  margin-top: 0;
}

.calculator-panel .calculator-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

@media (max-width: 640px) {
  .calculator-page {
    padding: 20px 0 32px;
  }

  .calculator-header {
    padding: 0 16px;
    margin-bottom: 24px;
  }

  .calculator-panel {
    padding: 20px 16px;
  }
}

/* Hide number input spin buttons (arrows) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}

.calculator-category {
  margin-bottom: 48px;
}

.calculator-category:last-child {
  margin-bottom: 0;
}

.calculator-category > .listing-heading-row {
  margin-bottom: 20px;
}

.calculator-card h3 {
  margin-bottom: 8px;
}

.calculator-card p {
  margin: 0 0 20px;
  flex: 1;
  line-height: 1.6;
  color: var(--text-muted);
}

.calculator-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.calculator-card-action svg {
  flex: 0 0 16px;
  transition: transform var(--transition-fast);
}

.calculator-card:hover .calculator-card-action svg,
.calculator-card:focus-visible .calculator-card-action svg {
  transform: translateX(2px);
}

.calculator-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 280px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.calculator-card:hover,
.calculator-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
  text-decoration: none;
}

.calculator-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.calculator-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex: 1;
  line-height: 1.6;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
}

.result-card {
  background: linear-gradient(135deg, var(--cat-bolan-bg), var(--bg-muted));
  border: 1px solid color-mix(in srgb, var(--cat-bolan) 30%, transparent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}

.result-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.result-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row-label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.result-row-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

/* ========================================
   Tables
   ======================================== */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-container th,
.table-container td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table-container th {
  background: var(--bg-muted);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-container tr:last-child td {
  border-bottom: none;
}

.table-container tr:hover td {
  background: var(--bg-warm);
}

[data-theme="dark"] .table-container th {
  background: var(--bg-muted);
  color: var(--text);
}

[data-theme="dark"] .table-container tr:hover td {
  background: rgba(212, 175, 55, 0.08);
}

/* ========================================
   Evidence Boxes
   ======================================== */

.evidence-box {
  padding: 20px 24px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin: 24px 0;
  position: relative;
}

.evidence-box h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.evidence-box p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
}

.evidence-box ul,
.evidence-box ol {
  margin: 12px 0 0 24px;
  padding: 0;
}

.evidence-box li {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.evidence-a {
  background: var(--evidence-a-bg);
  border-left-color: var(--evidence-a);
  color: var(--primary-dark);
}

.evidence-b {
  background: var(--evidence-b-bg);
  border-left-color: var(--evidence-b);
  color: var(--success);
}

.evidence-c {
  background: var(--evidence-c-bg);
  border-left-color: var(--evidence-c);
  color: #92400e;
}

.evidence-d {
  background: var(--evidence-d-bg);
  border-left-color: var(--evidence-d);
  color: var(--text-muted);
}

[data-theme="dark"] .evidence-a { color: #dbeafe; }
[data-theme="dark"] .evidence-b { color: #d1fae5; }
[data-theme="dark"] .evidence-c { color: #fef3c7; }
[data-theme="dark"] .evidence-d { color: #cbd5e1; }

/* ========================================
   Accordion
   ======================================== */

.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.accordion-item {
  border-top: 1px solid var(--border);
}

.accordion-item:first-child {
  border-top: none;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: var(--bg-card);
  border: none;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.accordion-trigger:hover {
  background: var(--bg-muted);
}

.accordion-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.accordion-trigger svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.accordion-item[open] .accordion-trigger svg {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 0 24px 24px;
  color: var(--text-muted);
  line-height: 1.7;
  animation: accordion-down 200ms ease;
}

@keyframes accordion-down {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Breadcrumbs
   ======================================== */

.breadcrumb,
[aria-label="Breadcrumbs"] {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
  flex-wrap: wrap;
}

.breadcrumb a,
[aria-label="Breadcrumbs"] a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.breadcrumb a:hover,
[aria-label="Breadcrumbs"] a:hover {
  color: var(--accent);
}

.breadcrumb svg,
[aria-label="Breadcrumbs"] > svg {
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 16px;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.breadcrumb-list li:last-child {
  overflow-wrap: anywhere;
}

.breadcrumb-separator {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  color: var(--text-light);
}

.breadcrumb-separator svg {
  display: block;
  width: 16px !important;
  height: 16px !important;
}

.breadcrumb span[aria-current="page"],
[aria-label="Breadcrumbs"] span[aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}


/* ========================================
   Hero Sections
   ======================================== */

.hero {
  padding: 80px 0;
  background: linear-gradient(180deg, var(--bg-warm) 0%, var(--bg) 100%);
}

[data-theme="dark"] .hero {
  background: linear-gradient(180deg, var(--bg-warm) 0%, var(--bg) 100%);
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.hero .highlight {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 640px;
  margin-bottom: 32px;
}

.hero .hero-description {
  max-width: 68ch;
  margin: 0 auto;
  line-height: 1.65;
}

.hero-tools {
  padding: 64px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  text-align: center;
}

.hero-tools h1 {
  margin-bottom: 16px;
  color: #fff;
  font-size: clamp(2rem, 5vw, 2.5rem);
}

.hero-tools .hero-description {
  max-width: 60ch;
  color: rgb(255 255 255 / 90%);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-top: 48px;
}

.hero-stat {
  flex: 1;
  min-width: 140px;
}

.hero-stat .number {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.hero-stat .label {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   Article / Prose Content
   ======================================== */

.article-content {
  width: 100%;
  max-width: var(--article-width);
  margin: 0 auto;
  padding: 0 24px;
}

.article-content.guide-page {
  max-width: var(--article-width);
}

.article-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 16px;
}

.article-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 48px 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.article-content h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin: 36px 0 16px;
}

.article-content p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 20px;
}

.article-content strong {
  color: var(--text);
  font-weight: 600;
}

.article-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: var(--accent);
}

/* Linked cards and breadcrumbs keep their own consistent affordance. */
.article-content a.card,
.article-content .breadcrumb a {
  text-decoration: none;
}

.article-content a.card:hover,
.article-content a.card:focus-visible {
  color: inherit;
  text-decoration: none;
}

.article-content .guide-card-action {
  text-decoration: none;
}

.article-content .guide-card-action:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content ul,
.article-content ol {
  margin: 16px 0 16px 24px;
}

.article-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.article-content code {
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--primary);
}

.article-content pre {
  background: var(--primary-dark);
  color: var(--text-light);
  padding: 24px;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.article-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 24px;
  margin: 24px 0;
  font-style: italic;
  color: var(--text-muted);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.article-content th,
.article-content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-content th {
  background: var(--bg-muted);
  font-weight: 600;
}

.article-content tr:nth-child(even) td {
  background: var(--bg-muted);
}

.article-content hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 48px 0;
}

/* Medical Disclaimer */
.disclaimer {
  background: var(--evidence-d-bg);
  border-left: 4px solid var(--evidence-d);
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 24px 0;
}

.disclaimer strong {
  color: var(--text);
}

.disclaimer p {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Source List */
.source-list {
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--bg-muted);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 0.9rem;
}

.source-list h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.source-list ul {
  margin: 0;
  padding-left: 20px;
}

.source-list li {
  margin-bottom: 6px;
}

.source-list a {
  color: var(--primary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-list a:hover {
  color: var(--accent);
}

/* Related Posts */
.related-posts {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 48px;
}

.related-posts h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

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

.related-posts li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.related-posts li:last-child {
  border-bottom: none;
}

.related-posts a {
  font-weight: 500;
  color: var(--text);
}

.related-posts a:hover {
  color: var(--accent);
}

.related-posts small {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   Footer
   ======================================== */

.site-footer {
  background: var(--bg-warm);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  padding: 64px 0 32px;
  margin-top: auto;
}

[data-theme="dark"] .site-footer {
  background: var(--bg-warm);
  border-top-color: var(--border);
}

.site-footer a {
  color: var(--text);
  transition: color var(--transition-fast);
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 40px;
  margin-bottom: 48px;
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand .site-logo {
  color: var(--text);
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 300px;
}

.footer-social {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.footer-social a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.footer-social a:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}

.footer-col nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
}

.footer-bottom nav {
  display: flex;
  gap: 24px;
}

.footer-bottom a {
  color: var(--text-muted);
}

.footer-bottom a:hover {
  color: var(--accent);
}

/* ========================================
   Page Hero
   ======================================== */

.page-hero {
  padding: 60px 0;
  background: linear-gradient(180deg, var(--bg-warm) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.page-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.page-hero .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.page-hero .meta time {
  white-space: nowrap;
}

/* ========================================
   Calculator Page Specific
   ======================================== */

.calculator-page {
  width: 100%;
  max-width: var(--calculator-width);
  margin: 0 auto;
  padding: 24px 0 48px;
}

.calculator-header {
  margin-bottom: 32px;
  padding: 0 24px;
}

.calculator-header .breadcrumb {
  margin-bottom: 24px;
}

.calculator-header h1 {
  max-width: 24ch;
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.calculator-lede {
  max-width: 68ch;
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.calculator-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.calculator-panel {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.calculator-panel > h2 {
  margin: 0 0 24px;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.calculator-form-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.calculator-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.calculator-results {
  margin-top: 32px;
  padding: 24px;
  background: linear-gradient(135deg, var(--cat-bolan-bg), var(--bg-muted));
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--cat-bolan) 30%, transparent);
}

.calculator-results h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.result-item .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.result-item .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.related-guide-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--primary);
  transition: all var(--transition-fast);
}

.related-guide-link:hover {
  border-color: var(--primary);
  color: var(--accent);
  text-decoration: none;
  transform: translateX(4px);
}

/* ========================================
   Category Grid (Index Page)
   ======================================== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin: 48px 0;
}

.category-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.category-card:hover,
.category-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
  text-decoration: none;
}

.category-card:hover h3,
.category-card:focus-visible h3 {
  color: var(--primary);
}

.category-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
  background: var(--category-bg, var(--primary));
  color: var(--category-color, white);
}

.category-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.category-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ========================================
   Pillar Index Cards
   ======================================== */

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

/* Shared listing/card grids keep every collection view aligned. */
.card-grid,
.calculator-grid,
.pillars-grid {
  width: 100%;
}

.listing-section {
  padding-block: 64px;
}

.listing-section-warm {
  background: var(--bg-warm);
}

.listing-title {
  margin: 0 0 40px;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.listing-intro {
  max-width: 68ch;
  margin: -16px auto 40px;
  color: var(--text-muted);
  text-align: center;
}

.listing-heading-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 0 0 32px;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 700;
}

.calculator-category {
  margin-bottom: 48px;
}

.calculator-category:last-child {
  margin-bottom: 0;
}

.calculator-category > .listing-heading-row {
  margin-bottom: 20px;
}

.pillar-card {
  justify-content: flex-start;
}

.pillar-card > .badge {
  align-self: flex-start;
  margin-bottom: 20px;
}

.pillar-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pillar-card h3 {
  margin: 0 0 12px;
}

.pillar-card-description {
  flex: 1;
  margin: 0 0 24px !important;
  color: var(--text-muted) !important;
  line-height: 1.65 !important;
}

.pillar-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
}

.pillar-card-action svg {
  flex: 0 0 16px;
  transition: transform var(--transition-fast);
}

.pillar-card:hover .pillar-card-action svg,
.pillar-card:focus-visible .pillar-card-action svg {
  transform: translateX(2px);
}

.evidence-badge {
  background: var(--evidence-a-bg);
  color: var(--evidence-a);
}

.listing-cta {
  margin-top: 40px;
  text-align: center;
}

@media (max-width: 640px) {
  .listing-section {
    padding-block: 40px;
  }

  .listing-title {
    margin-bottom: 28px;
  }

  .listing-intro {
    margin-top: -8px;
    margin-bottom: 28px;
  }

  .pillars-grid {
    gap: 16px;
  }
}

.pillar-card:hover,
.pillar-card:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.pillar-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pillar-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.pillar-card .description {
  font-size: 0.9rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 16px;
}

.pillar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-light);
}

.pillar-footer .read-more {
  font-weight: 600;
  color: var(--primary);
}

.pillar-footer .read-more:hover {
  color: var(--accent);
}

/* ========================================
   CTA Section
   ======================================== */

.cta-section {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 64px 0;
  text-align: center;
}

.cta-section h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 16px;
}

.cta-section p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  max-width: 600px;
  margin: 0 auto 32px;
}

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

.cta-section .btn-primary:hover {
  background: var(--bg-warm);
  color: var(--primary);
}

.cta-section .btn-outline {
  border-color: white;
  color: white;
}

.cta-section .btn-outline:hover {
  background: white;
  color: var(--primary);
}

/* ========================================
   Utilities
   ======================================== */

.hidden { display: none !important; }

.badge[style*="--category-bg"] {
  background: var(--category-bg);
  color: var(--category-color);
}

.card-icon[style*="--category-bg"] {
  background: var(--category-accent);
  color: #fff;
}

.toc-item-nested { padding-left: 16px; }
.toc-link { color: var(--text-muted); font-weight: 500; }
.toc-link:hover { color: var(--primary); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mt-16 { margin-top: 64px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }
.mb-16 { margin-bottom: 64px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

.w-full { width: 100%; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Print styles */
@media print {
  .site-header,
  .site-footer,
  .btn,
  .nav-dropdown,
  .mobile-menu-btn {
    display: none !important;
  }
  .article-content { max-width: 100%; }
  a { text-decoration: none; color: var(--text); }
  .evidence-box { break-inside: avoid; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   Live guide presentation
   ======================================== */

.guide-page {
  min-width: 0;
}

.guide-header {
  margin-bottom: 40px;
}

.guide-page .breadcrumb {
  margin-bottom: 24px;
  min-height: 24px;
  line-height: 1.4;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.breadcrumb-list li:last-child {
  overflow-wrap: anywhere;
}

.breadcrumb-separator {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  color: var(--text-light);
}

.breadcrumb-separator svg {
  display: block;
  width: 16px !important;
  height: 16px !important;
}

.guide-intro,
.article-intro {
  padding: 32px;
  border: 1px solid var(--category-border, var(--border));
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, color-mix(in srgb, var(--category-bg, var(--bg-card)) 74%, var(--bg-card)) 0%, var(--bg-card) 100%);
  box-shadow: var(--shadow-sm);
}

.guide-kicker {
  margin: 0 0 12px !important;
  color: var(--category-color, var(--primary)) !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4 !important;
  text-transform: uppercase;
}


.guide-page h1 {
  max-width: 22ch;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.guide-lede {
  max-width: 68ch;
  margin: 0 0 24px !important;
  color: var(--text-muted) !important;
  font-size: 1.12rem !important;
  line-height: 1.7 !important;
}

.guide-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  list-style: none;
}

.guide-meta li {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}

.badge[style*="--category-bg"] {
  background: var(--category-bg);
  border: 1px solid var(--category-border, transparent);
  color: var(--category-color);
}

.guide-disclaimer {
  margin: 0 0 32px;
}

.guide-disclaimer h2 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.guide-disclaimer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.guide-toc {
  margin: 0 0 48px;
  padding: 24px;
  border-color: var(--category-border, var(--border));
  background: var(--category-bg, var(--bg-card));
}

.guide-toc h2 {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  color: var(--category-color, var(--text));
  font-size: 1.1rem;
  line-height: 1.4;
}

.guide-toc-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-toc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

.guide-toc-list a:hover {
  background: color-mix(in srgb, var(--category-border, var(--border)) 30%, transparent);
  color: var(--category-color, var(--primary));
  text-decoration: none;
}

.guide-toc-list a svg {
  flex: 0 0 16px;
  margin-left: auto;
  color: var(--category-color, var(--primary));
}

.guide-toc-number {
  display: inline-flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--category-color, var(--primary));
  color: var(--category-bg, white);
  font-size: 0.78rem;
  font-weight: 700;
}

.guide-section {
  scroll-margin-top: calc(var(--header-height) + 24px);
  margin-top: 64px;
  padding-top: 16px;
}

.guide-section:first-of-type {
  margin-top: 0;
}

.guide-section h2 {
  margin-top: 0;
}

.section-number {
  color: var(--category-accent, var(--primary));
}

.section-intro {
  color: var(--text-muted) !important;
}

.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

.guide-card {
  min-width: 0;
  padding: 24px;
}

.guide-card h3 {
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.guide-card p {
  flex: 1;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}

.guide-card-link {
  border-color: var(--border);
}

.guide-card-link:hover,
.guide-card:has(.guide-card-action:hover) {
  border-color: var(--category-accent, var(--primary));
  transform: translateY(-2px);
}

.guide-card-eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--category-color, var(--text-muted));
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

.guide-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-light);
  font-size: 0.8rem;
}

.guide-card-action {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  margin-top: auto;
  color: var(--category-accent, var(--primary));
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.guide-card-action svg {
  flex: 0 0 16px;
  transition: transform var(--transition-fast);
}

.guide-card-action:hover {
  color: var(--category-color, var(--primary));
  text-decoration: underline;
  text-underline-offset: 3px;
}

.guide-card-action:hover svg {
  transform: translateX(2px);
}

.article-page .article-body {
  min-width: 0;
}

.article-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

.related-articles {
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .guide-header {
    margin-bottom: 32px;
  }

  .guide-page .breadcrumb {
    margin-bottom: 20px;
  }

  .breadcrumb-list {
    align-items: flex-start;
    gap: 8px 6px;
  }

  .breadcrumb-list li {
    max-width: 100%;
  }

  .breadcrumb-separator {
    margin-right: 6px;
  }

  .guide-intro,
  .article-intro {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  .guide-page h1 {
    font-size: clamp(1.85rem, 8vw, 2.4rem);
    line-height: 1.16;
  }

  .guide-lede {
    font-size: 1.02rem !important;
  }

  .guide-toc {
    margin-bottom: 32px;
    padding: 20px;
  }

  .guide-toc-list {
    grid-template-columns: 1fr;
  }

  .guide-section {
    margin-top: 48px;
    padding-top: 8px;
  }

  .guide-card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .guide-card {
    padding: 20px;
  }

  .article-body table {
    margin-right: 0;
    font-size: 0.9rem;
  }

  .article-body th,
  .article-body td {
    min-width: 10rem;
    padding: 10px 12px;
  }
}

/* Official link-out calculators */
.official-calculators { display: grid; gap: 16px; }
.official-calculators ul { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.official-calculators a { width: 100%; justify-content: center; text-align: center; }
.calculator-note { padding: 16px; border-left: 4px solid var(--primary); background: var(--bg-muted); border-radius: var(--radius); }
.article-sources { margin: 28px 0; padding: 20px 24px; }
.article-sources h2 { font-size: 1.15rem; margin: 0 0 10px; }
.article-sources ul { margin: 0; padding-left: 20px; }
.article-sources a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
@media (min-width: 640px) { .official-calculators ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
