/* ===================================
   EternalTech Responsive Styles
   Mobile-First Media Queries
   =================================== */

/* ===== Mobile (< 640px) ===== */
/* Base styles are mobile-first */

/* ===== Mobile Navigation ===== */

@media (max-width: 768px) {
  .mobile-menu-toggle,
  .nav-toggle {
    display: flex;
  }

  body {
    padding-top: 70px;
  }

  .navbar {
    padding: var(--spacing-sm) 0;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    padding: var(--spacing-3xl) var(--spacing-xl);
    flex-direction: column;
    gap: var(--spacing-sm);
    overflow-y: auto;
  }

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

  .nav-menu li {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-link {
    font-size: var(--font-size-lg);
    width: 100%;
    padding: var(--spacing-md) var(--spacing-sm);
    color: white;
    display: block;
  }

  .nav-link:hover {
    color: var(--color-accent);
  }

  .nav-link::after {
    background-color: var(--color-accent);
  }

  .nav-menu .btn-primary {
    width: 100%;
    text-align: center;
    margin-top: var(--spacing-lg);
    background-color: var(--color-accent);
    border-color: var(--color-accent);
  }

  .nav-menu .btn-primary:hover {
    background-color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
  }

  /* Mobile menu overlay */
  body.menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    backdrop-filter: blur(2px);
  }

  body.menu-open {
    overflow: hidden;
  }
}

/* ===== Tablet (768px - 1023px) ===== */

@media (min-width: 768px) {
  /* Typography adjustments */
  .hero-title {
    font-size: clamp(3rem, 5vw, 3.75rem);
  }

  .hero-subtitle {
    font-size: var(--font-size-xl);
  }

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

  /* Stats grid - 2x2 layout */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
    margin: 0 auto;
  }

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

  .footer-section:first-child {
    grid-column: span 2;
  }

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

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

/* ===== Desktop (1024px and up) ===== */

@media (min-width: 1024px) {
  /* Hero section adjustments */
  .hero-content {
    max-width: 900px;
  }

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

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

  /* Footer grid - 4 columns */
  .footer-grid,
  .footer-content {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }

  .footer-section:first-child {
    grid-column: span 1;
  }

  /* Contact wrapper - side by side */
  .contact-wrapper {
    grid-template-columns: 1.5fr 1fr;
  }

  /* Integration grid - 6 columns */
  .integration-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  /* Hover effects for desktop only */
  .service-card:hover {
    transform: translateY(-8px);
  }

  .integration-item:hover {
    transform: translateY(-4px);
  }
}

/* ===== Large Desktop (1280px and up) ===== */

@media (min-width: 1280px) {
  /* Increase container max-width for larger screens */
  .container {
    max-width: 1200px;
  }

  /* Typography scale adjustments */
  h1 {
    font-size: 3.5rem;
  }

  h2 {
    font-size: 2.5rem;
  }

  /* Section padding increase */
  section {
    padding: 6rem 0;
  }

  /* Hero section enhancements */
  .hero-section {
    min-height: calc(100vh - var(--header-height));
  }
}

/* ===== Extra Large Desktop (1536px and up) ===== */

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

  /* Even more generous spacing */
  section {
    padding: 8rem 0;
  }
}

/* ===== Landscape Mobile Devices ===== */

@media (max-width: 767px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: var(--spacing-3xl) 0;
  }

  section {
    padding: var(--spacing-2xl) 0;
  }
}

/* ===== Tablet Portrait Specific ===== */

@media (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
  .hero-section {
    min-height: 80vh;
  }

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

/* ===== Print Styles ===== */

@media print {
  /* Hide navigation and footer for printing */
  .site-header,
  .site-footer,
  .nav-menu,
  .hero-cta,
  .service-link,
  .contact-form {
    display: none;
  }

  /* Adjust colors for print */
  body {
    background: white;
    color: black;
  }

  /* Expand sections */
  section {
    page-break-inside: avoid;
  }

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

/* ===== High DPI / Retina Displays ===== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimize images and icons for retina displays */
  .stat-icon,
  .service-icon,
  .feature-icon {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ===== Touch Device Optimizations ===== */

@media (hover: none) and (pointer: coarse) {
  /* Increase touch target sizes */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-link {
    padding: var(--spacing-sm) var(--spacing-xs);
  }

  /* Remove hover effects on touch devices */
  .service-card:hover {
    transform: none;
  }

  .integration-item:hover {
    transform: none;
  }

  /* Add active states instead */
  .service-card:active {
    transform: scale(0.98);
  }

  .btn:active {
    transform: scale(0.95);
  }
}

/* ===== Container Queries (Modern Browsers) ===== */

@supports (container-type: inline-size) {
  .service-card {
    container-type: inline-size;
  }

  @container (min-width: 400px) {
    .service-title {
      font-size: var(--font-size-3xl);
    }
  }
}

/* ===== Accessibility: High Contrast Mode ===== */

@media (prefers-contrast: high) {
  .btn-primary {
    background: var(--color-primary-dark);
    border: 2px solid var(--color-text);
  }

  .nav-link::after {
    height: 3px;
  }

  .service-card {
    border: 2px solid var(--color-gray-300);
  }
}

/* ===== Accessibility: Reduced Transparency ===== */

@media (prefers-reduced-transparency) {
  .site-header.scrolled {
    background-color: rgb(255, 255, 255);
    backdrop-filter: none;
  }
}

/* ===== Accessibility: Reduced Motion ===== */

@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;
  }

  .floating-element {
    animation: none !important;
  }

  .service-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ===== Dark Mode (Optional - Currently Commented Out) ===== */

/* Uncomment to enable dark mode support */
/*
@media (prefers-color-scheme: dark) {
  .site-header.scrolled {
    background-color: rgba(15, 23, 42, 0.95);
  }

  .service-card,
  .contact-form,
  .integration-item {
    background-color: var(--color-gray-800);
    border-color: var(--color-gray-700);
  }

  .nav-menu {
    background-color: var(--color-gray-900);
  }
}
*/

/* ===== Utility: Show/Hide Based on Screen Size ===== */

.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .hide-mobile {
    display: block;
  }

  .hide-tablet {
    display: none;
  }
}

@media (min-width: 1024px) {
  .hide-tablet {
    display: block;
  }

  .hide-desktop {
    display: none;
  }
}

.show-mobile {
  display: block;
}

@media (min-width: 768px) {
  .show-mobile {
    display: none;
  }
}

/* ===== Grid Responsive Utilities ===== */

@media (max-width: 767px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}
