/* ============================================
   RESPONSIVE STYLES
   Mobile-First Approach
   Breakpoints: 640px (sm), 768px (md), 1024px (lg), 1280px (xl)
   ============================================ */

/* ===== MOBILE MENU OVERLAY ===== */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #222829;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
}

.mobile-menu.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0);
}

.close-menu-btn {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  background: transparent;
  border: none;
  color: var(--brand-cream);
  cursor: pointer;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  text-align: center;
}

.mobile-nav-link {
  font-family: var(--font-display);
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-black);
  color: var(--brand-cream);
  text-decoration: none;
}

/* ===== MOBILE (default - up to 640px) ===== */

/* Hide hero overlay on mobile for performance */
@media (max-width: 640px) {
  .hero-overlay {
    display: none;
  }

  .hero-gif {
    max-height: 60vh;
  }

  /* About Section - Smallest screens */
  .platform-link {
    width: 60px;
    height: 60px;
  }

  .platforms-container {
    gap: var(--space-4);
  }
}

/* ===== TABLET (641px - 768px) ===== */
@media (min-width: 641px) and (max-width: 768px) {
  .main-container {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .purchase-section {
    position: static;
  }
}

/* ===== SMALL DEVICES (max 768px) ===== */
@media (max-width: 768px) {
  /* Typography Scale Down */
  .hero-overlay h1 {
    font-size: var(--font-size-3xl);
  }

  .hero-overlay p {
    font-size: var(--font-size-lg);
  }

  /* Header Adjustments */
  .main-nav {
    display: none;
  }

  .hamburger-btn {
    display: block !important;
  }

  #site-header,
  header {
    padding: var(--space-3) var(--space-4);
  }

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

  .cart-link {
    font-size: var(--font-size-xl);
  }

  /* Main Container Stack */
  .main-container {
    grid-template-columns: 1fr;
    margin-top: var(--space-16);
    gap: var(--space-6);
    padding-inline: var(--space-4);
  }

  /* Slider Height */
  .slider-wrapper {
    aspect-ratio: 3 / 4;
  }

  /* Purchase Section */
  .purchase-section {
    position: static;
    padding: var(--space-8);
    top: auto;
  }

  .ozon-btn {
    width: 100% !important;
  }

  /* FAQ Buttons Stack */
  .faq-buttons {
    flex-direction: column;
  }

  /* Product Items Stack */
  .product-item {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .product-item.reverse {
    direction: ltr;
  }

  /* Gallery Grid Adjustment */
  .gallery-container {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding-inline: var(--space-4);
    margin-top: var(--space-16);
  }

  /* Cart Items Stack */
  .cart-item {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-4);
  }

  .cart-item img {
    margin: 0 auto;
  }

  .quantity-selector {
    justify-content: center;
  }

  /* Promo Section Stack */
  .promo-section {
    flex-direction: column;
    align-items: stretch;
  }

  .promo-section button {
    width: 100%;
  }

  /* Cookie Banner Adjust */
  .cookie-banner {
    bottom: var(--space-3);
    right: var(--space-3);
    left: var(--space-3);
    max-width: none;
  }

  /* Tabs */
  .tab-header {
    padding: var(--space-4);
    font-size: var(--font-size-lg);
  }

  .tab-content {
    padding: 0 var(--space-4);
  }

  .tab-content.open {
    padding: var(--space-4);
  }

  /* Slider arrows always visible on mobile */
  .slider-arrow {
    opacity: 1;
  }

  /* Product Detail Page - Stack layout */
  .product-detail-container {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    margin-top: var(--space-8);
    padding-inline: var(--space-4);
  }

  .product-detail-right {
    position: static;
    top: auto;
  }

  .breadcrumbs {
    padding-inline: var(--space-4);
    margin-top: var(--space-4);
    margin-bottom: var(--space-3);
    font-size: var(--font-size-xs);
  }

  /* Typography adjustments */
  .purchase-section h2,
  .purchase-section h1 {
    font-size: var(--font-size-2xl);
  }

  .description-container h2,
  .product-section h2 {
    font-size: var(--font-size-2xl);
  }

  #contact h2 {
    font-size: var(--font-size-2xl);
  }

  main.cart-main h1,
  main h1 {
    font-size: var(--font-size-3xl);
  }

  .policy-container h1 {
    font-size: var(--font-size-3xl);
  }

  /* Button sizing for mobile */
  .btn,
  button[class*="btn"],
  .memory-btn,
  .qty-btn,
  .faq-btn {
    min-height: 44px;
    padding: var(--space-2) var(--space-5);
  }

  /* About Section - Reduce spacing on mobile */
  .about-section {
    margin: var(--space-12) auto var(--space-16);
  }

  .platforms-container {
    gap: var(--space-6);
  }

  .platform-link {
    width: 70px;
    height: 70px;
  }
}

/* ===== MEDIUM DEVICES (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr 350px;
    gap: var(--space-8);
  }

  .gallery-container {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .purchase-section {
    top: calc(var(--space-16) + 80px);
  }

  /* Product Detail Page - Narrower sidebar on tablet */
  .product-detail-container {
    grid-template-columns: 1fr 350px;
    gap: var(--space-10);
  }

  .product-detail-right {
    top: calc(var(--space-16) + 80px);
  }
}

/* ===== LARGE DEVICES (1024px+) ===== */
@media (min-width: 1024px) {
  /* Gallery optimizations */
  .gallery-container {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  }

  /* Product section side-by-side */
  .product-item {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== EXTRA LARGE DEVICES (1440px+) ===== */
@media (min-width: 1440px) {
  .gallery-container {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-12);
  }

  .hero-gif {
    max-height: 100vh;
  }
}

/* ===== TOUCH DEVICE OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  button,
  .btn,
  a[role="button"] {
    min-height: 48px;
    min-width: 48px;
  }

  /* Remove hover effects on touch devices */
  .slider-arrow {
    opacity: 1;
  }

  /* Simplify animations for performance */
  * {
    animation-duration: 0.5s;
    transition-duration: 0.2s;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
    scroll-behavior: auto;
  }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
  :root {
    --color-neutral-600: #000;
    --color-neutral-700: #000;
  }

  .btn,
  button {
    border-width: 2px;
  }
}
