/* ─────────────────────────────────────────────────────────────────────────
 * HandwerkEasy · Header + Footer (Pflicht-Pattern, Session 9)
 *
 * Single-Source-of-Truth für Header (Logo, Nav, Login-Icon, Buchen-CTA)
 * und Footer (Brand, Kontakt, Service-Links, Standorte, Rechtliches).
 * Wird auf JEDER Seite eingebunden — Homepage UND alle Service-Seiten.
 *
 * Hex-Werte bewusst hardcoded (statt CSS-Variable), damit der Block
 * portable ist und nicht von der jeweiligen Page-CSS abhängt.
 *
 * Bei Änderung an Kontaktdaten (Telefon, E-Mail, Adresse): zuerst
 * data/contact.json updaten, dann ALLE HTML-Files anpassen.
 * ───────────────────────────────────────────────────────────────────────── */


/* ── Overflow-Guard (S16) ────────────────────────────────────────────────────
   Verhindert horizontalen Overflow — wird auch von Pages ohne base.css genutzt
   (agb, datenschutz, impressum, widerruf, login, barrierefrei).
   `clip` statt `hidden` lässt position:sticky in Kindern funktional. */
html, body {
  max-width: 100%;
  overflow-x: clip;
}
body {
  overflow-wrap: break-word;
}

/* ── HEADER / NAV ─────────────────────────────────────────────────────────── */

.he-nav {
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  position: sticky;
  top: 0;
  z-index: 200;
  /* S15 v4: min-height statt height — PLZ-Form wrappt auf Phone als 2./3. Zeile,
     fixed height würde Inhalt wegclippen. Wrapper .he-mobile-stack ist sticky,
     darum muss .he-nav-Höhe sich Inhalt anpassen.
     S18: 72→56 (Userin-Feedback Whitespace zu groß). */
  min-height: 56px;
  padding: 0 16px;
  font-family: 'Nunito', system-ui, sans-serif;
}
.he-nav-inner {
  max-width: 100%;
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.he-nav-logo {
  font-size: 20px;
  font-weight: 900;
  color: #005319;
  letter-spacing: -.03em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.he-nav-logo-mark {
  width: 36px;
  height: 36px;
  background: #005319;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.he-nav-logo-text { color: #005319; }
.he-nav-logo-text-accent { color: #22C55E; }
/* Session 14: horizontales Logo (logo-h.svg) — Aspect 5:1, Tagline lesbar.
   Desktop 60 px (max im 64-px-Nav), Mobile 44 px. */
.he-nav-logo-img {
  display: block;
  height: 48px;
  width: auto;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .he-nav-logo-img { height: 40px; }
}

.he-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.he-nav-links a {
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #64748B;
  border-radius: 8px;
  transition: all 200ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.he-nav-links a:hover { color: #005319; background: #EDF7F1; }
.he-nav-links a.is-active { color: #005319; background: #EDF7F1; }

.he-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.he-nav-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  background: #fff;
  color: #64748B;
  text-decoration: none;
  transition: all 200ms ease;
}
.he-nav-login:hover {
  color: #005319;
  border-color: #005319;
  background: #EDF7F1;
}
.he-nav-login svg { width: 18px; height: 18px; display: block; }

.he-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #005319;
  color: #fff !important;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none !important;
  transition: all 200ms ease;
  white-space: nowrap;
}
.he-nav-cta:hover { background: #002E0E; transform: translateY(-1px); }

/* S15: Hamburger + Mobile-Dropdown raus — Service-Pills decken die Nav,
   Hamburger ist redundant bei nur 6 Services. */

@media (max-width: 1222px) {
  /* Phone + Tablet + extended (S17 Bug 3): Inline Nav-Links versteckt — Pills (.he-nav-services)
     übernehmen die Service-Navigation. Range erweitert weil 1025-1222 sonst Login+Cart wrappten. */
  .he-nav-links { display: none; }
  /* Padding 16 px — fluchtet mit Service-Pills + PLZ */
  .he-nav { padding: 0 16px; }
  .he-nav-actions > .he-nav-cta { display: none; }
}

@media (max-width: 768px) {
  /* Phone: PLZ-Form wrappt als eigene Zeile unter Logo+Actions */
  .he-nav-inner { flex-wrap: wrap; }
}

/* ── FOOTER ───────────────────────────────────────────────────────────────── */

.he-footer-full {
  background: #002E0E;
  color: rgba(255,255,255,.8);
  padding: 48px clamp(20px, 4vw, 64px) 24px;
  margin-top: 80px;
  font-family: 'Nunito', system-ui, sans-serif;
}
/* Direkter Übergang vom Final-CTA-Block (grün-light) in den Footer — kein Weißraum dazwischen */
.he-cta-final + .he-footer-full,
section.he-cta-final + .he-footer-full {
  margin-top: 0;
}
.he-footer-inner { max-width: 1900px; margin: 0 auto; }
.he-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
@media (max-width: 768px) {
  .he-footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 480px) {
  .he-footer-grid { grid-template-columns: 1fr; }
}
.he-footer-brand {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.he-footer-brand-mark {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.15);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.he-footer-brand-accent { color: #22C55E; }

.he-footer-desc {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
  max-width: 280px;
  color: rgba(255,255,255,.8);
}
.he-footer-contact a {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  margin-bottom: 7px;
  transition: color 200ms ease;
}
.he-footer-contact a:hover { color: #fff; }

.he-footer-col h4 {
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}
.he-footer-col a {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  margin-bottom: 9px;
  transition: color 200ms ease;
}
.he-footer-col a:hover { color: #fff; }

.he-footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: rgba(255,255,255,.45);
}
.he-footer-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.he-footer-badge {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
}


/* ─────────────────────────────────────────────────────────────────────────
 * Session 13 — Mobile-Header-Umbau (Fensterreinigung-Page als Test-Surface)
 *
 * Auf Mobile (<= 768 px) wird der Header zweizeilig:
 *  Zeile 1: Logo · Login · Cart-Icon (statt "Jetzt buchen"-CTA)
 *  Zeile 2: horizontal scrollbare Service-Pills (touch-swipe)
 *
 * Hamburger + Mobile-Menu sind auf der Fensterreinigung-Page komplett aus
 * dem HTML entfernt. Auf anderen Pages bleiben sie (separate Pages, separate
 * HTMLs — Single-Source-Pattern wird in einer Folge-Session propagiert).
 * ───────────────────────────────────────────────────────────────────────── */

/* Cart-Icon — Default versteckt, nur Mobile sichtbar */
.he-nav-cart {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  background: #fff;
  color: #005319;
  text-decoration: none;
  position: relative;
  flex-shrink: 0;
  transition: all 200ms ease;
}
.he-nav-cart:hover,
.he-nav-cart:focus-visible {
  border-color: #005319;
  background: #EDF7F1;
  outline: none;
}
.he-nav-cart svg {
  width: 22px;
  height: 22px;
  display: block;
}
/* Cart-Badge fuer Multi-Service-Booking spaeter — aktuell unsichtbar */
.he-nav-cart-badge {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #22C55E;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.he-nav-cart[data-count]:not([data-count="0"]) .he-nav-cart-badge {
  display: inline-flex;
}

/* Service-Bar — zweite Header-Zeile auf Mobile, horizontal swipebar */
.he-nav-services {
  display: none;
}

@media (max-width: 1222px) {
  /* CTA "Jetzt buchen" raus, Cart-Icon rein — Phone + Tablet + extended (S17) */
  .he-nav-actions > .he-nav-cta { display: none; }
  .he-nav-actions > .he-nav-cart { display: inline-flex; }

  /* Service-Bar als zweite Zeile — Phone + Tablet
     KEIN eigenes sticky: Wrapper .he-mobile-stack ist universal sticky (S15-Fix),
     alle Stack-Kinder fliessen normal innen. */
  .he-nav-services {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    gap: 8px;
    padding: 10px 16px;
    justify-content: safe center;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    /* Scrollbar visuell verstecken (Touch-User scrollen mit Wisch) */
    scrollbar-width: none;       /* Firefox */
    -ms-overflow-style: none;    /* alte Edge/IE */
  }
  .he-nav-services::-webkit-scrollbar {
    display: none;               /* Chrome/Safari/Samsung Internet */
  }

  .he-nav-services-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 9px 16px;
    background: #F8FAFC;
    color: #64748B;
    border: 1.5px solid #E2E8F0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    scroll-snap-align: start;
    transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
    min-height: 38px;          /* Touch-Target ~44 px inkl. Padding-Reserve */
    letter-spacing: -0.01em;
  }
  .he-nav-services-pill.is-active {
    background: #005319;
    color: #fff;
    border-color: #005319;
  }
  .he-nav-services-pill:hover:not(.is-active),
  .he-nav-services-pill:focus-visible:not(.is-active) {
    border-color: #005319;
    color: #005319;
    outline: none;
  }
  .he-nav-services-pill:active {
    transform: scale(0.97);
  }
}


/* ─────────────────────────────────────────────────────────────────────────
 * Session 13 v2 — Cart-Badge final + PLZ-Zeile
 * ───────────────────────────────────────────────────────────────────────── */

/* Cart-Badge: NEU — kein Background, nur orange Zahl mittig im Korb */
.he-nav-cart-badge {
  display: none;
  position: absolute;
  top: 37%;
  left: 56%;
  transform: translate(-50%, -50%);
  color: #EA580C;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  font-family: 'Nunito', system-ui, sans-serif;
  pointer-events: none;
  /* Override aller älteren Badge-Styles aus v1 */
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
  min-width: 0 !important;
  align-items: initial !important;
  justify-content: initial !important;
  right: auto !important;
}
.he-nav-cart[data-count]:not([data-count="0"]) .he-nav-cart-badge {
  display: block;
}
/* Zweistellig (10+) → kompaktere Schrift, damit's reinpasst */
.he-nav-cart[data-count]:not([data-count="0"]):not([data-count="1"]):not([data-count="2"]):not([data-count="3"]):not([data-count="4"]):not([data-count="5"]):not([data-count="6"]):not([data-count="7"]):not([data-count="8"]):not([data-count="9"]) .he-nav-cart-badge {
  font-size: 11px;
  letter-spacing: -0.06em;
}

/* PLZ-Zeile — 3. Header-Zeile auf Mobile, schmal */
/* S15 v4: PLZ-Eingabe — Position je nach Viewport
   – Phone (≤768): wrap als eigene Zeile innerhalb .he-nav-inner
   – Tablet (769–1024): zentral in der Logo-Zeile (siehe Tablet-@media-Block)
   – Desktop (≥1025): wrap als 2. Zeile unter Logo-Reihe, zentriert, dezent grau */
.he-nav-inner {
  flex-wrap: wrap;
}
.he-nav-plz {
  /* S17 v4: PLZ ist sibling von .he-nav in .he-mobile-stack (HTML-Refactor).
     Kein flex-Item mehr, kein Pseudo-Element-Trick mehr — direkter background. */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EDF7F1;
  border-top: 1px solid #D1E7DA;
  border-bottom: 1px solid #D1E7DA;
  padding: 8px 16px;
}
.he-nav-plz-icon {
  width: 16px;
  height: 16px;
  color: #005319;
  flex-shrink: 0;
  margin-right: 8px;
}
.he-nav-plz-input {
  flex: 1;
  max-width: 480px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #0F1A14;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  outline: none;
  font-family: 'Nunito', system-ui, sans-serif;
  transition: border-color 180ms ease;
}
.he-nav-plz-input::placeholder {
  color: #64748B;
  font-weight: 500;
}
.he-nav-plz-input:focus {
  border-color: #005319;
}
.he-nav-plz-btn {
  background: #005319;
  color: #fff;
  border: none;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  margin-left: 8px;
  flex-shrink: 0;
  transition: background 180ms ease, transform 120ms ease;
}
.he-nav-plz-btn:hover,
.he-nav-plz-btn:focus-visible {
  background: #002E0E;
  outline: none;
}
.he-nav-plz-btn:active {
  transform: scale(0.97);
}
.he-nav-plz-result {
  display: none;
}

@media (max-width: 1222px) {
  .he-nav-plz {
    /* Phone + Tablet + extended (S17): PLZ wrappt als eigene Zeile. Background ist seit S17 schon im Default hellgrün. */
    background: #EDF7F1;
    border-bottom: 1px solid #D1E7DA;
    border-top: none;
    padding: 8px 16px;
    justify-content: center;
    gap: 8px;
  }
  .he-nav-plz-icon {
    width: 14px;
    height: 14px;
    color: #005319;
    flex-shrink: 0;
  }
  .he-nav-plz-label {
    font-size: 12px;
    font-weight: 700;
    color: #005319;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    margin: 0;
  }
  .he-nav-plz-input {
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid #C8E0CF;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    font-weight: 700;
    color: #0F1A14;
    letter-spacing: 0.04em;
    font-family: 'Nunito', system-ui, sans-serif;
    outline: none;
    transition: border-color 180ms ease;
  }
  .he-nav-plz-input:focus {
    border-color: #005319;
    background: #fff;
  }
  .he-nav-plz-input::placeholder {
    color: #94A3B8;
    font-weight: 600;
    letter-spacing: 0.02em;
  }
  .he-nav-plz-btn {
    background: #005319;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    transition: background 180ms ease, transform 120ms ease;
  }
  .he-nav-plz-btn:hover,
  .he-nav-plz-btn:focus-visible {
    background: #002E0E;
    outline: none;
  }
  .he-nav-plz-btn:active {
    transform: scale(0.97);
  }
  /* Result-Zeile (klein darunter, nur sichtbar wenn .is-shown) */
  .he-nav-plz-result.is-shown {
    display: block;
    padding: 6px clamp(16px, 4vw, 20px);
    background: #EDF7F1;
    border-bottom: 1px solid #D1E7DA;
    font-size: 12px;
    font-weight: 700;
    color: #005319;
    letter-spacing: -0.01em;
  }
  .he-nav-plz-result.is-error {
    background: #FEF3F2;
    color: #B42318;
    border-bottom-color: #FECDCA;
  }
}


/* Phone + Tablet ≤ 1024 px (S16 Variante A): PLZ wrappt als eigene Zeile
   unter Logo+Actions. Nutzt flex-wrap: wrap aus dem Defaults-Block +
   flex-basis: 100% damit die PLZ auf eine eigene Zeile gestellt wird. */
@media (max-width: 1222px) {
  .he-nav-plz {
    /* S17 v4: kein flex-basis mehr, PLZ ist nicht mehr flex-Item. Padding kompakter. */
    padding: 6px 16px;
  }
}


/* ─────────────────────────────────────────────────────────────────────────
 * S15 — Auto-hide Header (Amazon-Pattern), VEREINHEITLICHT für alle Viewports
 *
 * S14-Diagnose: position:sticky auf .he-nav allein hat auf Desktop NICHT
 * funktioniert, weil .he-nav im .he-mobile-stack-Wrapper sitzt und der
 * Wrapper auf Desktop nur 72 px hoch war (andere Kinder display:none) →
 * Sticky-Containing-Block nur 72 px → Header scrollt mit der Seite weg.
 *
 * S15-Fix: .he-mobile-stack ist UNIVERSAL der sticky-Wrapper (nicht mehr
 * nur Mobile). Inneres .he-nav wird position:static — der Wrapper
 * übernimmt das Sticky-Verhalten und das Auto-hide-Slide. So unifiziert
 * Mobile + Tablet + Desktop in EINEM Pattern.
 *
 * Ablauf:
 *   – Wrapper (.he-mobile-stack) klebt am Viewport-Top
 *   – Beim Runter-Scroll: JS toggelt .is-hidden → Wrapper translateY(-100%)
 *   – Beim Hoch-Scroll: .is-hidden weg → Wrapper zurück auf 0
 *   – Schrittleiste (.he-nav-progress, Desktop): rückt von top:72 → top:0
 *     wenn body.header-hidden (parallel zum Wrapper-Slide)
 *
 * JS toggelt unverändert beide Klassen: stack.is-hidden + body.header-hidden.
 * ───────────────────────────────────────────────────────────────────────── */

.he-mobile-stack {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  transition: transform 280ms cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
}
.he-mobile-stack.is-hidden {
  transform: translateY(-100%);
}
/* Innere Elemente: kein eigenes sticky/top — der Wrapper übernimmt alles. */
.he-mobile-stack > .he-nav,
.he-mobile-stack > .he-nav-services,
.he-mobile-stack > .he-nav-plz,
.he-mobile-stack > .he-nav-plz-result {
  position: static;
  top: auto;
}

/* Desktop-Sonderregel: Schrittleiste folgt dem Header — wenn der Wrapper
   hochslidet, rückt die Schrittleiste von top:72 auf top:0 nach. */
@media (min-width: 1223px) {
  .he-nav-progress {
    transition: top 280ms cubic-bezier(.4, 0, .2, 1);
  }
  body.header-hidden .he-nav-progress {
    top: 0;
  }
}


/* ────────────────────────────────────────────────────────
 * Session 13 v6 — Desktop-Cart aktivieren, CTA "Jetzt buchen" raus
 *
 * Cart ist jetzt auf ALLEN Bildschirmgrößen sichtbar (default inline-flex).
 * Desktop bekommt 42x42 (statt 40 v1), Mobile bleibt 38x38.
 * SVG: Desktop 24px, Mobile 22px.
 * Badge-Zahl: Desktop 14px, Mobile 13px.
 * ──────────────────────────────────────────────────────── */

/* Cart immer sichtbar */
.he-nav-cart {
  display: inline-flex !important;
  width: 42px;
  height: 42px;
}
.he-nav-cart svg {
  width: 24px;
  height: 24px;
}
.he-nav-cart-badge {
  font-size: 14px;
}

@media (max-width: 768px) {
  /* Mobile: kompaktere Cart-Maße (wie davor) */
  .he-nav-cart {
    width: 38px;
    height: 38px;
  }
  .he-nav-cart svg {
    width: 22px;
    height: 22px;
  }
  .he-nav-cart-badge {
    font-size: 13px;
  }
}

/* "Jetzt buchen"-CTA komplett aus dem Top-Header — auf allen Pages
   (HTML auf Fenster-Page ist eh entfernt; auf anderen Pages Backup).
   Mobile-Hide aus v1 wird damit obsolet, das aria-controls-Attribut
   wird ggf. ungültig — aber das Element existiert auf Fenster-Page
   nicht mehr. */
.he-nav-actions > .he-nav-cta {
  display: none !important;
}
