/* ============================================================
   PREMIUM-POLISH RUN 3 — 2026-05-12
   Score-Target: 9.5+ (Apple/Stripe-Niveau)
   ============================================================
   Fixes:
   - Hero-Höhen mit clamp() (statt 100vh → 369-1202px Range)
   - Form-Focus-Glow (Stripe-Standard)
   - Touch-Targets ≥44px (Mobile-First)
   - Premium-Iconography (SVG-Helper)
   - Spezifische transitions statt "all"
   - Hero-Visuals für textlastige Seiten
   ============================================================ */

/* -----------------------------------------------------------
   1) HERO-HEIGHTS NORMALISIEREN
   ----------------------------------------------------------- */
.hero,
section.hero,
[class*="hero-section"],
.wow-hero,
.hero-diet,
.wow-hero.hero-diet {
  min-height: clamp(560px, 88vh, 820px) !important;
  max-height: 100vh;
}

/* Foerderung-Page: kein full-screen Hero nötig */
.hero-h1-fix {
  margin-top: clamp(2rem, 6vw, 4rem) !important;
}

/* Mobile: kompakter */
@media (max-width: 768px) {
  .hero,
  section.hero,
  [class*="hero-section"],
  .wow-hero,
  .hero-diet {
    min-height: clamp(480px, 72vh, 680px) !important;
    padding-top: clamp(4rem, 10vw, 6rem) !important;
  }
}

/* -----------------------------------------------------------
   2) FORM-FOCUS-GLOW (Stripe-Standard)
   ----------------------------------------------------------- */
input,
textarea,
select {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
  outline: 2px solid #0EA5E9 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15) !important;
  border-color: #0EA5E9 !important;
}

/* Buttons: dezenter Focus-Ring */
button:focus-visible,
a.btn:focus-visible,
.cta:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #0EA5E9 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18) !important;
}

/* Invalid-State */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
  border-color: #EF4444 !important;
}
input:invalid:not(:placeholder-shown):focus,
textarea:invalid:not(:placeholder-shown):focus {
  outline-color: #EF4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15) !important;
}

/* -----------------------------------------------------------
   3) TOUCH-TARGETS ≥44px (WCAG/iOS HIG)
   ----------------------------------------------------------- */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  /* Generelle Mindestgröße für interaktive Elemente */
  a,
  button,
  input[type="button"],
  input[type="submit"],
  input[type="checkbox"] + label,
  input[type="radio"] + label,
  [role="button"],
  [role="link"],
  .btn,
  .cta,
  .nav-link,
  .footer-link,
  .chip,
  .tab,
  .toggle {
    min-height: 44px;
  }

  /* Inline-Links im Fließtext: Touch-Padding ohne Layout-Bruch */
  p a:not(.btn):not(.cta),
  li a:not(.btn):not(.cta),
  .text-content a:not(.btn):not(.cta) {
    padding: 6px 2px;
    margin: -6px -2px;
  }

  /* Icon-only Buttons */
  button:has(svg:only-child),
  a:has(svg:only-child),
  .icon-btn,
  .close-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Footer/Header-Links spezieller Fix */
  body footer a,
  body .footer a,
  body .footer-links a,
  body .breadcrumb a,
  body .cc-text a,
  body .feature-link,
  html body a.feature-link {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 10px 8px !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
  }

  /* Breadcrumb + inline-list links: höhere Spezifität für !important Wirkung */
  body ul li > a:not(.btn):not(.cta):not(.nav-cta),
  body .links-list a,
  body .link-list a {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 8px 6px !important;
    line-height: 1.4 !important;
  }

  /* App.html spezifische Footer-Liste (display:block bei <a>) */
  body footer a,
  body .footer a,
  body .footer-content a {
    min-height: 44px !important;
    padding-block: 12px !important;
  }

  /* Bottom-CTA Footer Phone/Mail */
  body a[href^="tel:"],
  body a[href^="mailto:"] {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 10px 8px !important;
  }
}

/* -----------------------------------------------------------
   3b) TOUCH-TARGETS — HIGH-SPECIFICITY FORCE-OVERRIDE
   Diese Regeln stehen außerhalb des @media-Blocks, weil sie
   gegen sehr spezifische andere Regeln (.footer-links > a etc.)
   konkurrieren müssen. Sie greifen nur Mobile.
   ----------------------------------------------------------- */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
  /* feature-link (App.html "Solar-Planer →") */
  html body a.feature-link,
  html body .feature-card .feature-link {
    min-height: 44px !important;
    padding: 12px 8px !important;
    display: inline-flex !important;
  }

  /* App.html CTA-Section block-Links ("Startseite/Blog/FAQ") */
  html body section.cta-section a,
  html body .cta-section a,
  html body .cta-section .fade-up a {
    min-height: 44px !important;
    padding: 12px 8px !important;
    display: inline-block !important;
    line-height: 1.5 !important;
  }

  /* Footer-Links Grid */
  html body .footer-links a,
  html body .footer-grid a,
  html body .footer-content a,
  html body footer .footer-links > a,
  html body footer .footer-grid > div > .footer-links > a {
    min-height: 44px !important;
    padding: 12px 6px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Form-Konsent-Links */
  html body label a,
  html body .lead-form-consent a,
  html body form label a {
    min-height: 44px !important;
    padding: 10px 4px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Cookie-Consent (.cc-text a) */
  html body .cc-text a,
  html body .cc-card a {
    min-height: 44px !important;
    padding: 12px 6px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Address-Block Phone/Mail (footer-brand) */
  html body address a,
  html body .footer-brand address a {
    min-height: 44px !important;
    padding: 12px 4px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Breadcrumb-Start */
  html body .breadcrumb a,
  html body nav.breadcrumb a {
    min-height: 44px !important;
    padding: 10px 8px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Inline-Links (Enpal-alt etc.) — generischer Fallback */
  html body p > a:not(.btn):not(.cta):not(.nav-cta):not([class]),
  html body div > a:not(.btn):not(.cta):not(.nav-cta):not(.feature-link):not([class]) {
    min-height: 44px !important;
    padding: 10px 4px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* FINAL FALLBACK — höchste Priorität für die kniffligen Fälle */
  /* nav-phone-icon */
  html body nav .nav-phone-icon,
  html body .nav-right .nav-phone-icon {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 12px 14px !important;
  }

  /* Breadcrumb Start-Link */
  html body nav.breadcrumb a,
  html body .breadcrumb.fade-up a {
    min-height: 44px !important;
    padding: 12px 8px !important;
  }

  /* OL/UL Listen-Links (Enpal-alt FAQ-Listen) */
  html body ol > li > a,
  html body main ol > li > a,
  html body main ul > li > a {
    min-height: 44px !important;
    padding: 12px 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1.4 !important;
  }

  /* Datenschutz-Link in Konsent */
  html body label.lead-form-consent a,
  html body .lead-form-consent span a,
  html body form label span a {
    min-height: 48px !important;
    padding: 14px 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1.4 !important;
  }

  /* Footer-Brand-Address Phone/Mail */
  html body .footer-brand address a,
  html body .footer-brand a[href^="tel:"],
  html body .footer-brand a[href^="mailto:"],
  html body div.footer-brand address a {
    min-height: 48px !important;
    padding: 14px 4px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* WhatsApp Floating-Button */
  html body a.wa-float,
  html body .wa-float {
    width: 56px !important;
    height: 56px !important;
    min-height: 56px !important;
    min-width: 56px !important;
    padding: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Nav-phone-icon (square button) */
  .nav-phone-icon,
  a.nav-phone-icon {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  /* Chips/Tags */
  .chip,
  .tag,
  .filter-pill,
  [class*="-chip"],
  [class*="-tag"] {
    min-height: 36px;
    padding: 10px 14px !important;
  }

  /* Tab-Bars (app.html) */
  .tab-item,
  .tabbar-item,
  [class*="tab-button"] {
    min-height: 48px !important;
    padding: 10px 12px !important;
  }
}

/* -----------------------------------------------------------
   4) PREMIUM ICONOGRAPHY HELPERS (Lucide-Stil)
   ----------------------------------------------------------- */
.ic {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ic-sm { width: 14px; height: 14px; }
.ic-md { width: 18px; height: 18px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 28px; height: 28px; }

/* Farbvarianten */
.ic-success { color: #10B981; }
.ic-warning { color: #F59E0B; }
.ic-danger  { color: #EF4444; }
.ic-info    { color: #0EA5E9; }
.ic-muted   { color: #94A3B8; }

/* -----------------------------------------------------------
   5) HERO-VISUALS für textlastige Seiten
   Wichtig: nur figure.hero-visual ansprechen, NICHT aside.hero-visual
   (index.html nutzt aside.hero-visual für Lisa-Promo)
   ----------------------------------------------------------- */
figure.hero-visual {
  position: relative;
  width: 100%;
  max-height: clamp(220px, 38vh, 420px);
  overflow: hidden;
  border-radius: 18px;
  margin: clamp(1.5rem, 4vw, 2.5rem) auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
figure.hero-visual img,
figure.hero-visual picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 16 / 9;
}
figure.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
  border-radius: inherit;
}
@media (max-width: 768px) {
  figure.hero-visual {
    border-radius: 14px;
    max-height: 50vh;
  }
  figure.hero-visual img {
    aspect-ratio: 4 / 3;
  }
}

/* -----------------------------------------------------------
   6) TRANSITION-FIXES (vermeide "all")
   ----------------------------------------------------------- */
/* Override generischer .btn/.cta transitions */
.btn,
.cta,
.hero-cta,
button,
a[class*="btn"],
a[class*="cta"] {
  transition:
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease !important;
}

/* Cards/Tiles */
.card,
.tile,
.feature-card,
[class*="card-"],
[class*="-card"] {
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s ease,
    border-color 0.25s ease !important;
}

/* Links generell */
a {
  transition:
    color 0.15s ease,
    opacity 0.15s ease,
    text-decoration-color 0.15s ease;
}

/* -----------------------------------------------------------
   7) PREMIUM-MICRO-DETAILS
   ----------------------------------------------------------- */
/* Smooth-Scroll global (falls nicht schon gesetzt) */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Bessere Selection-Farbe */
::selection {
  background: rgba(14, 165, 233, 0.3);
  color: #0F172A;
}

/* Scroll-Bar Premium (Webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

/* Bessere Image-Defaults */
img {
  max-width: 100%;
  height: auto;
}

/* -----------------------------------------------------------
   8) Reduce Motion Respect
   ----------------------------------------------------------- */
@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;
  }
}
