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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
li,
figure,
button,
input {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
  height: auto;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

body {
  font-family: var(--font-primary);
  line-height: 1.5;
  color: #1a1a1a;
  background-color: #fff;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Responsive Typography Variables
   Ensures desktop sizes are preserved while standardizing mobile/tablet.
*/
:root {
  /* Body-like sizes (Map to 18px on mobile) */
  --fs-14: 14px;
  --fs-15: 15px;
  --fs-16: 16px;
  --fs-17: 17px;
  --fs-18: 18px;
  --fs-19: 19px;
  --fs-20: 20px;
  --fs-21: 21px;

  /* Heading-like sizes (Map to 32px on mobile) */
  --fs-28: 28px;
  --fs-30: 30px;
  --fs-32: 32px;
  --fs-35: 35px;
  --fs-36: 36px;
  --fs-40: 40px;
  --fs-44: 44px;
  --fs-48: 48px;

  /* Large Heading sizes (Map to 42px on mobile) */
  --fs-56: 56px;
  --fs-60: 60px;
  --fs-64: 64px;
  --fs-74: 74px;
  --fs-80: 80px;

  /* Specific sizes that stay the same */
  --fs-13: 13px;
  --fs-24: 24px;

  --section-padding: 80px;
  --container-px: 20px;
}

/* LG: 1199px to 992px */
@media (max-width: 1199px) {
  :root {
    --fs-74: 64px;
    --fs-48: 42px;
    --section-padding: 60px;
  }
}

/* MD: 991px to 768px (Tablet/Mobile Start) */
@media (max-width: 991px) {
  body {
    font-size: 16px;
  }

  :root {
    /* Proportionally scale Body sizes */
    --fs-14: 13.5px;
    --fs-15: 14.5px;
    --fs-16: 15px;
    --fs-17: 16px;
    --fs-18: 16px;
    --fs-19: 17px;
    --fs-20: 18px;
    --fs-21: 19px;

    /* Proportionally scale Headings */
    --fs-28: 24px;
    --fs-30: 26px;
    --fs-32: 28px;
    --fs-35: 30px;
    --fs-36: 30px;
    --fs-40: 34px;
    --fs-44: 38px;
    --fs-48: 40px;

    /* Proportionally scale Large Headings */
    --fs-56: 46px;
    --fs-60: 48px;
    --fs-64: 52px;
    --fs-74: 58px;
    --fs-80: 64px;

    --section-padding: 40px;
    --container-px: 15px;
  }
}

/* XS: mobile optimization */
@media (max-width: 575px) {
  :root {
    --section-padding: 24px;

    /* Decelerate font sizes more for smallest screens */
    --fs-14: 13px;
    --fs-15: 14px;
    --fs-16: 14.5px;
    --fs-17: 15px;
    --fs-18: 15px;
    --fs-19: 16px;
    --fs-20: 17px;
    --fs-21: 18px;

    --fs-28: 22px;
    --fs-30: 24px;
    --fs-32: 26px;
    --fs-35: 28px;
    --fs-36: 28px;
    --fs-40: 30px;
    --fs-44: 32px;
    --fs-48: 34px;

    --fs-56: 40px;
    --fs-60: 42px;
    --fs-64: 46px;
    --fs-74: 50px;
    --fs-80: 54px;
  }
}

/* Utilities */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--container-px);
  width: 100%;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Typography Utilities - Responsive */
.text-74 {
  font-size: var(--fs-74);
}

.text-48 {
  font-size: var(--fs-48);
}

.text-40 {
  font-size: var(--fs-40);
}

.text-32 {
  font-size: var(--fs-32);
}

.text-24 {
  font-size: var(--fs-24);
}

.text-20 {
  font-size: var(--fs-20);
}

.text-18 {
  font-size: var(--fs-18);
}

.text-16 {
  font-size: var(--fs-16);
}

.section-padding-y {
  padding-top: var(--section-padding);
  padding-bottom: var(--section-padding);
}

/* Grid System */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1199px) {
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 991px) {

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Prevent Splide sliders from causing horizontal overflow before JS init */
.splide { overflow: hidden; }

/* Response Utilities */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 1024px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }
}

@media (min-width: 1025px) {
  .mobile-menu-drawer {
    display: none !important;
  }
}

/* Mobile Menu Drawer */
/* Ensure main headers stay above the mobile menu drawer */
/* RC22-iPad-Menu-Fix-15Jul: .pergola-pros-header never matched any element —
   the section's actual header class is .pp-header (see
   sections/pergola-pros-header.liquid) — so Pergola Pros never received this
   rule and fell back to its own section CSS, which set position:sticky
   unconditionally instead of relative. Corrected to .pp-header and added
   .sp-header, which was missing from this list entirely (Shutter Pros
   carried its own local position:relative;z-index:100 as a v11 workaround,
   but stayed out of sync with this shared list). */
.kp-announcement,
.sgs-announcement,
.plan-pros-announcement,
.pergola-pros-announcement,
.sp-announcement,
.kp-header,
.sgs-header,
.plan-pros-header,
.pp-header,
.sp-header,
.shopify-section-header {
  position: relative;
  z-index: 100;
}

/* Ensure background of headers are solid so they cover the drawer */
.kp-header,
.plan-pros-header,
.pergola-pros-header,
.sgs-header {
  background-color: #fff;
}

.kp-announcement {
  background-color: #45556C;
}

.plan-pros-announcement {
  background-color: #0B0F2D;
}

.mobile-menu-drawer-wrapper {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: auto;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.mobile-menu-drawer {
  position: relative;
  /* now relative to wrapper */
  top: 0;
  width: 100%;
  height: auto;
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  transform: translateY(-100%);
  /* Slides UP above the wrapper, hidden by overflow */
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  /* Shadow is contained by wrapper */
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  /* Re-enable clicks on the drawer body */
}

.mobile-menu-drawer.is-open {
  transform: translateY(0);
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.mobile-menu-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-menu-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
}

.mobile-menu-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.mobile-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-list li {
  border-bottom: 1px solid #f5f5f5;
}

.mobile-menu-list a {
  display: block;
  padding: 15px 0;
  font-size: 18px;
  color: #333;
  text-decoration: none;
}

/* Hamburger Styles */
.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  align-items: center;
  color: inherit;
  box-sizing: border-box;
  display: flex !important;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background-color: currentColor;
  border-radius: 2px;
  display: block;
  flex-shrink: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  /* Prevent shrinking */
}

.hamburger-btn.is-active .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.hamburger-btn.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Force dark color if specific parent doesn't set it */
.sgs-header .hamburger-btn,
.kp-header .hamburger-btn {
  color: #333;
}

/* Response Utilities - Enhanced Priority */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 1024px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .hamburger-btn.mobile-only {
    display: flex !important;
  }
}


/* Responsive utilities handled by global variables */

/* Sticky Header - Reveal on Scroll Up */
.header-sticky {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
  will-change: transform;
}

.header-sticky--hidden {
  transform: translateY(-100%) !important;
  box-shadow: none;
}

.header-sticky--visible {
  transform: translateY(0) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body.has-sticky-header {
  padding-top: var(--header-height, 0px) !important;
}

/* =============================================
   GLOBAL RESPONSIVE OVERRIDES
   ============================================= */

/* --- Tablet: 991px --- */
@media (max-width: 991px) {
  /* Reduce grid gaps globally */
  .grid { gap: 16px; }

  /* Make all action buttons full-width */
  .sgs-btn,
  .kp-btn,
  .kp-btn-hero,
  .pp-btn,
  .plan-pros-btn,
  .pp-quote-btn,
  .pp-contact-submit,
  .pp-form__submit,
  .btn--primary,
  .drawer-checkout-btn,
  .drawer-continue-btn {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  /* Flex button containers: stack vertically */
  .plan-pros-hero__buttons,
  .pp-cta-banner__actions,
  .pp-why-pay__buttons,
  .kp-hero-card__buttons {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  /* Generic flex-btn override for tablet */
  .flex-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Reduce large margins/paddings */
  .mb-6 { margin-bottom: 20px; }
}

/* --- Mobile: 575px --- */
@media (max-width: 575px) {
  /* Tighter grid gaps */
  .grid { gap: 12px; }

  /* Ensure full-width buttons */
  .sgs-btn,
  .kp-btn,
  .kp-btn-hero,
  .kp-btn-hero-2,
  .pp-btn,
  .plan-pros-btn,
  .pp-quote-btn,
  .pp-contact-submit,
  .pp-form__submit,
  .btn--primary,
  .password-btn,
  .password-modal-btn,
  .drawer-checkout-btn,
  .drawer-continue-btn {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .flex-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Reduce spacing helpers */
  .mb-6 { margin-bottom: 16px; }
  .mb-4 { margin-bottom: 12px; }

  /* Container tighter padding */
  .container,
  .pp-container { padding-left: 15px; padding-right: 15px; }
}
