/* ====================================================================
   viewport-layout.css — 3-Viewport-Konsistenz (2026-05-06)
   ────────────────────────────────────────────────────────────────────
   Lädt nach mobile-touch-fix.css. Klare Layout-Regeln pro Breakpoint.

   Worker-Allowlist:
   - W1 erweitert Mobile-Sections (max-width:768px)
   - W2 erweitert Tablet-L + Desktop-Sections (min-width:1024px)
   - Claude wartet zentrale Architektur (Spacing-Variablen, Container)
   ==================================================================== */

/* ── Design-Tokens (Variables global) ── */
:root {
  --vp-container-mobile: 100%;
  --vp-container-tablet: 720px;
  --vp-container-tablet-l: 960px;
  --vp-container-desktop: 1200px;
  --vp-container-desktop-xl: 1320px;

  --vp-pad-mobile: 1rem;
  --vp-pad-tablet: 1.5rem;
  --vp-pad-desktop: 2rem;

  --vp-hero-mobile: clamp(420px, 70vh, 600px);
  --vp-hero-tablet: clamp(480px, 65vh, 660px);
  --vp-hero-desktop: clamp(540px, 60vh, 700px);

  --vp-grid-gap-mobile: 1rem;
  --vp-grid-gap-tablet: 1.5rem;
  --vp-grid-gap-desktop: 2rem;
}

/* ── Globale Nav-Konsistenz (alle Pages: flex horizontal) ─────────── */
html body nav.nav,
html body nav#nav {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}
html body nav .nav-right {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  flex-wrap: nowrap !important;
}

/* Desktop: Nav-Links eine Zeile, kompakteres Spacing wenn viele Items ── */
@media (min-width: 1024px) {
  html body nav .nav-links {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.6rem !important;
    align-items: center !important;
    flex: 0 1 auto !important;
    justify-content: center !important;
  }
  html body nav .nav-links a {
    white-space: nowrap !important;
    padding: 0.5rem 0.6rem !important;
    font-size: 0.88rem !important;
    margin: 0 !important;
  }
  /* Center-Nav mit konsequentem Spacing */
  html body nav.nav, html body nav#nav {
    gap: 1rem !important;
  }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  /* Kleiner Desktop: noch kompakter */
  html body nav .nav-links {
    gap: 0.4rem !important;
  }
  html body nav .nav-links a {
    padding: 0.4rem 0.45rem !important;
    font-size: 0.8rem !important;
  }
}

/* Mobile: Phone-Number-Text verstecken, nur Icon (sonst bricht Nav) */
@media (max-width: 768px) {
  html body nav #navPhone {
    font-size: 0 !important;
    padding: 8px 10px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    overflow: hidden !important;
  }
  html body nav #navPhone::before {
    content: "📞";
    font-size: 18px !important;
    line-height: 1;
  }
  /* Hide nav-cta auf Mobile (CTAs sind im Burger-Menu) */
  html body nav .nav-right .nav-cta {
    display: none !important;
  }
  /* Hide #navRating auf Mobile (kompakt) */
  html body nav .nav-right #navRating {
    display: none !important;
  }
  /* Hide cw-senior-toggle auf Mobile (im Burger-Menu) */
  html body nav .nav-right .cw-senior-toggle {
    display: none !important;
  }
}

/* ── Container-Konsistenz pro Viewport ────────────────────────────── */

/* Mobile: full-width mit safe Padding */
@media (max-width: 767px) {
  html body .container,
  html body main > section,
  html body main > div.section {
    max-width: var(--vp-container-mobile);
    padding-left: var(--vp-pad-mobile);
    padding-right: var(--vp-pad-mobile);
    box-sizing: border-box;
  }
  /* Heros nicht zu hoch */
  html body section.hero,
  html body .hero-section,
  html body main > section:first-of-type {
    min-height: auto;
    max-height: none;
    padding-block: 5rem 2rem;
  }
}

/* Tablet Portrait: 720px Container, 1.5rem Pad */
@media (min-width: 768px) and (max-width: 1023px) {
  html body .container {
    max-width: var(--vp-container-tablet);
    padding-left: var(--vp-pad-tablet);
    padding-right: var(--vp-pad-tablet);
    margin-inline: auto;
    box-sizing: border-box;
  }
  /* Grid-Sections: 2 Cols statt 3 */
  html body .grid-3,
  html body [class*="grid-cols-3"]:not([class*="md:grid-cols"]),
  html body .features-grid,
  html body .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--vp-grid-gap-tablet);
  }
}

/* Tablet Landscape (Worker-W2 Bereich): 960px Container */
@media (min-width: 1024px) and (max-width: 1279px) {
  html body .container {
    max-width: var(--vp-container-tablet-l);
    padding-left: var(--vp-pad-desktop);
    padding-right: var(--vp-pad-desktop);
    margin-inline: auto;
    box-sizing: border-box;
  }
}

/* Desktop: 1200px Container, 3-Col-Grids zurück */
@media (min-width: 1280px) {
  html body .container {
    max-width: var(--vp-container-desktop);
    padding-left: var(--vp-pad-desktop);
    padding-right: var(--vp-pad-desktop);
    margin-inline: auto;
    box-sizing: border-box;
  }
}

/* Desktop-XL: 1320px max */
@media (min-width: 1600px) {
  html body .container {
    max-width: var(--vp-container-desktop-xl);
  }
}

/* ── Hero-Höhen-Konsistenz ────────────────────────────────────────── */
@media (max-width: 767px) {
  html body .hero, html body section.hero {
    min-height: var(--vp-hero-mobile);
  }
}
@media (min-width: 768px) and (max-width: 1023px) {
  html body .hero, html body section.hero {
    min-height: var(--vp-hero-tablet);
  }
}
@media (min-width: 1024px) {
  html body .hero, html body section.hero {
    min-height: var(--vp-hero-desktop);
    max-height: 720px;
  }
}

/* ── Section-Spacing-Konsistenz ───────────────────────────────────── */
@media (max-width: 767px) {
  html body section, html body .section { padding-block: 2.5rem; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  html body section, html body .section { padding-block: 3.5rem; }
}
@media (min-width: 1024px) {
  html body section, html body .section { padding-block: 4.5rem; }
}

/* ── Typografie-Skala pro Viewport ────────────────────────────────── */
@media (max-width: 767px) {
  html body h1 { font-size: clamp(1.75rem, 7vw, 2.25rem); line-height: 1.2; }
  html body h2 { font-size: clamp(1.4rem, 5vw, 1.75rem); line-height: 1.3; }
  html body h3 { font-size: clamp(1.15rem, 4vw, 1.35rem); line-height: 1.35; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  html body h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
  html body h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
  html body h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); }
}
@media (min-width: 1024px) {
  html body h1 { font-size: clamp(2.4rem, 3.5vw, 3.25rem); line-height: 1.15; }
  html body h2 { font-size: clamp(1.75rem, 2.5vw, 2.4rem); }
  html body h3 { font-size: clamp(1.3rem, 1.8vw, 1.6rem); }
}

/* ── Grid-Konsistenz ────────────────────────────────────────────── */
@media (max-width: 767px) {
  html body .grid, html body [class*="grid-cols-"] {
    grid-template-columns: 1fr;
    gap: var(--vp-grid-gap-mobile);
  }
}

/* ── Button-Konsistenz pro Viewport ──────────────────────────────── */
@media (max-width: 767px) {
  html body .btn, html body .cta, html body button:not([hidden]) {
    width: auto;
    min-width: 44px;
  }
  /* CTA-Buttons in Hero: full-width auf Mobile */
  html body section.hero .btn,
  html body section.hero .cta,
  html body .hero-cta {
    width: 100%;
    max-width: 360px;
  }
}
