/* ===========================================================
   VendWerk – gemeinsame Responsive-Schicht
   Wird von jeder Seite im <helmet> geladen und greift dadurch
   automatisch auch für neue Seiten (z. B. Automaten-Unterseiten).
   Da die Seiten inline-styled sind, wird über Attribut-/Tag-
   Selektoren übersteuert.
   =========================================================== */

/* ---------- Deutsche Silbentrennung für Fließtext ---------- */
p, li {
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
  overflow-wrap: break-word;
}

/* ---------- Hamburger / Mobile-Menü (von responsive.js erzeugt) ---------- */
.vw-burger {
  display: none;
  margin-left: auto;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: #fff; border: 1px solid #dbe3ec; border-radius: 12px;
  cursor: pointer; padding: 0;
}
.vw-burger span {
  position: relative; display: block; width: 20px; height: 2px;
  background: #2660a2; border-radius: 2px;
  transition: transform .25s, opacity .2s;
}
.vw-burger span::before, .vw-burger span::after {
  content: ""; position: absolute; left: 0; width: 20px; height: 2px;
  background: #2660a2; border-radius: 2px; transition: transform .25s;
}
.vw-burger span::before { top: -6px; }
.vw-burger span::after  { top:  6px; }
.vw-burger.open span { background: transparent; }
.vw-burger.open span::before { transform: translateY(6px) rotate(45deg); }
.vw-burger.open span::after  { transform: translateY(-6px) rotate(-45deg); }

.vw-mobilemenu {
  display: none;
  position: absolute; left: 0; right: 0; top: 100%;
  background: #fff; border-bottom: 1px solid #e8eef5;
  box-shadow: 0 22px 40px -26px rgba(14,47,79,0.45);
  flex-direction: column; padding: 10px 22px 20px; gap: 2px; z-index: 60;
}
.vw-mobilemenu a {
  text-decoration: none; color: #34373d; font-size: 16px; font-weight: 600;
  padding: 14px 6px; border-bottom: 1px solid #f0f4f9;
}
.vw-mobilemenu a:last-child { border-bottom: none; }
.vw-mobilemenu a.vw-cta {
  margin-top: 12px; background: #2660a2; color: #fff; text-align: center;
  border-radius: 999px; border: none; padding: 15px;
}
/* Sprach-Flaggen-Zeile im Mobil-Menü */
.vw-menulang {
  display: flex; gap: 10px; margin-top: 16px;
  padding-top: 16px; border-top: 1px solid #eef2f7;
}
.vw-menulang button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 12px; border-radius: 12px; cursor: pointer;
  background: #f5f8fc; border: 1.5px solid #e6eef6;
  font-family: inherit; font-size: 15px; font-weight: 700; color: #6b7885;
  transition: border-color .18s, color .18s, background .18s;
}
.vw-menulang button .vw-menulang-flag {
  display: inline-flex; line-height: 0; opacity: .55; transition: opacity .18s;
  box-shadow: 0 0 0 1px rgba(120,120,120,.25); border-radius: 3px;
}
.vw-menulang button.active {
  background: #fff; border-color: #2660a2; color: #34373d;
  box-shadow: 0 2px 8px rgba(38,96,162,.12);
}
.vw-menulang button.active .vw-menulang-flag { opacity: 1; box-shadow: 0 0 0 1px rgba(38,96,162,.45); }

/* ---------- Tablet ---------- */
@media (max-width: 980px) {
  /* 3- und 4-spaltige Raster auf 2 Spalten */
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: 1.5fr 1fr 1fr 1fr"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ===== Mobiler Header: NUR Logo + Sprach-Flaggen + Hamburger =====
     Alles andere (Sektionslinks, Shop, Telefon, Suche) steckt im Menü. */
  .vw-burger { display: inline-flex !important; }
  .vw-mobilemenu.open { display: flex; }

  /* Sektions-Linkgruppe raus */
  .vw-navlinks { display: none !important; }
  /* Suchfeld raus */
  .vw-search { display: none !important; }
  /* Separater Shop-Link im Header raus (bleibt im Hamburger-Menü) */
  nav > div:first-child > a[href="shop.dc.html"] { display: none !important; }
  /* Telefonnummer raus (Header + Menü) */
  nav a[href*="wa.me/"] { display: none !important; }
  .vw-navphone { display: none !important; }
  /* Sprach-Flaggen aus dem Header raus (stecken jetzt im Hamburger-Menü) */
  nav [data-vw-lang-toggle] { display: none !important; }
  /* Platzhalter, der auf Desktop den Warenkorb-Slot reserviert, mobil raus */
  nav div[aria-hidden="true"][style*="width: 46px"] { display: none !important; }

  /* Sicherheitsnetz: nichts darf die Seite seitlich überlaufen lassen.
     'clip' verhindert horizontales Scrollen, ohne die Sticky-Nav zu brechen. */
  html { overflow-x: clip; }
  img { max-width: 100%; height: auto; }
}

/* ---------- Handy ---------- */
@media (max-width: 680px) {
  /* Telefonnummer im Header ausblenden (steckt im Mobil-Menü) */
  .vw-navphone { display: none !important; }

  /* Alle mehrspaltigen Raster einspaltig */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Breite Außenränder reduzieren (64px / 56px horizontal) */
  [style*=" 64px"] { padding-left: 22px !important; padding-right: 22px !important; }
  [style*=" 56px"] { padding-left: 22px !important; padding-right: 22px !important; }

  /* Zeilenumbrüche wieder erlauben */
  [style*="white-space: nowrap"]:not(.vw-keep) { white-space: normal !important; }
  [style*="flex-wrap: nowrap"] { flex-wrap: wrap !important; }

  /* Hero-CTAs: fixe 240px-Buttons brechen um und werden vollbreit
     (verhindert horizontales Überlaufen des Heros auf schmalen Displays) */
  [style*="gap: 12px"][style*="margin-bottom: 40px"] { flex-wrap: wrap !important; }
  a[style*="width: 240px"] { width: 100% !important; max-width: 100% !important; }

  /* Subgrid-Vergleichskarten (z. B. SandenVendo/OPROO) untereinander stapeln:
     feste Spalten-/Zeilen-Zuweisung + Subgrid auflösen, sonst überläuft die
     zweite Karte den Viewport nach rechts. */
  [style*="grid-template-rows: subgrid"] {
    grid-template-rows: none !important;
    grid-row: auto !important;
    grid-column: auto !important;
  }

  /* Hero-Portrait (Startseite): Links-Versatz zurücknehmen, damit es beim
     Umbruch zentriert bleibt, und die schwebende Zitat-Karte in den Fluss
     holen, statt sie absolut über den rechten Rand ragen zu lassen. */
  .hero-portrait-spin { transform: none !important; justify-self: center !important; }
  .hero-portrait-spin > div[style*="position: absolute"] {
    position: relative !important;
    left: 0 !important; bottom: 0 !important;
    width: 100% !important; max-width: 340px !important;
    margin: 14px auto 0 !important;
  }

  /* Überschriften skalieren + lange Wörter umbrechen */
  h1 { font-size: 32px !important; line-height: 1.12 !important; }
  h2 { font-size: 24px !important; line-height: 1.2 !important; }
  h1, h2, h3, p { overflow-wrap: break-word; }

  /* Große vertikale Sektions-Abstände etwas verkleinern */
  [style*="padding: 100px 64px"],
  [style*="padding: 96px 64px"],
  [style*="padding: 92px 64px"],
  [style*="padding: 84px 64px"],
  [style*="padding: 80px 64px"] { padding-top: 56px !important; padding-bottom: 56px !important; }
}

/* ---------- Sehr schmal ---------- */
@media (max-width: 400px) {
  [style*=" 64px"] { padding-left: 16px !important; padding-right: 16px !important; }
  [style*=" 56px"] { padding-left: 16px !important; padding-right: 16px !important; }
  h1 { font-size: 28px !important; }
}


/* ---------- Kontakt-Formularkarte + hCaptcha ---------- */
/* hCaptcha rendert eine feste 303px breite iFrame. Auf schmalen Displays
   den Karten-Innenabstand reduzieren und das Widget bei Bedarf skalieren,
   damit nichts horizontal überläuft. */
#vw-hcaptcha { max-width: 100%; }
@media (max-width: 680px) {
  .vw-formcard { padding: 24px !important; }
}
@media (max-width: 420px) {
  #vw-hcaptcha { transform: scale(0.9); transform-origin: 0 0; }
}
@media (max-width: 400px) {
  .vw-formcard { padding: 16px !important; }
}
@media (max-width: 360px) {
  #vw-hcaptcha { transform: scale(0.82); transform-origin: 0 0; }
}

/* ---------- Suchfeld (Header) ---------- */
.vw-search #site-search-results { max-width: 92vw; }
@media (max-width: 680px) {
  .vw-search { flex: 1 1 auto; min-width: 0; margin-right: 10px; }
  .vw-search #site-search { width: 100% !important; }
  .vw-search #site-search-results { width: min(92vw, 340px) !important; right: 0; }
}
