/* ==========================================================================
   Shivangi Project Infra - Master Responsive & Production-Ready Rules
   ========================================================================== */

/* Global Overflow Safety */
html, body {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   0. Ultra-Wide & 4K Monitors (1920px, 2560px, 3440px)
   -------------------------------------------------------------------------- */
@media (min-width: 1920px) {
  .container {
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  .hero-slides-track {
    height: 560px;
  }

  .hero-slide .hero-visual {
    height: 480px;
  }
}

@media (min-width: 2560px) {
  .container {
    max-width: 1680px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 3rem;
    padding-right: 3rem;
  }

  .hero-slides-track {
    height: 600px;
  }

  .hero-slide .hero-visual {
    height: 520px;
  }
}

/* High-DPI / Retina Display Enhancement */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Accessibility: Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   1. Large Desktop (1200px and up)
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* --------------------------------------------------------------------------
   2. Desktop / Laptop Breakpoint Switch (992px to 1199px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) and (min-width: 992px) {
  .site-logo-img {
    width: 150px;
    max-height: 46px;
  }

  .nav-list {
    gap: 1rem;
  }

  .nav-link {
    font-size: 0.875rem;
  }

  .hero-layout {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .services-grid {
    gap: 1.25rem;
  }
  
  .service-card {
    padding: 1.75rem 1.25rem 1.5rem;
  }

  .about-layout {
    grid-template-columns: 0.9fr 1.1fr;
    gap: 2.5rem;
  }

  .industries-grid {
    gap: 1.25rem;
  }

  .projects-grid {
    gap: 1.5rem;
  }

  .portfolio-grid {
    gap: 1.5rem;
  }

  .why-layout {
    grid-template-columns: 0.9fr 1.1fr;
    gap: 2.5rem;
  }

  .contact-layout {
    grid-template-columns: 0.85fr 1.15fr;
    gap: 2.5rem;
  }

  .footer-main {
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
    gap: 2rem;
  }
}

/* --------------------------------------------------------------------------
   3. Tablet (768px to 991px) - Header Switch & Hamburger Menu
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  body {
    padding-top: 70px !important;
  }

  .site-logo-img {
    width: 145px;
    max-height: 44px;
  }

  /* Hide Topbar on tablet/mobile */
  .header-topbar {
    display: none;
  }

  /* Hide Desktop Nav & Header CTA */
  .main-nav,
  .header-cta {
    display: none;
  }

  /* Show Mobile Hamburger Toggle */
  .mobile-toggle {
    display: inline-flex;
  }

  .header-main-wrapper {
    height: 70px;
  }

  .site-header.is-scrolled .header-main-wrapper {
    height: 64px;
  }
}

/* --------------------------------------------------------------------------
   3B. Tablet & iPad Specific Rules (768px to 991px: iPad Mini, iPad Air, Surface Pro 7, Galaxy Tab)
   -------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 991px) {
  .hero-slides-track {
    height: 480px !important;
    position: relative !important;
  }

  .hero-slide {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  .hero-slide.is-active {
    position: absolute !important;
    height: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .hero-slide .hero-layout {
    display: grid !important;
    grid-template-columns: 1.05fr 0.95fr !important;
    align-items: center !important;
    gap: 1.5rem !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .hero-slide .hero-content {
    order: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    height: 100% !important;
    padding-top: 0 !important;
  }

  h1.hero-title,
  h2.hero-title,
  .hero-slide .hero-title,
  .hero-title {
    font-size: clamp(1.4rem, 2.4vw, 1.85rem) !important;
    line-height: 1.22 !important;
    margin-bottom: 0.65rem !important;
    min-height: auto !important;
  }

  .hero-slide .hero-description {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    margin-bottom: 1rem !important;
    min-height: auto !important;
  }

  .hero-slide .hero-actions {
    flex-direction: row !important;
    width: auto !important;
    gap: 0.75rem !important;
    margin-bottom: 1rem !important;
    min-height: auto !important;
  }

  .hero-slide .hero-actions .btn {
    width: auto !important;
    min-height: 46px !important;
    padding: 0.65rem 1rem !important;
    font-size: 0.875rem !important;
  }

  .hero-slide .hero-trust-row {
    margin-top: auto !important;
    padding-top: 0.75rem !important;
    gap: 0.75rem 1rem !important;
  }

  .trust-item {
    font-size: 0.8rem !important;
  }

  .hero-slide .hero-visual-wrapper {
    order: 2 !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .hero-slide .hero-visual {
    width: 100% !important;
    height: 380px !important;
    max-height: 380px !important;
    aspect-ratio: auto !important;
    border-radius: var(--radius-md) !important;
  }

  .hero-slider-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1.25rem !important;
    margin-top: 1.25rem !important;
    position: relative !important;
    z-index: 10 !important;
  }

  .services-grid,
  .projects-grid,
  .industries-grid,
  .portfolio-grid,
  .process-grid,
  .principles-grid,
  .why-module-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
  }

  .service-detail-layout,
  .service-detail-layout--reverse {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .service-detail-layout--reverse .service-content {
    order: 1;
  }

  .service-detail-layout--reverse .service-visual-wrapper {
    order: 2;
  }

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

  .footer-main {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 2rem;
  }

  .footer-col--brand {
    grid-column: span 2;
  }

  .footer-brand-desc {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   4. Mobile Phones & Small Screens (767px and below: iPhone, Pixel, Galaxy, Z Fold)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* 1. Hero Section Height & Padding Reduction */
  .hero {
    padding-top: 0.85rem !important;
    padding-bottom: 1.25rem !important;
  }

  .hero-slides-track {
    height: auto !important;
    min-height: auto !important;
  }

  .hero-slide {
    position: absolute !important;
    inset: 0 !important;
  }

  .hero-slide.is-active {
    position: relative !important;
    height: auto !important;
  }

  .hero-slide .hero-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    width: 100% !important;
    height: auto !important;
  }

  h1.hero-title,
  h2.hero-title,
  .hero-slide .hero-title,
  .hero-title {
    font-size: clamp(1.35rem, 4.2vw, 1.65rem) !important;
    line-height: 1.24 !important;
    margin-bottom: 0.65rem;
    word-break: break-word;
  }

  .hero-slide .hero-description,
  .hero-description {
    font-size: 1rem;
    line-height: 1.55;
    max-width: 100%;
    margin-bottom: 1rem;
  }

  /* 4. Hero Buttons (Min Height 48px, Touch Friendly) */
  .hero-actions {
    width: 100%;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  .hero-actions .btn {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
  }

  /* 5. Hero Image Top (order: 1) and Content Below Image (order: 2) */
  .hero-slide .hero-visual-wrapper {
    order: 1 !important;
    width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 1rem !important;
  }

  .hero-slide .hero-content {
    order: 2 !important;
    width: 100% !important;
    padding-top: 0 !important;
  }

  .hero-slide .hero-visual {
    aspect-ratio: 16 / 9;
    max-height: 220px;
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }

  /* 6. Hero Floating Badge Scaling */
  .hero-floating-card {
    bottom: 0.6rem;
    left: 0.6rem;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    border-radius: var(--radius-sm);
    background-color: rgba(11, 19, 37, 0.92);
  }

  .floating-card-icon {
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: var(--radius-xs);
  }

  .floating-card-title {
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .floating-card-sub {
    font-size: 0.68rem;
    line-height: 1.2;
  }

  /* 7. Slider Controls Centered (Min Touch Target 44px) */
  .hero-slider-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1rem;
  }

  .slider-arrow {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .hero-trust-row {
    gap: 0.75rem 1.25rem;
    padding-top: 0.85rem;
  }

  /* 8. Global Section Spacing (Target 48px - 64px) */
  section {
    padding-top: clamp(2.75rem, 6.5vw, 3.75rem) !important;
    padding-bottom: clamp(2.75rem, 6.5vw, 3.75rem) !important;
  }

  :root {
    --container-padding: 1rem;
  }

  .site-logo-img {
    width: 130px;
    max-height: 40px;
  }

  .footer-logo-box,
  .footer-logo-wrap {
    padding: 5px 7px;
  }

  .footer-logo-img {
    width: 130px;
    max-height: 42px;
  }

  .section-header {
    margin-bottom: 1.75rem;
  }

  .btn {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1.25rem;
  }
  
  .btn-inline {
    width: auto;
    min-height: auto;
  }

  /* 9 & 10. Service, Feature & Dark Cards Internal Padding */
  .card,
  .service-card,
  .why-module-item,
  .principle-card,
  .process-step,
  .industry-tile,
  .enquiry-form-card {
    padding: 1.35rem 1.25rem;
  }

  .about-visual {
    aspect-ratio: 4 / 3;
  }

  .about-approach-item {
    padding: 0.875rem;
  }

  /* Core Services Carousel Track on Homepage Mobile */
  .services-section .services-grid {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 1.25rem !important;
    padding-bottom: 0.5rem !important;
  }

  .services-section .services-grid::-webkit-scrollbar {
    display: none !important;
  }

  .services-section .services-grid .service-card {
    flex: 0 0 100% !important;
    min-width: 100% !important;
    scroll-snap-align: center !important;
    scroll-snap-stop: always !important;
  }

  .services-slider-controls {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1.25rem !important;
    margin-top: 1.75rem !important;
  }

  /* About & Contact CTA Box Mobile Vertical Stack */
  .about-cta-box {
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 1.25rem !important;
    padding: 1.5rem !important;
  }

  .about-cta-content {
    max-width: 100% !important;
    width: 100% !important;
  }

  .about-cta-actions {
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 0.85rem !important;
  }

  .about-cta-actions .btn {
    width: 100% !important;
    min-height: 48px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .about-cta-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  /* All Other Section Grids 1-Column Stack on Mobile */
  .about-layout,
  .industries-grid,
  .projects-grid,
  .portfolio-grid,
  .why-layout,
  .why-module-grid,
  .contact-layout,
  .form-grid,
  .overview-layout,
  .process-grid,
  .principles-grid,
  .integrated-layout,
  .service-capabilities-grid,
  .delivery-stages-grid,
  .bms-capability-grid,
  .bms-solutions-grid,
  .bms-gallery-grid,
  .proj-approach-grid,
  .contact-services-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  /* 11. Projects Section Header Mobile Stack & Card Image Scaling */
  .projects-header-wrapper {
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 1.25rem !important;
    margin-bottom: 2rem !important;
  }

  .projects-header-content {
    width: 100% !important;
    max-width: 100% !important;
  }

  .projects-header-btn {
    width: 100% !important;
    min-height: 48px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 0 !important;
  }

  .project-media,
  .project-card--featured .project-media {
    min-height: 180px;
    max-height: 210px;
    aspect-ratio: 16 / 10;
  }

  .project-info {
    padding: 1.15rem 1rem 1rem;
  }

  .project-title {
    font-size: 1.15rem;
  }

  /* Portfolio Grid 1-Col Stack on Mobile */
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .proj-approach-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Contact Form 1-Col Stack on Mobile */
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group--full {
    grid-column: span 1;
  }

  .enquiry-form-card {
    padding: 1.5rem 1.25rem;
  }

  /* Why Choose Us Mobile Grid Stack */
  .why-module-grid {
    grid-template-columns: 1fr;
  }

  .why-module-item {
    padding: 1.5rem 1.25rem;
  }

  /* Process Vertical Timeline Stack on Mobile */
  .process-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .process-step {
    padding: 1.5rem 1.25rem;
  }

  /* Principles 1-Col Stack on Mobile */
  .principles-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .principle-card {
    padding: 1.5rem 1.25rem;
  }

  /* Services Capabilities 1-Col Stack on Mobile */
  .service-capabilities-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .delivery-stages-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .quick-nav-list,
  .category-nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .quick-nav-link,
  .category-nav-link {
    justify-content: center;
  }

  /* Final CTA Mobile Stack */
  .cta-actions {
    flex-direction: column;
    width: 100%;
  }

  .cta-capability-line {
    font-size: 0.78125rem;
    line-height: 1.5;
  }

  /* Footer Mobile 1-Column Stack */
  .footer-main {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-col--brand {
    grid-column: span 1;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

/* --------------------------------------------------------------------------
   5. Small Mobile (480px and below)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .site-logo-img {
    width: 120px;
    max-height: 36px;
  }

  .eyebrow,
  .section-label {
    font-size: 0.75rem;
  }

  .mobile-nav-drawer {
    width: 100vw;
    max-width: 100vw;
  }

  .hero-slide .hero-title,
  .hero-title {
    font-size: clamp(1.45rem, 6.5vw, 1.85rem);
    line-height: 1.25;
  }

  .hero-slide .hero-visual {
    max-height: 220px;
  }

  .hero-trust-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .hero-floating-card {
    bottom: 0.75rem;
    left: 0.75rem;
    padding: 0.65rem 0.85rem;
    gap: 0.6rem;
  }

  .floating-card-title {
    font-size: 0.8125rem;
  }

  .floating-card-sub {
    font-size: 0.6875rem;
  }

  .about-floating-badge {
    bottom: 0.75rem;
    right: 0.75rem;
    padding: 0.5rem 0.85rem;
  }

  .badge-text {
    font-size: 0.6875rem;
  }
}

/* --------------------------------------------------------------------------
   6. BMS Page Responsive Enhancements
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .bms-capability-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

@media (max-width: 768px) {
  .bms-hero-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-nav-btn {
    width: 38px;
    height: 38px;
    background-color: rgba(11, 19, 37, 0.95);
  }
}

@media (max-width: 480px) {
  .bms-capability-grid,
  .bms-solutions-grid,
  .bms-gallery-grid {
    grid-template-columns: 1fr;
  }
}
