/**
 * MOBILE HERO - NUCLEAR OPTION
 * This file MUST load last and overrides ALL other hero CSS
 * Simple, aggressive rules to make mobile layout work
 */

/* ========================================
   GLOBAL FIXES (ALL BREAKPOINTS)
   ======================================== */

/* Tailwind arbitrary height classes - needed because Tailwind JIT isn't running */
.h-\[450px\] {
  height: 450px !important;
}

.h-\[400px\] {
  height: 400px !important;
}

.h-\[380px\] {
  height: 380px !important;
}

.h-\[432px\] {
  height: 432px !important;
}

.h-\[490px\] {
  height: 490px !important;
}

.h-\[600px\] {
  height: 600px !important;
}

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

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

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

/* Remove bullet point between byline and read time on news cards */
.news-card .flex.items-center.gap-4 span:not(:first-child):not(:last-child) {
  display: none !important;
}

/* Alternative selector if the above doesn't work */
.news-card .text-sm.text-gray-500 span {
  margin: 0 !important;
}

.news-card .text-sm.text-gray-500 span:nth-child(2) {
  display: none !important;
}

@media (max-width: 768px) {
  /* ===== STEP 1: Reset the hero section container ===== */
  section.hero-section.py-6 {
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  section.hero-section.py-6 > div.container.mx-auto.px-4 {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ===== STEP 2: Kill the grid, make it a simple block container ===== */
  section.hero-section.py-6 > div.container > div.grid {
    display: block !important;
    grid-template-columns: unset !important;
    grid-template-rows: unset !important;
    gap: 0 !important;
    width: 100% !important;
  }

  /* ===== STEP 3: Hero container (lg:col-span-2) - First child ===== */
  section.hero-section.py-6 > div.container > div.grid > div.lg\:col-span-2 {
    display: block !important;
    width: 100% !important;
    height: 350px !important;
    max-height: 350px !important;
    min-height: 350px !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative !important;
    grid-column: unset !important;
  }

  /* ===== STEP 4: Hero card itself ===== */
  section.hero-section article.hero-card {
    display: block !important;
    width: 100% !important;
    height: 350px !important;
    max-height: 350px !important;
    min-height: 350px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    position: relative !important;
  }

  /* ===== STEP 5: Hero image container - must fill the hero card ===== */
  section.hero-section article.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 article.hero-card .absolute.inset-0 .field,
  section.hero-section article.hero-card .absolute.inset-0 .field__item {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
  }

  /* ===== STEP 5b: Hero image - full cover, no gray space ===== */
  section.hero-section article.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;
  }

  /* ===== STEP 6: Cards container (space-y-6) - Second child ===== */
  section.hero-section.py-6 > div.container > div.grid > div.space-y-6 {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 1rem !important;
    position: relative !important;
    grid-column: unset !important;
    /* This is key - push it down AFTER the hero */
    margin-top: 0 !important;
  }

  /* ===== STEP 7: Make sure each card is visible ===== */
  section.hero-section div.space-y-6 article.hero-stacked-card {
    display: flex !important;
    width: 100% !important;
    margin-bottom: 1rem !important;
    background: white !important;
    visibility: visible !important;
  }

  /* ===== STEP 8: Make sure views containers don't interfere ===== */
  section.hero-section .views-element-container,
  section.hero-section .view,
  section.hero-section .view-content,
  section.hero-section .views-row {
    display: block !important;
    width: 100% !important;
    position: static !important;
  }

  /* ===== STEP 9: Reduce text size in hero ===== */
  section.hero-section article.hero-card h2 {
    font-size: 1.5rem !important;
  }

  section.hero-section article.hero-card .p-8 {
    padding: 1rem !important;
  }

  /* ========================================
     MOBILE SPACING REDUCTION FOR ALL SECTIONS
     ======================================== */

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

  /* Override py-8 classes */
  section.py-8,
  .py-8 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* Reduce section heading margins */
  section h2,
  .destinations-section h2,
  .gear-section h2,
  .quiz-carousel-section h2 {
    margin-bottom: 1rem !important;
    font-size: 1.5rem !important;
  }

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

  /* Reduce grid gaps */
  .destinations-section .grid,
  .gear-section .grid,
  .grid.gap-8 {
    gap: 1rem !important;
  }

  /* Reduce container padding on sections */
  section .container.mx-auto.px-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Reduce spacing between news cards */
  .news-card {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .news-card.py-8 {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  /* Reduce footer spacing */
  footer.site-footer {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
    margin-top: 2rem !important;
  }

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

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

  /* ========================================
     MOBILE SEARCH BAR - Fixed compact styling
     ======================================== */

  /* The search view container */
  .search-view-with-facets {
    padding: 0.5rem !important;
    max-width: 100% !important;
  }

  /* The gradient search bar - FIXED HEIGHT, no flex on container */
  .search-view-with-facets .view-filters {
    display: block !important;
    padding: 12px !important;
    margin: 0 0 12px 0 !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #1a1a1a 0%, #0c7e52 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    box-sizing: border-box !important;
    position: relative !important;
  }

  /* Kill the ::before pseudo element */
  .search-view-with-facets .view-filters::before {
    display: none !important;
    content: none !important;
  }

  /* The form inside - ROW layout: input + button side by side */
  .search-view-with-facets .views-exposed-form {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
  }

  /* Search field wrapper - takes remaining space */
  .search-view-with-facets .form-item-search {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* All form items - no margin/padding */
  .search-view-with-facets .form-item {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide labels */
  .search-view-with-facets label,
  .search-view-with-facets .form-item__label {
    display: none !important;
  }

  /* Hide descriptions */
  .search-view-with-facets .form-item__description,
  .search-view-with-facets .description,
  .search-view-with-facets [id*="--description"] {
    display: none !important;
  }

  /* Hide sort controls completely */
  .search-view-with-facets .form-item-sort-by,
  .search-view-with-facets .form-item-sort-order {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* The search input */
  .search-view-with-facets input[type="text"],
  .search-view-with-facets input.form-text,
  .search-view-with-facets input.form-element {
    display: block !important;
    width: 100% !important;
    height: 44px !important;
    padding: 0 14px !important;
    margin: 0 !important;
    font-size: 16px !important;
    border: none !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #333 !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  /* Button wrapper - fixed width, doesn't grow */
  .search-view-with-facets .form-actions {
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* The submit button - auto width */
  .search-view-with-facets input[type="submit"],
  .search-view-with-facets button[type="submit"],
  .search-view-with-facets .form-submit {
    display: inline-block !important;
    width: auto !important;
    height: 44px !important;
    padding: 0 20px !important;
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #0c7e52 !important;
    cursor: pointer !important;
    text-align: center !important;
    white-space: nowrap !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }
}
