/**
 * header-mobile.css — Gerbs mobile header bar + drawer (PR1, ≤980px).
 *
 * Enqueued with media="(max-width:980px)" so desktop never render-blocks (E5A).
 * The inline critical CSS in perf-header-critical.php carries the always-loaded
 * rules: desktop hide (@media ≥981px) + Divi header hide + padding-top reset (E8A).
 *
 * Token sources: gerbs-tokens.css (loaded as dep). Component-specific values
 * use --gmh-* custom props declared here (9A). Never re-declare --gerbs-* tokens.
 *
 * Decision refs: D1 (tokens), 9A (mapping), 10A (focus), 11A (sticky),
 *                12A (safe-area), 14A (label wrap), 6A (filter pill).
 *
 * @package Gerbs
 * @since   1.1.1.49 (PR1 mobile nav)
 */

/* ── Component custom props (9A, locked handoff values) ─────────────────────── */
.gmh-bar,
.gmh-drawer {
  --gmh-drawer-width: min(326px, 86vw);
  --gmh-slide:        300ms cubic-bezier(.32,.72,.32,1);
  --gmh-scrim:        rgba(30, 30, 30, 0.45);
  --gmh-scrim-fade:   280ms;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.gmh-bar {
  position: relative;
  z-index: 100;
}

/* Promo strip (scrolls away) */
.gmh-promo {
  background: var(--gerbs-blue);
  color: #fff;
  text-align: center;
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: var(--fw-semibold);
  line-height: 1.4;
  padding: 7px 12px;    /* handoff: 7px top/bottom per design */
}

/* Code Snippets has `b, strong { color:#000 }` globally — override for promo */
.gmh-promo b,
.gmh-promo strong {
  color: inherit;
}

/* Sticky main bar (11A) */
.gmh-main {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 10px 10px 6px;
  background: #fff;
  border-bottom: 1px solid var(--gerbs-hairline);
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 100;
}

/* Admin bar offset: WP adds 46px at ≤600px, 32px at 601–782px (12A) */
body.admin-bar .gmh-main {
  top: calc(46px + env(safe-area-inset-top, 0px));
}

@media (min-width: 601px) {
  body.admin-bar .gmh-main {
    top: calc(32px + env(safe-area-inset-top, 0px));
  }
}

/* ── Icon touch targets: 44×44 minimum (10A, WCAG 2.5.5) ─────────────────── */
.gmh-hamburger,
.gmh-search-link,
.gmh-cart-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gerbs-ink);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  text-decoration: none;
}

.gmh-hamburger:focus-visible,
.gmh-search-link:focus-visible,
.gmh-cart-link:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Logo (margin-right auto pushes search + cart right) */
.gmh-logo-link {
  margin-right: auto;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.gmh-logo {
  height: 40px !important; /* .woocommerce-page img{height:auto} is 0,1,1 — beats 0,1,0 without !important */
  width: auto !important;
  max-width: none;
  display: block;
}

/* Cart badge (3A', E9A — always rendered, hidden at 0 items) */
.gmh-cart-link {
  position: relative;
}

.gmh-cart-badge {
  position: absolute;
  top: 6px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  background: var(--gerbs-blue);
  color: #fff;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: var(--fw-bold);
  line-height: 1;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  pointer-events: none;
}

/* hidden attribute collapses to display:none (E9A) */
.gmh-cart-badge[hidden] {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DRAWER
   ═══════════════════════════════════════════════════════════════════════════ */

/* Override browser default <dialog> centering; start off-screen left */
.gmh-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--gmh-drawer-width);
  max-height: 100dvh;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-right: 1px solid var(--gerbs-hairline);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;  /* 0 16px 16px 0 (8A) */
  box-shadow: var(--shadow-lg);
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-105%);
  transition: transform var(--gmh-slide);
}

/* Open state (native dialog [open] attribute) */
.gmh-drawer[open] {
  transform: translateX(0);
}

/* prefers-reduced-motion: drawer appears without slide (plan §5) */
@media (prefers-reduced-motion: reduce) {
  .gmh-drawer {
    transition: none;
    transform: none;
  }
}

/* Scrim/backdrop */
.gmh-drawer::backdrop {
  background: var(--gmh-scrim);
  opacity: 0;
  transition: opacity var(--gmh-scrim-fade);
}

.gmh-drawer[open]::backdrop {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .gmh-drawer::backdrop {
    transition: none;
  }
}

/* ── Drawer header (yellow, 9A) ───────────────────────────────────────────── */
.gmh-drawer__head {
  background: var(--gerbs-yellow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 12px 20px;
  flex-shrink: 0;
}

.gmh-drawer__logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.gmh-drawer__logo {
  height: 34px !important; /* .woocommerce-page img{height:auto} is 0,1,1 — same fix as .gmh-logo */
  width: auto !important;
  max-width: none;
  display: block;
}

/* Close button (44×44 touch target, 10A) */
.gmh-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gerbs-ink);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.gmh-close:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ── Drawer body ──────────────────────────────────────────────────────────── */
.gmh-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;  /* prevent pull-to-refresh behind drawer */
  padding: 16px 0 8px;
  -webkit-overflow-scrolling: touch;
}

/* ── Search pill (15A) ────────────────────────────────────────────────────── */
.gmh-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--gerbs-fog);
  border-radius: var(--radius-pill);
  padding: 0 16px;
  height: 46px;
  margin: 0 16px 16px;
}

.gmh-search__icon {
  color: var(--gerbs-ink-50);
  flex-shrink: 0;
}

.gmh-search__input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: none;
  font-family: var(--ff-body);
  font-size: var(--fs-16);
  color: var(--gerbs-ink);
  outline: none;
}

.gmh-search__input::placeholder {
  color: var(--gerbs-ink-50);
}

.gmh-search:focus-within {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ── Eyebrow labels (SHOP / COMPANY) ─────────────────────────────────────── */
.gmh-eyebrow {
  font-family: var(--ff-body);
  font-size: 12px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: var(--ls-caps);
  color: var(--gerbs-blue);
  padding: 0 20px 8px;
  margin: 0;
}

/* ── Nav rows (14A — wrap, never truncate) ────────────────────────────────── */
.gmh-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gmh-nav__item + .gmh-nav__item {
  border-top: 1px solid var(--gerbs-hairline);
}

.gmh-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 20px;    /* handoff: 9px rows */
  font-family: var(--ff-body);
  font-size: var(--fs-16);
  font-weight: var(--fw-medium);
  color: var(--gerbs-ink);
  text-decoration: none;
  /* 14A: long labels wrap, never ellipsis */
  word-break: break-word;
  overflow-wrap: break-word;
}

.gmh-nav__link:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.gmh-nav__label {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: var(--space-2);  /* 14A: clears the chevron */
}

.gmh-chevron {
  color: var(--gerbs-ink-20);
  flex-shrink: 0;
}

/* Company links: no hairlines between rows, no chevron */
.gmh-nav--company .gmh-nav__item + .gmh-nav__item {
  border-top: none;
}

/* Section divider */
.gmh-divider {
  height: 1px;
  background: var(--gerbs-hairline);
  margin: 12px 20px;
}

/* ── Drawer footer ────────────────────────────────────────────────────────── */
.gmh-drawer__foot {
  flex-shrink: 0;
  padding: 16px 20px max(24px, env(safe-area-inset-bottom, 24px));  /* 12A */
  border-top: 1px solid var(--gerbs-hairline);
}

/* Allergen reassurance link (1A) */
.gmh-allergen-link {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-family: var(--ff-body);
  font-size: 12.5px;        /* handoff value */
  font-weight: var(--fw-semibold);
  color: var(--gerbs-blue);
  text-decoration: none;
  margin-bottom: var(--space-4);
  line-height: 1.4;
}

.gmh-allergen-link:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.gmh-shield {
  flex-shrink: 0;
  margin-top: 2px;  /* optical alignment with first text line */
}

/* Auth buttons (4A', 44px min-height) */
.gmh-auth {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.gmh-auth__primary,
.gmh-auth__ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  font-family: var(--ff-body);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  white-space: nowrap;
}

.gmh-auth__primary {
  background: var(--gerbs-blue);
  color: #fff;
  border: 2px solid transparent;
}

.gmh-auth__primary:hover,
.gmh-auth__primary:active {
  background: var(--gerbs-blue-hover);
}

.gmh-auth__ghost {
  background: none;
  color: var(--gerbs-blue);
  border: 2px solid var(--gerbs-blue);
}

.gmh-auth__ghost:hover,
.gmh-auth__ghost:active {
  background: var(--gerbs-blue-tint);
}

.gmh-auth__primary:focus-visible,
.gmh-auth__ghost:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER PILL — interim restyle (6A, T7)
   Applies only on ≤980px (this stylesheet is media-scoped to ≤980px).
   Replaces Divi TB's default button styling for .js-filters on archive pages.
   slideToggle behavior unchanged (single-bound after E4A dedupe in functions.php).
   ═══════════════════════════════════════════════════════════════════════════ */

.js-filters {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--gerbs-ink);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px var(--space-4);
  font-family: var(--ff-body);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  min-height: 40px;
  line-height: 1;
}

.js-filters:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Material Symbols icon inside the filter pill */
.js-filters .material-symbols-outlined {
  font-size: 18px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PR2 — TAB RAIL (Shop / Filters, category pages only)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tab rail: sits below the yellow drawer header, above the panel content */
.gmh-drawer__tabs {
  display: flex;
  flex-shrink: 0;
  border-bottom: 2px solid var(--gerbs-hairline);
  background: #fff;
}

.gmh-tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: none;
  border-bottom: 3px solid transparent;
  /* negative margin aligns the 3px indicator with the 2px rail border */
  margin-bottom: -2px;
  background: none;
  cursor: pointer;
  font-family: var(--ff-body);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--gerbs-ink-50);
  transition: color 120ms, border-color 120ms;
  white-space: nowrap;
}

.gmh-tab--active,
.gmh-tab[aria-selected="true"] {
  color: var(--gerbs-ink);
  border-bottom-color: var(--gerbs-ink);
}

.gmh-tab:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

@media (prefers-reduced-motion: reduce) {
  .gmh-tab {
    transition: none;
  }
}

/* ── Filters panel (same scroll behaviour as Shop panel) ─────────────────── */
.gmh-drawer__body--filters {
  padding: 12px 0 8px;
}

/* Container that receives .category-filters (and .yith-wcan-sort-by) via JS */
#gmh-filter-slot {
  padding: 0 16px;
}

/* Reset any .category-filters slideToggle inline style that may linger */
#gmh-filter-slot .category-filters {
  display: block !important;
}

/* Tighten YITH sort widget when hosted inside the drawer */
#gmh-filter-slot .yith-wcan-sort-by {
  margin-bottom: 12px;
}
