/* ============================================================
   AUTO1SOURCE — RESPONSIVE OVERRIDES
   Load this AFTER style.css on every page.
   Covers: desktop ≥1201 / large-tablet ≤1200 / tablet ≤960 /
           mobile ≤640 / small-mobile ≤420
   ============================================================ */

/* ---------- 0. UNIVERSAL SAFETY NET ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, iframe { max-width: 100%; height: auto; }

/* Body scroll-lock when mobile drawer is open */
body.no-scroll { overflow: hidden !important; }

/* ============================================================
   FOOTER — 4 columns (Contact column removed per client request)
   ============================================================ */
.footer-inner {
  grid-template-columns: 2fr 1fr 1fr 1fr !important;
}
@media (max-width: 1200px) {
  .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr !important; }
}
@media (max-width: 960px) {
  .footer-inner { grid-template-columns: 1fr 1fr !important; }
  .footer-brand { grid-column: 1 / -1 !important; }
}
@media (max-width: 640px) {
  .footer-inner { grid-template-columns: 1fr !important; }
}

/* ============================================================
   MEGA MENU — BIGGER & BOLDER (desktop only, ≥1101px)
   Half-screen width, large fonts, roomy spacing
   ============================================================ */
@media (min-width: 1101px) {
  .mega-menu {
    width: min(1400px, calc(100vw - 4rem)) !important;
    padding: 2.5rem !important;
    padding-top: calc(2.5rem + 6px) !important;
    border-radius: 24px !important;
    box-shadow: 0 30px 90px rgba(0,0,0,0.18), 0 8px 28px rgba(0,0,0,0.1) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: 68px !important;
  }

  /* Match animation to new transform */
  @keyframes dropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
  }

  .mega-inner {
    grid-template-columns: 1fr 1px 1fr 1px 360px !important;
    gap: 0 2.5rem !important;
  }

  .mega-col-label {
    font-size: 14px !important;
    letter-spacing: 0.12em !important;
    margin-bottom: 20px !important;
    padding: 0 12px !important;
    color: #9ca3af !important;
  }

  .mega-row {
    gap: 18px !important;
    padding: 16px 14px !important;
    border-radius: 14px !important;
    margin-bottom: 6px !important;
  }

  .mega-icon {
    width: 56px !important;
    height: 56px !important;
    border-radius: 14px !important;
    font-size: 26px !important;
  }

  .mrt {
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: #111827 !important;
  }

  .mrd {
    font-size: 14.5px !important;
    margin-top: 5px !important;
    line-height: 1.45 !important;
    color: #6b7280 !important;
  }

  .mega-sep { margin: 1.25rem 0 !important; }

  .mega-promo {
    padding: 2rem 1.5rem !important;
    border-radius: 18px !important;
    gap: 14px !important;
  }
  .mega-promo * { font-size: 15px !important; }
  .mega-promo h4,
  .mega-promo strong { font-size: 18px !important; }

  /* Shop-types mega (if it uses shop-mega class) */
  .shop-mega {
    width: min(1200px, calc(100vw - 4rem)) !important;
    padding: 2.5rem !important;
    border-radius: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: 68px !important;
  }
}

/* On smaller laptops 1101–1300 — slightly smaller but still big */
@media (min-width: 1101px) and (max-width: 1300px) {
  .mega-menu { width: min(1150px, calc(100vw - 3rem)) !important; padding: 2rem !important; }
  .mega-inner { grid-template-columns: 1fr 1px 1fr 1px 290px !important; gap: 0 2rem !important; }
  .mega-icon { width: 48px !important; height: 48px !important; font-size: 22px !important; }
  .mrt { font-size: 16px !important; }
  .mrd { font-size: 13.5px !important; }
}

/* ============================================================
   MEGA MENU HOVER BRIDGE
   Keeps menu open when cursor moves from nav link → dropdown
   (prevents "menu closes instantly when I try to click it")
   ============================================================ */
@media (min-width: 1101px) {
  /* Invisible bridge above the mega menu so cursor doesn't leave hover state */
  .mega-menu::before,
  .shop-mega::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
    background: transparent;
  }

  /* Keep nav-item hover-able even in the gap below it */
  .nav-item { padding-bottom: 0px; }
}

/* ============================================================
   NAVBAR LINK ALIGNMENT FIX
   Ensures all links sit on same baseline regardless of chevron or bold
   ============================================================ */
@media (min-width: 1101px) {
  .nav-links {
    align-items: center !important;
    gap: 4px !important;
  }

  .nav-item {
    display: flex !important;
    align-items: center !important;
  }

  /* Every nav link — force identical height, padding, and baseline */
  .nav-link,
  .nav-item > .nav-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 38px !important;
    padding: 0 14px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    color: #333 !important;
  }

  /* Bold "Blogs" link — keep same weight as others to avoid visual jump */
  .nav-link.bold {
    font-weight: 600 !important;
    color: #111 !important;
  }

  /* Chevron arrow — same size as text, proper baseline alignment */
  .chev {
    font-size: 11px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    color: #666 !important;
    margin-top: 1px !important;
    transition: transform 0.2s !important;
  }
}

/* Any fixed-width element gets capped */
[style*="width:1160px"], [style*="width:1400px"], [style*="width:1600px"] {
  max-width: 100% !important;
}

/* Long words / URLs shouldn't break layout */
h1, h2, h3, h4, p, li, a { overflow-wrap: break-word; word-wrap: break-word; }

/* Make <table> elements horizontally scrollable on small screens */
.table-wrap, .pr-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   LARGE TABLET / SMALL LAPTOP  ≤ 1200px
   ============================================================ */
@media (max-width: 1200px) {
  :root { --px: clamp(20px, 4vw, 60px); }

  /* Homepage hero — already partially handled in style.css, just reinforce */
  .hero-inner {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
    padding-top: 110px !important;
    padding-right: var(--px) !important;
  }
  .hero-text { width: 100% !important; max-width: 680px; }

  /* Dark hero (inner pages) */
  .dark-hero-grid { grid-template-columns: 1fr; gap: 40px; }

  /* Pricing page */
  .pr-hero { padding: 130px 40px 80px !important; }
  .pr-plans-wrap, .pr-compare-wrap, .pr-gye-wrap, .pr-faq-wrap, .pr-cta-wrap {
    padding-left: 40px !important; padding-right: 40px !important;
  }

  /* Mobile-app / integrations hero paddings */
  .ma-hero, .integrations-hero { padding-left: 40px !important; padding-right: 40px !important; }

  /* Footer: collapse to 2+1 */
  .footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr !important; gap: 30px !important; }
}

/* ============================================================
   TABLET  ≤ 960px
   ============================================================ */
@media (max-width: 960px) {

  /* --- Typography scale-down --- */
  .hero-text h1 { font-size: clamp(32px, 5.5vw, 48px) !important; }
  .sec-hdr h2, .sec-hdr-left h2,
  .dark-hero h1, .pr-hero h1 { font-size: clamp(26px, 4vw, 34px) !important; }

  /* --- Nav / header already handles via header.html @1100 --- */

  /* --- Hero quote card --- */
  .hero-quote {
    position: static !important;
    margin-top: 28px;
    width: 100% !important;
    max-width: 560px;
  }

  /* --- Generic 2+ column grids → 2 columns --- */
  .feat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .shops-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .integrations-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .benefits-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .vo-grid6 { grid-template-columns: repeat(2, 1fr) !important; }
  .blog-grid3 { grid-template-columns: repeat(2, 1fr) !important; }

  /* --- Pricing plans / compare --- */
  .pr-plans-box { grid-template-columns: 1fr !important; }
  .pr-gye-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .pr-faq-wrap { flex-direction: column !important; gap: 32px !important; }
  .pr-faq-left { flex: none !important; }

  /* Pricing comparison TABLE — horizontal scroll */
  .pr-table,
  table.pr-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .pr-table th, .pr-table td { white-space: normal; }

  /* --- Mobile-app page --- */
  .ma-checks { grid-template-columns: 1fr !important; }
  .ma-conn-grid,
  [class*="ma-"][class*="grid"] { grid-template-columns: 1fr !important; gap: 24px !important; }

  /* --- Generic split / two-column sections --- */
  .split-section,
  .split-section.reverse { flex-direction: column !important; gap: 40px !important; }
  .split-section .visual { width: 100% !important; max-width: 600px; margin: 0 auto; }

  /* --- App showcase --- */
  .app-showcase { flex-direction: column !important; gap: 50px !important; }
  .app-screens { max-width: 400px !important; margin: 0 auto !important; }

  /* --- Footer --- */
  .footer-inner { grid-template-columns: 1fr 1fr !important; }
  .footer-brand { grid-column: 1 / -1 !important; }

  /* --- Pain / More sections --- */
  .pain-grid, .more-grid { flex-direction: column !important; gap: 40px !important; }
  .more-imgs { max-width: 500px !important; margin: 0 auto !important; }

  /* --- Step row --- */
  .steps-row { flex-wrap: wrap !important; gap: 30px 10px !important; justify-content: center !important; }
  .steps-row::before { display: none !important; }
  .step { width: calc(50% - 20px) !important; flex: 0 0 auto !important; }

  /* --- Testimonial --- */
  .t-card { padding: 40px 28px !important; }

  /* --- CTA section --- */
  .cta-sec h2 { font-size: clamp(26px, 4vw, 32px) !important; }

  /* --- Generic inline 2-col grids in employees / vehicleowner etc --- */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   MOBILE  ≤ 640px
   ============================================================ */
@media (max-width: 640px) {
  :root { --px: 18px; }

  /* --- Typography --- */
  body { font-size: 15px; }
  .hero-text h1 { font-size: clamp(28px, 8vw, 36px) !important; letter-spacing: -.5px !important; }
  .hero-sub { font-size: 14.5px !important; margin: 16px 0 22px !important; }
  .sec-hdr h2, .sec-hdr-left h2,
  .dark-hero h1, .pr-hero h1,
  .cta-sec h2, .shop-detail-hero .content h1 {
    font-size: clamp(22px, 6.5vw, 28px) !important;
    line-height: 1.2 !important;
    letter-spacing: -.3px !important;
  }
  .sec-hdr p, .sec-hdr-left p, .page-hero .subtitle {
    font-size: 14.5px !important; line-height: 1.6 !important;
  }

  /* --- Page paddings --- */
  .page-hero, .dark-hero, .shop-detail-hero,
  .pr-hero, .ma-hero, .integrations-hero {
    padding-top: 100px !important;
    padding-bottom: 50px !important;
    padding-left: var(--px) !important;
    padding-right: var(--px) !important;
  }
  .pr-plans-wrap, .pr-compare-wrap, .pr-gye-wrap,
  .pr-faq-wrap, .pr-cta-wrap {
    padding: 48px var(--px) !important;
  }

  /* --- All multi-col grids → single column --- */
  .feat-grid,
  .shops-grid,
  .integrations-grid,
  .benefits-grid,
  .vo-grid6,
  .blog-grid3,
  .pr-gye-grid,
  .ma-checks,
  .dark-hero-grid,
  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Inline-style grids on employees/vehicleowner/shopflow pages */
  [style*="grid-template-columns:repeat(2,1fr)"],
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Pricing table — keep scrollable + tighten --- */
  .pr-table { font-size: 13px !important; }
  .pr-table th, .pr-table td { padding: 10px 12px !important; }

  /* --- Hero-specific homepage --- */
  .hero { padding-top: 0 !important; padding-bottom: 30px !important; min-height: auto !important; }
  .hero-inner { padding-top: 100px !important; gap: 24px !important; }
  .hero-quote { padding: 20px 22px !important; }
  .hero-quote .qt { font-size: 14.5px !important; }

  /* --- Stats row inside pain section --- */
  .pain-stats { flex-wrap: wrap !important; gap: 16px 0 !important; }
  .ps { flex: 0 0 33.33% !important; }
  .ps + .ps::before { display: none !important; }

  /* --- Steps --- */
  .step { width: 100% !important; }

  /* --- CTA buttons stack --- */
  .cta-btns,
  .hero-btns,
  .pr-hero-ctas,
  [class*="cta-row"],
  [class*="btn-row"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .cta-btns button,
  .cta-btns a,
  .hero-btns button,
  .hero-btns a { width: 100% !important; }

  /* --- Testimonial --- */
  .testi-wrap { gap: 10px !important; flex-direction: column !important; align-items: center !important; }
  .t-arr { width: 38px !important; height: 38px !important; font-size: 20px !important; }
  .t-card { padding: 40px 22px 28px 26px !important; }
  .t-card .bq { font-size: 55px !important; left: 12px !important; top: 6px !important; }
  .t-card .tx { font-size: 14.5px !important; line-height: 1.6 !important; }

  /* --- Buttons global shrink --- */
  .btn-navy, .btn-teal, .btn-red, .btn-white,
  .btn-outline, .btn-outline-dark {
    padding: 12px 20px !important;
    font-size: 14px !important;
  }

  /* --- "More" image collage shrink --- */
  .more-imgs { height: 380px !important; max-width: 340px !important; }
  .more-img1 { width: 260px !important; height: 220px !important; }
  .more-img2 { width: 200px !important; height: 175px !important; }

  /* --- Mobile-app screenshots --- */
  [class*="ma-phone"], [class*="ma-screen"] {
    max-width: 280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* --- Header logo slight shrink --- */
  .nav-logo img { height: 38px !important; }
}

/* ============================================================
   SMALL MOBILE  ≤ 420px
   ============================================================ */
@media (max-width: 420px) {
  :root { --px: 14px; }

  .hero-text h1 { font-size: 26px !important; }
  .sec-hdr h2, .sec-hdr-left h2,
  .dark-hero h1, .pr-hero h1 { font-size: 22px !important; }

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

  .pain-stats { flex-direction: column !important; gap: 14px !important; }
  .ps { flex: 1 1 100% !important; }

  .more-imgs { height: 300px !important; max-width: 260px !important; }
  .more-img1 { width: 210px !important; height: 180px !important; }
  .more-img2 { width: 170px !important; height: 145px !important; }

  .t-card { padding: 36px 18px 24px 22px !important; }

  /* Tighten inline-padded sections */
  [style*="padding:60px"], [style*="padding: 60px"] { padding: 40px var(--px) !important; }
  [style*="padding:80px"], [style*="padding: 80px"] { padding: 48px var(--px) !important; }
}

/* ============================================================
   TOUCH-DEVICE TWEAKS
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover-triggered mega menus on touch — they're handled by the drawer */
  .nav-item:hover .mega-menu { display: none; }

  /* Larger tap targets for small buttons */
  .btn-navy, .btn-teal, .btn-red, .btn-white,
  .btn-outline, .btn-outline-dark,
  .nav-cta, a.btn { min-height: 44px; }
}

/* ============================================================
   LANDSCAPE PHONES — prevent tall hero eating whole screen
   ============================================================ */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .hero, .page-hero, .dark-hero, .pr-hero { min-height: auto !important; }
  .hero-inner { padding-top: 90px !important; }
}
