/* ============================================================
   MOMO Premier Fun World - Responsive Hero Hardening
   Applies to every page hero (shared include).
   ============================================================ */

/* Safe-area insets for notched / fullscreen devices (viewport-fit=cover) */
.hero-section .hero-content-wrapper {
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

.hero-section .hero-content-text {
  width: 100%;
  max-width: 900px;
}

/* Ensure background layers always cover without horizontal overflow */
.hero-section .hero-bg,
.hero-section .hero-slide {
  background-size: cover;
  background-position: center;
  min-width: 100%;
}

/* Fix for hero-full on mobile - prevent content overflow */
.hero-section.hero-full .hero-content-wrapper {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-section.hero-full .hero-content-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

/* --- Small screens (< 768) --- */
@media (max-width: 767.98px) {
  .hero-section .hero-content-text {
    max-width: 100%;
  }

  .hero-section .hero-subtitle {
    max-width: 100%;
  }

  /* Stats bar should not force horizontal scroll on small screens */
  .hero-section .hero-stats {
    gap: 1.25rem 1rem;
    padding: 1.5rem 1rem;
  }

  .hero-section .hero-stats .stat-item {
    flex: 0 0 40%;
  }

  /* Fix hero-full on mobile */
  .hero-section.hero-full {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
  }

  .hero-section.hero-full .hero-content-wrapper {
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .hero-section.hero-full .hero-title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    line-height: 1.2;
  }

  .hero-section.hero-full .hero-subtitle {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    margin-bottom: 1.5rem;
  }

  .hero-section.hero-full .hero-buttons {
    gap: 0.75rem;
  }

  .hero-section.hero-full .hero-buttons .btn {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }
}

/* --- Very small screens (< 400) --- */
@media (max-width: 400px) {
  .hero-section .hero-stats .stat-item {
    flex: 0 0 100%;
  }

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

  .hero-section .hero-buttons .btn {
    width: 100%;
  }

  .hero-section.hero-full .hero-title {
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .hero-section.hero-full .hero-subtitle {
    font-size: 0.875rem;
  }

  .hero-section.hero-full .hero-content-wrapper {
    padding: 1rem max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-bottom));
  }

  .hero-section.hero-full .stat-number {
    font-size: 1.5rem !important;
  }

  .hero-section.hero-full .stat-label {
    font-size: 0.7rem !important;
  }
}

/* --- Short viewports (landscape phones) - prevent content/stats overlap --- */
@media (max-height: 520px) and (orientation: landscape) {
  .hero-section.hero-normal {
    min-height: 100vh;
    padding: 90px 0 60px;
  }

  .hero-section.hero-full {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
  }

  .hero-section .hero-title {
    font-size: 1.6rem;
  }

  .hero-section .hero-subtitle {
    margin-bottom: 1.25rem;
  }

  .hero-section .hero-stats-wrapper {
    position: static;
    margin-top: 1.5rem;
  }

  .hero-section .hero-stats {
    border-top: none;
    padding-top: 0.75rem;
  }

  .hero-section.hero-full .hero-content-wrapper {
    min-height: auto;
    padding: 3rem 1.5rem;
  }

  .hero-section.hero-full .hero-content-text {
    flex: none;
  }
}

/* --- Android Chrome fix for address bar + viewport issues --- */
@supports (height: 100dvh) {
  .hero-section.hero-full {
    min-height: 100dvh;
  }

  .hero-section.hero-full .hero-content-wrapper {
    min-height: 100dvh;
  }
}

/* --- Extra large screens --- */
@media (min-width: 1600px) {
  .hero-section .hero-content-text {
    max-width: 1000px;
  }

  .hero-section .hero-title {
    font-size: 3.5rem;
  }
}

/* --- Reduced motion: no entrance animation on hero --- */
@media (prefers-reduced-motion: reduce) {
  .hero-section .hero-title,
  .hero-section .hero-subtitle,
  .hero-section .hero-buttons,
  .hero-section .hero-content-text > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* --- Ensure hero slides don't cause layout shift --- */
.hero-section.hero-slideshow .hero-slide {
  will-change: opacity;
}

/* --- Prevent horizontal overflow on all hero sections --- */
.hero-section {
  overflow-x: hidden;
}

.hero-section .hero-content-wrapper {
  overflow-x: hidden;
}

/* --- Hero Badge Responsive --- */
.hero-section .hero-content-text .badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  white-space: normal;
  max-width: 100%;
}

.hero-section .hero-content-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@media (max-width: 767.98px) {
  .hero-section .hero-content-text .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.875rem;
    max-width: calc(100% - 1rem);
    border-radius: 50rem;
  }
  
  .hero-section .hero-content-text .badge i {
    font-size: 0.875rem;
    flex-shrink: 0;
  }
}

@media (max-width: 400px) {
  .hero-section .hero-content-text .badge {
    font-size: 0.7rem;
    padding: 0.375rem 0.75rem;
    max-width: calc(100% - 0.5rem);
    gap: 0.25rem;
    border-radius: 50rem;
  }
  
  .hero-section .hero-content-text .badge i {
    font-size: 0.75rem;
  }
}

/* --- Android-specific fixes --- */
@media screen and (max-width: 767.98px) {
  /* Fix badge text wrapping on Android Chrome */
  .hero-section .hero-content-text .badge {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    min-width: 0;
  }
  
  /* Ensure badge content wraps properly */
  .hero-section .hero-content-text .badge > * {
    flex: 1 1 auto;
    min-width: 0;
  }
  
  /* Fix hero title line height on Android */
  .hero-section.hero-full .hero-title {
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  
  /* Fix subtitle */
  .hero-section.hero-full .hero-subtitle {
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
  }
}

/* Android Chrome address bar fix - ensure content fits in dynamic viewport */
@supports (height: 100dvh) {
  .hero-section.hero-full {
    min-height: 100dvh;
  }
  
  .hero-section.hero-full .hero-content-wrapper {
    min-height: 100dvh;
  }
}

/* Fix for very narrow screens in landscape */
@media (max-width: 480px) and (orientation: landscape) {
  .hero-section.hero-full .hero-content-wrapper {
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
  
  .hero-section.hero-full .hero-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }
  
  .hero-section.hero-full .hero-subtitle {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }
  
  .hero-section.hero-full .hero-buttons .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.85rem;
  }
  
  .hero-section .hero-content-text .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.625rem;
  }
}

/* Ensure no horizontal scroll ever */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

.hero-section * {
  max-width: 100%;
  box-sizing: border-box;
}
