/* ========================================================================
   RESPONSIVE SAFEGUARDS
   Shared finishing layer for every page. Desktop styling remains untouched;
   these rules resolve narrow-screen overflow, touch sizing and reflow.
   ======================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip !important;
  overflow-y: auto !important;
  background-color: #faf8f5 !important;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip !important;
  overflow-y: visible !important;
  background-color: #faf8f5 !important;
  position: relative;
  min-width: 320px;
}

.overflow-x-hidden {
  overflow-x: clip !important;
}

img,
picture,
video,
iframe,
canvas,
svg {
  max-width: 100%;
}

img,
video {
  height: auto;
}

video[height],
video.h-full,
img.h-full {
  height: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
  font: inherit;
}

textarea {
  resize: vertical;
}

/* An intentionally wide data table scrolls inside its own card, never the page. */
main :is(.overflow-hidden, .overflow-x-auto):has(> table) {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

main :is(.overflow-hidden, .overflow-x-auto):has(> table) > table {
  min-width: 540px;
}

/* The blog templates include an older duplicated navigation block. Keep the
   shared header/drawer and suppress only the later duplicate instances. */
body > #mobile-nav ~ #mobile-nav,
body > #main-header ~ #main-header {
  display: none !important;
}

@media (max-width: 767px) {
  html {
    scroll-padding-top: 68px;
  }

  body {
    min-width: 0;
    font-size: 16px;
  }

  /* Compact, always-usable header with an accessible quote action. */
  #main-header nav {
    min-height: 64px;
    padding: .625rem 1rem;
    gap: .625rem;
  }

  #main-header nav > a img {
    height: 38px !important;
    max-width: min(44vw, 178px);
  }

  #main-header a[onclick="openInquiryPopup()"] {
    min-height: 42px;
    padding: .625rem .8rem;
    font-size: .75rem;
  }

  #main-header .quote-cta-label {
    display: none;
  }

  #main-header a[onclick="openInquiryPopup()"]::before {
    content: 'Quote';
  }

  #main-header button[onclick="openMobileNav()"] {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .mobile-nav {
    width: min(88vw, 360px);
    max-width: 100%;
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
  }

  .mobile-link {
    min-height: 48px;
    padding: 13px 18px;
  }

  .mobile-sub-link {
    min-height: 44px;
    padding: 11px 18px 11px 28px;
  }

  /* Typography is fluid instead of desktop-sized on narrow displays. */
  main h1 {
    font-size: clamp(2rem, 8.4vw, 3rem) !important;
    line-height: 1.12 !important;
    overflow-wrap: anywhere;
  }

  main h2 {
    font-size: clamp(1.55rem, 6.5vw, 2.25rem) !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere;
  }

  main h3:not(.faq-q-title) {
    font-size: clamp(1.2rem, 5vw, 1.55rem) !important;
    line-height: 1.25 !important;
  }

  main p,
  main li {
    overflow-wrap: break-word;
  }

  /* Page heroes keep clear of the fixed header without wasting the viewport. */
  main > section:first-child,
  body > section:first-of-type {
    padding-top: max(6.5rem, calc(64px + 2.5rem)) !important;
  }

  #hero-3d-cinematic {
    min-height: auto !important;
    padding-top: 5.75rem !important;
    padding-bottom: 2.5rem !important;
  }

  #hero-3d-cinematic .grid {
    min-height: 0 !important;
  }

  #hero-3d-cinematic .hero-veil,
  #hero-3d-cinematic [class*="bg-gradient-to-r"] {
    background-position: left center;
  }

  /* Primary controls remain comfortably tappable and never escape their row. */
  button,
  input[type="submit"],
  input[type="button"],
  a.inline-flex,
  a.flex {
    min-height: 44px;
  }

  .flex-wrap > a,
  .flex-wrap > button {
    max-width: 100%;
  }

  /* Shared modal and form layout. */
  #inquiryPopup {
    align-items: flex-end;
    padding: .75rem;
  }

  #inquiryPopup > .relative {
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    border-radius: 1.25rem;
  }

  #inquiryPopup .p-6 {
    padding: 1.25rem;
  }

  #inquiryForm .grid.grid-cols-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  form :is(input, select, textarea) {
    min-height: 44px;
  }

  /* Calculator alloy chips are readable as a two-column group on phones. */
  div:has(> .alloy-btn) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Fixed contact actions are replaced by the global bottom action bar on phones. */
  a[aria-label="Contact us on WhatsApp"],
  a[aria-label="Call Us"] {
    display: none !important;
  }

  /* Reserve space so the fixed mobile action bar never covers page content. */
  body {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)) !important;
  }

  footer {
    padding-inline: 1.25rem !important;
  }

  footer .grid {
    gap: 1.75rem;
  }

  footer img {
    max-height: 56px;
  }

  /* Compact Industrial FAQ Section on Mobile */
  #industrial-buyer-faq {
    padding-top: 1.75rem !important;
    padding-bottom: 1.75rem !important;
    padding-inline: 0.875rem !important;
  }
  #industrial-buyer-faq .faq-badge {
    font-size: 10px !important;
    letter-spacing: 0.12em !important;
    padding: 0.25rem 0.65rem !important;
    margin-bottom: 0.5rem !important;
  }
  #industrial-buyer-faq h2 {
    font-size: 1.15rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.35rem !important;
  }
  #industrial-buyer-faq p.faq-intro {
    font-size: 11px !important;
    line-height: 1.4 !important;
    margin-bottom: 0.25rem !important;
  }
  #industrial-buyer-faq .faq-filter-btn {
    font-size: 10.5px !important;
    padding: 0.3rem 0.65rem !important;
    min-height: auto !important;
  }
  #industrial-buyer-faq .faq-item {
    border-radius: 0.75rem !important;
    margin-bottom: 0.35rem !important;
  }
  #industrial-buyer-faq .faq-btn {
    padding: 0.6rem 0.75rem !important;
    gap: 0.5rem !important;
  }
  #industrial-buyer-faq .faq-num {
    width: 1.5rem !important;
    height: 1.5rem !important;
    font-size: 10px !important;
    border-radius: 0.375rem !important;
  }
  #industrial-buyer-faq .faq-q-title {
    font-size: 12.5px !important;
    line-height: 1.3 !important;
    font-weight: 600 !important;
  }
  #industrial-buyer-faq .faq-chevron {
    width: 1.35rem !important;
    height: 1.35rem !important;
  }
  #industrial-buyer-faq .faq-chevron svg {
    width: 0.75rem !important;
    height: 0.75rem !important;
  }
  #industrial-buyer-faq .faq-ans {
    padding: 0.65rem 0.75rem !important;
    font-size: 11.5px !important;
    line-height: 1.45 !important;
  }

  /* Footer on mobile: COMPACT mode — small paddings, small fonts, tight gaps */
  footer {
    padding-top: 1.5rem !important;
    padding-bottom: 1rem !important;
    padding-inline: 1rem !important;
  }
  footer .grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem 1rem !important;
  }
  footer .brand-logo-wrap {
    margin-bottom: 0.5rem !important;
  }
  footer .brand-logo-wrap img {
    height: 2.25rem !important;
  }
  footer .brand-name {
    font-size: 0.95rem !important;
    margin-bottom: 0.35rem !important;
  }
  footer .brand-desc {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.65rem !important;
  }
  footer .brand-socials a {
    width: 2rem !important;
    height: 2rem !important;
    border-radius: 0.5rem !important;
  }
  footer .brand-socials svg {
    width: 0.875rem !important;
    height: 0.875rem !important;
  }
  footer .footer-col-title {
    font-size: 10px !important;
    letter-spacing: 0.12em !important;
    margin-bottom: 0.65rem !important;
  }
  footer .footer-links {
    gap: 0.4rem !important;
    font-size: 11.5px !important;
  }
  footer .footer-links li a {
    font-size: 11.5px !important;
    line-height: 1.3 !important;
  }
  footer .footer-links li {
    line-height: 1.25 !important;
  }
  footer .footer-bottom-bar {
    padding-top: 0.75rem !important;
    gap: 0.4rem !important;
    font-size: 10.5px !important;
  }
  footer .footer-contact-card {
    padding: 0.75rem !important;
  }
  footer .footer-contact-card p,
  footer .footer-contact-card a {
    font-size: 11.5px !important;
  }
  /* Brand + Works full width; Quick + Fleet side by side */
  footer .footer-col-brand,
  footer .footer-col-works {
    grid-column: 1 / -1 !important;
  }
  footer .footer-col-quick {
    grid-column: 1 !important;
  }
  footer .footer-col-fleet {
    grid-column: 2 !important;
  }

/* Expansive decorative elements can cause a one-pixel horizontal scroll. */
  .-left-32,
  .-right-32,
  .-left-24,
  .-right-24,
  .-bottom-24,
  .-top-32 {
    pointer-events: none;
  }
}

/* Tablet footer: same 2-column rhythm as phones (brand + works full width) */
@media (min-width: 768px) and (max-width: 1023px) {
  footer {
    padding-top: 3rem !important;
    padding-inline: 1.75rem !important;
  }
  footer .grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2.5rem 2rem !important;
  }
  footer .footer-col-brand,
  footer .footer-col-works {
    grid-column: 1 / -1 !important;
  }
  footer .footer-col-quick {
    grid-column: 1 !important;
  }
  footer .footer-col-fleet {
    grid-column: 2 !important;
  }
  footer .footer-col-title {
    font-size: 12px !important;
  }
  footer .footer-links,
  footer .footer-links li a {
    font-size: 13px !important;
  }
}

/* Keep the hero video running behind the complete hero on phones and tablets.
   `cover` fills the tall hero instead of leaving a blank area below the video. */
@media (max-width: 1023px) {
  #hero-3d-cinematic #hero-bg-layer {
    object-fit: cover !important;
    object-position: center center !important;
  }
}

@media (max-width: 380px) {
  #main-header nav {
    padding-inline: .75rem;
  }

  #main-header nav > a img {
    height: 34px !important;
    max-width: 39vw;
  }

  #main-header a[onclick="openInquiryPopup()"] {
    padding-inline: .65rem;
  }

  main h1 {
    font-size: clamp(1.8rem, 8.2vw, 2.35rem) !important;
  }

  .grid.grid-cols-2.gap-4,
  .grid.grid-cols-2.gap-5,
  .grid.grid-cols-2.gap-6 {
    gap: .75rem;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  #main-header nav {
    padding-inline: 1.5rem;
  }

  .mobile-nav {
    width: min(62vw, 400px);
  }

  main > section:first-child,
  body > section:first-of-type {
    padding-top: 7.5rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

  /* ---------- About Section Mobile Compact ---------- */
  @media (max-width: 640px) {
    .about-py { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .about-py-sm { padding-top: 1.75rem !important; padding-bottom: 1.75rem !important; }
    .about-h2 { font-size: 1.25rem !important; line-height: 1.3 !important; }
    .about-h3 { font-size: 1.1rem !important; line-height: 1.3 !important; }
    .about-text { font-size: 0.95rem !important; line-height: 1.4 !important; }
    .about-video { height: 280px !important; object-fit: cover !important; }
    .about-grid-cols-4 { grid-template-columns: 1fr !important; }
    .about-grid-cols-2 { grid-template-columns: 1fr !important; }
    .about-p-6 { padding: 1rem !important; }
    .about-p-4 { padding: 0.75rem !important; }
    .about-mb-5 { margin-bottom: 1.5rem !important; }
    .about-mb-3 { margin-bottom: 1rem !important; }
    .about-icon { width: 2rem !important; height: 2rem !important; }
    .about-svg { width: 1.25rem !important; height: 1.25rem !important; }
  }

  /* Reviews: swipeable horizontal row on phones (keeps page short) */
  @media (max-width: 640px) {
    .reviews-scroll {
      display: flex !important;
      grid-template-columns: none !important;
      gap: 0.75rem !important;
      overflow-x: auto;
      scroll-snap-type: x mandatory;
      -webkit-overflow-scrolling: touch;
      padding: 0 0 0.75rem 0 !important;
      scrollbar-width: none;
    }
    .reviews-scroll::-webkit-scrollbar { display: none; }
    .reviews-scroll > * { flex: 0 0 82%; max-width: 82%; scroll-snap-align: start; }
    .reviews-scroll { scroll-padding-left: 0; }
  }

  /* Mobile footer compact + bolder text */
  @media (max-width: 640px) {
    .footer-col-title {
      font-size: 11px !important;
      font-weight: 700 !important;
    }
    .footer-links {
      font-size: 14px !important;
      line-height: 1.4 !important;
    }
    .footer-links li {
      font-weight: 500 !important;
    }
    .footer-bottom-bar {
      font-size: 12px !important;
      font-weight: 500 !important;
    }
  }

  /* Make footer text bigger and bolder on tablets */
  @media (min-width: 641px) and (max-width: 1023px) {
    .footer-col-title {
      font-size: 12px !important;
    }
    .footer-links {
      font-size: 13px !important;
    }
    .footer-bottom-bar {
      font-size: 11px !important;
    }
  }





/* ========================================================================
   HEADER STYLING & Z-INDEX FIX
   ======================================================================== */
#main-header {
  z-index: 9999 !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 4px 20px -5px rgba(2, 132, 199, 0.12) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  backdrop-filter: blur(16px) !important;
}

/* Homepage Hero: transparent only at top of page over the dark video */
body:has(.hero-section) #main-header:not(.scrolled) {
  background: transparent !important;
  background-image: none !important;
  border-bottom: 1px solid transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

#main-header.scrolled {
  z-index: 9999 !important;
  background: rgba(255, 255, 255, 0.96) !important;
  background-image: none !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
  box-shadow: 0 12px 34px -28px rgba(2, 132, 199, 0.55) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  backdrop-filter: blur(16px) !important;
}

/* Drawer sits on the right, so the dividing border belongs on its left edge. */
#mobile-nav.mobile-nav {
  border-right: 0 !important;
  border-left: 1px solid rgba(226, 232, 240, 0.9) !important;
}

/* Keep the close (X) control pinned and always tappable. */
#mobile-nav > div:first-child {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}
#mobile-nav button[aria-label="Close Navigation"] {
  flex: 0 0 auto;
  min-width: 38px;
  min-height: 38px;
}
