/* Mobile Navigation Fix - Show top links directly on mobile */
@media (max-width: 599px) {
  /* Hide the hamburger/toggle button */
  .wp-block-navigation__responsive-container-open {
    display: none !important;
  }

  /* Make the responsive container display as a normal inline block instead of fixed overlay */
  .wp-block-navigation__responsive-container:not(.is-menu-open) {
    display: block !important;
    position: static !important;
    inset: auto !important;
    background: transparent !important;
  }

  /* Show the wrapper div */
  .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-close {
    display: block !important;
  }

  /* Hide only the X close button (not the wrapper) */
  .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__responsive-container-close {
    display: none !important;
  }

  /* Show the nav items in a horizontal wrapping flex layout */
  .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__container {
    display: flex !important;
    flex-wrap: wrap !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    gap: 2px 10px !important;
    padding: 4px 0 !important;
  }

  /* Nav link touch targets - minimum 44px height */
  .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item a {
    font-size: 13px !important;
    padding: 9px 4px !important;
    display: block !important;
    min-height: 44px !important;
    line-height: 26px !important;
  }
}

/* =========================================
   MOBILE OPTIMIZATIONS - Full Checklist
   ========================================= */
@media (max-width: 599px) {

  /* 1. LOGO - Cap the logo size on mobile */
  .custom-logo,
  header .wp-block-site-logo img,
  header img[src*="logo"],
  header img[src*="hj-logo"] {
    max-width: 240px !important;
    height: auto !important;
    width: auto !important;
  }

  /* 2. HEADER - Compact vertical padding */
  header .wp-block-group {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  /* 3. SOCIAL ICON RAIL - Move to bottom-right corner on mobile */
  #hj-social-rail {
    top: auto !important;
    bottom: 16px !important;
    right: 8px !important;
    transform: none !important;
    background: rgba(255,255,255,0.9) !important;
    border-radius: 24px !important;
    padding: 4px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  /* 4. SOCIAL ICON BUTTONS - Ensure 44px touch target */
  #hj-social-rail .hj-sr-btn {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 5. FOOTER NAV LINKS - Adequate touch target height */
  footer a {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* 6. FOOTER COLUMNS - Stack vertically */
  footer .wp-block-columns {
    flex-direction: column !important;
  }
  footer .wp-block-column {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
    margin-left: 0 !important;
  }

  /* 7. COLUMN STACKING - Force multi-col blocks to stack */
  .wp-block-column {
    flex-basis: 100% !important;
  }

  /* 8. IMAGES - No overflow */
  img, video {
    max-width: 100% !important;
    height: auto !important;
  }

  /* 9. RESPONSIVE IFRAMES (YouTube embeds etc.) */
  .wp-block-embed__wrapper {
    position: relative !important;
    padding-bottom: 56.25% !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  .wp-block-embed__wrapper iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
  }

  /* 10. TYPOGRAPHY - Minimum readable sizes */
  body {
    font-size: 16px !important;
  }

  p, li, td, th {
    font-size: 16px !important;
    line-height: 1.65 !important;
  }

  h1, .hj-hero-title {
    font-size: clamp(24px, 7vw, 36px) !important;
    line-height: 1.2 !important;
  }

  h2 {
    font-size: clamp(20px, 5.5vw, 28px) !important;
    line-height: 1.3 !important;
  }

  h3 {
    font-size: clamp(16px, 4.5vw, 22px) !important;
    line-height: 1.4 !important;
  }

  /* 11. CTA BUTTONS - Good touch target */
  .wp-block-button__link,
  .wp-block-button a,
  .hj-hero-cta,
  .hj-featured-cta {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 12. FORM INPUTS - Prevent iOS zoom (min 16px) & good touch target */
  input[type="email"],
  input[type="text"],
  input[type="search"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    min-height: 44px !important;
    font-size: 16px !important;
  }

  /* 13. TABLES - Horizontal scroll */
  table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
  }

  /* 14. HORIZONTAL BUILD STRIP - Smooth scroll snap */
  .hj-build-strip-grid {
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
  }
  .hj-build-thumb {
    scroll-snap-align: start !important;
    flex-shrink: 0 !important;
  }


  /* 15. CATEGORY GRID CARDS - Stack to single column on mobile */
  /* WordPress grid layouts with 3+ columns -> 1 column */
  .wp-block-group-is-layout-grid,
  .is-layout-grid {
    grid-template-columns: 1fr !important;
  }

  /* Also fix any inline grid-template-columns styles */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

}

/* Remove top whitespace gap above hero image */
.wp-site-blocks > main {
  margin-top: 0 !important;
}