/* Mobile / tablet overrides for Hausverwaltung Arno Goos prototype */

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

img, svg, video {
  max-width: 100%;
  height: auto;
}

/* JS-driven flag as backup when attribute selectors fail */
html.ag-is-mobile .ag-nav-links,
html.ag-is-mobile .ag-nav-cta {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

html.ag-is-mobile .ag-burger {
  display: grid !important;
  visibility: visible !important;
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

html.ag-is-mobile .ag-nav-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

html.ag-is-mobile .ag-sticky-nav {
  width: 100% !important;
  z-index: 60 !important;
}

html.ag-is-phone .ag-nav-brand-eyebrow {
  display: none !important;
}

html.ag-is-mobile .ag-infobar {
  flex-wrap: wrap !important;
  height: auto !important;
  min-height: 0 !important;
  max-width: 100% !important;
  padding: 8px 12px !important;
  gap: 6px 10px !important;
  font-size: 11px !important;
  letter-spacing: 0.02em !important;
  justify-content: center !important;
  text-align: center !important;
}

html.ag-is-mobile .ag-infobar-mail,
html.ag-is-mobile .ag-infobar-sep-mail,
html.ag-is-mobile .ag-infobar a[href^="mailto:"] {
  display: none !important;
}

/* ---- ≤ 1100px ---- */
@media (max-width: 1100px) {
  body .ag-infobar a[href^="mailto:"],
  body .ag-infobar .ag-infobar-mail,
  body .ag-infobar > a {
    display: none !important;
  }

  /* Hide trailing separator before mail when present */
  body .ag-infobar > span.ag-infobar-sep-mail {
    display: none !important;
  }

  body .ag-infobar {
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: 38px !important;
    padding: 8px 16px !important;
    gap: 6px 10px !important;
    font-size: 11px !important;
  }
}

/* ---- ≤ 900px ---- */
@media (max-width: 900px) {
  /* Sticky nav bar */
  body .ag-nav-inner {
    padding: 0 20px !important;
    gap: 12px !important;
    height: 64px !important;
  }

  body .ag-nav-links,
  body .ag-nav-cta {
    display: none !important;
  }

  body .ag-burger {
    display: grid !important;
  }

  /* Force major grids to one column */
  body div[style*="max-width:1240px"][style*="display:grid"],
  body div[style*="max-width:1240px"] > div[style*="display:grid"],
  body div[style*="grid-template-columns:1.05fr"],
  body div[style*="grid-template-columns:0.85fr"],
  body div[style*="grid-template-columns:1fr 1fr"],
  body div[style*="grid-template-columns:1.15fr"],
  body div[style*="grid-template-columns:1.4fr"],
  body div[style*="grid-template-columns:72px"],
  body div[style*="grid-template-columns:repeat(3,1fr)"],
  body div[style*="grid-template-columns:repeat(4,1fr)"],
  body .ag-force-stack {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  /* Section padding / horizontal gutters */
  body div[style*="padding:128px 40px"],
  body div[style*="padding:104px 40px"],
  body div[style*="padding:112px 40px"],
  body div[style*="padding:96px 40px"],
  body div[style*="padding:88px 40px"],
  body div[style*="padding:72px 40px"],
  body div[style*="padding:72px 40px 56px"],
  body div[style*="max-width:1240px"][style*="padding:"] {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  body div[style*="padding:128px 40px 72px"],
  body div[style*="padding:72px 40px 56px"] {
    padding-top: 48px !important;
    padding-bottom: 40px !important;
  }

  body div[style*="padding:104px 40px"],
  body div[style*="padding:72px 40px 0"] {
    padding-top: 56px !important;
  }

  body div[style*="background:#EDEDE7"][style*="padding:104px"] {
    padding: 64px 20px !important;
  }

  /* Typography */
  body h1[style*="font-size:68px"],
  body h1[style*="font-size:64px"],
  body h1[style*="font-size:78px"] {
    font-size: 40px !important;
    line-height: 1.08 !important;
  }

  body h2[style*="font-size:46px"],
  body h2[style*="font-size:38px"] {
    font-size: 30px !important;
    line-height: 1.12 !important;
  }

  body blockquote[style*="font-size:34px"] {
    font-size: 26px !important;
  }

  /* Hero image height */
  body div[style*="height:580px"] {
    height: 280px !important;
  }

  body div[style*="height:600px"] {
    height: 280px !important;
  }

  body div[style*="height:280px"][style*="border-radius:18px"] {
    height: 200px !important;
  }

  /* Form / contact split cards */
  body div[style*="grid-template-columns:0.85fr 1.15fr"],
  body div[style*="grid-template-columns:1.15fr 0.85fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Footer grid */
  body div[style*="grid-template-columns:1.4fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px !important;
  }

  /* Keep entrance motion tiny on tablet — avoids scroll fight */
  html.ag-motion-ready .ag-reveal,
  html.ag-motion-ready .ag-reveal-child {
    transform: translate3d(0, 8px, 0);
    filter: none;
  }
}

/* ---- ≤ 640px ---- */
@media (max-width: 640px) {
  body .ag-infobar {
    font-size: 11px !important;
    padding: 8px 12px !important;
  }

  body .ag-nav-inner {
    padding: 0 16px !important;
    height: 60px !important;
  }

  body h1[style*="font-size:68px"],
  body h1[style*="font-size:64px"] {
    font-size: 34px !important;
  }

  body h2[style*="font-size:46px"],
  body h2[style*="font-size:38px"] {
    font-size: 26px !important;
  }

  body div[style*="max-width:1240px"] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  body div[style*="padding:48px"],
  body div[style*="padding:56px"],
  body div[style*="padding:64px 72px"],
  body div[style*="padding:56px 64px"] {
    padding: 32px 22px !important;
  }

  body div[style*="grid-template-columns:1.4fr 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  body div[style*="height:56px"],
  body div[style*="height:46px"][style*="border-radius:999px"] {
    min-height: 52px !important;
  }

  /* Map pins: hide secondary labels crowding */
  body .ag-map .ag-label:not(.ag-label-home):not(.ag-label-hover) {
    font-size: 11px !important;
  }

  html.ag-motion-ready .ag-reveal,
  html.ag-motion-ready .ag-reveal-child {
    transform: translate3d(0, 8px, 0);
    filter: none;
  }
}

/* Burger button — hidden on desktop */
.ag-burger {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(10, 10, 10, 0.14);
  background: #fff;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  z-index: 60;
}

.ag-burger span,
.ag-burger span::before,
.ag-burger span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #0a0a0a;
  border-radius: 2px;
  position: relative;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms;
}

.ag-burger span::before,
.ag-burger span::after {
  content: "";
  position: absolute;
  left: 0;
}

.ag-burger span::before { top: -6px; }
.ag-burger span::after { top: 6px; }

body.ag-nav-open .ag-burger span {
  background: transparent;
}
body.ag-nav-open .ag-burger span::before {
  top: 0;
  transform: rotate(45deg);
}
body.ag-nav-open .ag-burger span::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile drawer */
.ag-mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(245, 245, 240, 0.97);
  backdrop-filter: blur(16px);
  padding: 100px 24px 40px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

body.ag-nav-open .ag-mobile-menu {
  display: flex;
}

.ag-mobile-menu a,
.ag-mobile-menu button {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #0a0a0a;
  padding: 14px 4px;
  cursor: pointer;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.ag-mobile-menu a:hover,
.ag-mobile-menu button:hover {
  color: #5b3bc4;
}

.ag-mobile-menu .ag-mobile-cta {
  margin-top: 20px;
  border: 0;
  border-radius: 999px;
  background: #724ce9;
  color: #fff !important;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  padding: 16px 24px;
  min-height: 56px;
}

.ag-mobile-menu .ag-mobile-cta:hover {
  background: #5b3bc4;
  color: #fff !important;
}

body.ag-nav-open {
  overflow: hidden;
}
