/* ============================================
   RESPONSIVE STYLES
   Mobile First Approach
   ============================================ */

/* ============================================
   EXTRA SMALL DEVICES (Phones, less than 576px)
   Default styles - no media query needed
   ============================================ */

/* Mobile Navigation - Only for screens 768px and below */
@media (max-width: 768px) {
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    height: 100dvh;
    background-color: var(--background-dark);
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
    padding-top: 100px;
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    margin: 0;
    list-style: none;
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-menu li {
    width: 100%;
    list-style: none;
    position: relative;
    z-index: 1002;
  }

  .nav-menu li a.nav-link,
  .nav-menu li a {
    font-size: 1.25rem;
    display: block;
    padding: 20px;
    color: var(--text-light) !important;
    text-decoration: none;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
    z-index: 1002;
    -webkit-tap-highlight-color: rgba(212, 168, 75, 0.3);
  }

  .nav-menu li a.nav-link:hover,
  .nav-menu li a.nav-link:active,
  .nav-menu li a:hover,
  .nav-menu li a:active {
    background-color: rgba(212, 168, 75, 0.2);
    color: var(--accent-color) !important;
  }

  .menu-toggle {
    display: flex;
    z-index: 1001;
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }

  .nav-cta {
    margin-left: 0;
    margin-top: var(--spacing-md);
    width: 100%;
    padding: 0 20px;
    position: relative;
    z-index: 1002;
  }

  .nav-cta .btn {
    width: 100%;
    display: block;
    text-align: center;
  }
}

/* Mobile overlay when menu is open - positioned to NOT overlap the menu */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 20%; /* Only cover the left side, not the menu (menu is 80% from right) */
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.nav-overlay.active {
  display: block;
}

/* Logo responsive adjustments for mobile */
.logo-text {
  font-size: 1rem;
}

.logo-img {
  height: 35px;
}

.footer-logo-text {
  font-size: 1rem;
}

.footer-logo-img {
  height: 40px;
}

/* Hero adjustments for mobile */
.hero {
  min-height: calc(100vh - 80px);
  margin-top: 80px;
  height: calc(100vh - 80px);
}

.hero-content h1 {
  font-size: 2rem;
}

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

.hero-buttons {
  flex-direction: column;
  align-items: center;
}

.hero-buttons .btn {
  width: 100%;
  max-width: 280px;
}

.slideshow-arrow {
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
}

.slideshow-arrow.prev {
  left: 10px;
}

.slideshow-arrow.next {
  right: 10px;
}

/* Services grid mobile */
.services-grid {
  grid-template-columns: 1fr;
}

/* Features grid mobile */
.features-grid {
  grid-template-columns: 1fr;
}

/* Stats mobile */
.stats-container {
  grid-template-columns: repeat(2, 1fr);
}

/* Projects grid mobile */
.projects-grid {
  grid-template-columns: 1fr;
}

/* Service detail mobile */
.service-detail-grid {
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

.service-detail:nth-child(even) .service-detail-grid {
  direction: ltr;
}

.service-detail-image {
  margin-bottom: var(--spacing-md);
}

.service-detail-image img {
  height: clamp(200px, 40vh, 300px);
  border-radius: var(--radius-md);
}

.service-detail {
  padding: var(--spacing-xl) 0;
}

/* About intro mobile */
.about-intro {
  grid-template-columns: 1fr;
}

/* Contact grid mobile */
.contact-grid {
  grid-template-columns: 1fr;
}

/* Gallery grid mobile */
.gallery-grid {
  grid-template-columns: 1fr;
}

/* Footer mobile */
.footer-grid {
  grid-template-columns: 1fr;
  text-align: center;
}

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

.social-links {
  justify-content: center;
}

/* CTA phone mobile */
.cta-phone {
  font-size: 1.75rem;
}

/* Page header mobile */
.page-header {
  padding: 120px 0 60px;
}

.breadcrumb {
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================
   SMALL DEVICES (Landscape phones, 576px and up)
   ============================================ */

@media (min-width: 576px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

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

  .hero-content h1 {
    font-size: 2.5rem;
  }

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

  .social-links {
    justify-content: flex-start;
  }
}

/* ============================================
   MEDIUM DEVICES (Tablets, 768px and up)
   ============================================ */

@media (min-width: 768px) {
  /* Logo for tablets */
  .logo-text {
    font-size: 1.15rem;
  }

  .logo-img {
    height: 40px;
  }

  .footer-logo-text {
    font-size: 1.15rem;
  }

  .footer-logo-img {
    height: 45px;
  }

  /* Navigation */
  .nav-menu {
    position: static;
    width: auto;
    height: auto;
    background-color: transparent;
    flex-direction: row;
    gap: var(--spacing-lg);
  }

  .menu-toggle {
    display: none;
  }

  .nav-cta {
    margin-left: var(--spacing-sm);
    margin-top: 0;
  }

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

  /* Hero */
  .hero-content h1 {
    font-size: 3rem;
  }

  .hero-content p {
    font-size: 1.25rem;
  }

  .hero-buttons {
    flex-direction: row;
  }

  .hero-buttons .btn {
    width: auto;
    max-width: none;
  }

  .slideshow-arrow {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .slideshow-arrow.prev {
    left: 30px;
  }

  .slideshow-arrow.next {
    right: 30px;
  }

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

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

  /* Stats */
  .stats-container {
    grid-template-columns: repeat(4, 1fr);
  }

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

  .project-card:first-child {
    grid-column: span 2;
  }

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

  /* Page Header */
  .page-header {
    padding: 150px 0 80px;
  }

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

  /* CTA */
  .cta-phone {
    font-size: 2.5rem;
  }

  /* Service content improvements for mobile */
  .service-detail-content {
    text-align: center;
  }

  .service-detail-content h3 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: var(--spacing-sm);
  }

  .service-detail-content p {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    line-height: 1.6;
  }

  .service-list {
    text-align: left;
    max-width: 90%;
    margin: 0 auto var(--spacing-lg);
  }

  .service-list li {
    font-size: clamp(0.85rem, 2.2vw, 1rem);
    padding: var(--spacing-xs) 0;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }
}

/* ============================================
   LARGE DEVICES (Desktops, 1024px and up)
   ============================================ */

@media (min-width: 1024px) {
  /* Logo for desktops */
  .logo-text {
    font-size: 1.25rem;
  }

  .logo-img {
    height: 45px;
  }

  .footer-logo-text {
    font-size: 1.25rem;
  }

  .footer-logo-img {
    height: 50px;
  }

  /* Container */
  :root {
    --container-padding: 2rem;
  }

  /* Hero */
  .hero-content h1 {
    font-size: 3.5rem;
  }

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

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

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

  .project-card:first-child {
    grid-column: span 1;
  }

  /* Service Detail */
  .service-detail-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
  }

  .service-detail-image img {
    height: clamp(300px, 45vh, 420px);
  }

  .service-detail {
    padding: var(--spacing-xxl) 0;
  }

  .service-detail-image {
    margin-bottom: 0;
  }

  /* About */
  .about-intro {
    grid-template-columns: 1fr 1fr;
  }

  /* Contact */
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }

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

/* ============================================
   EXTRA LARGE DEVICES (Large desktops, 1280px and up)
   ============================================ */

@media (min-width: 1280px) {
  /* Container */
  :root {
    --container-max: 1400px;
  }

  /* Hero */
  .hero-content h1 {
    font-size: 4rem;
  }

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

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

/* ============================================
   ULTRA WIDE (1536px and up)
   ============================================ */

@media (min-width: 1536px) {
  :root {
    --container-max: 1536px;
  }
}

/* ============================================
   HEIGHT BASED MEDIA QUERIES
   ============================================ */

/* Short screens */
@media (max-height: 600px) {
  .hero {
    min-height: 500px;
    height: auto;
  }

  .page-header {
    padding: 100px 0 40px;
  }
}

/* ============================================
   ORIENTATION QUERIES
   ============================================ */

@media (orientation: landscape) and (max-height: 500px) {
  .hero {
    min-height: 400px;
    height: auto;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-content p {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
  }

  .slideshow-nav {
    bottom: 20px;
  }
}

/* ============================================
   HIGH DPI / RETINA DISPLAYS
   ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Use higher resolution images where needed */
}

/* ============================================
   HOVER MEDIA QUERY
   Only apply hover effects on devices that support it
   ============================================ */

@media (hover: hover) and (pointer: fine) {
  .service-card:hover {
    transform: translateY(-10px);
  }

  .project-card:hover .project-overlay {
    opacity: 1;
  }

  .gallery-item:hover .gallery-item-overlay {
    opacity: 1;
  }
}

/* Disable hover effects on touch devices */
@media (hover: none) {
  .service-card:hover {
    transform: none;
  }

  .project-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  }

  .gallery-item-overlay {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.3);
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  /* Hide non-essential elements */
  .header,
  .footer,
  .slideshow-nav,
  .slideshow-arrow,
  .cta-section,
  .testimonials,
  .btn,
  .social-links,
  .lightbox {
    display: none !important;
  }

  /* Reset colors for printing */
  body {
    color: #000;
    background: #fff;
  }

  /* Ensure links are visible */
  a {
    color: #000;
    text-decoration: underline;
  }

  /* Show URL after links */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  /* Remove shadows and backgrounds */
  .service-card,
  .team-card,
  .contact-form {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  /* Ensure images print */
  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  /* Page breaks */
  h1, h2, h3 {
    page-break-after: avoid;
  }

  .section {
    page-break-inside: avoid;
  }

  /* Hero for print */
  .hero {
    height: auto;
    min-height: auto;
    padding: 40px 0;
  }

  .hero-content {
    position: static;
    transform: none;
    color: #000;
  }

  .hero-content h1 {
    color: #000;
  }

  .slide-overlay {
    display: none;
  }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
  /* Uncomment to enable dark mode support */
  /*
  :root {
    --text-dark: #f8f9fa;
    --text-medium: #adb5bd;
    --text-light: #1a1a1a;
    --background-light: #1a1a1a;
    --background-alt: #2d2d2d;
    --background-dark: #000;
    --border-color: #444;
  }
  */
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus styles for keyboard navigation */
*:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-color);
  color: var(--text-light);
  padding: 8px 16px;
  z-index: 10000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000;
    --secondary-color: #000;
    --accent-color: #ff0;
    --text-dark: #000;
    --text-light: #fff;
    --background-light: #fff;
    --border-color: #000;
  }

  .btn {
    border: 2px solid currentColor;
  }
}

/* Services overview responsive improvements */
@media (max-width: 768px) {
  .services-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    max-width: 100%;
  }

  .service-card-image {
    height: clamp(160px, 30vh, 200px);
  }

  .service-card-content {
    padding: var(--spacing-lg);
  }

  .service-card-content h3 {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
  }

  .service-card-content p {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .services-grid {
    grid-template-columns: 1fr 1fr;
    max-width: 100%;
    gap: var(--spacing-lg);
  }

  .service-card-image {
    height: clamp(180px, 22vh, 200px);
  }
}

@media (min-width: 1024px) {
  .services-grid {
    grid-template-columns: 1fr 1fr;
    max-width: 900px;
  }
}

/* ============================================
   RESPONSIVE FIXES & IMPROVEMENTS
   ============================================ */

/* Prevent horizontal scroll on all devices */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Fix for very small screens */
@media (max-width: 320px) {
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .hero-content h1 {
    font-size: 1.75rem;
  }
  
  .service-card-content {
    padding: var(--spacing-md);
  }
  
  .btn {
    font-size: 0.9rem;
    padding: var(--spacing-sm) var(--spacing-md);
  }
}

/* Improve tablet landscape layout */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .hero {
    min-height: 70vh;
  }
  
  .section {
    padding: var(--spacing-lg) 0;
  }
}

/* Large screen improvements */
@media (min-width: 1400px) {
  .container {
    max-width: var(--container-max);
  }
  
  .hero-content {
    max-width: 700px;
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px; /* Minimum touch target size */
  }
  
  .nav-link {
    padding: var(--spacing-sm);
  }
  
  .filter-btn {
    min-height: 44px;
    padding: var(--spacing-sm) var(--spacing-md);
  }
}

/* ============================================
   MOBILE MENU IMPROVEMENTS
   ============================================ */

/* Prevent body scroll when menu is open */
@media (max-width: 768px) {
  body.menu-open {
    overflow: hidden;
  }
}

/* Improve menu toggle button */
.menu-toggle {
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
}

.menu-toggle span {
  transition: all var(--transition-normal);
  transform-origin: center;
}

/* Animated hamburger menu */
.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Consistent page spacing across all breakpoints */
@media (max-width: 480px) {
  .section-top {
    padding-top: 100px !important;
  }
  
  .hero {
    margin-top: 70px;
    height: calc(100vh - 70px);
    min-height: calc(100vh - 70px);
  }
  
  .section-header {
    padding-top: var(--spacing-lg);
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .section-top {
    padding-top: 120px !important;
  }
  
  .hero {
    margin-top: 80px;
    height: calc(100vh - 80px);
    min-height: calc(100vh - 80px);
  }
}

@media (min-width: 769px) {
  .section-top {
    padding-top: 140px !important;
  }
  
  .hero {
    margin-top: 80px;
  }
}

/* Extra space for very large screens */
@media (min-width: 1200px) {
  .section-top {
    padding-top: 160px !important;
  }
}

/* Ensure consistent header height accounting */
@media (max-width: 768px) {
  .section:first-of-type:not(.hero):not(.section-top) {
    padding-top: calc(var(--spacing-xxl) + 40px);
  }
}

@media (min-width: 769px) {
  .section:first-of-type:not(.hero):not(.section-top) {
    padding-top: calc(var(--spacing-xxl) + 60px);
  }
}

/* Service areas mobile */
.service-areas-grid {
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  justify-content: center;
}

.service-areas-grid .service-list {
  display: inline-block;
  text-align: left;
}

.service-areas-grid .service-list li {
  white-space: normal;
}

/* Text formatting mobile */
.text-formatted {
  font-size: 1rem;
}

.lead-text {
  font-size: 1.1rem;
}

.text-highlight {
  margin-left: calc(var(--spacing-sm) * -1);
  margin-right: calc(var(--spacing-sm) * -1);
}

.commitment-statement p {
  font-size: 1rem;
}
