/**
 * DWiA Global Responsive Styles
 * Mobile-first responsive layer for the entire site
 *
 * This file ensures proper responsiveness across all sections
 * and fixes any layout issues on mobile, tablet, and desktop.
 *
 * @package DWiA Theme
 * @version 1.0.0
 */

/* =========================================
   BASE RESPONSIVE FOUNDATION
========================================== */

/* Ensure html and body allow scrolling on all devices */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

body {
  /* NOTE: overflow-x: hidden breaks position: sticky on header */
  /* Instead, constrain width and ensure sections don't overflow */
  width: 100%;
  max-width: 100vw;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Prevent horizontal overflow at section level instead of body */
section,
main,
.dwia-container {
  max-width: 100%;
}

/* Ensure images are responsive by default */
img {
  max-width: 100%;
  height: auto;
}

/* Ensure all containers are responsive */
.dwia-container,
.section-inner,
.hero-inner,
.about-inner,
.gallery-inner,
.our-work-inner,
.newsletter-layout,
.contact-layout {
  max-width: 100%;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 768px) {
  .dwia-container,
  .section-inner,
  .hero-inner,
  .about-inner,
  .gallery-inner,
  .our-work-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-width: 480px) {
  .dwia-container,
  .section-inner,
  .hero-inner,
  .about-inner,
  .gallery-inner,
  .our-work-inner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* =========================================
   HEADER & NAVIGATION RESPONSIVE
========================================== */

@media (max-width: 768px) {
  header {
    padding: 0.75rem 1rem;
  }

  nav {
    font-size: 0.85rem;
  }

  nav a {
    padding: 0.4rem 0.6rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 0.5rem 0.75rem;
  }

  nav {
    font-size: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  nav a {
    padding: 0.3rem 0.4rem;
    margin: 0.2rem;
  }
}

/* =========================================
   HERO SECTION RESPONSIVE
========================================== */

@media (max-width: 768px) {
  #hero {
    min-height: 60vh;
  }

  .hero-carousel-slide h1 {
    font-size: 1.8rem;
  }

  .hero-carousel-slide p {
    font-size: 1rem;
  }

  /* Hero CTA styles moved to main.css for better control */
}

@media (max-width: 480px) {
  #hero {
    min-height: 50vh;
  }

  .hero-carousel-slide h1 {
    font-size: 1.4rem;
  }

  .hero-carousel-slide p {
    font-size: 0.9rem;
  }

  /* Hero CTA styles moved to main.css for better control */

  .hero-carousel-dots {
    bottom: 0.5rem;
  }

  .carousel-arrow {
    width: 35px;
    height: 35px;
  }
}

/* =========================================
   SECTION SPACING RESPONSIVE
========================================== */

@media (max-width: 768px) {
  section {
    padding: 3rem 0;
  }

  .section-topband {
    margin-bottom: 1.5rem;
  }

  .section-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  section {
    padding: 2rem 0;
  }

  .section-topband {
    margin-bottom: 1rem;
  }

  .section-title {
    font-size: 1.3rem;
  }
}

/* =========================================
   GRID LAYOUTS RESPONSIVE
========================================== */

/* Gallery grid */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
}

/* Our Work layout */
@media (max-width: 860px) {
  .our-work-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .our-work-layout {
    gap: 1rem;
  }
}

/* Newsletter layout */
@media (max-width: 860px) {
  .newsletter-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* Contact layout */
@media (max-width: 860px) {
  .contact-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* =========================================
   BUTTONS & FORMS RESPONSIVE
========================================== */

@media (max-width: 480px) {
  button,
  .btn,
  input[type="submit"] {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  input[type="text"],
  input[type="email"],
  textarea {
    font-size: 0.9rem;
  }
}

/* =========================================
   MODALS RESPONSIVE
========================================== */

@media (max-width: 768px) {
  .dwia-modal-content {
    width: 95%;
    max-width: 95%;
    margin: 1rem auto;
  }

  .dwia-modal-body {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .dwia-modal-content {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
  }

  .dwia-modal-body {
    padding: 0.75rem;
  }
}

/* =========================================
   TYPOGRAPHY RESPONSIVE
========================================== */

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  h4 {
    font-size: 1.25rem;
  }

  p {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.6rem; /* Increased from 1.5rem */
  }

  h2 {
    font-size: 1.4rem; /* Increased from 1.3rem */
  }

  h3 {
    font-size: 1.2rem; /* Increased from 1.1rem */
  }

  h4 {
    font-size: 1.1rem; /* Increased from 1rem */
  }

  p {
    font-size: 0.95rem; /* Increased from 0.9rem for better readability */
  }

  /* Ensure minimum readable font size */
  body {
    font-size: 16px; /* Minimum to prevent iOS zoom on input focus */
  }
}

/* =========================================
   UTILITY CLASSES FOR RESPONSIVE
========================================== */

/* Hide elements on mobile */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .show-mobile {
    display: block !important;
  }
}

/* =========================================
   TOUCH TARGET SIZES (Accessibility)
========================================== */

@media (max-width: 768px) {
  /* Ensure touch targets are at least 44x44px (Apple HIG recommendation) */
  button,
  a,
  input[type="submit"],
  input[type="button"],
  .dwia-carousel-btn,
  .dwia-carousel-dot,
  .dwia-nav-menu a {
    min-height: 44px;
    min-width: 44px;
  }

  /* Increase padding for better touch area on navigation */
  .dwia-nav-menu a {
    padding: 0.6rem 0.8rem;
  }

  /* Carousel controls should be larger on touch devices */
  .dwia-carousel-btn {
    width: 44px;
    height: 44px;
  }

  /* Carousel dots should be easier to tap */
  .dwia-carousel-dot {
    width: 16px;
    height: 16px;
  }
}

/* =========================================
   FIX: Prevent horizontal overflow
========================================== */

* {
  box-sizing: border-box;
}

/* Ensure no element exceeds viewport width */
body * {
  max-width: 100%;
}

/* Allow specific elements to exceed (like positioned elements) */
.dwia-modal,
.dwia-toast-container,
[style*="position: fixed"],
[style*="position: absolute"] {
  max-width: none;
}

/* =========================================
   FIX: Smooth scrolling behavior
========================================== */

html {
  scroll-behavior: smooth;
}

/* Disable smooth scroll for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* =========================================
   FIX: iOS Safari fixes
========================================== */

/* Fix viewport height issues on mobile */
@supports (-webkit-touch-callout: none) {
  /* Target iOS Safari specifically */
  .hero-carousel,
  #hero {
    min-height: -webkit-fill-available;
  }
}

/* Prevent zoom on input focus */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important; /* Prevents iOS zoom */
  }
}

/* =========================================
   FIX: Android Chrome fixes
========================================== */

/* Prevent text size adjustment */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

/* =========================================
   PERFORMANCE OPTIMIZATIONS
========================================== */

/* GPU acceleration for smooth transforms */
.carousel-arrow,
.gallery-card,
.our-work-card,
.work-filter-btn,
button {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Remove will-change after animation completes */
.carousel-arrow:not(:hover),
.gallery-card:not(:hover),
.our-work-card:not(:hover) {
  will-change: auto;
}
