/* responsive-ux.css - Premium Mobile Responsiveness Overrides */

/* --- 1. VIEWPORT & OVERFLOW --- */
html, body {
  /* Prevent horizontal scrolling entirely */
  overflow-x: hidden !important;
  width: 100%;
  position: relative;
  -webkit-text-size-adjust: 100%; /* Prevent iOS text scaling */
}

/* Ensure media stays contained only on mobile to prevent breaking desktop logos */
@media screen and (max-width: 768px) {
  img, video, canvas, svg, iframe {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* --- 2. HEADER & LOGO --- */
@media screen and (max-width: 768px) {
  /* Hide the desktop nav links */
  .hidden.md\\:flex {
    display: none !important;
  }
  
  /* Logo scaling logic */
  header img.h-12, header img {
    height: auto !important;
    max-height: 48px !important;
    width: auto !important;
    max-width: 60vw !important; /* Never exceed 60% of viewport width */
    object-fit: contain;
  }

  /* Make header elements align correctly */
  header > div {
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  /* Force the right container to push to the end */
  header > div > div:last-child {
    display: flex !important;
    justify-content: flex-end !important;
    flex-grow: 1;
  }
}

/* --- 3. FLUID TYPOGRAPHY --- */
@media screen and (max-width: 768px) {
  /* Using clamp() for smooth fluid scaling from 320px to 768px */
  h1, .text-4xl, .text-5xl {
    font-size: clamp(24px, 6vw, 36px) !important;
    line-height: 1.2 !important;
    word-break: break-word; /* Prevent long words from overflowing */
  }
  h2, .text-3xl {
    font-size: clamp(20px, 5vw, 28px) !important;
    line-height: 1.3 !important;
  }
  h3, .text-2xl {
    font-size: clamp(18px, 4.5vw, 22px) !important;
    line-height: 1.4 !important;
  }
  p, li, span, .text-lg, .text-base {
    font-size: 16px !important; /* Enforce 16px to prevent iOS input zoom */
    line-height: 1.6 !important;
  }
}

/* --- 4. GRID & FLEX REFLOWS --- */
@media screen and (max-width: 768px) {
  /* Force multi-column grids to single column */
  .grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important; /* Consistent modern spacing */
  }

  /* Reduce excessive padding on sections */
  section, main > div {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
    padding-left: 1.25rem !important; /* Nice breathing room on edges */
    padding-right: 1.25rem !important;
  }

  /* Hero Section Reflow */
  .hero-container, section.relative.h-\[600px\], section.relative.h-\[400px\] {
    height: auto !important;
    min-height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
  }
  
  .hero-container > div, section.relative > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Hero button container stack */
  .hero-container .flex, section.relative .flex {
    flex-direction: column !important;
    width: 100% !important;
    gap: 1rem !important;
  }
}

/* --- 5. ACCESSIBLE TAP TARGETS (WCAG AA) --- */
@media screen and (max-width: 768px) {
  /* Buttons and CTAs must be easy to tap */
  button, .btn, a.inline-flex, a.bg-primary, a.bg-white {
    min-height: 48px !important; /* Slightly larger than standard 44px for premium feel */
    width: 100% !important; /* Full width buttons on mobile */
    justify-content: center !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    white-space: normal !important; /* Allow text wrapping inside buttons */
    height: auto !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }
  
  /* Exception: Inline links shouldn't expand */
  p a, span a, footer a {
    min-height: auto !important;
    width: auto !important;
    display: inline-block; /* Still allows some padding */
    padding: 0.5rem 0; /* Makes inline text links easier to hit */
  }
}

/* --- 6. FOOTER --- */
@media screen and (max-width: 768px) {
  footer {
    padding: 3rem 1.25rem !important;
  }
  footer .grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 2.5rem !important;
    text-align: left !important;
  }
  /* Space out footer links for easy tapping */
  footer ul li {
    padding: 0.5rem 0 !important;
  }
}


/* =========================================================
   PREMIUM ANIMATED MOBILE NAVIGATION DRAWER
   ========================================================= */

/* The Hamburger Toggle Button */
#lswmo-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

#lswmo-mobile-toggle svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
  transition: transform 0.3s ease;
}

#lswmo-mobile-toggle.active svg {
  transform: rotate(90deg); /* Subtle spin on open */
}

@media screen and (max-width: 768px) {
  #lswmo-mobile-toggle {
    display: flex;
  }
  /* Hide the broken React mobile menu button if it exists */
  header > div:last-child > [aria-label="Open navigation menu"],
  header > div:last-child > button[variant="ghost"] {
    display: none !important;
  }
}

/* The Sliding Drawer */
#lswmo-nav-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 85%;
  max-width: 350px;
  height: 100vh;
  background-color: #ffffff;
  z-index: 99998;
  /* Premium iOS-style shadow */
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Smooth snap physics */
  padding: 5rem 1.5rem 2rem; /* Give room for close button at top */
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#lswmo-nav-drawer.open {
  right: 0;
}

/* Drawer Links - Styled as Outline Buttons */
#lswmo-nav-drawer a, #lswmo-nav-drawer button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin-bottom: 0.75rem;
  color: #7B3F00; /* Primary brand color */
  text-decoration: none;
  font-size: 1.125rem;
  font-weight: 500;
  border: 2px solid #7B3F00;
  border-radius: 8px;
  background: #ffffff;
  text-align: center;
  width: 100%;
  transition: all 0.2s ease;
}

#lswmo-nav-drawer a:active, #lswmo-nav-drawer button:active {
  background-color: #fcf8f2;
  transform: scale(0.98); /* Micro-interaction squeeze */
}

/* Primary Action Buttons in Drawer */
#lswmo-nav-drawer .drawer-action-btn {
  background-color: #7B3F00;
  color: #ffffff;
  border: 2px solid #7B3F00;
}
#lswmo-nav-drawer .drawer-action-btn:active {
  background-color: #5c2e00;
}
#lswmo-nav-drawer .drawer-action-btn.outline {
  background-color: transparent;
  color: #7B3F00;
}

/* Backdrop Overlay with Blur */
#lswmo-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px); /* Premium glass effect */
  -webkit-backdrop-filter: blur(4px);
  z-index: 99997;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s;
}

#lswmo-backdrop.open {
  opacity: 1;
  visibility: visible;
}
