/* ============================================================
   Magical Pest Control — Responsive + Mobile App Nav
   ============================================================ */

/* ---------- Mobile slide-in drawer (hidden on desktop) ---------- */
.mobile-drawer {
  position: fixed; inset: 0; z-index: 520; visibility: hidden; pointer-events: none;
}
.mobile-drawer .backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s; }
.mobile-drawer .panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(380px, 88vw);
  background: #fff; box-shadow: var(--shadow-lg); transform: translateX(100%);
  transition: transform .35s var(--ease); display: flex; flex-direction: column; overflow-y: auto;
}
.mobile-drawer.open { visibility: visible; pointer-events: auto; }
.mobile-drawer.open .backdrop { opacity: 1; }
.mobile-drawer.open .panel { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.2rem; border-bottom: 1px solid var(--line); position: sticky; top:0; background:#fff; z-index:2; }
.drawer-body { padding: 1rem 1.2rem 2rem; }
.drawer-cta { display:grid; gap:.6rem; margin: 1rem 0 1.4rem; }
.m-acc { border-bottom: 1px solid var(--line-soft); }
.m-acc > button, .m-link {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap:.6rem;
  padding: .95rem .2rem; font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: var(--ink); text-align:left;
}
.m-link .mpc-icon { color: var(--violet); }
.m-acc > button .chev { transition: transform .3s; color: var(--muted); }
.m-acc.open > button .chev { transform: rotate(180deg); }
.m-sub { max-height: 0; overflow: hidden; transition: max-height .35s var(--ease); }
.m-acc.open .m-sub { max-height: 800px; }
.m-sub a { display: flex; align-items:center; gap:.6rem; padding: .6rem .2rem .6rem 1rem; color: var(--slate); font-size: .98rem; }
.m-sub a:hover { color: var(--violet-700); }
.m-sub a .mpc-icon { width:17px; height:17px; color: var(--violet); }
.drawer-contact { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); display:grid; gap:.7rem; }
.drawer-contact a { display:flex; gap:.6rem; align-items:center; color: var(--slate); font-weight:500; }
.drawer-contact a .mpc-icon { color: var(--teal-600); }
.drawer-socials { display:flex; gap:.6rem; margin-top:1rem; }
.drawer-socials a { width:40px; height:40px; border-radius:50%; background:var(--bg-soft); display:grid; place-items:center; color:var(--slate); }
.drawer-socials a:hover { background: var(--violet-50); color: var(--violet-700); }

/* ---------- App-style bottom nav (5 equal buttons, mobile only) ---------- */
.app-nav {
  display: none;                 /* shown as flex at <=768px (see breakpoint) */
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 450;
  height: 64px;
  background: rgba(255,255,255,.93); backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--glass-border); box-shadow: 0 -8px 30px rgba(31,38,135,.12);
  align-items: stretch; justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}
.app-nav .app-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; cursor: pointer; text-decoration: none;
  color: var(--muted); font-size: .66rem; font-weight: 600; font-family: var(--font-head);
  transition: color .2s, transform .2s;
}
.app-nav .app-link .mpc-icon { width: 22px; height: 22px; transition: transform .2s; }
.app-nav .app-link:active { transform: scale(.9); }
.app-nav .app-link.active { color: var(--violet); }
.app-nav .app-link.active .mpc-icon { transform: translateY(-2px); }

/* ---------- Breakpoints ---------- */

/* hide the inline call CTA when the bar gets tight (the phone is still in the
   top bar, and the dock/drawer cover smaller screens) */
@media (max-width: 1260px){
  .nav-cta-call, .nav-cta-contact { display: none; }
}
@media (max-width: 1080px){
  .nav-link { padding: .55rem .6rem; font-size: .92rem; }
  .hero-visual { min-height: 380px; }
}

/* ============================================================
   APP-STYLE SHELL — turns on at <=1024px
   Covers EVERY phone AND iPad portrait. The top bar + desktop
   nav give way to a floating frosted "pill" header (search +
   hamburger) and a fixed 5-button bottom dock — the
   antigravity prototype's native-app feel, at any size.
   ============================================================ */
@media (max-width: 1024px){
  :root { --header-h: 68px; }

  /* swap desktop chrome for app chrome */
  .topbar { display: none; }
  .nav-menu { display: none; }
  .nav-toggle { display: grid; }
  .mega { display: none; }
  .app-nav { display: flex; }
  body { padding-bottom: 74px; }            /* room for the dock */

  /* the header floats as a rounded frosted pill */
  .site-header, .site-header.scrolled {
    background: transparent !important; box-shadow: none !important;
    border-bottom: none !important; position: sticky; top: 0;
  }
  .site-header > .container { padding-top: 10px; padding-bottom: 2px; }
  .navbar {
    min-height: 56px; padding: 0 .85rem;
    background: rgba(255,255,255,.82);
    -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
    border: 1px solid var(--glass-border); border-radius: 18px;
    box-shadow: 0 10px 30px rgba(31,38,135,.14);
  }
  .brand-name { font-size: 1.05rem; }
  .brand-mark { width: 38px; height: 38px; }
  .nav-actions { gap: .4rem; }

  /* the dock reads as an app tab-bar */
  .app-nav { border-radius: 20px 20px 0 0; height: 66px; }

  /* float the chat / back-to-top / cookie widgets above the dock */
  .chat-launcher { bottom: calc(80px + env(safe-area-inset-bottom)); right: 16px; }
  .chat-window   { bottom: calc(150px + env(safe-area-inset-bottom)); right: 12px; }
  .to-top        { bottom: calc(80px + env(safe-area-inset-bottom)); left: 16px; }
  .cookie-banner { bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
}

/* on roomy tablets, group the dock buttons toward the centre
   instead of stretching them edge-to-edge */
@media (min-width: 620px) and (max-width: 1024px){
  .app-nav { padding-left: 8%; padding-right: 8%; }
}

/* ---------- content reflow (independent of the app shell) ---------- */
@media (max-width: 980px){
  .topbar-left { gap: 1rem; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { min-height: 340px; order: -1; }
  .with-aside { grid-template-columns: 1fr; }
  .aside-card { position: static; }
  .content-split { grid-template-columns: 1fr; }
  .content-split.reverse > :first-child { order: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.6rem; }
  .pest-grid { grid-template-columns: repeat(4,1fr); }
}

@media (max-width: 768px){
  body { font-size: 16px; }
  .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .stats-band { grid-template-columns: repeat(2,1fr); }
  .steps { grid-template-columns: 1fr 1fr; gap: 1.2rem; }
  .contact-methods { grid-template-columns: 1fr; }
  .pest-grid { grid-template-columns: repeat(3,1fr); }
  .chat-launcher { width: 56px; height: 56px; }
  .chat-launcher .mpc-icon { width: 26px; height: 26px; }
  .chat-window { bottom: calc(146px + env(safe-area-inset-bottom)); right: 8px; left: 8px; width: auto; height: min(70vh, 560px); }
  /* keep the hero image compact on phones so it doesn't push the bottom dock off-screen */
  .hero-card-main { width: min(72%, 320px); }
}
@media (max-width: 480px){
  .hero-card-main { width: min(64%, 260px); }
}

@media (max-width: 560px){
  :root { --gutter: 1.1rem; }
  h1 { font-size: clamp(1.9rem, 8vw, 2.4rem); }
  .stats-band { grid-template-columns: 1fr 1fr; }
  .pest-grid { grid-template-columns: repeat(2,1fr); }
  .field-row { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .btn-row .btn { width: 100%; }
  .hero-trust { font-size: .82rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom .container { flex-direction: column; align-items: flex-start; }
  .marquee-track { gap: 1.6rem; }
}

/* larger screens: roomier hero */
@media (min-width: 1280px){
  .section { padding: 6.5rem 0; }
}
