/* ==============================================================================
   CLOSAPP CORPORATE SHOWCASE — RESPONSIVE DESIGN SYSTEM (MOBILE FIRST)
   Guaranteed Zero Horizontal Overflow on all screen sizes:
   - 320px (iPhone SE 1st gen)
   - 360px - 390px (Android & Modern iPhones)
   - 414px - 430px (iPhone Plus/Max)
   - 640px+ (Phablets & Small Tablets)
   - 768px+ (Tablets / iPad)
   - 1024px+ (Laptops / Desktops)
   - 1280px+ (Large Screens)
   ============================================================================== */

/* ------------------------------------------------------------------------------
   0. UNIVERSAL ANTI-OVERFLOW RULES
   ------------------------------------------------------------------------------ */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, svg, video, canvas {
  max-width: 100%;
  height: auto;
}

/* ------------------------------------------------------------------------------
   1. MOBILE PHONES (ALL MOBILE < 640px)
   ------------------------------------------------------------------------------ */
@media (max-width: 639px) {
  /* Conteneur fluide */
  .container {
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
    max-width: 100%;
  }

  /* Header mobile */
  .site-header {
    height: 68px;
  }

  .brand-logo-img {
    height: 24px;
    width: auto;
  }

  .brand-badge {
    display: none; /* Alléger la barre de navigation sur smartphone */
  }

  /* Hero Section */
  .hero-section {
    padding: 36px 0 48px;
    overflow: hidden;
  }

  .hero-glow-bg {
    width: 100%;
    max-width: 100vw;
    left: 0;
    transform: none;
    filter: blur(40px);
    height: 350px;
  }

  .badge-pill {
    font-size: 0.78rem;
    padding: 6px 12px;
    gap: 6px;
    margin-bottom: 18px;
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .hero-title {
    font-size: clamp(1.65rem, 6.8vw, 2.1rem);
    line-height: 1.18;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
    word-break: break-word;
  }

  .hero-subtitle {
    font-size: 0.92rem;
    line-height: 1.55;
    margin-bottom: 28px;
    padding: 0 4px;
  }

  /* Badges Store Mobile */
  .store-badges-group {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto 36px;
  }

  .btn-store {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    min-height: 52px;
  }

  .btn-store-title {
    font-size: 0.98rem;
  }

  /* Statistiques Hero en 2 colonnes ultra-propres */
  .hero-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 32px;
    width: 100%;
  }

  .hero-stat-card {
    padding: 12px 8px;
  }

  .hero-stat-num {
    font-size: 1.25rem;
  }

  .hero-stat-label {
    font-size: 0.72rem;
    line-height: 1.3;
  }

  /* Mockup App Interface (Zero Overflow) */
  .hero-mockup-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .app-preview-frame {
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 100%;
  }

  .preview-top-bar {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .preview-dots {
    display: none; /* Supprimer les 3 points décoratifs qui prennent trop de largeur sur mobile */
  }

  .preview-app-identity {
    font-size: 0.78rem;
    gap: 6px;
  }

  .preview-status-pill {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .mockup-body {
    padding: 16px 12px;
    width: 100%;
    overflow-x: hidden;
  }

  .chat-bubble-incoming, .chat-copilot-card {
    max-width: 100%;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    word-break: break-word;
  }

  .chat-text {
    font-size: 0.88rem;
  }

  .copilot-reply-box {
    font-size: 0.86rem;
    padding: 10px 12px;
  }

  .copilot-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .copilot-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .action-btn-copy, .action-btn-alt {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  /* Sections standard */
  .section {
    padding: 48px 0;
    overflow: hidden;
  }

  .section-header {
    margin-bottom: 32px;
  }

  .section-title {
    font-size: clamp(1.45rem, 5.8vw, 1.85rem);
    word-break: break-word;
  }

  .section-subtitle {
    font-size: 0.92rem;
  }

  /* Cartes et grilles */
  .features-grid, .comparison-grid, .steps-container, .metrics-strip {
    grid-template-columns: 1fr;
    gap: 16px;
    width: 100%;
  }

  .feature-card, .comparison-card, .step-card {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }

  .feature-title, .comparison-title, .step-title {
    font-size: 1.15rem;
    word-break: break-word;
  }

  .feature-desc, .comparison-item, .step-desc {
    font-size: 0.9rem;
  }

  /* Banner CTA final */
  .cta-banner-card {
    padding: 32px 16px;
    border-radius: var(--radius-lg);
  }

  .cta-banner-card::before {
    width: 100%;
    max-width: 100%;
    left: 0;
    transform: none;
    filter: blur(35px);
  }

  .cta-banner-title {
    font-size: clamp(1.4rem, 5.5vw, 1.8rem);
    word-break: break-word;
    margin-bottom: 12px;
  }

  .cta-banner-subtitle {
    font-size: 0.92rem;
    margin-bottom: 24px;
  }

  /* Contact */
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .contact-card {
    padding: 20px 16px;
  }

  /* Footer */
  .site-footer {
    padding: 44px 0 24px;
  }

  .footer-top-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-bottom: 32px;
  }

  .footer-bottom-bar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

/* ------------------------------------------------------------------------------
   2. VERY SMALL PHONES (< 360px - e.g. iPhone SE 1st gen 320px)
   ------------------------------------------------------------------------------ */
@media (max-width: 359px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

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

  .hero-stats-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .btn-store {
    padding: 8px 12px;
  }

  .btn-store-title {
    font-size: 0.92rem;
  }

  .feature-card, .comparison-card, .step-card, .contact-card {
    padding: 16px 12px;
  }
}

/* ------------------------------------------------------------------------------
   3. TABLETS & LARGE PHONES (>= 640px)
   ------------------------------------------------------------------------------ */
@media (min-width: 640px) {
  .store-badges-group {
    flex-direction: row;
    justify-content: center;
    max-width: none;
  }

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

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

  .footer-bottom-bar {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ------------------------------------------------------------------------------
   4. TABLETS (>= 768px)
   ------------------------------------------------------------------------------ */
@media (min-width: 768px) {
  .hero-section {
    padding: 72px 0 88px;
  }

  .hero-title {
    font-size: 2.8rem;
  }

  .hero-subtitle {
    font-size: 1.15rem;
  }

  .hero-stats-row {
    grid-template-columns: repeat(4, 1fr);
    max-width: 760px;
  }

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

  .steps-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .contact-layout {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .footer-top-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
  }

  .section {
    padding: 88px 0;
  }

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

/* ------------------------------------------------------------------------------
   5. DESKTOPS (>= 1024px)
   ------------------------------------------------------------------------------ */
@media (min-width: 1024px) {
  .nav-menu {
    display: flex;
  }

  .nav-actions {
    display: flex;
  }

  .mobile-toggle {
    display: none;
  }

  .mobile-drawer {
    display: none;
  }

  .hero-section {
    padding: 88px 0 110px;
  }

  .hero-title {
    font-size: 3.4rem;
    line-height: 1.12;
  }

  .hero-subtitle {
    font-size: 1.22rem;
  }

  .features-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
  }

  .steps-container {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }

  .metrics-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .cta-banner-card {
    padding: 64px 48px;
  }

  .cta-banner-title {
    font-size: 2.6rem;
  }

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

/* ------------------------------------------------------------------------------
   6. ULTRA-WIDE SCREENS (>= 1440px)
   ------------------------------------------------------------------------------ */
@media (min-width: 1440px) {
  .hero-title {
    font-size: 3.8rem;
  }

  .container {
    max-width: 1240px;
  }
}

/* ------------------------------------------------------------------------------
   7. ACCESSIBILITY
   ------------------------------------------------------------------------------ */
@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;
  }
}
