/* ============================================================
   Global Mobile Fixes
   Loaded last to safely override legacy/duplicate layout rules.
   ============================================================ */

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

/* Better defaults for embedded content */
img,
video,
iframe {
  max-width: 100%;
}

/* Keep long content from pushing layout */
.content-card,
.rich-content {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.rich-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {

  .v3-topbar-inner,
  .v3-navbar,
  .v3-footer-main,
  .v3-footer-bottom,
  .v3-footer-cta-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Search button: keep visible, just shrink slightly */
  .v3-nav-actions .v3-icon-btn[aria-label="Search"] {
    display: flex;
  }

  .v3-hero-body {
    padding: 4.5rem 1rem 2.5rem;
  }

  /* Hide arrow buttons on tablet/mobile */
  .v3-arrow {
    display: none;
  }

  /* Hide slide indicators on tablet and mobile */
  .v3-indicators {
    display: none !important;
  }

  /* ── Search overlay: stack input + button on tablet/mobile ── */
  .v3-search-box {
    padding: 0 1rem;
  }
  .v3-search-row {
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: none;
    padding-bottom: 0;
  }
  .v3-search-input {
    flex: 1 1 100%;
    font-size: clamp(1.1rem, 5vw, 1.6rem);
    border-bottom: 2px solid rgba(255,255,255,0.15);
    padding-bottom: 0.5rem;
  }
  .v3-search-submit {
    flex: 1 1 100%;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    border-radius: 8px;
    text-align: center;
    justify-content: center;
  }

  /* ── search.php: stack input + button on tablet/mobile ── */
  .search-form {
    flex-direction: column;
    gap: 0.6rem;
  }
  .search-input {
    flex: 1 1 auto;
    width: 100%;
  }
  .search-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 768px) {

  .section-container,
  .contact-wrapper {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .v3-topbar {
    padding: 0.45rem 0;
  }

  .v3-topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .v3-topbar-left {
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
  }

  .v3-topbar-right {
    display: none;
  }

  .v3-navbar {
    height: 62px;
    gap: 0.75rem;
  }

  .v3-brand img {
    height: 34px;
  }

  .v3-icon-btn {
    width: 34px;
    height: 34px;
  }

  .v3-drawer {
    width: min(88vw, 320px);
    right: -100%;
  }

  .v3-hero {
    min-height: auto;
  }

  .v3-hero-body {
    align-items: flex-start;
    padding: 3.75rem 1rem 2.25rem;
  }

  .v3-hero-content h1 {
    min-height: 0;
  }

  .v3-hero-content p {
    min-height: 0;
    max-width: 100%;
  }

  .v3-feature-strip,
  .v3-stats-grid,
  .v3-team-grid,
  .v3-services-grid,
  .v3-blog-grid,
  .v3-cert-grid,
  .info-grid,
  .map-grid,
  .form-row-2,
  .about-container,
  .quality-container,
  .about-highlights {
    grid-template-columns: 1fr !important;
  }

  .v3-feature-strip {
    gap: 0.9rem;
  }

  .v3-feature-item {
    min-height: auto;
  }

  .contact-page-header,
  .about-page-header {
    padding: 3rem 1rem;
  }

  .offices-col h2,
  .details-col h2,
  .form-section-inner h2,
  .map-section-title {
    font-size: 1.65rem;
    line-height: 1.1;
  }

  .offices-col,
  .details-col,
  .form-section-inner,
  .contact-form-card,
  .map-card {
    padding: 1rem;
  }

  .map-card iframe {
    height: 220px;
  }

  .content-card {
    padding: 1.2rem 1rem;
    border-radius: 14px;
  }

  .detail-page-title {
    line-height: 1.15;
    margin-bottom: 0.9rem;
  }

  .detail-page-meta {
    gap: 0.55rem 0.9rem;
  }

  .detail-page-actions {
    margin-top: 1.4rem;
    padding-top: 1rem;
  }

  .v3-footer-cta {
    padding: 2.5rem 0;
  }

  .v3-footer-cta-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .v3-topbar-left a {
    font-size: 0.7rem;
  }

  .v3-drawer-head,
  .v3-drawer-nav,
  .v3-drawer-footer {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .about-page-header h1,
  .contact-page-header h1 {
    font-size: 1.9rem;
  }

  .hero-btn,
  .btn-primary,
  .btn-submit,
  .success-box a,
  .detail-page-cta,
  .btn-outline-sm {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* ── Services page: full-width cards on small screens ── */
  .services-section {
    padding-left: 0;
    padding-right: 0;
  }

  .services-section .section-container {
    padding-left: 0;
    padding-right: 0;
  }

  .services-grid {
    gap: 0;
  }

  .service-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: 24px 1rem 28px;
  }

  .service-card:first-child {
    border-top: 1.5px solid #e8f2ec;
  }

  .service-media {
    border-radius: 10px;
  }

  /* ── Blog page: full-width cards on small screens ── */
  .blog-section {
    padding-left: 0;
    padding-right: 0;
  }

  .blog-section .section-container {
    padding-left: 0;
    padding-right: 0;
  }

  .blog-grid {
    gap: 0;
  }

  .blog-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    padding: 24px 1rem 28px;
  }

  .blog-card:first-child {
    border-top: 1.5px solid #e8f2ec;
  }

  .blog-img {
    border-radius: 10px;
    overflow: hidden;
  }

  .blog-img img {
    border-radius: 10px;
  }
}