/* ==========================================================================
   Base: Reset, Typografie, Buttons, Header, Footer, Utilities
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4 {
  margin: 0 0 var(--sp-4);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: -0.022em;
  color: var(--c-ink);
  text-wrap: balance;
}
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); letter-spacing: -0.015em; }
h4 { font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: -0.01em; }

/* Auf schmalen Schirmen Silbentrennung erlauben.
   Deutsche Komposita sind das Problem: "Krankenversicherung" ist in der
   Hero-Größe rund 400 px breit und passt auf kein Handy. <html lang="de">
   ist gesetzt, der Browser trennt also nach deutschen Regeln.
   break-word als Netz, falls die Trennung nicht greift. */
@media (max-width: 620px) {
  h1, h2, h3, .slide__title, .starter__title {
    hyphens: auto;
    overflow-wrap: break-word;
  }
}

p  { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

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

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25em; }
li + li { margin-top: var(--sp-2); }

hr { border: 0; border-top: 1px solid var(--c-line); margin: var(--sp-7) 0; }

:focus-visible {
  outline: 3px solid var(--c-brand-light);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--c-ink); color: #fff; padding: 12px 20px;
  border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

/* --- Layout ---------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--slim { max-width: var(--container-slim); }

.section        { padding-block: var(--sp-9); }
.section--tight { padding-block: var(--sp-8); }
.section--soft  { background: var(--c-surface-soft); }
.section--tint  { background: var(--c-brand-tint); }
.section--ink   { background: var(--c-ink); color: rgba(255,255,255,.86); }
.section--ink h2, .section--ink h3, .section--ink h4 { color: #fff; }

.stack > * + * { margin-top: var(--sp-4); }

.section-head { max-width: 720px; margin-bottom: var(--sp-7); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head p { font-size: var(--fs-md); color: var(--c-text-muted); margin: 0; }
.section--ink .section-head p { color: rgba(255,255,255,.78); }

.eyebrow {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--c-brand);
  margin-bottom: var(--sp-3);
}
.section--ink .eyebrow { color: var(--c-cta); }

.lead { font-size: var(--fs-md); color: var(--c-ink-3); }

/* --- Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 15px 28px;
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}

.btn--cta {
  background: var(--c-cta);
  color: var(--c-cta-text);
  border-color: var(--c-cta);
}
.btn--cta:hover  { background: var(--c-cta-hover); border-color: var(--c-cta-hover); }
.btn--cta:active { background: var(--c-cta-active); border-color: var(--c-cta-active); }

.btn--brand {
  background: var(--c-brand);
  color: #fff;
  border-color: var(--c-brand);
}
.btn--brand:hover { background: var(--c-brand-dark); border-color: var(--c-brand-dark); }

.btn--ghost {
  background: transparent;
  color: var(--c-ink);
  /* Rahmen folgt der Textfarbe. Wird die Farbe für einen dunklen Bereich
     überschrieben, zieht der Rahmen automatisch mit — sonst bleibt ein
     unsichtbarer Rahmen stehen, wenn jemand nur die Schriftfarbe anpasst. */
  border-color: currentColor;
}
.btn--ghost:hover { background: var(--c-ink); color: #fff; }

/* --- Ghost-Button auf dunklem Grund -----------------------------------------
   Diese Aufzählung ist die Stolperstelle: Kommt ein neuer dunkler Bereich
   dazu, muss er hier ergänzt werden. Sonst steht dort ein Button in Ink auf
   Ink — technisch vorhanden, praktisch unsichtbar. Genau das war im
   Tippgeber-Band der Fall, weil .affiliate kein .section--ink ist.
   -------------------------------------------------------------------------- */
.section--ink .btn--ghost,
.affiliate    .btn--ghost,
.site-footer  .btn--ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, .55);
}
.section--ink .btn--ghost:hover,
.affiliate    .btn--ghost:hover,
.site-footer  .btn--ghost:hover {
  background: #fff;
  color: var(--c-ink);
  border-color: #fff;
}

.btn--quiet {
  background: var(--c-surface-soft);
  color: var(--c-ink);
  border-color: var(--c-surface-soft);
}
.btn--quiet:hover { background: var(--c-surface-soft-2); border-color: var(--c-surface-soft-2); }

.btn--lg { padding: 18px 36px; font-size: var(--fs-md); }
.btn--sm { padding: 10px 18px; font-size: var(--fs-sm); }
.btn--block { width: 100%; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.btn-row--center { justify-content: center; }

/* --- Cards ------------------------------------------------------------------ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}
.card--soft   { background: var(--c-surface-soft); border-color: transparent; }
.card--raised { border-color: transparent; box-shadow: var(--sh-2); }
.card h3 { margin-bottom: var(--sp-2); }
.card p  { color: var(--c-text-muted); font-size: var(--fs-sm); }

.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* --- Badges / Pills ---------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  background: var(--c-brand-tint);
  color: var(--c-brand-dark);
}
.badge--cta     { background: var(--c-cta-tint);     color: #7A5200; }
.badge--success { background: var(--c-success-tint); color: #076034; }
.badge--danger  { background: var(--c-danger-tint);  color: #8E241D; }

/* --- Topbar / Header ---------------------------------------------------------- */
.topbar {
  background: linear-gradient(90deg, var(--c-brand-dark), var(--c-ink));
  color: #fff;
  font-size: var(--fs-sm);
  min-height: var(--topbar-h);
  display: flex; align-items: center;
}
.topbar .container { display: flex; align-items: center; gap: var(--sp-4); justify-content: space-between; }
.topbar a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.topbar__note { display: flex; align-items: center; gap: var(--sp-2); font-weight: var(--fw-semi); }
.topbar__meta { display: flex; align-items: center; gap: var(--sp-4); white-space: nowrap; }
@media (max-width: 760px) { .topbar__meta { display: none; } }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-line);
}
.site-header .container {
  display: flex; align-items: center; gap: var(--sp-5);
  min-height: var(--header-h);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: var(--fw-black); font-size: var(--fs-lg);
  color: var(--c-ink); letter-spacing: -0.02em; text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--c-brand-light), var(--c-brand-dark));
  display: grid; place-items: center;
  color: #fff;
}
.brand__mark svg { width: 20px; height: 20px; }

.site-nav { display: flex; align-items: center; gap: var(--sp-5); margin-left: auto; }
.site-nav a {
  color: var(--c-ink); font-size: var(--fs-sm); font-weight: var(--fw-semi);
  text-decoration: none; padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--c-brand); text-decoration: none; }
.site-header__actions { display: flex; align-items: center; gap: var(--sp-3); }
@media (max-width: 1024px) { .site-nav { display: none; } }
@media (max-width: 520px)  { .site-header__actions .btn--ghost { display: none; } }

/* Auf schmalen Schirmen bricht ein längerer Markenname am Bindestrich um
   ("Die PKV-" / "Vergleicher") und zieht den Header in die Höhe. Das liest
   sich wie ein Fehler. Deshalb hier eine Nummer kleiner und nicht umbrechen —
   lieber knapp als zweizeilig. */
@media (max-width: 560px) {
  .brand {
    font-size: 1.0625rem;
    white-space: nowrap;
    gap: 8px;
  }
  .brand__mark {
    width: 30px; height: 30px; flex-basis: 30px;
    border-radius: 9px;
  }
  .site-header__actions .btn--cta {
    font-size: var(--fs-xs);
    padding: 10px 16px;
    white-space: nowrap;
  }
  .site-header .container { gap: var(--sp-3); min-height: 60px; }
}

/* --- Footer -------------------------------------------------------------------- */
.site-footer {
  background: var(--c-ink);
  color: rgba(255,255,255,.72);
  padding-block: var(--sp-8) var(--sp-5);
  font-size: var(--fs-sm);
}
.site-footer a { color: rgba(255,255,255,.86); }
.site-footer h4 { color: #fff; font-size: var(--fs-sm); letter-spacing: .06em; text-transform: uppercase; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: var(--sp-2); }
.footer-grid {
  display: grid; gap: var(--sp-6);
  grid-template-columns: 1.4fr repeat(3, 1fr);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid rgba(255,255,255,.14);
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  justify-content: space-between; align-items: center;
  padding-top: var(--sp-5);
  font-size: var(--fs-xs); color: rgba(255,255,255,.55);
}
.footer-legal { display: flex; flex-wrap: wrap; gap: var(--sp-4); }

/* --- Formular-Basis --------------------------------------------------------------- */
.field { display: block; margin-bottom: var(--sp-4); }
.field__label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-ink);
}
.field__hint { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--c-text-muted); }
.field__error { display: block; margin-top: 6px; font-size: var(--fs-xs); color: var(--c-danger); font-weight: var(--fw-semi); }

.input, .select, .textarea {
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--c-ink);
  background: var(--c-surface);
  border: 2px solid var(--c-line-strong);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-brand-light); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: var(--sh-focus);
}
.input[aria-invalid="true"] { border-color: var(--c-danger); }
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; padding-right: 44px; }

.field-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.checkline { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); }
.checkline input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--c-brand); }

.alert {
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border-left: 4px solid var(--c-brand);
  background: var(--c-brand-tint);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-5);
}
.alert--error   { background: var(--c-danger-tint);  border-left-color: var(--c-danger); }
.alert--success { background: var(--c-success-tint); border-left-color: var(--c-success); }

/* --- Utilities --------------------------------------------------------------------- */
.u-center      { text-align: center; }
.u-muted       { color: var(--c-text-muted); }
.u-small       { font-size: var(--fs-sm); }
.u-xs          { font-size: var(--fs-xs); }
.u-bold        { font-weight: var(--fw-bold); }
.u-nowrap      { white-space: nowrap; }
.u-mt-0        { margin-top: 0; }
.u-mb-0        { margin-bottom: 0; }
.u-hidden      { display: none !important; }
.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;
}
