/*
  ELX Energy spacing control layer.
  Loaded after typography to normalize vertical rhythm, reduce empty air,
  and remove duplicate divider lines across key templates.
*/

:root {
  --space-2xs: clamp(0.375rem, 0.3rem + 0.2vw, 0.5rem);
  --space-xs: clamp(0.625rem, 0.5rem + 0.3vw, 0.875rem);
  --space-sm: clamp(0.875rem, 0.7rem + 0.45vw, 1.125rem);
  --space-md: clamp(1.25rem, 1rem + 0.7vw, 1.75rem);
  --space-lg: clamp(1.75rem, 1.3rem + 1.1vw, 2.5rem);
  --space-xl: clamp(2.5rem, 1.8rem + 1.8vw, 3.75rem);
  --space-2xl: clamp(3.25rem, 2.2rem + 2.8vw, 5.5rem);
  --space-section: clamp(3.25rem, 2.45rem + 2.35vw, 5.25rem);
  --line-soft: rgba(43, 49, 55, 0.11);
}

main {
  overflow-x: clip;
}

/* Global section rhythm. */
.section-head {
  margin-bottom: var(--space-lg) !important;
}

.section-head h2 {
  margin-bottom: var(--space-sm) !important;
}

.section-head p {
  margin-top: 0 !important;
}

.deep,
.deep-band,
.trust,
.manifest,
.seo-faq,
section[id],
body:has(.shop-layout) main > section {
  scroll-margin-top: 96px;
}

/* Homepage keeps presence but loses the excessive vertical drift. */
.home-page .hero {
  padding-top: clamp(1.5rem, 3.2vw, 2.75rem) !important;
  padding-bottom: clamp(2rem, 4vw, 3.35rem) !important;
}

.home-page .section-head {
  margin-bottom: clamp(1.75rem, 3vw, 2.75rem) !important;
}

.home-page .deep-band,
.home-page .seo-faq,
.home-page #packages,
.home-page #projects,
.home-page #benefits,
.home-page .install-section {
  padding-top: var(--space-section) !important;
  padding-bottom: var(--space-section) !important;
}

/* Category/catalog pages are dense shopping surfaces. */
body:has(.shop-layout):not(.home-page) main,
body:has(.catalog-hero) main {
  padding-top: clamp(1.75rem, 3.6vw, 3rem) !important;
}

body:has(.shop-layout):not(.home-page) .hero,
body:has(.catalog-hero) .catalog-hero {
  padding-top: clamp(2rem, 3.6vw, 3.25rem) !important;
  padding-bottom: clamp(1.875rem, 3.4vw, 2.875rem) !important;
}

body:has(.shop-layout):not(.home-page) .shop-layout,
body:has(.catalog-hero) .catalog-tools,
body:has(.catalog-hero) .catalog-featured-grid {
  margin-top: var(--space-lg) !important;
}

body:has(.shop-layout) .shop-grid,
.catalog-featured-grid {
  gap: clamp(1rem, 1.6vw, 1.5rem) !important;
}

body:has(.shop-layout) .shop-card,
.catalog-featured-grid .shop-card {
  padding: clamp(1.125rem, 1.85vw, 1.625rem) !important;
}

body:has(.shop-layout) .product-card-image,
.catalog-featured-grid .product-card-image {
  margin-top: clamp(1rem, 2vw, 1.75rem) !important;
  margin-bottom: clamp(1.25rem, 2.2vw, 2rem) !important;
}

/* Product detail pages: reduce vertical voids and duplicate divider lines. */
body:has(.product-layout) main,
body:has(.product-layout) main:has(.product-layout) {
  padding-top: clamp(1.5rem, 2.5vw, 2.25rem) !important;
  padding-bottom: clamp(2.5rem, 4.2vw, 4rem) !important;
}

body:has(.product-layout--wide-detail) .product-topline {
  margin-bottom: var(--space-sm) !important;
}

body:has(.product-layout--wide-detail) .product-layout--wide-detail {
  column-gap: clamp(2rem, 3.2vw, 3.5rem) !important;
  row-gap: var(--space-lg) !important;
}

body:has(.product-layout--wide-detail) .gallery {
  gap: var(--space-sm) !important;
}

body:has(.product-layout--wide-detail) .gallery-main {
  min-height: clamp(23rem, 35vw, 30rem) !important;
}

body:has(.product-layout--wide-detail) .product-layout--wide-detail h1 {
  margin-bottom: var(--space-sm) !important;
}

body:has(.product-layout--wide-detail) .product-layout--wide-detail .badges {
  margin-bottom: var(--space-md) !important;
}

body:has(.product-layout--wide-detail) .product-layout--wide-detail .price {
  margin-top: var(--space-sm) !important;
  margin-bottom: var(--space-md) !important;
}

body:has(.product-layout--wide-detail) .product-layout--wide-detail .actions {
  margin-bottom: var(--space-sm) !important;
}

body:has(.product-layout--wide-detail) .product-layout--wide-detail .bundle-highlight {
  margin-top: 0 !important;
  margin-bottom: var(--space-md) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections {
  gap: var(--space-sm) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .section-tabs,
body:has(.product-layout) .section-tabs {
  padding-top: 0 !important;
  padding-bottom: var(--space-xs) !important;
  margin-bottom: 0 !important;
  border-top: 0 !important;
  border-bottom: 0 !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .section-card {
  padding: clamp(1.125rem, 1.75vw, 1.625rem) !important;
  border-top: 1px solid var(--line-soft) !important;
  border-bottom: 0 !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections #description p {
  margin-top: 0 !important;
  margin-bottom: var(--space-sm) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections #description h3 {
  margin-top: var(--space-md) !important;
  margin-bottom: var(--space-xs) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections #description ul {
  margin-top: var(--space-xs) !important;
  margin-bottom: var(--space-md) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .spec-panel {
  border-top: 1px solid var(--line-soft) !important;
  border-bottom: 0 !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .spec-row {
  padding: clamp(0.65rem, 1vw, 0.95rem) 0 !important;
  border-top: 1px solid var(--line-soft) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .spec-row:first-child {
  border-top: 0 !important;
}

body:has(.product-layout--wide-detail) .related-links {
  margin-top: var(--space-lg) !important;
}

/* FAQ blocks: keep secondary content compact and prevent repeated heavy bands. */
.seo-faq {
  padding-top: clamp(2.75rem, 4.3vw, 4rem) !important;
  padding-bottom: clamp(2.75rem, 4.3vw, 4rem) !important;
}

.seo-faq .section-head {
  margin-bottom: clamp(1.375rem, 2.2vw, 2rem) !important;
}

.seo-faq .answer-grid {
  gap: 0 !important;
}

.seo-faq .answer-card {
  padding-top: clamp(1rem, 1.7vw, 1.375rem) !important;
  padding-bottom: clamp(1rem, 1.7vw, 1.375rem) !important;
}

.seo-faq + .seo-faq,
.deep-band + .seo-faq,
.seo-faq + .deep-band {
  margin-top: 0 !important;
}

/* Cart page: reduce dead zones between headline, table, and recommendations. */
body:has(.cart-layout) main {
  padding-top: clamp(1.75rem, 3vw, 2.75rem) !important;
  padding-bottom: clamp(2.5rem, 4.2vw, 4rem) !important;
}

.cart-hero {
  gap: var(--space-md) !important;
  margin-bottom: var(--space-lg) !important;
}

.cart-layout,
.cart-lower {
  gap: var(--space-lg) !important;
}

.cart-panel,
.summary-panel,
.cart-empty {
  padding-top: var(--space-lg) !important;
  padding-bottom: var(--space-lg) !important;
}

.cart-hit-grid {
  gap: clamp(1rem, 1.8vw, 1.5rem) !important;
}

/* Service/legal/contact pages: useful air, not empty air. */
body:has(.page-head) main,
body:has(.legal) main,
body:has(.doc) main,
.contacts-page main,
body:has(.contact-grid) main {
  padding-top: clamp(2.5rem, 4.2vw, 4rem) !important;
  padding-bottom: clamp(3rem, 5vw, 4.75rem) !important;
}

.page-head,
body:has(.contact-grid) .page-head {
  margin-bottom: var(--space-lg) !important;
}

.contact-grid,
.doc-grid,
.summary-grid,
.document-card,
.legal-card {
  gap: 1px !important;
}

.contact-card,
.document-card,
.legal-card,
.doc {
  padding: clamp(1.375rem, 2.5vw, 2.125rem) !important;
}

/* 9/10 pass: tighter repeated page modules and fewer stacked dividers. */
.hero + .deep,
.hero + .shop-layout,
.hero + .seo-faq,
.catalog-hero + .deep,
.catalog-hero + .shop-layout,
.catalog-hero + .seo-faq {
  margin-top: 0 !important;
}

.deep,
.deep-band,
.trust,
.manifest,
.projects,
.benefits,
.catalog-compare {
  padding-top: var(--space-section) !important;
  padding-bottom: var(--space-section) !important;
}

.section-head + .shop-grid,
.section-head + .catalog-featured-grid,
.section-head + .answer-grid,
.section-head + .contact-grid,
.section-head + .doc-grid {
  margin-top: 0 !important;
}

body:has(.shop-layout) .filters,
body:has(.shop-layout) .filter-bar,
body:has(.shop-layout) .catalog-tools {
  margin-top: var(--space-md) !important;
  margin-bottom: var(--space-lg) !important;
}

body:has(.shop-layout) .shop-card > * + *,
.catalog-featured-grid .shop-card > * + * {
  margin-top: var(--space-sm) !important;
}

body:has(.shop-layout) .shop-card .card-actions,
.catalog-featured-grid .shop-card .card-actions {
  margin-top: var(--space-md) !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .section-tabs + .product-sections {
  margin-top: 0 !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .section-card + .section-card,
body:has(.product-layout--wide-detail) .tab-panel + .tab-panel {
  margin-top: 0 !important;
}

body:has(.product-layout--wide-detail) .product-wide-sections .spec-panel + *,
body:has(.product-layout--wide-detail) .product-wide-sections .section-card > *:last-child {
  margin-bottom: 0 !important;
}

.answer-grid,
.contact-grid,
.doc-grid,
.summary-grid,
.cart-table {
  margin-top: 0 !important;
}

.answer-card > *:last-child,
.contact-card > *:last-child,
.document-card > *:last-child,
.legal-card > *:last-child,
.doc > *:last-child,
.cart-panel > *:last-child,
.summary-panel > *:last-child {
  margin-bottom: 0 !important;
}

@media (max-width: 760px) {
  :root {
    --space-section: clamp(2.5rem, 10vw, 3.75rem);
  }

  .home-page .hero,
  body:has(.shop-layout):not(.home-page) .hero,
  body:has(.catalog-hero) .catalog-hero {
    padding-top: clamp(1.25rem, 6vw, 2rem) !important;
    padding-bottom: clamp(1.5rem, 7vw, 2.5rem) !important;
  }

  body:has(.product-layout) main,
  body:has(.cart-layout) main,
  body:has(.page-head) main,
  body:has(.legal) main,
  body:has(.doc) main,
  body:has(.contact-grid) main {
    padding-top: clamp(1.5rem, 7vw, 2.5rem) !important;
    padding-bottom: clamp(2.25rem, 9vw, 3.25rem) !important;
  }

  body:has(.product-layout--wide-detail) .gallery-main {
    min-height: clamp(18rem, 68vw, 24rem) !important;
  }

  body:has(.product-layout--wide-detail) .product-wide-sections .section-card,
  .contact-card,
  .document-card,
  .legal-card,
  .doc {
    padding: clamp(1.125rem, 5vw, 1.5rem) !important;
  }

  .seo-faq {
    padding-top: clamp(2.125rem, 9vw, 3rem) !important;
    padding-bottom: clamp(2.125rem, 9vw, 3rem) !important;
  }
}

/* Footer contacts: one clean divider between each contact row. */
.site-footer .footer-contacts {
  display: grid !important;
  gap: 0 !important;
  border-top: 1px solid rgba(245, 247, 248, 0.10) !important;
}

.site-footer .footer-contacts > a,
.site-footer .footer-contacts > span.footer-call-hours {
  padding: 9px 0 10px !important;
  border-top: 0 !important;
  border-bottom: 1px solid rgba(245, 247, 248, 0.10) !important;
}

/* Homepage packages: removed fit tags, so price should sit closer without a top rule. */
#packages .package p {
  margin-bottom: 10px !important;
}

#packages .package-price {
  margin-top: 0 !important;
  border-top: 0 !important;
}

@media (max-width: 760px) {
  .site-footer .footer-contacts > a,
  .site-footer .footer-contacts > span.footer-call-hours {
    padding: 8px 0 9px !important;
  }

  #packages .package p {
    margin-bottom: 8px !important;
  }
}

/* Mobile lead popup: keep the request form short and light. */
@media (max-width: 760px) {
  .lead-modal-dialog {
    align-self: center !important;
    justify-self: center !important;
    height: auto !important;
    min-height: 0 !important;
    width: min(100%, 410px) !important;
    max-height: calc(100dvh - 88px) !important;
    padding: 30px 18px 24px !important;
    border-radius: 18px !important;
  }

  .lead-modal-dialog h2 {
    max-width: calc(100% - 56px) !important;
    margin-bottom: 8px !important;
    font-size: clamp(1.55rem, 6.4vw, 1.9rem) !important;
    line-height: 1.06 !important;
  }

  .lead-modal-dialog > p {
    max-width: 94% !important;
    margin-bottom: 12px !important;
    font-size: 0.92rem !important;
    line-height: 1.42 !important;
  }

  .lead-modal-facts {
    display: none !important;
  }

  .lead-scenario {
    display: block !important;
    margin: 4px 0 6px !important;
  }

  .lead-scenario-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  .lead-scenario-option span {
    min-height: 46px !important;
    padding: 8px 6px !important;
  }

  .lead-scenario-option strong {
    font-size: 11.5px !important;
    line-height: 1.12 !important;
  }

  .lead-modal-form {
    gap: 12px !important;
  }

  .lead-modal-form label {
    gap: 6px !important;
    font-size: 0.82rem !important;
  }

  .lead-modal-form input,
  .lead-modal-form textarea,
  .lead-modal-form button[type="submit"] {
    min-height: 46px !important;
    padding: 0 14px !important;
    font-size: 0.95rem !important;
  }

  .lead-modal-form textarea {
    min-height: 74px !important;
    padding-top: 11px !important;
  }

  .lead-modal-note:empty {
    display: none !important;
  }
}

/* Homepage installations: same header rhythm as trust/process blocks, without two-column split. */
.home-page .install-showcase .section-head {
  display: grid !important;
  grid-template-columns: minmax(0, 760px) !important;
  justify-content: start !important;
  gap: 0 !important;
  text-align: left !important;
}

.home-page .install-showcase .section-head .section-kicker {
  margin-bottom: clamp(1.125rem, 1.8vw, 1.625rem) !important;
}

.home-page .install-showcase .section-head h2 {
  max-width: 760px !important;
  margin-bottom: clamp(1.125rem, 1.8vw, 1.75rem) !important;
}

.home-page .install-showcase .section-head p {
  max-width: 760px !important;
  color: rgba(118, 130, 140, 0.95) !important;
  font-weight: 400 !important;
}
