/* ==========================================================================
   COVERBOX RESPONSIVE.CSS
   Comprehensive mobile & tablet overrides — desktop untouched
   Breakpoints: 1024px | 768px | 640px | 480px | 375px | 320px
   ========================================================================== */

/* ────────────────────────────────────────────────
   1.  GLOBAL RESETS & OVERFLOW PREVENTION
   ──────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* ────────────────────────────────────────────────
   2.  TABLET — max-width: 1024px
   ──────────────────────────────────────────────── */
@media (max-width: 1024px) {

  /* --- Section spacing --- */
  .section { padding: 60px 0; }

  /* --- Announcement bar --- */
  .announcement-bar { font-size: 0.78rem; padding: 8px 16px; }

  /* --- Two-column hero layouts collapse to single column --- */
  .service-overview-grid,
  .service-hero-split {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* --- Why choose split (industries page, service pages) --- */
  .why-choose-split-layout {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* --- Portfolio featured project --- */
  .featured-project-layout {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  /* --- Portfolio two-column stats --- */
  .portfolio-stats-row {
    grid-template-columns: 1fr 1fr !important;
  }

  /* --- Service page 1.15fr / 0.85fr columns --- */
  [style*="grid-template-columns: 1.15fr 0.85fr"],
  [style*="grid-template-columns: 1.1fr 0.9fr"],
  [style*="grid-template-columns: 1.2fr 0.8fr"],
  [style*="grid-template-columns: 1.3fr 0.7fr"],
  [style*="grid-template-columns: 1.25fr 0.75fr"],
  [style*="grid-template-columns: 1fr 1.3fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 1.4fr 0.6fr"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* --- Industries: 1fr 1fr overview/process --- */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* --- Contact page layout --- */
  .contact-card-layout { grid-template-columns: 1fr !important; gap: 32px !important; }

  /* --- Locations: contact + form --- */
  [style*="grid-template-columns: 1fr 1.3fr"],
  [style*="grid-template-columns: 1.3fr 0.7fr"] {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  /* --- Sticky sidebar release on tablet --- */
  .sticky-sidebar { position: static !important; }

  /* --- Hero font clamp override for tablet --- */
  .hero-text-content h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }

  /* --- Industries/CTA hero h1 --- */
  .section h1[style*="font-size: 3rem"],
  h1[style*="font-size: 3rem"] {
    font-size: clamp(2rem, 4.5vw, 2.75rem) !important;
  }

  h2[style*="font-size: 2.5rem"] {
    font-size: clamp(1.7rem, 4vw, 2.2rem) !important;
  }

  /* --- About page overview 1.1fr 0.9fr --- */
  .about-overview-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ────────────────────────────────────────────────
   3.  TABLET PORTRAIT — max-width: 768px
   ──────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* --- Section spacing --- */
  .section { padding: 48px 0; }

  /* --- Hero buttons stack --- */
  .hero-buttons { flex-direction: column; align-items: center; gap: 12px; }
  .hero-buttons .btn { width: 100%; max-width: 320px; }

  /* --- Section header alignment --- */
  .section-header { text-align: center !important; }
  .section-header h2 { font-size: clamp(1.5rem, 4vw, 2rem); }
  .section-desc { margin-left: auto; margin-right: auto; }

  /* --- Service page overview split (contact info + form) --- */
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Blog layout --- */
  .blog-layout-grid { grid-template-columns: 1fr !important; gap: 36px !important; }

  /* --- Details layout (blog single, portfolio single) --- */
  .details-layout-grid { grid-template-columns: 1fr !important; gap: 32px !important; }

  /* --- Portfolio: secondary stats row (1fr 1fr) --- */
  [style*="grid-template-columns: 1fr 1fr; gap: 20px"],
  [style*="grid-template-columns: 1fr 1fr; border-bottom"] {
    grid-template-columns: 1fr !important;
  }

  /* --- CTA buttons in service pages --- */
  .cta-buttons-row {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }
  .cta-buttons-row .btn { width: 100%; max-width: 320px; }

  /* --- Testimonial stars / quote layout --- */
  .testimonials-card-grid { grid-template-columns: 1fr !important; }

  /* --- Breadcrumbs: prevent overflow --- */
  .breadcrumbs-list { flex-wrap: wrap; gap: 4px; }

  /* --- Hero image hide on tablet --- */
  .hero-visual-card { display: none; }

  /* --- Announcement bar text truncate --- */
  .announcement-bar span {
    display: block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: calc(100vw - 60px);
  }

  /* --- Nav logo on tablet --- */
  .nav-logo-img { height: 34px !important; }

  /* --- footer grid --- */
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 28px !important; }

  /* --- Industries/CTA hero h1 big sizes --- */
  h1[style*="font-size: 3rem"],
  h1[style*="font-size: 2.8rem"] {
    font-size: clamp(1.8rem, 5vw, 2.4rem) !important;
  }
  h2[style*="font-size: 2.5rem"] {
    font-size: clamp(1.5rem, 4vw, 2rem) !important;
  }
  h2[style*="font-size: 2rem"] {
    font-size: clamp(1.4rem, 3.5vw, 1.8rem) !important;
  }
  h3[style*="font-size: 1.8rem"],
  h3[style*="font-size: 1.5rem"] {
    font-size: clamp(1.2rem, 3vw, 1.5rem) !important;
  }

  /* --- Search results grid --- */
  [style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Back to top button --- */
  .back-to-top { bottom: 16px; right: 16px; }

  /* --- Locations: remove side-by-side form layout --- */
  [style*="grid-template-columns: 1fr 1.3fr; gap: 40px"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* --- Inline quick-stats strip (two-col) on portfolio --- */
  [style*="grid-template-columns: 1fr 1fr; border-bottom: 1px solid"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* --- Portfolio load more container --- */
  .portfolio-load-more-container { text-align: center; }
}

/* ────────────────────────────────────────────────
   4.  MOBILE LANDSCAPE — max-width: 640px
   ──────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* --- Section spacing --- */
  .section { padding: 40px 0; }
  .section[style*="padding: 80px 0"] { padding: 48px 0 !important; }
  .section[style*="padding: 100px 0"] { padding: 56px 0 !important; }

  /* --- Footer --- */
  .footer-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 12px; }
  .footer-bottom-links { justify-content: center; flex-wrap: wrap; }
  .footer { padding: 48px 0 24px !important; }

  /* --- Hero section --- */
  .hero-section { padding: clamp(40px, 8vw, 60px) 0; }
  .hero-text-content h1 { font-size: clamp(1.7rem, 7vw, 2.4rem); }
  .hero-desc { font-size: 0.95rem; }

  /* --- Service page hero CTA row buttons --- */
  div[style*="margin-top: 32px"] .btn,
  div[style*="margin-top: 32px;"] .btn {
    margin-right: 0 !important;
    margin-bottom: 12px;
    display: block;
    width: 100%;
    text-align: center;
  }

  /* --- All inline grids collapse --- */
  [style*="grid-template-columns: 1.15fr 0.85fr"],
  [style*="grid-template-columns: 1.1fr 0.9fr"],
  [style*="grid-template-columns: 1.2fr 0.8fr"],
  [style*="grid-template-columns: 1.3fr 0.7fr"],
  [style*="grid-template-columns: 1.25fr 0.75fr"],
  [style*="grid-template-columns: 1fr 1.3fr"],
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 1.4fr 0.6fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
  }

  /* --- Navigation hamburger target --- */
  .nav-hamburger { min-width: 44px; min-height: 44px; }

  /* --- Nav logo --- */
  .nav-logo-img { height: 30px !important; }

  /* --- Mobile menu body padding --- */
  .mobile-menu-body { padding: 16px 20px 24px; }
  .mobile-dropdown-item { font-size: 0.95rem; padding: 6px 0; min-height: 44px; display: flex; align-items: center; }
  .mobile-dropdown-toggle { min-height: 44px; }

  /* --- Contact details grid --- */
  .contact-details-grid { grid-template-columns: 1fr !important; }

  /* --- Cards --- */
  .card { padding: 20px; }

  /* --- Why choose grid (automation page) --- */
  .automation-why-choose-grid { grid-template-columns: 1fr !important; }
  .automation-why-choose { padding: 56px 0 !important; }

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

  /* --- Process timeline 4 steps --- */
  .timeline-4-steps { grid-template-columns: 1fr !important; }

  /* --- Services grid on service page --- */
  .grid-3-col { grid-template-columns: 1fr !important; }
  .grid-4-col { grid-template-columns: 1fr 1fr !important; }

  /* --- FAQ question button --- */
  .faq-question { font-size: 0.95rem; padding: 14px 16px; }
  .faq-answer p { padding: 0 16px 16px; }

  /* --- Section tags / badges --- */
  .section-tag { font-size: 0.68rem; }

  /* --- Pagination --- */
  .pagination { flex-wrap: wrap; gap: 6px; justify-content: center; }
  .pagination .page-numbers { min-width: 36px; height: 36px; font-size: 0.82rem; }

  /* --- Portfolio card --- */
  .portfolio-grid { grid-template-columns: 1fr !important; }

  /* --- Showcase grid --- */
  .showcase-grid { grid-template-columns: 1fr !important; }

  /* --- Portfolio stats bar --- */
  .portfolio-stats-bar { flex-direction: column; }
  .portfolio-stat-item { border-right: none; border-bottom: 1px solid var(--border-color); }
  .portfolio-stat-item:last-child { border-bottom: none; }

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

  /* --- Portfolio before/after comparison grid --- */
  .transformation-split-grid {
    grid-template-columns: 1fr !important;
  }
  .transformation-split-grid > div:first-child {
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
  }

  /* --- Inline font size overrides --- */
  h1[style*="font-size: 3rem"],
  h1[style*="font-size: 2.8rem"],
  h1[style*="font-size: 2.5rem"] {
    font-size: clamp(1.6rem, 6vw, 2.2rem) !important;
    line-height: 1.25 !important;
  }
  h2[style*="font-size: 2.5rem"],
  h2[style*="font-size: 2.2rem"],
  h2[style*="font-size: 2rem"] {
    font-size: clamp(1.4rem, 5vw, 1.9rem) !important;
  }

  /* --- Announcement bar --- */
  .announcement-bar { display: none; } /* hide on very small to prevent overflow */

  /* --- CTA section buttons --- */
  section[style*="background-color: var(--primary)"] .btn {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 8px auto !important;
    text-align: center;
  }

  /* --- Buttons full width in small hero areas --- */
  .mobile-full-btn { width: 100% !important; }
}

/* ────────────────────────────────────────────────
   5.  MOBILE PORTRAIT — max-width: 480px
   ──────────────────────────────────────────────── */
@media (max-width: 480px) {

  /* --- Container padding --- */
  :root { --container-padding: 16px; }

  /* --- Section spacing --- */
  .section { padding: 32px 0; }

  /* --- Hero extra-small --- */
  .hero-text-content h1 { font-size: clamp(1.5rem, 8vw, 2rem); }
  .hero-desc { font-size: 0.9rem; }

  /* --- All buttons at least 44px touch targets --- */
  .btn { min-height: 48px; padding: 11px 20px; }

  /* --- Cards tighter padding --- */
  .card { padding: 16px; }

  /* --- Industries grid on home --- */
  .industries-card-grid { grid-template-columns: 1fr 1fr !important; }

  /* --- Nav hamburger target --- */
  .nav-hamburger { width: 44px; height: 44px; }

  /* --- Grid-4-col single column --- */
  .grid-4-col { grid-template-columns: 1fr !important; }

  /* --- Platform grid single column --- */
  .platform-grid { grid-template-columns: 1fr 1fr !important; }

  /* --- Automation why choose grid --- */
  .automation-why-choose-grid { grid-template-columns: 1fr !important; }

  /* --- Form inputs clearly spaced --- */
  .form-group { margin-bottom: 16px; }
  .form-input { padding: 12px 14px; font-size: 16px !important; } /* 16px prevents iOS zoom */

  /* --- Footer social icons --- */
  .footer-social-links { gap: 12px; }
  .footer-social-links a { width: 40px; height: 40px; }
}

/* ────────────────────────────────────────────────
   6.  MOBILE SMALL — max-width: 375px
   ──────────────────────────────────────────────── */
@media (max-width: 375px) {

  /* --- Tightest section spacing --- */
  .section { padding: 28px 0; }

  /* --- Hero --- */
  .hero-text-content h1 { font-size: clamp(1.4rem, 8.5vw, 1.8rem); }

  /* --- Industries cards: 1 col on smallest devices --- */
  .industries-card-grid { grid-template-columns: 1fr !important; }

  /* --- Nav logo + hamburger compact --- */
  .nav-logo-img { height: 26px !important; }
  .navbar-inner { gap: 8px; }
  .nav-actions { gap: 8px; }

  /* --- Button text wrap prevention --- */
  .btn { white-space: nowrap; font-size: 0.85rem; }

  /* --- Announcement bar completely hidden --- */
  .announcement-bar { display: none !important; }

  /* --- Mobile menu: full height, side padding compact --- */
  .nav-mobile-menu { padding: 90px 16px 32px; }
  .mobile-menu-body { padding: 12px 16px 24px; }
}

/* ────────────────────────────────────────────────
   7.  EXTRA SMALL — max-width: 320px
   ──────────────────────────────────────────────── */
@media (max-width: 320px) {

  /* --- Hero --- */
  .hero-text-content h1 { font-size: 1.35rem; }
  .hero-desc { font-size: 0.85rem; }

  /* --- Buttons fit single column --- */
  .btn { padding: 10px 16px; font-size: 0.82rem; }

  /* --- Cards no padding bloat --- */
  .card { padding: 14px; border-radius: 10px; }

  /* --- All grids collapse --- */
  .grid-4-col,
  .grid-3-col,
  .industries-card-grid,
  .platform-grid,
  .automation-why-choose-grid,
  .timeline-4-steps,
  .portfolio-grid,
  .showcase-grid,
  .testimonials-card-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ────────────────────────────────────────────────
   8.  INDUSTRY-SPECIFIC TEMPLATE FIXES
   ──────────────────────────────────────────────── */

/* Industries Page (single-industries.php) */
@media (max-width: 768px) {
  /* Overview + Challenges two-column */
  .industries-overview-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Process + Why Choose Us two-column */
  .industries-process-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
}

/* Locations Page (single-locations.php) */
@media (max-width: 768px) {
  .locations-contact-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .locations-quick-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }
}

/* Portfolio Single Page */
@media (max-width: 768px) {
  .portfolio-detail-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
}

/* About Page */
@media (max-width: 768px) {
  .about-overview-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
}

/* Contact Page */
@media (max-width: 768px) {
  .contact-card-layout {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
}

/* Services List Page */
@media (max-width: 768px) {
  .services-list-hero-split {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
}

/* ────────────────────────────────────────────────
   9.  FOCUS & ACCESSIBILITY
   ──────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* WCAG min touch target for interactive elements */
button, a, [role="button"] {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Exception: inline text links */
p a, li a, label a, .breadcrumbs-item a, .nav-mobile-link {
  min-height: unset;
  display: inline;
}

/* ────────────────────────────────────────────────
   10.  MOBILE MENU POLISH
   ──────────────────────────────────────────────── */

/* Ensure mobile menu backdrop blur works */
.nav-mobile-menu {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Mobile dropdown items: generous touch targets */
.mobile-dropdown-item {
  min-height: 44px;
  display: flex !important;
  align-items: center;
  padding: 6px 0;
}

/* Mobile nav links: generous touch targets */
.nav-mobile-link {
  min-height: 48px;
  display: flex !important;
  align-items: center;
}

/* Mobile nav CTA button full width */
@media (max-width: 992px) {
  .mobile-menu-cta .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
  }
}

/* ────────────────────────────────────────────────
   11.  IMAGE SAFETY
   ──────────────────────────────────────────────── */
.hero-visual-img,
.service-hero-img,
.portfolio-card-img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

/* Images in cards should never overflow */
.card img, .automation-card img {
  max-width: 100%;
  height: auto;
}

/* ────────────────────────────────────────────────
   12.  PRINT SAFETY (prevent print layout breaks)
   ──────────────────────────────────────────────── */
@media print {
  .navbar, .footer, .announcement-bar, .back-to-top, .mobile-menu-close { display: none !important; }
  .container { max-width: 100%; padding: 0; }
}
