/*
 * Site header — src/components/Header.tsx, behaviour in public/assets/js/header.js.
 * Loaded on every page (MainLayout), so it only uses its own .zh-* classes and the global --zp-* tokens.
 * Buttons need !important on colours/borders: Electro's "button:not(...)" rule (style.css) outranks classes.
 */
.zh-wrap { max-width: 1240px; width: calc(100% - 80px); margin: 0 auto; }
.zh-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Arial sized to Cabin's metrics: text keeps its width and height when the Cabin webfont swaps in
 * (display=swap), so the header, chips and toolbars don't shift (CLS). Measured against Cabin v35:
 * width ratio 0.94 (400/500) and 0.905 (600/700); ascent 0.97em, descent 0.25em. */
@font-face { font-family: 'Cabin Fallback'; src: local('Arial'); font-weight: 100 500; size-adjust: 94%; ascent-override: 103.2%; descent-override: 26.6%; line-gap-override: 0%; }
@font-face { font-family: 'Cabin Fallback'; src: local('Arial Bold'), local('Arial-BoldMT'); font-weight: 600 900; size-adjust: 90.5%; ascent-override: 107.2%; descent-override: 27.6%; line-gap-override: 0%; }

.zh-topbar, .zh-header { font-family: 'Cabin', 'Cabin Fallback', sans-serif; -webkit-font-smoothing: antialiased; }
.zh-topbar *, .zh-header * { box-sizing: border-box; }
.zh-header :is(ul, p) { margin: 0; padding: 0; list-style: none; }
.zh-header a { text-decoration: none; }
.zh-header svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Top bar */
.zh-topbar { background: var(--zp-primary, #a63235); color: #fff; font-size: 11.5px; letter-spacing: .6px; line-height: 1.5; }
.zh-topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; }
.zh-topbar__inner > span { text-transform: uppercase; }
.zh-topbar a { color: #fff; letter-spacing: 0; }
.zh-topbar a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* Main row */
.zh-header { position: relative; z-index: 60; background: #fff; border-bottom: 1px solid var(--zp-line, #e9e6e3); color: var(--zp-ink-strong, #080808); }
.zh-header__row { display: flex; align-items: center; gap: 35px; height: 82px; }
.zh-logo { display: block; flex: none; width: 130px; }
.zh-logo img { display: block; width: 100%; height: auto; }

.zh-nav { flex: 1 1 auto; min-width: 0; }
.zh-nav__list { display: flex; align-items: center; gap: 28px; }
.zh-nav__item { position: relative; }
.zh-nav__item.is-wide { position: static; }
.zh-header .zh-nav__link {
  display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 8px 0 !important;
  background: none !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  color: var(--zp-ink-strong, #080808) !important; font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4; white-space: nowrap; cursor: pointer;
  transition: color .15s;
}
.zh-header .zh-nav__link:hover,
.zh-header .zh-nav__toggle[aria-expanded="true"] { color: var(--zp-primary, #a63235) !important; }
.zh-chevron { width: 14px; height: 14px; transition: transform .2s; }
.zh-nav__toggle[aria-expanded="true"] .zh-chevron { transform: rotate(180deg); }

/* Simple dropdown (CMS children) and account menu */
.zh-dropdown { position: absolute; top: calc(100% + 12px); left: -14px; z-index: 70; min-width: 220px; }
.zh-dropdown--end { left: auto; right: -10px; }
.zh-dropdown__inner { padding: 8px; background: #fff; border: 1px solid #eee; border-radius: 6px; box-shadow: 0 12px 30px rgba(0, 0, 0, .08); }
.zh-dropdown a { display: block; padding: 9px 12px; border-radius: 4px; font-size: 14px; color: var(--zp-ink, #242424); }
.zh-dropdown a:hover { background: var(--zp-primary-tint, #fdf6f5); color: var(--zp-primary, #a63235); }
.zh-dropdown__sep { margin-top: 6px !important; padding-top: 6px !important; border-top: 1px solid #eee; }

/* Mega panel (Shop, CMS mega columns): full width under the header */
.zh-mega { position: absolute; left: 0; right: 0; top: 100%; z-index: 70; background: #fff; border-top: 1px solid var(--zp-line, #e9e6e3); border-bottom: 1px solid var(--zp-line, #e9e6e3); box-shadow: 0 14px 24px rgba(0, 0, 0, .07); }
.zh-mega__inner { display: grid; grid-template-columns: 190px 190px minmax(0, 1fr); gap: 32px; padding: 30px 0 34px; max-height: calc(100dvh - 140px); overflow-y: auto; }
.zh-header .zh-mega__title { margin-bottom: 12px; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--zp-primary, #a63235); }
/* Drawers fade/slide in when shown (they are toggled with [hidden], so an entry animation is enough). */
@media (min-width: 1025px) {
  .zh-mega:not([hidden]), .zh-dropdown:not([hidden]) { animation: zh-drawer-in .18s ease-out; }
}
@keyframes zh-drawer-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.zh-mega__links a { display: block; padding: 5px 0; font-size: 15px; line-height: 1.5; color: #333; }
.zh-mega__links a:hover { color: var(--zp-primary, #a63235); }
.zh-mega__cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-self: start; min-width: 0; }
.zh-mega__card {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; min-height: 170px; padding: 18px;
  background: var(--zp-paper, #eeebe5); border-radius: 6px; overflow: hidden; transition: background-color .15s;
}
.zh-mega__card::before {
  content: ''; position: absolute; top: -46px; right: -46px; width: 120px; height: 120px;
  border: 18px solid rgba(255, 255, 255, .55); border-radius: 50%;
}
.zh-mega__card:hover { background: var(--zp-primary-soft, #f9e9e8); }
.zh-mega__card-name { position: relative; font-size: 17px; font-weight: 600; line-height: 1.3; color: var(--zp-ink-strong, #080808); }
.zh-mega__card-meta { position: relative; font-size: 13px; color: #6b6b6b; }
.zh-mega__card-arrow { position: absolute; top: 14px; left: 18px; font-size: 16px; color: var(--zp-primary, #a63235); }

/* Actions */
.zh-actions { display: flex; flex: none; align-items: center; gap: 22px; margin-left: auto; }
.zh-header .zh-icon-btn {
  display: grid; place-items: center; width: 26px; height: 32px; margin: 0; padding: 0 !important;
  background: none !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  color: #162733 !important; cursor: pointer; transition: color .15s;
}
.zh-header .zh-icon-btn:hover,
.zh-header .zh-icon-btn[aria-expanded="true"] { color: var(--zp-primary, #a63235) !important; }
.zh-icon-btn svg { width: 22px; height: 22px; }
.zh-account { position: relative; }

.zh-cart { display: flex; align-items: center; gap: 8px; min-height: 36px; color: #162733; font-size: 14px; font-weight: 600; }
.zh-cart:hover { color: var(--zp-primary, #a63235); }
.zh-cart__bag { position: relative; display: block; width: 24px; }
.zh-cart__bag svg { width: 24px; height: 26px; stroke-width: 1.3; }
.zh-cart__count {
  position: absolute; bottom: -8px; left: 11px; display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px;
  border-radius: 10px; background: var(--zp-primary, #a63235); color: #fff; font-size: 11px; font-weight: 600; line-height: 1;
}
.zh-cart__total .woocommerce-Price-amount { color: inherit; font-weight: 600; }
.zh-cart__total .woocommerce-Price-currencySymbol { margin-left: 1px; text-decoration: underline; }

.zh-menu-btn { display: none !important; }
.zh-menu-btn__close { display: none !important; }
.zh-menu-btn[aria-expanded="true"] .zh-menu-btn__open { display: none !important; }
.zh-menu-btn[aria-expanded="true"] .zh-menu-btn__close { display: block !important; }

/* Search panel */
.zh-search { position: absolute; top: 100%; right: max(40px, calc((100vw - 1240px) / 2)); z-index: 70; width: 480px; padding: 16px; background: #fff; border: 1px solid #eee; border-top: 0; border-radius: 0 0 6px 6px; box-shadow: 0 12px 30px rgba(0, 0, 0, .08); }
.zh-search__form { display: flex; align-items: center; gap: 8px; margin: 0; }
.zh-header .zh-search__form input {
  flex: 1; min-width: 0; height: 44px; margin: 0; padding: 0 16px; border: 1px solid #ddd; border-radius: 25px; background: #fff; box-shadow: none;
  color: var(--zp-ink-strong, #080808); font: inherit; font-size: 14px;
}
.zh-header .zh-search__form input:focus { outline: none; border-color: var(--zp-primary, #a63235); box-shadow: 0 0 0 3px rgba(var(--zp-primary-rgb, 166, 50, 53), .15); }
.zh-header .zh-search__submit {
  height: 44px; margin: 0; padding: 0 18px !important; border: 0 !important; border-radius: 25px !important;
  background-color: var(--zp-primary, #a63235) !important; color: #fff !important; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.zh-header .zh-search__submit:hover { background-color: var(--zp-primary-dark, #852729) !important; }
.zh-header .zh-search__close {
  width: 36px; height: 36px; margin: 0; padding: 0 !important; border: 0 !important; border-radius: 50% !important;
  background: none !important; color: #555 !important; font-size: 24px; line-height: 1; cursor: pointer;
}
.zh-header .zh-search__close:hover { background: var(--zp-surface-warm, #f1efeb) !important; }

.zh-header :is(a, button, input):focus-visible { outline: 3px solid var(--zp-primary, #a63235); outline-offset: 3px; }

@media (max-width: 1200px) {
  .zh-header__row { gap: 24px; }
  .zh-nav__list { gap: 20px; }
  .zh-actions { gap: 18px; }
  .zh-mega__inner { grid-template-columns: 160px 160px minmax(0, 1fr); gap: 22px; }
}

/* Tablet / phone: nav becomes a drop-down sheet under the header */
@media (max-width: 1024px) {
  .zh-wrap { width: calc(100% - 48px); }
  .zh-header__row { height: 72px; gap: 16px; }
  .zh-logo { width: 115px; }
  .zh-menu-btn { display: grid !important; }
  .zh-nav {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 65; display: none;
    max-height: calc(100dvh - 110px); overflow-y: auto; padding: 8px 24px 20px;
    background: #fff; border-top: 1px solid var(--zp-line, #e9e6e3); box-shadow: 0 14px 24px rgba(0, 0, 0, .08);
  }
  .zh-nav.is-open { display: block; }
  .zh-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .zh-nav__item, .zh-nav__item.is-wide { position: static; border-bottom: 1px solid #f0eeeb; }
  .zh-header .zh-nav__link { justify-content: space-between; width: 100%; padding: 14px 0 !important; font-size: 16px; }
  .zh-dropdown:not(.zh-dropdown--end), .zh-mega { position: static; min-width: 0; margin: 0 0 12px; border: 0; box-shadow: none; }
  .zh-dropdown:not(.zh-dropdown--end) .zh-dropdown__inner { padding: 0 0 0 12px; border: 0; box-shadow: none; }
  .zh-mega__inner { width: 100%; grid-template-columns: 1fr 1fr; gap: 18px; padding: 6px 0 4px; max-height: none; }
  .zh-mega__cards { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .zh-mega__card { min-height: 110px; padding: 14px; }
  .zh-search { right: 0; left: 0; width: auto; padding: 14px 24px; border-radius: 0; }
}
@media (max-width: 760px) {
  .zh-wrap { width: calc(100% - 32px); }
  .zh-topbar { font-size: 11px; }
  .zh-topbar__inner { justify-content: center; padding: 5px 0; }
  .zh-topbar a { display: none; }
  .zh-header__row { height: 64px; }
  .zh-logo { width: 103px; }
  .zh-actions { gap: 14px; }
  .zh-icon-btn svg { width: 21px; height: 21px; }
  .zh-cart { gap: 6px; font-size: 13px; }
  .zh-cart__bag, .zh-cart__bag svg { width: 21px; }
  .zh-cart__count { min-width: 17px; height: 17px; font-size: 10px; left: 9px; }
  .zh-nav { padding: 4px 16px 18px; max-height: calc(100dvh - 90px); }
  .zh-mega__inner { grid-template-columns: 1fr; gap: 6px; }
  .zh-search { padding: 12px 16px; }
  .zh-header .zh-search__form input { font-size: 16px; } /* 16px stops iOS zooming on focus */
}
@media (max-width: 400px) {
  .zh-cart__total { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .zh-header * { transition: none !important; animation: none !important; }
}
