/*
 * tech-storefront — header + mobile drawer (Balanced + Regular + Light only).
 *
 * Ported intent from the Claude Design prototype. No data-theme / data-dark /
 * data-density qualifiers are permitted in this file — strip them on any
 * future re-port.
 */

/* ------------------------------------------------------------------
 * Site header shell
 * ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-sans);
}

.site-header .wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header .bar {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* ------------------------------------------------------------------
 * Promo strip
 * ------------------------------------------------------------------ */

.site-header .promo {
  background: var(--brand);
  color: var(--paper);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.5rem 1rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.site-header .promo .promo-sep { opacity: 0.75; }

.site-header .promo a.promo-wa {
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.site-header .promo a.promo-wa:hover { text-decoration: none; }
.site-header .promo svg.tech-icon { width: 14px; height: 14px; }

/* ------------------------------------------------------------------
 * Logo
 * ------------------------------------------------------------------ */

.site-header .logo {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.site-header .logo:hover { text-decoration: none; }
.site-header .logo .dot {
  color: var(--brand);
  font-size: 1.05em;
  font-weight: 900;
}

/* ------------------------------------------------------------------
 * Desktop nav cluster (mega trigger + Shop link)
 * ------------------------------------------------------------------ */

.header-nav-cluster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mega-trigger {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: var(--brand);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  transition: background-color 160ms ease, color 160ms ease;
}
.mega-trigger:hover,
.mega-trigger[aria-expanded="true"] {
  background: var(--accent);
  color: var(--paper);
}
.mega-trigger svg.tech-icon { color: inherit; }

.site-header .shop-link {
  color: var(--ink-2);
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 160ms ease, background-color 160ms ease;
}
.site-header .shop-link:hover {
  color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}

/* ------------------------------------------------------------------
 * Search (desktop + mobile)
 * ------------------------------------------------------------------ */

.header-search {
  min-width: 0;
}

.header-search .search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.6rem 0.4rem 2.25rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.header-search .search-form:focus-within {
  border-color: var(--accent);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-search .search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.header-search .search-field {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0.25rem 0.25rem;
  font-size: 0.9375rem;
  color: var(--ink);
}
.header-search .search-field::placeholder { color: var(--ink-3); }

.header-search .search-submit {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: var(--paper);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  flex: 0 0 32px;
  transition: background-color 160ms ease;
}
.header-search .search-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 14px no-repeat
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}
.header-search .search-submit:hover { background: var(--accent); }

/* tech-merch autocomplete dropdown — light theme polish. JS owns positioning. */
.tm-autocomplete-dropdown {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-sans);
}
.tm-autocomplete-dropdown .tm-results { list-style: none; margin: 0; padding: 0; }
.tm-autocomplete-dropdown .tm-results li { border-bottom: 1px solid var(--line); }
.tm-autocomplete-dropdown .tm-results li:last-child { border-bottom: 0; }
.tm-autocomplete-dropdown .tm-results a {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.625rem 0.875rem;
  color: var(--ink);
  text-decoration: none;
}
.tm-autocomplete-dropdown .tm-results a:hover { background: var(--paper-2); }
.tm-autocomplete-dropdown .tm-results img { width: 44px; height: 44px; object-fit: contain; flex: 0 0 44px; }
.tm-autocomplete-dropdown .tm-name { font-weight: 500; font-size: 0.875rem; }
.tm-autocomplete-dropdown .tm-brand { color: var(--ink-3); font-size: 0.75rem; }
.tm-autocomplete-dropdown .tm-price { color: var(--brand); font-weight: 600; font-size: 0.875rem; }
.tm-autocomplete-dropdown .tm-price .tm-sale { color: var(--brand); }
.tm-autocomplete-dropdown .tm-price s { color: var(--ink-3); font-weight: 400; margin-left: 0.35rem; }
.tm-autocomplete-dropdown .tm-more {
  padding: 0.625rem 0.875rem;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 0.875rem;
}
.tm-autocomplete-dropdown .tm-more a { color: var(--accent); font-weight: 600; }
.tm-autocomplete-dropdown .tm-no-results {
  padding: 0.875rem;
  color: var(--ink-3);
  font-size: 0.875rem;
  text-align: center;
}

.site-header .mobile-search-row {
  display: none;
  padding: 0 1rem 0.75rem;
}
.site-header .mobile-search-row .header-search { width: 100%; }

/* T-129: mobile search row — `get_search_form()` renders searchform.php here
 * (icon + input + submit), but the pill rules above are scoped to
 * `.header-search .search-form`. Re-apply them inside `.mobile-search-row`. */
.site-header .mobile-search-row .search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.6rem 0.4rem 2.25rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.site-header .mobile-search-row .search-form:focus-within {
  border-color: var(--accent);
  background: var(--paper);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.site-header .mobile-search-row .search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.site-header .mobile-search-row .search-field {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 0.25rem 0.25rem;
  font-size: 16px; /* iOS Safari avoids zoom-on-focus at >=16px */
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
.site-header .mobile-search-row .search-field::placeholder { color: var(--ink-3); }
.site-header .mobile-search-row .search-submit {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: var(--paper);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  flex: 0 0 32px;
  transition: background-color 160ms ease;
}
.site-header .mobile-search-row .search-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 14px no-repeat
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}
.site-header .mobile-search-row .search-submit:hover { background: var(--accent); }

/* ------------------------------------------------------------------
 * Actions (account, wishlist, cart, hamburger)
 * ------------------------------------------------------------------ */

.site-header .actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  justify-self: end;
}

.site-header .icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: color 160ms ease, background-color 160ms ease;
}
.site-header .icon-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.site-header .icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}
.site-header .icon-btn .badge[hidden] { display: none; }

.site-header .hamburger { display: none; }

/* ------------------------------------------------------------------
 * Responsive: ≤900px collapses desktop nav + search into mobile row
 * ------------------------------------------------------------------ */

@media (max-width: 900px) {
  .site-header .bar {
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem;
    min-height: 56px;
  }
  .site-header .logo { font-size: 22px; }

  .header-nav-cluster { display: none; }
  .site-header .desktop-search { display: none; }
  .site-header .desktop-only-action { display: none; }

  .site-header .mobile-search-row { display: block; }

  .site-header .hamburger { display: inline-flex; }
}

/* Home page suppresses the header's search entirely (home has its own bigger search). */
.site-header.home .desktop-search,
.site-header.home .mobile-search-row { display: none !important; }

/* ------------------------------------------------------------------
 * Mobile drawer
 * ------------------------------------------------------------------ */

.mobile-drawer-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(15, 16, 20, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 240ms ease, visibility 0s linear 240ms;
  z-index: 80;
}
.mobile-drawer.is-open ~ .mobile-drawer-bg,
.mobile-drawer-bg.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 240ms ease, visibility 0s linear 0s;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(86vw, 380px);
  background: var(--paper);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform 240ms ease, visibility 0s linear 240ms;
  display: grid;
  grid-template-rows: auto 1fr;
  z-index: 90;
  font-family: var(--font-sans);
  visibility: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mobile-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 240ms ease, visibility 0s linear 0s;
}

body.tech-drawer-open { overflow: hidden; }

@media (min-width: 901px) {
  .mobile-drawer,
  .mobile-drawer-bg { display: none !important; }
}

.mobile-drawer-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.mobile-drawer-hd .logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1;
}
.mobile-drawer-hd .logo .dot { color: var(--brand); font-size: 1.05em; font-weight: 900; }

.mobile-drawer-hd .icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}
.mobile-drawer-hd .icon-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.mobile-drawer-body {
  overflow-y: auto;
  padding: 0.5rem 0 1.25rem;
}

.mobile-drawer-body .label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-3);
  padding: 1rem 1rem 0.35rem;
}

.mobile-drawer-body .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
  text-decoration: none;
  font-family: inherit;
}
.mobile-drawer-body .item:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}
.mobile-drawer-body .item.active {
  background: var(--brand-soft);
  color: var(--brand);
}

.mobile-drawer-body .item-left,
.mobile-drawer-body .item-right {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.mobile-drawer-body .item .ico {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-2);
}
.mobile-drawer-body .item:hover .ico { color: inherit; }

.mobile-drawer-body .item .ct {
  font-size: 0.75rem;
  color: var(--ink-3);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 600;
}
.mobile-drawer-body .item .chev {
  color: var(--ink-3);
  transition: transform 200ms ease;
}
.mobile-drawer-body .item[data-open="1"] .chev {
  transform: rotate(90deg);
  color: var(--accent);
}

.mobile-drawer-body .submenu {
  background: var(--paper-2);
}
.mobile-drawer-body .submenu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  color: var(--ink-2);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.mobile-drawer-body .submenu a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.mobile-drawer-body .drawer-allcat {
  font-weight: 600;
  color: var(--brand) !important;
}

.mobile-drawer-body .drawer-foot {
  padding: 1rem;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.8125rem;
}
.mobile-drawer-body .drawer-foot p { margin: 0.5rem 0 0; }

.mobile-drawer-body .btn.primary {
  background: var(--brand);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 0.625rem 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9375rem;
  transition: background-color 160ms ease;
}
.mobile-drawer-body .btn.primary:hover { background: var(--accent); text-decoration: none; }
.mobile-drawer-body .btn.sm { padding: 0.5rem 0.875rem; font-size: 0.875rem; }
