/* ============================================================
   Mobile Oven Clean — Cross-Platform QA Fix
   Scope: ALL 505 pages (template-level)
   Breakpoints: 320 · 375 · 390 · 414 · 768 · 1024 · 1280 · 1440 · 1920px
   Browsers: Chrome · Safari · Edge · Firefox
   ============================================================ */

/* ─────────────────────────────────────────────────────────────
   SECTION 1 · GLOBAL RESET — no horizontal scroll on any device
   ───────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

img,
video,
iframe,
svg {
  max-width: 100% !important;
  height: auto;
  display: block;
}

/* ─────────────────────────────────────────────────────────────
   SECTION 2 · iOS INPUT ZOOM PREVENTION
   Safari auto-zooms when input font-size < 16px
   ───────────────────────────────────────────────────────────── */
input,
select,
textarea,
.mob-d-input,
.hf-row input,
.step2-fields input,
.form-group input,
.form-group select,
.form-group textarea,
.mqs-input,
.mqs-select,
.ac-wrap input {
  font-size: 16px !important;
  -webkit-text-size-adjust: 100%;
}

/* ─────────────────────────────────────────────────────────────
   SECTION 3 · Z-INDEX HIERARCHY
   mob-bar     99999  ← always on top
   mob-drawer  99998
   mob-overlay 99997
   modal       9999
   desktop CTA 9990
   header      1000
   ───────────────────────────────────────────────────────────── */
.mob-bar              { z-index: 99999 !important; }
.mob-drawer           { z-index: 99998 !important; }
.mob-overlay          { z-index: 99997 !important; }
#quote-modal-overlay  { z-index: 9999  !important; }
.desktop-sticky-cta   { z-index: 9990  !important; }
header                { z-index: 1000  !important; position: -webkit-sticky; position: sticky; top: 0; }

/* ─────────────────────────────────────────────────────────────
   SECTION 4 · MOBILE STICKY BAR
   Safe-area padding for iPhone notch / Dynamic Island
   Body bottom-padding prevents bar from hiding content
   ───────────────────────────────────────────────────────────── */
.mob-bar {
  padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
}

@media (max-width: 768px) {
  body {
    padding-bottom: max(80px, calc(72px + env(safe-area-inset-bottom))) !important;
  }
}

@media (min-width: 769px) {
  body       { padding-bottom: 0 !important; }
  .mob-bar   { display: none !important; }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 5 · TOUCH TARGETS — minimum 44×44px
   ───────────────────────────────────────────────────────────── */
.mob-bar-call,
.mob-bar-wa,
.mob-bar-quote,
.faq-question,
.mob-city-card,
.mob-town-chip,
.btn {
  min-height: 44px !important;
}

a[href^="tel:"],
a[href*="wa.me"] {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* ─────────────────────────────────────────────────────────────
   SECTION 6 · FIXED-COLUMN GRID COLLAPSE
   Fixes 84 pages with "1fr 320px / 380px / 420px" sidebar layouts
   These are main-content + quote-card grids
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  /* Sidebar grids — collapse to single column on tablet */
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns:1fr 380px"],
  [style*="grid-template-columns:1fr 420px"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns: 1fr 380px"],
  [style*="grid-template-columns: 1fr 420px"],
  .main-content-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 7 · INLINE 2-COL GRID COLLAPSE (mobile)
   Fixes 505 pages with "1fr 1fr" inline SEO content grids
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 8 · 320px — tightest viewport
   ───────────────────────────────────────────────────────────── */
@media (max-width: 360px) {
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .hero h1,
  .hero-content h1,
  .page-hero h1 {
    font-size: 1.2rem !important;
    line-height: 1.25 !important;
  }

  .section-title {
    font-size: 1.1rem !important;
  }

  .mob-bar {
    grid-template-columns: 1fr 1.3fr 1fr !important;
    gap: 5px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .mob-bar-quote {
    font-size: 11px !important;
    padding: 10px 4px !important;
  }

  .mob-bar-lbl {
    font-size: 7px !important;
  }

  .btn {
    font-size: 0.82rem !important;
    padding: 10px 12px !important;
  }

  /* Footer stack to single col */
  footer .footer-grid {
    grid-template-columns: 1fr !important;
  }

  /* Stat items scrollable at 320 */
  .stats-grid {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
  }

  .stat-item {
    min-width: 80px !important;
    flex: 0 0 auto !important;
  }

  /* Service grid 2-col minimum */
  .services-grid,
  .svc-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
  }

  /* No horizontal gap on page-hero badge */
  .page-hero-badge {
    font-size: 0.65rem !important;
    padding: 4px 10px !important;
  }

  /* Hub suburb chips full wrap */
  .hub-suburb-chips,
  .suburbs-grid,
  .postcode-chips {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 9 · 375px–414px — standard iPhone range
   ───────────────────────────────────────────────────────────── */
@media (min-width: 361px) and (max-width: 414px) {
  .container {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  .hero h1,
  .hero-content h1 {
    font-size: 1.45rem !important;
  }

  .page-hero h1 {
    font-size: 1.35rem !important;
  }

  .mob-bar {
    grid-template-columns: 1fr 1.5fr 1fr !important;
    gap: 7px !important;
  }

  /* Stats horizontal scroll */
  .stats-grid {
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  .stats-grid::-webkit-scrollbar {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 10 · 768px — tablet portrait / large phone landscape
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Container padding */
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* No section wider than viewport */
  section,
  .page-hero,
  .trust-strip,
  .marquee-wrap,
  .mid-cta-strip,
  .quote-nudge,
  footer {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* Hero: single column, centred */
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  .hero-form-card {
    display: none !important;
  }

  .hero {
    padding: 28px 0 24px !important;
    overflow: hidden !important;
  }

  /* Nav: hamburger only */
  nav ul,
  .nav-cta {
    display: none !important;
  }

  .hamburger {
    display: flex !important;
  }

  /* Service cards: 2-col */
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .service-img {
    height: 100px !important;
  }

  .service-img img {
    max-width: 72px !important;
    height: 60px !important;
  }

  .service-body h3 {
    font-size: 0.78rem !important;
  }

  .service-body p {
    display: none !important;
  }

  .service-actions {
    grid-template-columns: 1fr !important;
  }

  .service-actions a:not(:first-child) {
    display: none !important;
  }

  /* Why features: 2-col */
  .why-features {
    grid-template-columns: 1fr 1fr !important;
  }

  .why-grid {
    grid-template-columns: 1fr !important;
  }

  /* Process: 1-col */
  .process-grid {
    grid-template-columns: 1fr !important;
  }

  /* BA grid: 1-col */
  .ba-grid,
  .gallery-grid {
    grid-template-columns: 1fr !important;
  }

  .ba-card:not(:first-child) {
    display: none !important;
  }

  /* Reviews: 1-col */
  .reviews-grid {
    grid-template-columns: 1fr !important;
  }

  /* Blog: 1-col */
  .blog-grid {
    grid-template-columns: 1fr !important;
  }

  /* Areas: 1-col */
  .areas-grid {
    grid-template-columns: 1fr !important;
  }

  /* Footer: 2-col then brand full-width */
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }

  .footer-grid > *:first-child {
    grid-column: 1 / -1 !important;
  }

  /* CTA band */
  .cta-inner {
    flex-direction: column !important;
    text-align: center !important;
    align-items: center !important;
  }

  .cta-btns {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .cta-btns .btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* FAQ: single col */
  .faq-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Stats: overflow scroll */
  .stats-grid {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
    padding: 0 4px !important;
  }

  .stats-grid::-webkit-scrollbar {
    display: none !important;
  }

  .stat-item {
    flex: 0 0 auto !important;
    min-width: 90px !important;
  }

  /* Form rows: single col */
  .form-row,
  .hf-row,
  .mob-d-row {
    grid-template-columns: 1fr !important;
  }

  /* Page hero buttons: stacked full-width */
  .page-hero-btns {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .page-hero-btns a,
  .page-hero-btns button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* No desktop sticky CTA on mobile */
  .desktop-sticky-cta {
    display: none !important;
  }

  /* Hero service SVG: hide on mobile */
  .service-hero-img {
    display: none !important;
  }

  /* Hub final content 2-col inline grids */
  [style*="display:grid"][style*="1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Section padding reduction */
  section {
    padding: 44px 0 !important;
  }

  /* Typography */
  .section-title {
    font-size: clamp(1.2rem, 5.5vw, 1.65rem) !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 11 · 1024px — tablet landscape / small laptop
   ───────────────────────────────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {

  /* Hero: single col, centred */
  .hero-grid {
    grid-template-columns: 1fr !important;
    text-align: center;
  }

  .hero-form-card {
    display: none !important;
  }

  .hero-trust,
  .hero-btns {
    justify-content: center !important;
  }

  .hero-sub {
    margin: 0 auto 28px !important;
  }

  /* Nav hamburger shows at 1024 */
  nav ul,
  .nav-cta {
    display: none !important;
  }

  .hamburger {
    display: flex !important;
  }

  /* Desktop sticky button visible */
  .desktop-sticky-cta {
    display: none !important;
  }

  /* Service grid 2-col */
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Process 2-col */
  .process-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .process-grid::before {
    display: none !important;
  }

  /* Reviews 2-col */
  .reviews-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Blog 2-col */
  .blog-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Areas 2-col */
  .areas-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Footer 2-col */
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Stats 2-col */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .stat-item {
    border-right: 1px solid #f0e0ea;
    border-bottom: 1px solid #f0e0ea;
  }

  /* FAQ 1-col */
  .faq-grid {
    grid-template-columns: 1fr !important;
  }

  /* Why grid single col */
  .why-grid {
    grid-template-columns: 1fr !important;
  }

  .why-img-wrap {
    display: none !important;
  }

  /* Sidebar grids collapse (already in section 6, reinforced) */
  .main-content-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 12 · 1280px–1440px — standard desktop
   ───────────────────────────────────────────────────────────── */
@media (min-width: 1025px) and (max-width: 1439px) {
  .container {
    max-width: 1160px !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
  }

  /* Show service hero SVG on desktop */
  .service-hero-img {
    display: flex !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 13 · 1440px+ — large desktop
   ───────────────────────────────────────────────────────────── */
@media (min-width: 1440px) {
  .container {
    max-width: 1280px !important;
  }

  .hero-grid {
    gap: 64px !important;
  }

  section {
    padding: 96px 0 !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 14 · 1920px — 4K / ultra-wide
   ───────────────────────────────────────────────────────────── */
@media (min-width: 1920px) {
  .container {
    max-width: 1440px !important;
  }

  html {
    font-size: 18px;
  }

  .hero h1 {
    font-size: 3.4rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 15 · MODAL — usable at all sizes
   ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #quote-modal-overlay {
    padding: 8px !important;
    align-items: flex-end !important;
  }

  #quote-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 48px) !important;
    border-radius: 18px 18px 0 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #quote-modal-box .quote-card {
    padding: 22px 16px 20px !important;
  }

  .service-picker {
    gap: 6px !important;
  }

  .sp-option {
    flex: 1 1 calc(50% - 6px) !important;
  }

  .extras-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 16 · CTA CONFLICTS — no double Call buttons on mobile
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Hero "Call Now" button hidden — mob-bar has it */
  .hero-btns .hero-btn-call {
    display: none !important;
  }

  /* Hero: stack buttons vertically */
  .hero-btns {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-bottom: 16px !important;
  }

  .hero-btn {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 12px 16px !important;
  }

  /* Final CTA section — full-width stacked */
  .cta-band .cta-btns {
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .cta-band .btn {
    width: 280px !important;
    max-width: 100% !important;
    justify-content: center !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 17 · TYPOGRAPHY — consistent clamp scaling
   ───────────────────────────────────────────────────────────── */
.hero h1,
.hero-content h1 {
  font-size: clamp(1.55rem, 5.5vw, 3.1rem);
  line-height: 1.12;
}

.page-hero h1 {
  font-size: clamp(1.25rem, 5vw, 2.4rem);
  line-height: 1.15;
}

.section-title {
  font-size: clamp(1.4rem, 3.5vw, 2.6rem);
}

/* ─────────────────────────────────────────────────────────────
   SECTION 18 · CROSS-BROWSER SPECIFICS
   ───────────────────────────────────────────────────────────── */

/* Safari: -webkit-sticky */
header {
  position: -webkit-sticky;
  position: sticky;
}

/* Safari / Chrome: smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Firefox: scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #ff2d8f rgba(255,255,255,0.1);
}

/* Safari: backdrop-filter prefix */
#quote-modal-overlay,
.mob-overlay {
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* Chrome/Safari: tap highlight */
a,
button,
.faq-question,
.svc-card,
.mob-bar-call,
.mob-bar-wa,
.mob-town-chip,
.mob-city-card {
  -webkit-tap-highlight-color: transparent;
}

/* Edge / older browsers: flex gap fallback */
.hero-btns {
  gap: 12px;
}

.hero-btns > * + * {
  margin-left: 0;
}

/* Safari: -webkit-fill-available for full-height modals */
#quote-modal-box {
  max-height: calc(100dvh - 32px);
  max-height: -webkit-fill-available;
}

/* ─────────────────────────────────────────────────────────────
   SECTION 19 · FOOTER — correct stacking at all sizes
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  footer {
    padding: 36px 0 14px !important;
  }

  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
    gap: 6px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 20 · HEADER — hamburger + mobile nav
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .nav-wrap {
    height: 60px !important;
  }

  .logo-img {
    height: 40px !important;
  }
}

@media (max-width: 768px) {
  .logo-img {
    height: 36px !important;
  }

  .mobile-nav {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-nav ul li a {
    padding: 14px 16px !important;
    font-size: 1rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 21 · HUB / AREA PAGE SEO SECTIONS
   The inline grid sections added to all 505 area pages
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Service checklist grids on area pages */
  [style*="display:grid;grid-template-columns:1fr 1fr;gap:8px"],
  [style*="display:grid;grid-template-columns:1fr 1fr;gap:7px"],
  [style*="display:grid;grid-template-columns:1fr 1fr;gap:6px"] {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  /* FAQ grid in SEO sections */
  .faq-section .faq-grid {
    grid-template-columns: 1fr !important;
  }

  /* Areas chip grid on suburb pages */
  .suburb-chips,
  .area-chip-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

/* ─────────────────────────────────────────────────────────────
   SECTION 22 · LAZY LOADING — all non-hero images
   ───────────────────────────────────────────────────────────── */
img:not([loading="eager"]):not([data-eager]) {
  content-visibility: auto;
}

/* ─────────────────────────────────────────────────────────────
   SECTION 23 · ACCESSIBILITY / FOCUS
   ───────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid #ff2d8f !important;
  outline-offset: 2px !important;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid #ff2d8f !important;
  border-radius: 4px;
}
