/* =========================================================
   Games & More — Stylesheet
   ========================================================= */

/* Self-hosted fonts (no request to Google's servers -> no consent banner needed) */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("../fonts/manrope-variable.woff2") format("woff2");
}
@font-face {
  font-family: "UnifrakturMaguntia";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/unifraktur-maguntia.woff2") format("woff2");
}

:root {
  --purple-950: #120b1f;
  --purple-900: #1b1130;
  --purple-800: #271a45;
  --purple-700: #34225c;
  --purple-600: #452c78;

  --accent: #a78bfa;
  --accent-strong: #7c3aed;
  --accent-strong-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, .12);

  --bg: #f8f8fb;
  --bg-alt: #f2eff9;
  --surface: #ffffff;

  --text: #14171f;
  --text-muted: #5b6472;
  --text-inverse: #f5f6f8;
  --text-inverse-muted: #b3aecb;

  --border: #e7e4f0;
  --border-dark: #362a52;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 2px 8px rgba(18, 11, 31, 0.08);
  --shadow-md: 0 12px 32px rgba(18, 11, 31, 0.12);
  --shadow-lg: 0 24px 64px rgba(18, 11, 31, 0.18);

  --font-head: "Manrope", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-brand: "UnifrakturMaguntia", "Manrope", cursive;

  --header-h: 76px;
  --container-w: 1180px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
.icon-sprite { display: none; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h5 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; color: inherit; }
p {
  margin: 0 0 1em;
  overflow-wrap: break-word;
  text-wrap: pretty;
}
button { font: inherit; cursor: pointer; }
svg { flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent-strong);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  font-weight: 700;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

/* Sections/main get tabindex="-1" added by JS only to receive focus after an
   in-page anchor jump; that's a programmatic convenience, not a real
   interactive control, so it shouldn't show a focus ring. */
section[tabindex="-1"], main[tabindex="-1"] { outline: none; }

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 24px;
}
.container-narrow { max-width: 820px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-strong-hover); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--text); }
.section-dark .btn-ghost, .hero .btn-ghost { color: var(--text-inverse); border-color: var(--border-dark); }
.section-dark .btn-ghost:hover, .hero .btn-ghost:hover { border-color: var(--text-inverse-muted); background: rgba(255,255,255,.06); }
.btn-sm { padding: 10px 20px; font-size: 0.9rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(248, 248, 251, 0.62);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 30px rgba(18, 11, 31, 0.08);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark-wrap { position: relative; width: 34px; height: 34px; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--purple-900), var(--purple-700));
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(167,139,250,.55);
  display: block;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 9px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}
.brand-logo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; border-radius: 9px;
}
.brand-text { font-family: var(--font-brand); font-weight: 400; font-size: 1.5rem; letter-spacing: .02em; color: var(--purple-950); }
.brand-text em { font-style: normal; color: var(--accent-strong); }
.footer-brand { color: var(--text-inverse); font-size: 2rem; display: inline-block; margin-bottom: 10px; }

/* On desktop this wrapper must not affect the header's flex layout at all -
   `display: contents` makes it disappear as a box, leaving .main-nav as the
   effective flex item. The mobile media query below turns it into the actual
   fixed, clipping drawer container. */
.nav-drawer { display: contents; }

.main-nav ul { display: flex; gap: 28px; }
.main-nav a {
  font-size: 0.95rem; font-weight: 500; color: var(--text-muted);
  position: relative; padding: 6px 0;
  transition: color .15s ease;
}
.main-nav a:hover, .main-nav a.active { color: var(--purple-950); }
.main-nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--accent-strong); border-radius: 2px;
}

.header-actions { display: flex; align-items: center; gap: 14px; }
.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border); border-radius: 10px;
  width: 42px; height: 42px; align-items: center; justify-content: center; color: var(--text);
}

/* ---------- Sections ---------- */
.section { padding: 40px 0 84px; }
/* In-page clicks scroll themselves (see main.js) and already account for the
   sticky header's height, but a fresh page load landing on a fragment (e.g.
   a link from impressum.html to index.html#automaten) is handled natively by
   the browser - this is what makes that native jump land below the header
   too, instead of hiding the heading behind it. */
section[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
.section-alt { background: var(--bg-alt); }
.section-dark {
  background: linear-gradient(160deg, var(--purple-950), var(--purple-800));
  color: var(--text-inverse);
}
.section-dark p { color: var(--text-inverse-muted); }

.kicker {
  display: inline-block;
  font-weight: 700; font-size: 0.82rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-strong); margin-bottom: 14px;
}
.kicker-light { color: var(--accent); }

.section-head { max-width: 680px; margin-bottom: 56px; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.section-head-center { max-width: 640px; margin-left: auto; margin-right: auto; text-align: center; }
.lead-text { color: var(--text-muted); font-size: 1.05rem; }
.section-dark .lead-text { color: var(--text-inverse-muted); }

.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}
.section-grid-reverse { direction: rtl; }
.section-grid-reverse > * { direction: ltr; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(175deg, var(--purple-950) 0%, var(--purple-900) 55%, var(--purple-800) 100%);
  color: var(--text-inverse);
  padding: 48px 0 120px;
}
.hero-glow {
  position: absolute;
  top: -220px; right: -160px;
  width: 620px; height: 620px;
  background: radial-gradient(circle, rgba(124,58,237,.35), transparent 68%);
  filter: blur(10px);
  pointer-events: none;
}
.hero-inner {
  position: relative;
}
.hero-copy { max-width: 720px; }
.hero h1 {
  font-size: clamp(2.1rem, 4.4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 22px;
  text-wrap: balance;
}
.hero-lead {
  font-size: 1.12rem;
  color: var(--text-inverse-muted);
  max-width: 540px;
  margin-bottom: 34px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; }

/* ---------- Stats band ---------- */
.stats-band { background: var(--purple-950); padding: 40px 0; }
.stats-band-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 260px));
  justify-content: center;
  gap: 64px;
  text-align: center;
}
.stat-count-item { display: flex; flex-direction: column; gap: 6px; }
.stat-count-item strong {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(1.7rem, 3vw, 2.1rem);
  color: var(--text-inverse);
}
.stat-count-item > span { color: var(--text-inverse-muted); font-size: .9rem; }

/* ---------- Feature list (Über uns) ---------- */
.feature-list { display: flex; flex-direction: column; gap: 22px; }
.feature-list li { display: flex; gap: 16px; align-items: flex-start; }
.feature-list svg { color: var(--accent-strong); flex-shrink: 0; margin-top: 3px; }
.feature-list strong { display: block; margin-bottom: 4px; font-family: var(--font-head); }
.feature-list span { color: var(--text-muted); font-size: .95rem; }

/* ---------- Card grid (Automaten) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
/* On desktop/tablet this wrapper must not affect the grid layout at all -
   `display: contents` makes it disappear as a box, leaving the cards as the
   grid's direct items. The mobile media query turns it into the actual
   sliding track of the swipe carousel. */
.card-track { display: contents; }
.carousel-hint { display: none; }
.carousel-dots { display: none; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
/* Image and text share the card's own tinted background - no separate
   panel/box behind the photo, so there's no visual break between the two. */
.card-image {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.card-image img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  box-sizing: border-box;
  object-fit: contain;
  padding: 14px;
  filter: blur(16px);
  transform: scale(1.15); /* hides the blur's soft edge bleeding past the box while loading */
  transition: transform .4s ease, filter .5s ease;
}
.card-image img.is-loaded { filter: blur(0); transform: scale(1); }
.card:hover .card-image img.is-loaded { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) {
  .card-image img { transition: none; }
}
.card-body { padding: 24px 26px 28px; }
.card-body h3 { font-size: 1.08rem; margin-bottom: 8px; }
.card-body p { color: var(--text-muted); font-size: .93rem; margin-bottom: 0; }

/* Closing "ask us for anything else" tile at the end of the Automaten grid -
   uses the same card-image/img markup as the product photos. */
.card-cta-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px;
  font-weight: 700; font-size: .93rem;
  color: var(--accent-strong);
}
.card-cta-link:hover { color: var(--accent-strong-hover); }
.card-cta-link svg { flex-shrink: 0; }
.card-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 18px;
}
.card-icon-accent { background: linear-gradient(135deg, var(--accent-strong), var(--accent)); color: #fff; }

/* ---------- Pricing (Vergütung) ---------- */
.pricing-tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 360px;
  margin: 0 auto 40px;
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 6px;
}
.pricing-tab-indicator {
  position: absolute; top: 6px; left: 6px;
  width: calc(50% - 6px); height: calc(100% - 12px);
  background: var(--accent-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.pricing-tabs[data-active="miete"] .pricing-tab-indicator { transform: translateX(100%); }
.pricing-tab {
  position: relative; z-index: 1;
  padding: 12px 20px;
  border-radius: 999px;
  border: none; background: transparent;
  font-weight: 700; font-size: .95rem;
  color: var(--text-muted);
  transition: color .25s ease;
}
.pricing-tab[aria-selected="true"] { color: #fff; }

.pricing-panels { max-width: 560px; margin: 0 auto; }
.pricing-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 38px;
}
.pricing-featured { border-color: var(--accent-strong); box-shadow: var(--shadow-md); }
.badge {
  position: absolute; top: -13px; right: 30px;
  background: var(--accent-strong); color: #fff;
  font-size: .78rem; font-weight: 700; letter-spacing: .03em;
  padding: 5px 14px; border-radius: 999px;
}
.pricing-panel h3 { font-size: 1.3rem; margin-bottom: 10px; }
.pricing-panel > p { color: var(--text-muted); }
.pricing-panel ul { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.pricing-panel li { display: flex; align-items: center; gap: 10px; font-size: .93rem; }
.pricing-panel li svg { color: var(--accent-strong); }
.pricing-panel li.muted { color: var(--text-muted); }
.pricing-panel li.muted svg { color: var(--text-muted); }


/* ---------- Verantwortung ---------- */
.responsibility-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.resp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px 28px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.resp-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.resp-card h3 { font-size: 1.1rem; }
.resp-card p { color: var(--text-muted); font-size: .93rem; }
.resp-hotlines {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.resp-hotline { display: flex; flex-direction: column; gap: 2px; }
.resp-hotline a { font-weight: 700; font-size: .92rem; color: var(--purple-950); }
.resp-hotline a:hover { color: var(--accent-strong); }
.resp-hotline span { font-weight: 400; font-size: .78rem; color: var(--text-muted); }

/* ---------- Servicegebiet ---------- */
.area-primary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}
.area-block-primary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 26px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.area-block-primary:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.area-block-primary .area-icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  margin-bottom: 16px;
}
.area-block-primary h3 { font-size: 1.15rem; margin-bottom: 6px; color: var(--purple-950); }
.area-block-primary p { color: var(--text-muted); font-size: .96rem; margin-bottom: 0; }

.area-tags-wrap h4 {
  font-size: .85rem; margin-bottom: 12px; color: var(--text-muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.area-more-text { font-size: 1rem; color: var(--text); line-height: 1.7; margin-bottom: 0; max-width: 760px; }
.area-more-text a { color: var(--accent-strong); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.area-more-text a:hover { color: var(--accent-strong-hover); }


/* "Mehr erfahren" trigger inside each Automaten card, opens the matching
   detail-dialog below. */
.card-detail-btn {
  display: inline-flex; align-items: center;
  margin-top: 14px;
  font-weight: 700; font-size: .93rem;
  color: var(--accent-strong);
  background: none; border: none; padding: 0;
  font-family: inherit;
}
.card-detail-btn:hover { color: var(--accent-strong-hover); text-decoration: underline; }

/* Per-category detail popups for the Automaten cards. Closed (and hidden)
   by default via the native <dialog> element - the text stays in the
   initial HTML and is fully crawlable, it's just not visually shown until
   a card's "Mehr erfahren" button opens it. */
.detail-dialog {
  max-width: 520px;
  width: calc(100% - 48px);
  border: none;
  border-radius: var(--radius-md);
  padding: 32px 30px;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.detail-dialog::backdrop { background: rgba(18, 11, 31, .55); }
.detail-dialog h3 { font-size: 1.3rem; margin: 0 32px 14px 0; color: var(--purple-950); }
.detail-dialog p { color: var(--text-muted); margin: 0; }
.detail-dialog-close {
  position: absolute; top: 18px; right: 18px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text);
  border: none;
  cursor: pointer;
  transition: background .15s ease;
}
.detail-dialog-close:hover { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- Accordion (FAQ) ---------- */
.accordion { display: flex; flex-direction: column; gap: 12px; }
.accordion-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 24px;
  overflow: hidden;
}
.accordion-item summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 0;
  font-weight: 600;
  cursor: pointer;
}
.accordion-item summary::-webkit-details-marker { display: none; }
.accordion-item summary svg { color: var(--accent-strong); transition: transform .25s ease; flex-shrink: 0; }
.accordion-item[open] summary svg { transform: rotate(180deg); }
.accordion-body { padding-bottom: 22px; color: var(--text-muted); }
.accordion-body p { margin: 0; }
.accordion-item summary:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; border-radius: 4px; }

/* ---------- Kontakt ---------- */
.contact-cta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}
.contact-cta {
  display: flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius-md);
  padding: 26px 24px;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.contact-cta:hover { transform: translateY(-4px); background: rgba(255,255,255,.08); box-shadow: var(--shadow-md); }
.contact-cta .cta-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.contact-cta .cta-text { display: flex; flex-direction: column; gap: 2px; }
.contact-cta .cta-text strong { font-family: var(--font-head); font-size: 1.05rem; color: var(--text-inverse); }
.contact-cta .cta-text span { font-size: .88rem; color: var(--text-inverse-muted); }
.contact-cta-featured { grid-column: 1 / -1; }
.contact-cta-whatsapp {
  background: #25D366; border-color: #25D366;
  box-shadow: 0 12px 32px rgba(37,211,102,.28);
  padding: 28px 30px;
}
.contact-cta-whatsapp .cta-icon { background: rgba(255,255,255,.22); color: #fff; }
.contact-cta-whatsapp .cta-text strong,
.contact-cta-whatsapp .cta-text span { color: #fff; }
.contact-cta-whatsapp .cta-text span { opacity: .9; }
.contact-cta-whatsapp:hover { background: #21bd5c; box-shadow: 0 16px 40px rgba(37,211,102,.38); }
.contact-cta-whatsapp .cta-arrow { margin-left: auto; color: #fff; opacity: .85; }

/* ---------- Footer ---------- */
.site-footer { background: var(--purple-950); color: var(--text-inverse-muted); padding: 72px 0 0; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.footer-grid h3 { color: var(--text-inverse); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 16px; }
.footer-grid ul { display: flex; flex-direction: column; gap: 10px; }
.footer-grid a:hover { color: var(--accent); }
.footer-grid address { font-style: normal; line-height: 1.8; }
.footer-grid ul.footer-social { flex-direction: row; gap: 14px; margin-top: 18px; }
.footer-social a {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
}
.footer-social a:hover { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }
.footer-bottom { padding: 22px 24px; font-size: .85rem; }

/* ---------- WhatsApp FAB ---------- */
.whatsapp-fab {
  position: fixed;
  right: max(24px, env(safe-area-inset-right, 0px) + 16px);
  bottom: max(24px, env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 950;
  width: 60px; height: 60px; border-radius: 50%;
  background: #25D366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(37,211,102,.45);
  transition: transform .2s ease, box-shadow .2s ease;
}
.whatsapp-fab:hover { transform: scale(1.08); box-shadow: 0 14px 36px rgba(37,211,102,.55); }

/* Mobile Safari's own floating bottom bar isn't part of the OS "safe area"
   (that only covers the home-indicator strip), so env(safe-area-inset-bottom)
   alone still leaves it overlapping fixed bottom elements. There's no way for
   a page to hide Safari's own UI - the practical fix is a bigger fixed
   clearance, applied only on iOS via this well-known WebKit-only feature
   check so other browsers keep the tighter default above. iOS's own toolbar
   is commonly cited at ~44px across devices; 68px gives comfortable room
   above that plus visual breathing space. */
@supports (-webkit-touch-callout: none) {
  .whatsapp-fab { bottom: max(24px, env(safe-area-inset-bottom, 0px) + 68px); }
}

/* ---------- Scroll-to-top button ---------- */
.scroll-top-btn {
  position: fixed;
  left: max(24px, env(safe-area-inset-left, 0px) + 16px);
  bottom: max(24px, env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 950;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}
.scroll-top-btn.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top-btn:hover { background: var(--accent-strong); color: #fff; box-shadow: var(--shadow-lg); }
.scroll-top-btn svg { transform: rotate(180deg); }

@supports (-webkit-touch-callout: none) {
  .scroll-top-btn { bottom: max(24px, env(safe-area-inset-bottom, 0px) + 68px); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-top-btn { transition: opacity .01ms; }
}

/* ---------- Legal pages (Impressum / Datenschutz) ---------- */
.legal-page { padding-top: 76px; }
.legal-page h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin-bottom: 34px; }

/* ---------- Error pages (404 etc.) ---------- */
.error-page { text-align: center; }
.error-page .btn { margin-top: 28px; }
.legal-content h2 { font-size: 1.15rem; margin: 34px 0 12px; color: var(--purple-950); }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p { color: var(--text-muted); font-size: .98rem; }
.legal-content ul { list-style: disc; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; margin: 0 0 1em; }
.legal-content li { color: var(--text-muted); font-size: .98rem; }
.legal-content a { color: var(--accent-strong); text-decoration: underline; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .responsibility-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  /* Sized exactly to the viewport area below the header and clipped -
     nothing inside it, however it's transformed, can ever extend the page's
     scrollable width. .main-nav is absolutely positioned inside it (this
     wrapper is its containing block) and does the actual sliding. */
  .nav-drawer {
    display: block;
    position: fixed; top: var(--header-h); right: 0; left: 0;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    overflow: hidden;
    pointer-events: none;
  }
  .main-nav {
    position: absolute; inset: 0;
    background: var(--purple-950); padding: 30px 24px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
  }
  .main-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .3s ease, visibility 0s linear 0s;
  }
  .main-nav ul { flex-direction: column; gap: 6px; }
  .main-nav a { color: var(--text-inverse-muted); display: block; padding: 14px 4px; font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
  .main-nav a:hover, .main-nav a.active { color: var(--text-inverse); }
  .nav-toggle { display: flex; }
  .header-actions .btn-primary.btn-sm { display: none; }

  .section-grid, .section-grid-reverse { grid-template-columns: 1fr; direction: ltr; }
  .area-primary-grid { grid-template-columns: 1fr; gap: 22px; }
  .stats-band-grid { grid-template-columns: repeat(2, minmax(0, 200px)); gap: 24px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .section { padding: 28px 0 60px; }

  /* Swipe carousel: .card-grid is a plain clipping viewport (no scrolling of
     its own at all - not even native overflow-x), .card-track is the flex
     row that actually moves, positioned purely via `transform` and driven by
     main.js. This is the same viewport/track split real carousel libraries
     (Embla, Swiper, ...) use, and for good reason: transform is GPU-composited
     so dragging stays smooth regardless of main-thread load, and - critically
     for iOS - it sidesteps `touch-action`, whose directional pan-x/pan-y
     values iOS Safari only partially honors, which is what made the native
     overflow-x approach unreliable there for letting vertical page scrolls
     pass through. */
  .card-grid {
    grid-template-columns: none;
    overflow: hidden;
    margin: 0 -24px;
    padding: 4px 24px 8px;
  }
  .card-track {
    display: flex;
    gap: 16px;
    touch-action: pan-y;
  }
  .card-track .card {
    flex: 0 0 78%;
    max-width: 320px;
  }
  .carousel-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    margin: 18px auto 0;
    padding: 7px 16px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: .85rem;
    font-weight: 700;
  }
  .carousel-hint-arrow { animation: hint-nudge 1.4s ease-in-out infinite; }
  @keyframes hint-nudge {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
  }
  @media (prefers-reduced-motion: reduce) {
    .carousel-hint-arrow { animation: none; }
  }
  .carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
  }
  .carousel-dots .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--border);
    transition: background .2s ease, transform .2s ease;
  }
  .carousel-dots .dot.active { background: var(--accent-strong); transform: scale(1.35); }
}

@media (max-width: 480px) {
  .hero { padding: 36px 0 88px; }
  /* "Ihr Automatenaufsteller" needs to fit on one line at this width, or the
     lone "Ihr" gets orphaned on its own line above the long compound noun. */
  .hero h1 { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .contact-cta-grid { grid-template-columns: 1fr; }
  .contact-cta-featured { grid-column: auto; }
  .whatsapp-fab {
    width: 54px; height: 54px;
    right: max(16px, env(safe-area-inset-right, 0px) + 10px);
    bottom: max(16px, env(safe-area-inset-bottom, 0px) + 10px);
  }
  @supports (-webkit-touch-callout: none) {
    .whatsapp-fab { bottom: max(16px, env(safe-area-inset-bottom, 0px) + 68px); }
  }
  .scroll-top-btn {
    width: 44px; height: 44px;
    left: max(16px, env(safe-area-inset-left, 0px) + 10px);
    bottom: max(16px, env(safe-area-inset-bottom, 0px) + 10px);
  }
  @supports (-webkit-touch-callout: none) {
    .scroll-top-btn { bottom: max(16px, env(safe-area-inset-bottom, 0px) + 68px); }
  }
}
