/* ============================================
   HEADER MOBILE — SINGLE SOURCE OF TRUTH
   Organic Urban — Mobile Header Component
   ============================================

   This file is the definitive mobile header style definition.
   It is loaded by BOTH head-meta.php (via $cssFiles) AND
   blog-head-css.php, ensuring header consistency across
   every page of the site — including blog pages.

   Uses !important to override style.css and header-consistency.css
   base desktop rules. This is intentional: mobile header layout
   MUST win the cascade regardless of load order.
   ============================================ */

@media screen and (max-width: 768px) {

  /* ============================================
     HEADER CONTAINER
     ============================================ */

  .site-header,
  body .site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 10000 !important;
    width: 100% !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-bottom: 1px solid rgba(229, 224, 216, 0.8) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    padding: 0.5rem 0 !important;
    min-height: 60px !important;
    max-height: 60px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    overflow: visible !important;
    /* Stacking context */
    isolation: isolate;
    transform: translateZ(0);
  }

  /* ============================================
     HEADER INNER LAYOUT
     ============================================ */

  .header-inner,
  body .site-header .header-inner {
    display: grid !important;
    grid-template-columns: 50px minmax(auto, 1fr) auto !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.5rem 1rem !important;
    width: 100% !important;
    max-width: 100vw !important;
    gap: 0.5rem !important;
    margin: 0 auto !important;
    position: relative !important;
    overflow: visible !important;
    height: 100%;
    z-index: 10001;
  }

  /* Safe area support for header inner */
  @supports (padding: max(0px)) {
    .header-inner {
      padding-left: max(1rem, env(safe-area-inset-left)) !important;
      padding-right: max(1rem, env(safe-area-inset-right)) !important;
    }
  }

  /* ============================================
     HAMBURGER MENU BUTTON
     ============================================ */

  #menuToggle,
  button#menuToggle,
  body .site-header #menuToggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    padding: 8px !important;
    margin: 0 !important;
    transition: opacity 0.2s ease !important;
    z-index: 10001 !important;
    position: relative !important;
    grid-column: 1 !important;
    order: 1 !important;
    justify-self: start !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    font-size: 1.5rem !important;
    color: #2f2a24 !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    font-family: inherit !important;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(122, 154, 122, 0.2);
  }

  #menuToggle:hover,
  #menuToggle:focus {
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 0.6 !important;
  }

  #menuToggle:active {
    background: none !important;
    background-color: transparent !important;
    transform: none !important;
    border: none !important;
    box-shadow: none !important;
    opacity: 0.5 !important;
  }

  /* ============================================
     LOGO
     ============================================ */

  .logo,
  body .site-header .header-inner > .logo {
    grid-column: 2 !important;
    order: 2 !important;
    justify-self: center !important;
    text-align: center !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: #2f2a24 !important;
    text-decoration: none !important;
    margin: 0 auto !important;
    flex: 0 0 auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 200px !important;
    white-space: nowrap !important;
    position: relative !important;
    z-index: 10002 !important;
    isolation: isolate !important;
    overflow: visible;
  }

  .logo img,
  .logo picture {
    max-height: 32px !important;
    width: auto !important;
    display: block !important;
    position: relative !important;
    z-index: 10003 !important;
  }

  .logo span {
    white-space: nowrap;
    font-size: 1.1rem;
    font-weight: 600;
  }

  /* ============================================
     DESKTOP NAVIGATION (Hidden on Mobile)
     ============================================
     Mobile navigation is handled by:
     - #mobile-nav-overlay (markup in mobile-nav.php)
     - layout.js (JavaScript control)
     ============================================ */

  .nav {
    display: none !important;
  }

  /* ============================================
     HEADER ACTIONS (Search, Cart, Wishlist)
     ============================================ */

  .header-actions,
  body .site-header .header-inner > .header-actions {
    grid-column: 3 !important;
    order: 3 !important;
    justify-self: end !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 10002 !important;
    width: auto !important;
  }

  .header-actions a,
  .header-actions button {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    position: relative;
    border-radius: 8px;
    /* Touch optimization */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(122, 154, 122, 0.2);
  }

  .header-actions a:active,
  .header-actions button:active {
    background: rgba(0, 0, 0, 0.05);
  }

  .search-icon-btn,
  .cart-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    color: #2f2a24;
  }

  /* Cart/Wishlist badge */
  .cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #7a9a7a;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
  }

  /* Hide text labels, show icons only */
  .header-actions a span:not(.cart-count):not(.wishlist-badge),
  .header-actions button span:not(.cart-count):not(.wishlist-badge) {
    display: none !important;
  }

  /* Hide sign-in / logout text link on mobile */
  .header-actions .nav-signin {
    display: none !important;
  }

  /* ============================================
     SEARCH OVERLAY (Mobile Tweaks)
     ============================================ */

  .search-overlay {
    padding-top: 50px;
  }

  /* Safe area support for search overlay */
  @supports (padding: max(0px)) {
    .search-overlay {
      padding-top: max(50px, env(safe-area-inset-top));
    }
  }

  .search-overlay-content {
    width: 95%;
    max-width: 100%;
    padding: 1.5rem;
  }

  .search-form {
    flex-direction: column;
    gap: 1rem;
  }

  .search-submit {
    width: 100%;
    min-height: 48px;
  }

}
