/* ==========================================================================
   5 STAR CONSTRUCTION COMPANY — COMPREHENSIVE RESPONSIVE SYSTEM
   Mobile-First Multi-Breakpoint Architectural Adaptations
   Target Breakpoints: 320px, 375px, 430px, 768px, 1024px, 1280px, 1440px+
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GLOBAL ZERO-OVERFLOW & FLUID CONTAINER GUARDS
   -------------------------------------------------------------------------- */
html, body {
  max-width: 100%;
  overflow-x: clip;
}

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

/* Fluid Content Containers */
.container,
.container-wide,
.container-narrow {
  width: 100%;
  box-sizing: border-box;
  padding-left: clamp(1rem, 3.5vw, 2.5rem);
  padding-right: clamp(1rem, 3.5vw, 2.5rem);
  margin-left: auto;
  margin-right: auto;
}

.container {
  max-width: var(--max-width-content, 1280px);
}

.container-wide {
  max-width: var(--max-width-wide, 1440px);
}

.container-narrow {
  max-width: var(--max-width-narrow, 840px);
}

/* --------------------------------------------------------------------------
   2. SMALL PHONES (320px – 374px)
   Ultra-compact devices: iPhone SE 1st/2nd Gen, Galaxy Fold (folded)
   -------------------------------------------------------------------------- */
@media (max-width: 374px) {
  :root {
    --header-height: 66px;
    --header-height-mobile: 66px;
  }

  /* Header compacting */
  .site-header {
    height: 66px;
  }

  .header-brand {
    gap: 6px;
  }

  .header-brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-title {
    font-size: 0.88rem;
    letter-spacing: 0.02em;
  }

  .brand-sub {
    font-size: 0.5rem;
    letter-spacing: 0.1em;
  }

  .header-actions .btn-sm {
    display: none;
  }

  .mobile-toggle {
    width: 40px;
    height: 40px;
  }

  /* Home Hero Content */
  .home-hero-content h1,
  .home-hero-sticky-frame h1 {
    font-size: 1.65rem !important;
    line-height: 1.15;
    margin-bottom: 8px;
  }

  .hero-badge {
    padding: 3px 8px;
    font-size: 10px;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
  }

  .home-hero-lead,
  .home-hero-content .home-hero-lead {
    font-size: 0.85rem;
    line-height: 1.45;
    margin-bottom: 14px;
  }

  .hero-cta-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }

  .hero-cta-group .btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 12px;
    justify-content: center;
  }

  .hero-trust-bar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding-top: 8px;
  }

  .trust-item-title {
    font-size: 12px;
  }

  .trust-item-desc {
    font-size: 10px;
  }

  /* Floating Video Bar on ultra-small screens */
  .hero-video-floating-bar {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 4px 8px;
    gap: 6px;
  }

  .floating-time-display {
    display: none;
  }

  .floating-mode-indicator {
    font-size: 9px;
  }

  .floating-timeline-track {
    width: 45px;
  }

  .floating-ctrl-btn {
    padding: 3px 8px;
    font-size: 9px;
  }

  /* Cards & Spacing */
  .service-card-body,
  .value-card,
  .process-step-card,
  .contact-form-panel,
  .contact-info-panel {
    padding: 16px;
  }

  .service-card-highlights.service-card-highlights--multi {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  /* Floating WhatsApp */
  .floating-whatsapp {
    bottom: 14px;
    right: 14px;
  }

  .floating-whatsapp-btn {
    width: 48px;
    height: 48px;
  }

  .floating-whatsapp-btn svg {
    width: 24px;
    height: 24px;
  }
}

/* --------------------------------------------------------------------------
   3. STANDARD MOBILE PHONES (375px – 430px)
   Standard viewports: iPhone 12/13/14/15/Pro, Galaxy S21/S22/S23, Pixel
   -------------------------------------------------------------------------- */
@media (min-width: 375px) and (max-width: 430px) {
  :root {
    --header-height: 70px;
    --header-height-mobile: 70px;
  }

  .site-header {
    height: 70px;
  }

  .header-brand-logo {
    width: 38px;
    height: 38px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-sub {
    font-size: 0.54rem;
  }

  .header-actions .btn-sm,
  .header-actions .btn {
    display: none !important;
  }

  .home-hero-content h1,
  .home-hero-sticky-frame h1 {
    font-size: 1.85rem !important;
    line-height: 1.15;
  }

  .hero-cta-group {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero-cta-group .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-trust-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hero-video-floating-bar {
    bottom: 12px;
    left: 12px;
    right: 12px;
    padding: 6px 12px;
  }
}

/* --------------------------------------------------------------------------
   4. LARGE PHONES & COMPACT VIEWPORTS (< 768px)
   General Mobile Behaviors
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* Grid Breakpoint Fail-safe: prevent horizontal overflow */
  #services-grid-container,
  #featured-services-container,
  #gallery-grid-container,
  .services-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-lg) !important;
  }

  /* Two Column Split Sections Stack Naturally */
  .split-layout-2col {
    grid-template-columns: 1fr !important;
    gap: var(--space-xl) !important;
  }

  /* Hero Section Adaptations */
  .home-hero-scroll-track {
    height: 220vh;
  }

  .home-hero-sticky-frame {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top: calc(var(--header-height, 70px) + 12px);
    padding-bottom: 70px;
  }

  .home-hero-content {
    max-width: 100%;
  }

  /* Buttons on Mobile */
  .btn-block-mobile {
    width: 100% !important;
    justify-content: center;
  }

  /* Section Spacing & Headings */
  .section {
    padding-top: clamp(2.5rem, 6vw, 4rem);
    padding-bottom: clamp(2.5rem, 6vw, 4rem);
  }

  .section-header {
    margin-bottom: var(--space-xl);
  }

  /* Values and Process Steps on Mobile */
  .values-grid,
  .process-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  /* Filter Pills Horizontal Flow */
  .filter-pills-container {
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .filter-pills-container::-webkit-scrollbar {
    display: none;
  }

  .filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 11px;
  }

  /* Comparison Table Mobile Wrapping */
  .comparison-wrapper {
    position: relative;
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
  }

  .comparison-wrapper::after {
    content: 'Swipe horizontally to compare →';
    display: block;
    font-size: 11px;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-brand-accent);
    padding: 6px 12px;
    background-color: rgba(166, 101, 44, 0.08);
    text-align: right;
    border-top: 1px dashed var(--color-border-subtle);
  }

  /* Contact Page on Mobile */
  .contact-layout-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-xl) !important;
    width: 100% !important;
  }

  .contact-sidebar-col,
  .contact-form-col {
    width: 100% !important;
    min-width: 0 !important;
  }

  .contact-info-panel,
  .contact-form-panel {
    padding: 20px 16px !important;
    border-radius: var(--radius-md) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .contact-card-item {
    gap: 10px !important;
    padding: 10px 0 !important;
  }

  .contact-card-icon {
    width: 36px !important;
    height: 36px !important;
  }

  .contact-card-label {
    font-size: 11px !important;
  }

  .contact-card-val {
    font-size: 14px !important;
    word-break: break-word !important;
  }

  .contact-form-panel h2 {
    font-size: 20px !important;
  }

  /* Lightbox Modal on Mobile */
  .lightbox-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .lightbox-content-box {
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--radius-md);
  }

  .lightbox-image-wrap {
    min-height: 200px;
    max-height: 40vh;
  }

  .lightbox-details {
    padding: 16px;
  }

  .lightbox-close-btn {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
  }

  .lightbox-nav-btn {
    width: 36px;
    height: 36px;
    top: 30%;
  }

  .lightbox-prev-btn { left: 8px; }
  .lightbox-next-btn { right: 8px; }

  /* Footer on Mobile */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .footer-brand-col {
    text-align: left;
  }

  .footer-links a,
  .footer-contact-item {
    padding: 4px 0;
  }
}

/* --------------------------------------------------------------------------
   5. TABLETS (768px – 1023px)
   iPads, Android Tablets, Foldable Phones Unfolded
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --header-height: 76px;
  }

  .site-header {
    height: 76px;
  }

  .header-brand-logo {
    width: 44px;
    height: 44px;
  }

  /* 2-Column Grids for Tablets */
  #services-grid-container,
  #featured-services-container,
  #gallery-grid-container,
  .services-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-lg) !important;
  }

  .values-grid,
  .process-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

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

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }

  .contact-info-panel,
  .contact-form-panel {
    padding: var(--space-xl);
  }
}

/* --------------------------------------------------------------------------
   6. SMALL DESKTOPS & LAPTOPS (1024px – 1279px)
   Laptops, MacBook Air, iPad Pro Landscape
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) and (max-width: 1279px) {
  .site-header {
    height: var(--header-height, 84px);
  }

  .nav-list {
    gap: 4px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 13px;
  }

  #services-grid-container,
  #featured-services-container,
  #gallery-grid-container,
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }

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

  .footer-grid {
    grid-template-columns: 1.8fr 1.1fr 1.1fr 1.5fr;
  }
}

/* --------------------------------------------------------------------------
   7. STANDARD DESKTOP SCREENS (1280px – 1439px)
   -------------------------------------------------------------------------- */
@media (min-width: 1280px) and (max-width: 1439px) {
  #services-grid-container,
  #featured-services-container,
  #gallery-grid-container,
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
  }

  .values-grid,
  .process-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
  }
}

/* --------------------------------------------------------------------------
   8. LARGE DESKTOP & 4K DISPLAYS (1440px and above)
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  .container {
    max-width: 1380px;
  }

  .container-wide {
    max-width: 1560px;
  }

  .home-hero-content {
    max-width: 840px;
  }

  .home-hero-content h1,
  .home-hero-sticky-frame h1 {
    font-size: 4.25rem;
  }

  .section {
    padding-top: clamp(4rem, 6vw, 6.5rem);
    padding-bottom: clamp(4rem, 6vw, 6.5rem);
  }
}

@media (min-width: 1800px) {
  .container {
    max-width: 1520px;
  }

  .container-wide {
    max-width: 1720px;
  }
}

/* --------------------------------------------------------------------------
   9. MOBILE LANDSCAPE ORIENTATION (Short Viewports)
   -------------------------------------------------------------------------- */
@media (max-height: 540px) and (orientation: landscape) {
  :root {
    --header-height: 56px;
    --header-height-mobile: 56px;
  }

  .site-header {
    height: 56px;
  }

  .header-brand-logo {
    height: 32px;
    width: 32px;
  }

  .home-hero-sticky-frame {
    padding-top: 60px;
    padding-bottom: 40px;
    height: auto;
    min-height: 100vh;
  }

  .home-hero-content h1 {
    font-size: 1.6rem !important;
    margin-bottom: 6px;
  }

  .home-hero-lead {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  .hero-trust-bar {
    display: none;
  }

  .hero-video-floating-bar {
    position: relative;
    bottom: auto;
    right: auto;
    left: auto;
    margin-top: 14px;
  }

  .lightbox-modal {
    padding: 6px;
  }

  .lightbox-content-box {
    max-height: 94vh;
    grid-template-columns: 1fr 1fr;
  }

  .lightbox-image-wrap {
    min-height: 180px;
  }
}

/* --------------------------------------------------------------------------
   10. TOUCH TARGET ACCESSIBILITY (Pointer: Coarse)
   -------------------------------------------------------------------------- */
@media (pointer: coarse) {
  .nav-link,
  .dropdown-link,
  .mobile-nav-link,
  .btn,
  .filter-pill,
  .faq-question-btn,
  .floating-ctrl-btn,
  .mobile-close-btn,
  .lightbox-close-btn,
  .lightbox-nav-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .footer-links a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .radio-tile-label {
    min-height: 48px;
  }
}

/* --------------------------------------------------------------------------
   11. PRINT STYLESHEET
   -------------------------------------------------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .floating-whatsapp,
  .mobile-drawer,
  .mobile-backdrop,
  .hero-video-floating-bar,
  .btn {
    display: none !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  .container,
  .container-wide {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .home-hero-scroll-track {
    height: auto !important;
  }

  .home-hero-sticky-frame {
    position: static !important;
    height: auto !important;
  }
}
