/* ===== RESPONSIVE EXPERT - SOLUTIONS STACKOVERFLOW/REDDIT ===== */

/* 
 * Breakpoints basés sur les meilleures pratiques :
 * - Mobile First approach
 * - Fluid typography avec clamp()
 * - Container queries ready
 * - Touch-friendly targets (44px minimum)
 */

:root {
  /* Responsive Breakpoints */
  --bp-xs: 320px;   /* iPhone SE */
  --bp-sm: 375px;   /* iPhone 12/13 mini */
  --bp-md: 768px;   /* iPad portrait */
  --bp-lg: 1024px;  /* iPad landscape */
  --bp-xl: 1280px;  /* MacBook Air */
  --bp-2xl: 1440px; /* MacBook Pro 14" */
  --bp-3xl: 1920px; /* Desktop */
  
  /* Fluid Spacing */
  --fluid-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --fluid-sm: clamp(0.5rem, 1vw, 1rem);
  --fluid-md: clamp(1rem, 2vw, 2rem);
  --fluid-lg: clamp(1.5rem, 3vw, 3rem);
  --fluid-xl: clamp(2rem, 4vw, 4rem);
  --fluid-2xl: clamp(3rem, 6vw, 6rem);
  
  /* Fluid Typography */
  --fluid-text-xs: clamp(0.75rem, 0.8vw, 0.875rem);
  --fluid-text-sm: clamp(0.875rem, 1vw, 1rem);
  --fluid-text-base: clamp(1rem, 1.2vw, 1.125rem);
  --fluid-text-lg: clamp(1.125rem, 1.5vw, 1.25rem);
  --fluid-text-xl: clamp(1.25rem, 2vw, 1.5rem);
  --fluid-text-2xl: clamp(1.5rem, 2.5vw, 2rem);
  --fluid-text-3xl: clamp(2rem, 4vw, 3rem);
  --fluid-text-4xl: clamp(2.5rem, 5vw, 4rem);
  
  /* Touch Targets */
  --touch-target: 44px;
  --touch-target-lg: 48px;
}

/* ===== CONTAINER SYSTEM ===== */
.container {
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--fluid-md);
  padding-right: var(--fluid-md);
}

/* Container Sizes */
@media (min-width: 640px) {
  .container { max-width: 640px; }
}

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

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

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

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

/* ===== RESPONSIVE UTILITIES ===== */

/* Hide/Show based on screen size */
.hidden { display: none !important; }
.block { display: block !important; }
.flex { display: flex !important; }
.grid { display: grid !important; }

/* Mobile First Visibility */
.sm\:hidden { display: none !important; }
@media (min-width: 640px) {
  .sm\:block { display: block !important; }
  .sm\:flex { display: flex !important; }
  .sm\:grid { display: grid !important; }
  .sm\:hidden { display: none !important; }
}

@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:flex { display: flex !important; }
  .md\:grid { display: grid !important; }
  .md\:hidden { display: none !important; }
}

@media (min-width: 1024px) {
  .lg\:block { display: block !important; }
  .lg\:flex { display: flex !important; }
  .lg\:grid { display: grid !important; }
  .lg\:hidden { display: none !important; }
}

/* ===== RESPONSIVE GRID SYSTEM ===== */
.grid-responsive {
  display: grid;
  gap: var(--fluid-md);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-responsive.sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-responsive.sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

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

@media (min-width: 1024px) {
  .grid-responsive.lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-responsive.lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-responsive.lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-responsive.lg\:grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */
.text-responsive {
  font-size: var(--fluid-text-base);
  line-height: 1.6;
}

.text-responsive.text-xs { font-size: var(--fluid-text-xs); }
.text-responsive.text-sm { font-size: var(--fluid-text-sm); }
.text-responsive.text-lg { font-size: var(--fluid-text-lg); }
.text-responsive.text-xl { font-size: var(--fluid-text-xl); }
.text-responsive.text-2xl { font-size: var(--fluid-text-2xl); }
.text-responsive.text-3xl { font-size: var(--fluid-text-3xl); }
.text-responsive.text-4xl { font-size: var(--fluid-text-4xl); }

/* ===== RESPONSIVE SPACING ===== */
.p-responsive { padding: var(--fluid-md); }
.px-responsive { padding-left: var(--fluid-md); padding-right: var(--fluid-md); }
.py-responsive { padding-top: var(--fluid-md); padding-bottom: var(--fluid-md); }
.m-responsive { margin: var(--fluid-md); }
.mx-responsive { margin-left: var(--fluid-md); margin-right: var(--fluid-md); }
.my-responsive { margin-top: var(--fluid-md); margin-bottom: var(--fluid-md); }

/* ===== TOUCH OPTIMIZATION ===== */
.touch-target {
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  display: flex;
  align-items: center;
  justify-content: center;
}

.touch-target-lg {
  min-height: var(--touch-target-lg);
  min-width: var(--touch-target-lg);
}

/* Touch-friendly buttons */
button, .btn {
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ===== DEVICE-SPECIFIC OPTIMIZATIONS ===== */

/* iPhone SE et petits écrans */
@media (max-width: 374px) {
  .hero-title {
    font-size: 1.75rem;
    text-align: center;
    line-height: 1.2;
  }
  
  .hero-subtitle {
    text-align: center;
    font-size: 1rem;
  }
  
  .mockup-image {
    height: 500px !important;
    transform: scale(0.7) !important;
  }
  
  .vision-container,
  .features-container,
  .about-container {
    padding: 0 var(--spacing-md);
    text-align: center;
  }
  
  .nav-container {
    justify-content: space-between;
    align-items: center;
  }
}

/* iPhone 12/13 mini (375px) */
@media (min-width: 375px) and (max-width: 413px) {
  .mockup-image {
    transform: scale(0.9) !important;
    height: 900px !important;
  }
}

/* iPhone 12/13/14 (390px-428px) */
@media (min-width: 390px) and (max-width: 428px) {
  .mockup-image {
    transform: scale(1) !important;
    height: 1000px !important;
  }
}

/* iPad Mini (768px) */
@media (min-width: 768px) and (max-width: 820px) {
  .vision-container,
  .features-container {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
}

/* iPad Pro (1024px) */
@media (min-width: 1024px) and (max-width: 1180px) {
  .nav-container {
    max-width: 1000px !important;
  }
}

/* MacBook Air M2 (1440px) */
@media (min-width: 1440px) and (max-width: 1600px) {
  .nav-container {
    max-width: 1300px !important;
  }
  
  .vision-container,
  .features-container {
    max-width: 1200px !important;
  }
}

/* Large Desktop (1920px+) */
@media (min-width: 1920px) {
  .nav-container {
    max-width: 1600px !important;
  }
  
  .vision-container,
  .features-container {
    max-width: 1400px !important;
  }
}

/* ===== ORIENTATION HANDLING ===== */
@media (orientation: landscape) and (max-height: 500px) {
  .hero-section {
    min-height: 100vh;
    padding: 2rem 0;
  }
  
  .mockup-image {
    height: 400px !important;
    transform: scale(0.7) !important;
  }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .mockup-image {
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: high-quality !important;
    image-rendering: auto !important;
    backface-visibility: hidden !important;
    transform: translateZ(0) !important;
  }
}

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

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #ffffff;
    --bg-color: #1a1a1a;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .navbar,
  .mobile-menu,
  .contact-btn,
  video,
  .iphone-mockup,
  .ipad-mockup {
    display: none !important;
  }
  
  .hero-section,
  .vision-section,
  .features-section {
    background: white !important;
    color: black !important;
  }
}
