/* ==========================================================================
   msocalc.com — Global Stylesheet
   ========================================================================== */

/* CLS-Killer: Fallback-Schriftart mit Inter-passenden Metriken.
   Bevor Inter geladen ist, rendert der Browser mit dieser anpassbar gestylten
   Variante von Arial. Sobald Inter da ist, ist der Swap visuell minimal
   → kein Reflow, kein Layout-Shift durch Web-Font.
   Werte aus Googles offizieller Inter-Fallback-Definition. */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  ascent-override: 90%;
  descent-override: 22.43%;
  line-gap-override: 0%;
  size-adjust: 107.06%;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --accent: #f59e0b;
  --positive: #10b981;
  --negative: #ef4444;

  --bg: #f7f8fb;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  --border: #e5e7eb;
  --border-strong: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow: 0 4px 8px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 24px 32px -8px rgb(15 23 42 / 0.12), 0 10px 14px -6px rgb(15 23 42 / 0.05);

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
  --max-width: 1240px;
  --content-width: 760px;

  --font-sans: "Inter", "Inter Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  /* Category accents */
  --cat-finance: #2563eb;
  --cat-health:  #10b981;
  --cat-math:    #8b5cf6;
  --cat-convert: #f59e0b;
  --cat-other:   #ef4444;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; color: var(--text); }
h1 { font-size: clamp(1.875rem, 4vw, 2.625rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.02em; margin-top: 2em; }
h3 { font-size: 1.2rem; font-weight: 700; margin-top: 1.5em; }
p  { margin: 0 0 1em; }

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

/* ==========================================================================
   Header / Mega-Menu Navigation
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 20px;
  padding-top: 14px; padding-bottom: 14px;
}

.logo {
  font-size: 1.3rem; font-weight: 800; color: var(--text);
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; font-weight: 900; font-size: 1rem;
  box-shadow: 0 4px 10px -2px rgba(37,99,235,0.4);
}

.nav {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  color: var(--text);
  font-weight: 600; font-size: 0.95rem;
  border-radius: 8px;
  cursor: pointer;
  border: 0; background: transparent;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link[aria-expanded="true"] {
  background: var(--primary-50); color: var(--primary-dark);
  text-decoration: none;
}
.nav-link .chev {
  width: 14px; height: 14px;
  transition: transform 0.2s;
}
.nav-link[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Mega menu panel */
.mega-menu {
  position: absolute; top: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: min(900px, calc(100vw - 32px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 200;
}
/* Invisible bridge over the 8px gap so mouseleave doesn't fire while user
   moves from the trigger button down to the menu panel. */
.nav-item.open .mega-menu::before {
  content: "";
  position: absolute;
  top: -16px; left: 0; right: 0;
  height: 16px;
}
.nav-item.open .mega-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px;
}
.mega-menu .mega-cat {
  display: block;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 8px;
}
.mega-menu a.mega-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.92rem; font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}
.mega-menu a.mega-link:hover { background: var(--primary-50); color: var(--primary-dark); text-decoration: none; }
.mega-menu a.mega-link .mega-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px;
  background: var(--bg);
  font-size: 0.95rem;
}
.mega-menu .mega-cta {
  display: block;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  text-align: right;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border-strong);
  width: 40px; height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center; justify-content: center;
  margin-left: auto;
}
.menu-toggle svg { width: 22px; height: 22px; }

/* Mobile drawer */
.mobile-nav {
  display: none;
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 300;
  padding: 70px 20px 40px;
  overflow-y: auto;
}
.mobile-nav.open { display: block; }
.mobile-nav .close-btn {
  position: absolute; top: 14px; right: 14px;
  background: transparent; border: 1px solid var(--border-strong);
  width: 40px; height: 40px; border-radius: 8px;
  cursor: pointer;
  font-size: 1.4rem;
}
.mobile-nav .mn-cat {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-light); font-weight: 700;
  margin: 20px 0 8px;
}
.mobile-nav a {
  display: block; padding: 10px 12px;
  font-weight: 500; color: var(--text);
  border-radius: 8px;
}
.mobile-nav a:hover { background: var(--primary-50); text-decoration: none; }

@media (max-width: 880px) {
  .nav { display: none; }
  .menu-toggle { display: inline-flex; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  padding: 56px 0 40px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-50) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero h1 { margin-bottom: 14px; }
.hero p.lead {
  font-size: 1.15rem; color: var(--text-muted);
  max-width: 660px; margin: 0 auto 24px;
}
.hero .search-wrap {
  max-width: 540px; margin: 0 auto;
  position: relative;
}
.hero .search-wrap input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  font-size: 1rem; font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.hero .search-wrap input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
}
.hero .search-wrap::before {
  content: "🔍";
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 1rem;
}
.hero .search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px; overflow-y: auto;
  text-align: left;
  display: none;
  z-index: 50;
}
.hero .search-results.open { display: block; }
.hero .search-results a {
  display: block; padding: 10px 16px;
  color: var(--text); font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.hero .search-results a:last-child { border-bottom: 0; }
.hero .search-results a:hover { background: var(--primary-50); text-decoration: none; }
.hero .search-results .cat-tag {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-left: 8px;
}

.hero .badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  margin-top: 22px;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; font-size: 0.82rem;
  color: var(--text-muted); font-weight: 500;
}
.badge::before { content: "✓"; color: var(--primary); font-weight: 800; }

/* ==========================================================================
   Category Sections (Homepage)
   ========================================================================== */
.cat-section { margin: 48px 0; }
.cat-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
}
.cat-header .cat-icon {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px;
  font-size: 1.25rem;
  color: #fff;
}
.cat-header h2 { margin: 0; font-size: 1.5rem; }
.cat-header .view-all {
  margin-left: auto; font-weight: 600; font-size: 0.92rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.calc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
  text-decoration: none;
}
.calc-card .icon {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  font-size: 1.1rem;
  background: var(--bg); color: var(--text);
  margin-bottom: 10px;
}
.calc-card h3 { margin: 0 0 4px; font-size: 1.02rem; }
.calc-card p { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

/* Category accent left-border */
.calc-card[data-cat="finance"]  .icon { background: rgba(37,99,235,0.1);  color: var(--cat-finance); }
.calc-card[data-cat="health"]   .icon { background: rgba(16,185,129,0.1); color: var(--cat-health); }
.calc-card[data-cat="math"]     .icon { background: rgba(139,92,246,0.1); color: var(--cat-math); }
.calc-card[data-cat="convert"]  .icon { background: rgba(245,158,11,0.1); color: var(--cat-convert); }
.calc-card[data-cat="other"]    .icon { background: rgba(239,68,68,0.1);  color: var(--cat-other); }

.cat-icon.finance  { background: var(--cat-finance); }
.cat-icon.health   { background: var(--cat-health); }
.cat-icon.math     { background: var(--cat-math); }
.cat-icon.convert  { background: var(--cat-convert); }
.cat-icon.other    { background: var(--cat-other); }

/* ==========================================================================
   Calculator Page Layout
   ========================================================================== */
.calc-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding: 32px 0;
}
@media (min-width: 1000px) {
  .calc-page { grid-template-columns: minmax(0, 1fr) 320px; }
}
.calc-main { min-width: 0; }

.breadcrumb {
  font-size: 0.88rem; color: var(--text-muted); margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }

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

.calc-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.field .hint { font-size: 0.78rem; color: var(--text-muted); }
.field .input-wrap { position: relative; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.field .prefix, .field .suffix {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-weight: 500; pointer-events: none;
}
.field .prefix { left: 12px; }
.field .prefix + input { padding-left: 28px; }
.field .suffix { right: 12px; }

button.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: 0;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
  box-shadow: 0 4px 10px -2px rgba(37,99,235,0.4);
}
button.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
button.btn:active { transform: translateY(0); }
button.btn.secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}

/* Currency selector */
.ccy-row {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ccy-row label {
  font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
}
.ccy-row select {
  padding: 6px 10px;
  font-size: 0.92rem; font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* Results */
.results { margin-top: 28px; }
.result-headline {
  background: linear-gradient(135deg, var(--primary-50), #ecfeff);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.result-headline .label {
  font-size: 0.82rem; font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.result-headline .value {
  font-size: clamp(1.875rem, 5vw, 2.875rem);
  font-weight: 800; color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.result-headline .sub {
  margin-top: 8px; color: var(--text-muted); font-size: 0.95rem;
}

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.metric .label {
  font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600;
}
.metric .value {
  font-size: 1.2rem; font-weight: 700;
  margin-top: 4px; font-variant-numeric: tabular-nums;
}
.metric .value.positive { color: var(--positive); }
.metric .value.negative { color: var(--negative); }

/* Chart */
.chart-wrap {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
}
.chart-wrap h3, .chart-wrap .chart-title { margin-top: 0; }
/* .chart-title benimmt sich optisch wie h3, ist semantisch aber h2 (für a11y) */
.chart-title { font-size: 1.25rem; font-weight: 700; }
.chart-svg { width: 100%; height: 320px; }

/* Table */
.table-wrap { overflow-x: auto; margin-top: 16px; }
/* CLS-Fix: Tabellen, die per JS gefüllt werden, brauchen reservierten Platz
   damit <main> nicht erst beim Befüllen um hunderte Pixel wächst.
   Die Werte entsprechen ungefähr der gefüllten Höhe (thead ~34px + N×36px Zeilen)
   plus etwas Puffer. min-height bleibt aktiv — falls weniger Zeilen drin sind,
   ist unten etwas Leerraum, aber NULL Layout-Shift. */
.table-wrap.reserve-amort  { min-height: 1120px; }  /* 30 Jahre = 30 Zeilen */
.table-wrap.reserve-amort-short { min-height: 580px; }  /* 15 Jahre */
.table-wrap.reserve-15rows { min-height: 580px; }
.table-wrap.reserve-10rows { min-height: 400px; }
table.data {
  width: 100%; border-collapse: collapse;
  font-size: 0.92rem; font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  padding: 10px 12px; text-align: right;
  border-bottom: 1px solid var(--border);
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  background: var(--bg); font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-strong);
}
table.data tbody tr:hover { background: #f8fafc; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 1000px) {
  .sidebar { position: sticky; top: 84px; align-self: flex-start; }
}
.sidebar h4 {
  margin: 0 0 12px; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted);
}
.related-list { list-style: none; padding: 0; margin: 0; }
.related-list li { margin-bottom: 8px; }
.related-list a {
  display: block; padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-weight: 500;
  color: var(--text); font-size: 0.92rem;
}
.related-list a:hover { border-color: var(--primary); background: var(--primary-50); text-decoration: none; }

/* AdSense slots */
/* ---- CLS-Prevention: reserve space for dynamically-injected blocks ----
   Header, footer, categories list and ad slots are rendered/filled after JS
   loads. Without reserved heights the page reflows and CLS goes to 1.0+.
   These min-heights match the final rendered size on each breakpoint.
   Goal: keep CLS below 0.10 (Google's "Good" threshold). */

#site-shell-header {
  min-height: 66px;
  display: block;
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid var(--border);
}
#site-shell-footer {
  min-height: 580px;
  display: block;
  background: #0f172a;        /* match footer bg so reservation looks intentional */
}
@media (min-width: 760px) {
  #site-shell-footer { min-height: 440px; }
}

/* Homepage categories list — 5 sections with grids of calc cards.
   Reserve enough so the SEO content below doesn't jump when JS fills it,
   but not so much that Lighthouse over-counts layout work.
   Tuned for current 52-calc inventory; revise if catalog grows significantly. */
#categories-list { min-height: 3000px; }
@media (min-width: 640px)  { #categories-list { min-height: 2400px; } }
@media (min-width: 980px)  { #categories-list { min-height: 2000px; } }
@media (min-width: 1240px) { #categories-list { min-height: 1800px; } }
/* Once the list is filled (has child elements), drop the reservation */
#categories-list:not(:empty) { min-height: 0; }

/* Calculator pages: hidden results area shouldn't reserve space */
.results[hidden] { display: none !important; }

/* Hero h1 — prevents font-swap shift on first paint */
.hero h1 { min-height: 1.25em; }
.hero p.lead { min-height: 1.5em; }

/* Ad slots: CLS-safe Defaults
   ──────────────────────────────────────────────────────────────────────────
   • Per Default `display:none` → kein reservierter Platz, kein Flash, kein CLS
     wenn AdSense (noch) nicht freigeschaltet ist.
   • `body.ads-on` (gesetzt von shell.js wenn ADSENSE_ENABLED=true) reserviert
     den Platz mit min-height aber OHNE sichtbare Box → Ads füllen ein,
     keine Layout-Sprünge.
   • `body.ads-dev` (gesetzt von shell.js bei file://) zeigt die gestrichelte
     Box als Dev-Vorschau. */
.ad-slot { display: none; }

body.ads-on .ad-slot,
body.ads-dev .ad-slot {
  margin: 32px auto;
  text-align: center;
  min-height: 100px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase;
}

/* Nur Dev-Vorschau hat sichtbare gestrichelte Box + Text */
body.ads-dev .ad-slot {
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 10px, #f8fafc 10px, #f8fafc 20px);
  border: 1px dashed var(--border-strong);
  color: var(--text-light);
}
/* Production-Modus: Platz reserviert aber visuell unsichtbar bis Ad geladen */
body.ads-on .ad-slot {
  color: transparent;
}

body.ads-on .ad-slot.in-content,
body.ads-dev .ad-slot.in-content { min-height: 280px; }
body.ads-on .ad-slot.sidebar-ad,
body.ads-dev .ad-slot.sidebar-ad { min-height: 600px; width: 300px; }

@media (min-width: 760px) {
  body.ads-on .ad-slot,
  body.ads-dev .ad-slot { min-height: 100px; }
}
@media (min-width: 1000px) {
  body.ads-on .ad-slot,
  body.ads-dev .ad-slot { min-height: 120px; }
  body.ads-on .ad-slot.in-content,
  body.ads-dev .ad-slot.in-content { min-height: 300px; }
}

/* When AdSense fills the slot, the <ins class="adsbygoogle"> takes over
   sizing. Keep the slot wrapper from collapsing while ads load. */
.ad-slot ins.adsbygoogle { display: block; min-height: inherit; }

/* SEO content */
.seo-content {
  margin-top: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.seo-content h2:first-child { margin-top: 0; }
.seo-content ul, .seo-content ol { padding-left: 1.2em; }
.seo-content li { margin-bottom: 6px; }
.seo-content .faq-item { border-top: 1px solid var(--border); padding: 16px 0; }
.seo-content .faq-item:first-of-type { border-top: 0; }
.seo-content .faq-item h3 { margin: 0 0 6px; font-size: 1.05rem; }

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.tabs button {
  flex: 1; background: transparent; border: 0;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 600; font-size: 0.9rem;
  color: var(--text-muted); cursor: pointer;
  font-family: inherit;
}
.tabs button.active {
  background: #fff; color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Convert UI */
.convert-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}
@media (max-width: 600px) { .convert-row { grid-template-columns: 1fr; } .convert-swap { transform: rotate(90deg); justify-self: center; } }
.convert-swap {
  background: var(--bg); border: 1px solid var(--border-strong);
  width: 44px; height: 44px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.convert-swap:hover { background: var(--primary-50); border-color: var(--primary); }

/* Pill / chip */
.pill {
  display: inline-flex; align-items: center;
  background: var(--primary-50); color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  padding: 3px 10px;
}

/* ==========================================================================
   SEO content extras — case studies, callouts, mistake boxes
   ========================================================================== */
.case-study {
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 22px 0;
}
.case-study .label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-dark);
  background: #fff;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.case-study h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--primary-dark);
}
.case-study p:last-child { margin-bottom: 0; }
.case-study strong { color: var(--text); }

.callout {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 18px 0;
}
.callout.warn { background: #fef2f2; border-color: #fecaca; border-left-color: var(--negative); }
.callout.success { background: #f0fdf4; border-color: #bbf7d0; border-left-color: var(--positive); }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }

.seo-content table.compare {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.93rem;
}
.seo-content table.compare th,
.seo-content table.compare td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.seo-content table.compare thead th {
  background: var(--bg);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.seo-content table.compare tbody tr:hover { background: #f8fafc; }
.seo-content table.compare .num { text-align: right; font-variant-numeric: tabular-nums; }
/* WCAG AA: bedarf 4.5:1 Kontrast für Text — die Default-Variablen sind dafür zu hell */
.seo-content table.compare .good { color: #047857; font-weight: 700; }
.seo-content table.compare .bad { color: #b91c1c; font-weight: 700; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: linear-gradient(180deg, #0f172a 0%, #060b18 100%);
  color: #cbd5e1;
  padding: 56px 0 24px;
  margin-top: 80px;
}
.site-footer .container { display: block; }

/* --- Tier 1: brand --- */
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 32px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 32px;
}
@media (min-width: 760px) {
  .footer-brand {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
  }
}
.footer-brand-main { max-width: 540px; }
.footer-brand-main .logo { font-size: 1.5rem; }
.footer-brand-main .logo .logo-icon { width: 38px; height: 38px; font-size: 1.05rem; }
.footer-brand-main p {
  margin: 12px 0 0;
  color: #94a3b8;
  font-size: 0.95rem;
  line-height: 1.55;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: flex-start;
  flex-shrink: 0;
}
.footer-nav a {
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #1e293b;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.footer-nav a:hover {
  background: #1e293b;
  color: #fff;
  border-color: #334155;
  text-decoration: none;
}

/* --- Tier 2: 5 calculator columns side-by-side --- */
.footer-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-bottom: 32px;
}
@media (min-width: 640px) {
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 980px) {
  .footer-cols { grid-template-columns: repeat(5, 1fr); }
}
.footer-col h4 {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-col-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  font-size: 0.9rem;
  background: #1e293b;
}
.footer-col-icon.finance  { background: rgba(37,99,235,0.18);  color: #60a5fa; }
.footer-col-icon.health   { background: rgba(16,185,129,0.18); color: #34d399; }
.footer-col-icon.math     { background: rgba(139,92,246,0.18); color: #a78bfa; }
.footer-col-icon.convert  { background: rgba(245,158,11,0.18); color: #fbbf24; }
.footer-col-icon.other    { background: rgba(239,68,68,0.18);  color: #f87171; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 0; }
.footer-col a {
  display: block;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 4px 0;
  text-decoration: none;
  transition: color 0.12s, padding-left 0.12s;
}
.footer-col a:hover {
  color: #fff;
  padding-left: 4px;
  text-decoration: none;
}
.footer-col a.view-all {
  margin-top: 4px;
  color: #60a5fa;
  font-weight: 600;
}
.footer-col a.view-all:hover { color: #93c5fd; }

/* --- Tier 3: disclaimer --- */
.footer-disclaimer {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 24px;
}
.footer-disclaimer-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  color: #fbbf24;
  font-size: 0.95rem;
}
.footer-disclaimer-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.18);
  font-weight: 700;
  font-size: 0.85rem;
  font-style: normal;
}
.footer-disclaimer p {
  margin: 0 0 10px;
  color: #cbd5e1;
  font-size: 0.85rem;
  line-height: 1.6;
}
.footer-disclaimer p:last-child { margin-bottom: 0; }
.footer-disclaimer em { color: #fde68a; font-style: normal; font-weight: 600; }
.footer-disclaimer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 0.82rem !important;
  padding-top: 10px;
  border-top: 1px solid rgba(245, 158, 11, 0.16);
}
.footer-disclaimer-links a {
  color: #fbbf24;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.12s;
}
.footer-disclaimer-links a:hover { color: #fcd34d; text-decoration: underline; }
.footer-disclaimer-links span { color: #475569; }

/* --- Tier 4: legal copyright line --- */
.footer-legal {
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
  padding-top: 18px;
  border-top: 1px solid #1e293b;
}
.footer-legal strong { color: #cbd5e1; font-weight: 700; }

/* ==========================================================================
   Utilities
   ========================================================================== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: 32px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow { flex-grow: 1; }
.row-actions {
  margin-top: 20px;
  display: flex; gap: 10px; flex-wrap: wrap;
}

/* Article (about, privacy) */
.article {
  max-width: var(--content-width);
  margin: 40px auto; padding: 0 20px;
}
.article p, .article li { color: var(--text); }
.article h2 { margin-top: 2em; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--primary); color: #fff;
  padding: 10px 16px; z-index: 1000;
}
.skip-link:focus { left: 12px; top: 12px; }

/* Result note */
.result-note {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #78350f;
}


/* ==========================================================================
   Guides (long-form article pages)
   ========================================================================== */
.guide-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding: 32px 0;
}
@media (min-width: 1000px) {
  .guide-page { grid-template-columns: minmax(0, 1fr) 320px; }
}

.guide-article { min-width: 0; max-width: 760px; }

.guide-header { margin-bottom: 24px; }
.guide-header h1 {
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
  line-height: 1.15;
  margin: 12px 0 6px;
}

/* CTA box: jump to the calculator */
.guide-cta {
  display: flex; align-items: center; gap: 16px;
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 24px 0 28px;
}
.guide-cta-icon { font-size: 2rem; line-height: 1; flex-shrink: 0; }
.guide-cta-text { flex: 1; min-width: 0; }
.guide-cta-text strong { font-size: 1.05rem; color: var(--text); }
.guide-cta-text p { margin: 4px 0 0; }
.guide-cta .btn { flex-shrink: 0; }
.guide-cta-bottom { margin: 32px 0; }
@media (max-width: 600px) {
  .guide-cta { flex-direction: column; align-items: flex-start; }
  .guide-cta .btn { width: 100%; text-align: center; }
}

/* Long-form article body — generous typography */
.guide-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
}
.guide-body h2 {
  font-size: 1.5rem;
  margin: 48px 0 16px;
  scroll-margin-top: 80px;  /* anchor jumps clear the sticky header */
}
.guide-body h2:first-of-type { margin-top: 8px; }
.guide-body h3 {
  font-size: 1.18rem;
  margin: 32px 0 12px;
}
.guide-body p { margin: 0 0 18px; }
.guide-body ul, .guide-body ol {
  margin: 0 0 20px;
  padding-left: 26px;
}
.guide-body li { margin-bottom: 8px; }
.guide-body blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-50);
  margin: 24px 0;
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
.guide-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.96rem;
}
.guide-body table th,
.guide-body table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.guide-body table thead th {
  background: var(--bg);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.guide-body .faq-item {
  border-top: 1px solid var(--border);
  padding: 18px 0;
}
.guide-body .faq-item h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}
.guide-body .faq-item p { margin: 0; }

/* Cross-link footer on calculator pages → guide */
.calc-to-guide-link {
  margin: 24px 0;
  padding: 16px 18px;
  background: linear-gradient(135deg, #faf5ff, #f0f9ff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}
.calc-to-guide-link:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.calc-to-guide-link .icon { font-size: 1.7rem; flex-shrink: 0; }
.calc-to-guide-link .text { flex: 1; }
.calc-to-guide-link .text strong { display: block; font-size: 1rem; color: var(--text); }
.calc-to-guide-link .text small { color: var(--text-muted); font-size: 0.88rem; }
.calc-to-guide-link .arrow { color: var(--primary); font-weight: 800; }


/* ==========================================================================
   Mobile Spacing Refinements (≤640px)
   Tighten container padding, reduce internal card padding, scale typography
   so the calculator and content feel comfortable on phones.
   ========================================================================== */
@media (max-width: 640px) {
  .container { padding: 0 40px; }
  /* Extra left/right breathing room for the title area on calc and guide pages.
     The card has its own padding inside, but breadcrumb/H1/lead sit on the page
     background and need their own room. */
  .calc-main > .breadcrumb,
  .calc-main > h1,
  .calc-main > p.text-muted,
  .guide-article > .breadcrumb,
  .guide-article > .guide-header { padding-left: 4px; padding-right: 4px; }

  /* Hero on mobile: less vertical, smaller heading */
  .hero { padding-top: 24px; padding-bottom: 20px; }
  .hero h1 { font-size: clamp(1.65rem, 7vw, 2rem); }
  .hero .lead { font-size: 1rem; }
  .hero .badges { gap: 6px; }
  .hero .badge { font-size: 0.75rem; padding: 4px 10px; }

  /* Calc page: less vertical breathing */
  .calc-page { padding: 20px 0; gap: 24px; }

  /* Calc card: tighter padding */
  .calc-box { padding: 18px; border-radius: 12px; }

  /* Calc inputs: tighter gap */
  .calc-inputs { gap: 14px; }

  /* H1/H2 sizes on calc and guide pages */
  h1 { font-size: clamp(1.5rem, 6vw, 1.875rem); }
  .calc-main h1 { font-size: clamp(1.5rem, 6.5vw, 1.875rem); }

  /* Guide article: tighter padding on the article shell */
  .guide-page { padding: 20px 0; gap: 24px; }
  .guide-article { padding: 0 2px; }
  .guide-cta { padding: 14px 16px; gap: 12px; }
  .guide-cta-icon { font-size: 1.6rem; }
  .guide-body { font-size: 1rem; line-height: 1.7; }
  .guide-body h2 { font-size: 1.3rem; margin: 32px 0 12px; }
  .guide-body h3 { font-size: 1.08rem; margin: 24px 0 10px; }
  .guide-body table { font-size: 0.88rem; }
  .guide-body table th, .guide-body table td { padding: 8px 10px; }

  /* Breadcrumb breathing room */
  .breadcrumb { font-size: 0.82rem; margin-bottom: 6px; }

  /* Footer columns: collapse to single column with tighter padding */
  .footer-cols { grid-template-columns: 1fr 1fr !important; gap: 18px; }
  .footer-disclaimer { padding: 18px; }

  /* Tables in seo-content: smaller text, less padding */
  .seo-content table.compare th,
  .seo-content table.compare td { padding: 8px 10px; font-size: 0.88rem; }

  /* Result headlines: smaller "$2547.62" so it doesn't overflow */
  .result-headline .value { font-size: clamp(1.5rem, 8vw, 2.2rem); }
}

/* Even tighter at very small phones (≤380px) */
@media (max-width: 380px) {
  .container { padding: 0 28px; }
  .calc-box { padding: 14px; }
  .hero h1 { font-size: 1.5rem; }
}
