/**
 * Homepage Mobile Fixes
 * Addresses vertical spacing and missing elements on mobile breakpoints
 */

/* ===================================================================
   HERO IMAGE - DESKTOP OBJECT-FIT FIX
   =================================================================== */

/* Ensure hero image fills container on ALL breakpoints */
.hero-section .hero-card .absolute.inset-0 {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.hero-section .hero-card .absolute.inset-0 .field,
.hero-section .hero-card .absolute.inset-0 .field__item,
.hero-section .hero-card .absolute.inset-0 .media,
.hero-section .hero-card .absolute.inset-0 .media--view-mode-hero {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-section .hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

/* ===================================================================
   MOBILE BREAKPOINT ADJUSTMENTS
   =================================================================== */

/* Reduce hero section padding on mobile */
@media (max-width: 767px) {
  .hero-section {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  .hero-section.py-6,
  .hero-section.py-12 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
}

/* ===================================================================
   NEWS CARDS - REDUCE EXCESSIVE VERTICAL SPACING
   =================================================================== */

/* Mobile: Compact news cards */
@media (max-width: 767px) {
  /* Reduce card padding */
  .news-card {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Reduce anchor padding */
  .news-card a {
    padding: 0.5rem !important;
  }

  /* Tighten spacing between cards */
  .news-card.border-b {
    padding-bottom: 1rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Reduce title size on mobile */
  .news-card h2 {
    font-size: 1.25rem !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.3 !important;
  }

  /* Reduce meta info spacing */
  .news-card .flex.items-center.gap-4 {
    gap: 0.5rem !important;
    margin-top: 0.25rem !important;
  }

  /* Stack date on mobile for cleaner layout */
  .news-card .md\:w-24 {
    width: 100% !important;
    margin-bottom: 0.5rem !important;
  }
}

/* ===================================================================
   NEWS CARD IMAGES - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 640px) {
  /* Make news images responsive on mobile */
  .news-image-200 {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 180px !important;
    max-height: 220px !important;
    aspect-ratio: 16/9 !important;
  }

  .news-image-200 .field,
  .news-image-200 .field__item {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
  }

  .news-image-200 img {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 220px !important;
    aspect-ratio: 16/9 !important;
  }

  /* Hide images on mobile to save space (optional - uncomment if needed) */
  /* .news-image-200 {
    display: none !important;
  } */
}

/* ===================================================================
   GRID SPACING - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  /* Reduce grid gaps on mobile */
  .destinations-section .grid,
  .gear-section .grid,
  .news-card .grid {
    gap: 1rem !important;
  }

  /* Compact section spacing */
  .destinations-section,
  .gear-section,
  .quiz-carousel-section {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  .destinations-section.py-8,
  .gear-section.py-8,
  .quiz-carousel-section.py-8 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* Reduce container padding on mobile for most sections */
  .destinations-section .container.mx-auto.px-4,
  .gear-section .container.mx-auto.px-4,
  .quiz-carousel-section .container.mx-auto.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Hero section container handled separately above */
}

/* ===================================================================
   HERO STACKED CARDS - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  /* Make stacked cards more compact */
  .hero-stacked-card {
    padding: 0.75rem !important;
    gap: 0.75rem !important;
  }

  /* Reduce image size on mobile */
  .hero-stacked-card .w-32 {
    width: 80px !important;
    min-width: 80px !important;
  }

  .hero-stacked-card .h-32 {
    height: 80px !important;
    min-height: 80px !important;
  }

  /* Compact text */
  .hero-stacked-card h3 {
    font-size: 0.875rem !important;
    line-height: 1.3 !important;
  }

  .hero-stacked-card .text-xs {
    font-size: 0.7rem !important;
  }

  /* Reduce spacing between stacked cards */
  .hero-section .space-y-6 > * + * {
    margin-top: 0.75rem !important;
  }
}

/* ===================================================================
   HERO SECTION MOBILE LAYOUT - CRITICAL FIXES
   =================================================================== */

@media (max-width: 767px) {
  /* REMOVE container padding for full width hero */
  section.hero-section,
  .hero-section {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  section.hero-section .container,
  .hero-section .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Convert grid to normal block flow */
  section.hero-section > div.container > div.grid,
  section.hero-section > div.container > div[class*="grid"],
  section.hero-section .container > div.grid,
  section.hero-section .container > div[class*="grid"] {
    display: block !important;
    width: 100% !important;
  }

  /* Main hero container - full width, contained height */
  section.hero-section .lg\:col-span-2,
  .hero-section .lg\:col-span-2,
  section.hero-section > div.container > div > *:first-child {
    width: 100% !important;
    margin: 0 0 1.5rem 0 !important;
    padding: 0 !important;
    display: block !important;
    height: 400px !important;
    max-height: 400px !important;
    overflow: hidden !important;
    position: relative !important;
  }

  /* Stacked cards container - appears AFTER hero, clear separation */
  section.hero-section .space-y-6,
  .hero-section .space-y-6,
  section.hero-section > div.container > div > *:last-child {
    width: 100% !important;
    display: block !important;
    padding: 0 1rem !important;
    margin: 0 !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
  }

  /* Show all stacked cards - override homepage.css hiding rules */
  section.hero-section .hero-stacked-card,
  .hero-section .hero-stacked-card {
    display: flex !important;
    width: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-bottom: 0.75rem !important;
    background: white !important;
    position: static !important;
  }

  /* Override any :has() hiding rules from homepage.css */
  .hero-stacked-card:not(:has(img)),
  .hero-stacked-card:has(.group-hover\:scale-105:empty),
  .hero-stacked-card:has(.w-32 .group-hover\:scale-105:empty) {
    display: flex !important;
    visibility: visible !important;
  }

  /* Force views-row to display in normal flow */
  section.hero-section .views-row,
  .hero-section .views-row {
    display: block !important;
    width: 100% !important;
    visibility: visible !important;
    margin-bottom: 0.75rem !important;
    position: static !important;
  }

  /* Ensure view-content displays all items */
  section.hero-section .view-content,
  .hero-section .view-content {
    display: block !important;
    width: 100% !important;
    position: static !important;
  }

  /* Ensure views-element-container is in normal flow */
  section.hero-section .views-element-container,
  .hero-section .views-element-container {
    display: block !important;
    width: 100% !important;
    position: static !important;
  }
}

/* ===================================================================
   MAIN HERO CARD - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  /* Make hero card full width with no border radius on mobile */
  section.hero-section .hero-card,
  .hero-section article.hero-card {
    height: 350px !important;
    min-height: 350px !important;
    max-height: 350px !important;
    border-radius: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
  }

  section.hero-section .hero-card.h-\[600px\],
  .hero-section article.hero-card.h-\[600px\],
  section.hero-section .hero-card.h-\[490px\],
  .hero-section article.hero-card.h-\[490px\] {
    height: 350px !important;
    max-height: 350px !important;
  }

  section.hero-section .hero-card.rounded-xl,
  .hero-section article.hero-card.rounded-xl {
    border-radius: 0 !important;
  }

  /* Ensure hero card wrapper doesn't overflow */
  section.hero-section .lg\:col-span-2 .views-element-container,
  .hero-section .lg\:col-span-2 .views-element-container {
    max-height: 350px !important;
    overflow: hidden !important;
  }

  /* Ensure hero image is full width and centered */
  section.hero-section .hero-card .absolute.inset-0,
  .hero-section .hero-card .absolute.inset-0 {
    width: 100% !important;
    height: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
  }

  /* Ensure image container fills parent */
  section.hero-section .hero-card .absolute.inset-0,
  .hero-section .hero-card .absolute.inset-0 {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  section.hero-section .hero-card .absolute.inset-0 .field,
  section.hero-section .hero-card .absolute.inset-0 .field__item,
  .hero-section .hero-card .absolute.inset-0 .field,
  .hero-section .hero-card .absolute.inset-0 .field__item {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
  }

  section.hero-section .hero-card img,
  .hero-section .hero-card img {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
  }

  /* Reduce hero text size on mobile */
  .hero-card h2 {
    font-size: 1.75rem !important;
    margin-bottom: 1rem !important;
  }

  .hero-card .text-4xl,
  .hero-card .md\:text-5xl {
    font-size: 1.75rem !important;
  }

  /* Reduce padding in hero card */
  .hero-card .p-8 {
    padding: 1.5rem !important;
  }

  /* Hide or reduce excerpt on mobile */
  .hero-card .text-lg {
    font-size: 0.9rem !important;
    margin-bottom: 0.5rem !important;
  }

  .hero-card .mb-6 {
    margin-bottom: 0.75rem !important;
  }
}

/* ===================================================================
   GEAR SECTION - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  /* Ensure proper grid on mobile */
  .gear-section .grid-cols-1 {
    grid-template-columns: 1fr !important;
  }

  /* Compact gear cards */
  .gear-section .node--type-travel-gear header {
    padding: 1rem !important;
  }

  .gear-section .node__title {
    font-size: 1.125rem !important;
    margin-bottom: 0.5rem !important;
  }

  .gear-section .node__meta {
    font-size: 0.75rem !important;
  }
}

/* ===================================================================
   SECTION HEADERS - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  /* Reduce section heading size on mobile */
  .destinations-section h2,
  .gear-section h2,
  .quiz-carousel-section h2 {
    font-size: 1.5rem !important;
    margin-bottom: 1rem !important;
  }

  .text-3xl {
    font-size: 1.5rem !important;
  }

  /* Reduce spacing in header flex container */
  .flex.items-center.justify-between.mb-6 {
    margin-bottom: 1rem !important;
  }
}

/* ===================================================================
   QUIZ CAROUSEL - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  .quiz-carousel-section .container {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  .quiz-card-wrapper {
    padding: 0.5rem !important;
  }
}

/* ===================================================================
   FOOTER - MOBILE OPTIMIZATION
   =================================================================== */

@media (max-width: 767px) {
  .site-footer {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
    margin-top: 2rem !important;
  }

  .site-footer.py-12 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .site-footer.mt-16 {
    margin-top: 2rem !important;
  }
}
