/**
 * Custom Footer Responsive Overrides (Named Grid Areas)
 * Package: Salient Theme Customization
 */

/* ==========================================================================
   Base Grid & Clearfix Resets
   ========================================================================== */

/* Disable clearfix pseudo-elements so CSS Grid counts only .col elements */
#footer-widgets .container .row::before,
#footer-widgets .container .row::after {
  display: none !important;
  content: none !important;
}

#footer-widgets .container {
  max-width: min(1400px, 92vw) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
}

#footer-widgets .container .row > .col {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  float: none !important;
  box-sizing: border-box !important;
}

/* ==========================================================================
   Named Grid Area Assignments (Element-Order Independent)
   ========================================================================== */

/* 1. Logo & About Column */
#footer-widgets .container .row > .col:has(img),
#footer-widgets .container .row > .col:has(.widget_text:first-child) {
  grid-area: logo !important;
}

/* 2. Explore Column (Shifted slightly to the right) */
#footer-widgets .container .row > .col:has(.widget_nav_menu:first-of-type),
#footer-widgets .container .row > .col:has(a[href*="explore"]) {
  grid-area: explore !important;
  justify-self: center !important;
  padding-left: 20px !important;
}

/* 3. Services Column (Shifted slightly to the right) */
#footer-widgets .container .row > .col:has(.widget_nav_menu:last-of-type),
#footer-widgets .container .row > .col:has(a[href*="service"]) {
  grid-area: services !important;
  justify-self: center !important;
  padding-left: 20px !important;
}

/* 4. Contact Form Column */
#footer-widgets .container .row > .col:has(form),
#footer-widgets .container .row > .col:has(.wpcf7),
#footer-widgets .container .row > .col:has(input[type="submit"]) {
  grid-area: form !important;
}

/* ==========================================================================
   Desktop (1200px and wider)
   ========================================================================== */
@media only screen and (min-width: 1200px) {
  #footer-widgets .container .row {
    display: grid !important;
    grid-template-areas: "logo explore services form" !important;
    grid-template-columns: 1.35fr 0.85fr 0.85fr 1.35fr !important;
    gap: clamp(24px, 3vw, 48px) !important;
    align-items: start !important;
  }
}

/* ==========================================================================
   Tablet (768px – 1199px)
   ========================================================================== */
@media only screen and (min-width: 768px) and (max-width: 1199px) {
  #footer-widgets .container .row {
    display: grid !important;
    grid-template-areas:
      "logo form"
      "explore services" !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px 32px !important;
    align-items: start !important;
  }
}

/* ==========================================================================
   Mobile (Below 768px)
   ========================================================================== */
@media only screen and (max-width: 767px) {
  #footer-outer {
    overflow-x: hidden !important;
  }

  #footer-widgets .container .row {
    display: flex !important;
    flex-direction: column !important;
    gap: 32px !important;
  }

  #footer-widgets input[type="text"],
  #footer-widgets input[type="email"],
  #footer-widgets input[type="tel"],
  #footer-widgets textarea,
  #footer-widgets select,
  #footer-widgets button,
  #footer-widgets input[type="submit"] {
    width: 100% !important;
    box-sizing: border-box !important;
  }
}
