/* ============================================================
   SUN TOOLS V3 — HEADER
   ============================================================
   Two rows: a compact dark utility bar (real contact info — not
   decoration), and the main white header (logo / nav+mega menu /
   search / account / cart). Sticky on desktop so the search and cart
   stay reachable while browsing a large catalog.
   ============================================================ */

.st3-header {
  position: sticky;
  top: 0;
  z-index: var(--st3-z-header);
  background: var(--st3-base);
}

/* ---------- Utility bar ---------- */
.st3-utility {
  background: var(--st3-dark);
  color: var(--st3-on-dark-muted);
}
.st3-utility__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--st3-space-4);
  min-height: 38px;
  font-size: var(--st3-text-xs);
}
.st3-utility__contact,
.st3-utility__links {
  display: flex;
  align-items: center;
  gap: var(--st3-space-5);
}
.st3-utility__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--st3-on-dark-muted);
  transition: color var(--st3-fast) var(--st3-ease);
}
.st3-utility__link:hover { color: var(--st3-on-dark); }
.st3-utility__icon { width: 14px; height: 14px; }
.st3-utility__links a { color: var(--st3-on-dark-muted); }
.st3-utility__links a:hover { color: var(--st3-on-dark); }

/* ---------- Main header ---------- */
.st3-main-header {
  border-bottom: 1px solid var(--st3-border);
}
.st3-main-header__inner {
  position: relative; /* mega menu anchors here — see .st3-mega — so it
    aligns to the real page container's edges, not to the nav trigger's
    incidental position within the flex row. */
  display: flex;
  align-items: center;
  gap: var(--st3-space-4);
  min-height: 92px;
}

.st3-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--st3-ink);
  cursor: pointer;
  flex-shrink: 0;
}
.st3-nav-toggle svg { width: 22px; height: 22px; }

.st3-logo { flex-shrink: 0; display: block; }
.st3-logo img { height: 44px; width: auto; }
.st3-logo--sm img { height: 36px; }

/* ---------- Categories mega trigger ---------- */
.st3-cat-trigger-wrap { position: static; flex-shrink: 0; }
.st3-cat-trigger {
  display: flex;
  align-items: center;
  gap: var(--st3-space-2);
  height: 46px;
  padding-inline: var(--st3-space-4);
  background: var(--st3-red);
  border: none;
  border-radius: var(--st3-radius);
  color: var(--st3-white);
  font-size: var(--st3-text-base);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--st3-fast) var(--st3-ease);
}
.st3-cat-trigger:hover,
.st3-cat-trigger[aria-expanded="true"] { background: var(--st3-red-dark); }
.st3-cat-trigger__icon { width: 18px; height: 18px; flex-shrink: 0; }
.st3-cat-trigger__chevron { width: 14px; height: 14px; flex-shrink: 0; transition: transform var(--st3-fast) var(--st3-ease); }
.st3-cat-trigger[aria-expanded="true"] .st3-cat-trigger__chevron { transform: rotate(180deg); }

/* ---------- Header search (inline, always visible) ---------- */
.st3-header-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 46px;
  background: var(--st3-surface);
  border: 1px solid var(--st3-border);
  border-radius: var(--st3-radius);
}
.st3-header-search__icon {
  width: 18px;
  height: 18px;
  margin-inline-start: var(--st3-space-4);
  color: var(--st3-muted);
  flex-shrink: 0;
}
.st3-header-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: none;
  background: none;
  padding-inline: var(--st3-space-3);
  font-family: var(--st3-font);
  font-size: var(--st3-text-base);
  color: var(--st3-ink);
}
.st3-header-search__input:focus { outline: none; }
.st3-header-search__input::-webkit-search-cancel-button { display: none; }
.st3-header-search__submit {
  flex-shrink: 0;
  width: 46px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0 var(--st3-radius) var(--st3-radius) 0;
  background: var(--st3-red);
  color: var(--st3-white);
  cursor: pointer;
}
.st3-header-search__submit svg { width: 18px; height: 18px; }
.st3-header-search:focus-within { border-color: var(--st3-red); }
.st3-header-search__results {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline: 0;
  z-index: var(--st3-z-search);
  background: var(--st3-white);
  border-radius: var(--st3-radius);
  overflow: hidden;
  box-shadow: var(--st3-shadow-lg);
}
.st3-header-search__results:empty { display: none; }

/* ---------- Mega menu ----------
   A real image-led navigation panel, not a dropdown of link lists: a
   mini-hero orientation block (real category photo, always-visible
   title/CTA) beside a dense photo-tile grid of all 12 real
   categories, grouped under two labeled headings. Every category is
   represented by its own real photo + always-visible caption — same
   visual language as the homepage category grid, so the menu reads
   as part of one designed system rather than a generic WP dropdown. */
.st3-mega {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  width: max-content;
  min-width: 560px;
  max-width: min(920px, 100vw);
  max-height: 80vh;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: var(--st3-z-mega-menu);
  background: var(--st3-base);
  border: 1px solid var(--st3-border);
  border-top: none;
  border-radius: 0 0 var(--st3-radius-lg) var(--st3-radius-lg);
  box-shadow: var(--st3-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--st3-base-speed) var(--st3-ease),
              transform var(--st3-base-speed) var(--st3-ease),
              visibility 0s linear var(--st3-base-speed);
}
.st3-cat-trigger-wrap:hover .st3-mega,
.st3-cat-trigger-wrap:focus-within .st3-mega,
.st3-mega.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}
@media (prefers-reduced-motion: reduce) {
  .st3-mega { transition: opacity .01s linear, visibility 0s linear; }
}
.st3-mega__inner {
  display: flex;
  align-items: stretch;
  gap: var(--st3-space-6);
  padding: var(--st3-space-6);
}

/* -- Intro / orientation panel: real photo, always-on caption -- */
.st3-mega__intro {
  position: relative;
  flex: 0 0 200px;
  display: flex;
  align-items: flex-end;
  border-radius: var(--st3-radius);
  overflow: hidden;
  background: var(--st3-dark);
}
.st3-mega__intro img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--st3-base-speed) var(--st3-ease);
}
.st3-mega__intro-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(200deg, rgba(21,21,21,.35) 0%, rgba(21,21,21,.92) 100%);
}
.st3-mega__intro-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--st3-space-2);
  padding: var(--st3-space-5);
  color: var(--st3-white);
}
.st3-mega__intro-eyebrow {
  font-size: var(--st3-text-xs);
  font-weight: 700;
  color: var(--st3-red);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.st3-mega__intro-title {
  font-size: var(--st3-text-lg);
  font-weight: 800;
  line-height: 1.25;
}
.st3-mega__intro-sub {
  font-size: var(--st3-text-xs);
  color: rgba(255,255,255,.75);
}
.st3-mega__intro-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--st3-space-2);
  margin-top: var(--st3-space-2);
  font-size: var(--st3-text-sm);
  font-weight: 700;
  color: var(--st3-white);
}
.st3-mega__intro-cta-icon { width: 16px; height: 16px; transform: scaleX(-1); transition: transform var(--st3-fast) var(--st3-ease); }
.st3-mega__intro:hover img { transform: scale(1.05); }
.st3-mega__intro:hover .st3-mega__intro-cta-icon,
.st3-mega__intro:focus-visible .st3-mega__intro-cta-icon { transform: scaleX(-1) translateX(4px); }

/* -- Category grid: grouped, image-led -- */
.st3-mega__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--st3-space-5);
  min-width: 0;
}
.st3-mega__group-heading {
  display: block;
  font-size: var(--st3-text-xs);
  font-weight: 700;
  color: var(--st3-red);
  text-transform: uppercase;
  letter-spacing: .02em;
  margin-bottom: var(--st3-space-3);
  padding-bottom: var(--st3-space-2);
  border-bottom: 2px solid var(--st3-red);
}
.st3-mega__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--st3-space-3);
}
.st3-mega__tile {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 1 / 1;
  width: 84px;
  border-radius: var(--st3-radius);
  overflow: hidden;
  background: var(--st3-soft-gray);
}
.st3-mega__tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--st3-fast) var(--st3-ease);
}
.st3-mega__tile-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15,15,15,.85) 0%, rgba(15,15,15,.15) 55%, transparent 75%);
}
.st3-mega__tile-label {
  position: relative;
  z-index: 1;
  padding: var(--st3-space-2);
  color: var(--st3-white);
  font-size: 11px;
  line-height: 1.25;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.st3-mega__tile:not(.st3-mega__tile--photo) .st3-mega__tile-label { color: var(--st3-ink); text-shadow: none; }
.st3-mega__tile:hover img,
.st3-mega__tile:focus-visible img { transform: scale(1.08); }

@media (max-width: 768px) {
  /* min-width:560px from the base rule otherwise wins over width:100vw
     below 560px viewports (min-width always beats width), forcing this
     hidden-but-still-laid-out absolute panel to overflow the document
     and create real horizontal scroll on phones. */
  .st3-mega { width: 100vw; max-width: 100vw; min-width: 0; }
  .st3-mega__inner { flex-direction: column; gap: var(--st3-space-5); padding: var(--st3-space-4); }
  .st3-mega__intro { flex: none; aspect-ratio: 21 / 9; }
  .st3-mega__grid { grid-template-columns: repeat(4, 1fr); }
  .st3-mega__tile { width: auto; }
}

/* ---------- Header actions (search / account / cart) ---------- */
.st3-header__actions {
  display: flex;
  align-items: center;
  gap: var(--st3-space-2);
  flex-shrink: 0;
}
.st3-icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: var(--st3-radius);
  background: none;
  color: var(--st3-ink);
  cursor: pointer;
  transition: background-color var(--st3-fast) var(--st3-ease), color var(--st3-fast) var(--st3-ease);
}
.st3-icon-btn svg { width: 21px; height: 21px; }
.st3-icon-btn:hover { background: var(--st3-soft-gray); color: var(--st3-red); }
.st3-icon-btn__count {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--st3-red);
  color: var(--st3-white);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  line-height: 1;
}

/* ---------- Cart pill ---------- */
.st3-cart-pill {
  display: flex;
  align-items: center;
  gap: var(--st3-space-2);
  height: 46px;
  padding-inline: var(--st3-space-3) var(--st3-space-4);
  background: var(--st3-red);
  border-radius: var(--st3-radius);
  color: var(--st3-white);
  transition: background-color var(--st3-fast) var(--st3-ease);
}
.st3-cart-pill:hover { background: var(--st3-red-dark); }
.st3-cart-pill__icon-wrap { position: relative; display: flex; }
.st3-cart-pill__icon { width: 20px; height: 20px; }
.st3-cart-pill__count {
  position: absolute;
  top: -7px;
  inset-inline-end: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--st3-white);
  color: var(--st3-red);
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  line-height: 1;
}
.st3-cart-pill__label { font-size: var(--st3-text-sm); font-weight: 700; white-space: nowrap; }

/* ---------- Search suggestion results (rendered into .st3-header-search__results) ---------- */
.st3-search-suggest__item {
  display: flex;
  align-items: center;
  gap: var(--st3-space-3);
  padding: var(--st3-space-2) var(--st3-space-3);
  transition: background-color var(--st3-fast) var(--st3-ease);
}
.st3-search-suggest__item:hover { background: var(--st3-soft-gray); }
.st3-search-suggest__item img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: var(--st3-soft-gray);
  border-radius: var(--st3-radius-sm);
  flex-shrink: 0;
}
.st3-search-suggest__meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st3-search-suggest__title {
  font-size: var(--st3-text-sm);
  font-weight: 600;
  color: var(--st3-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st3-search-suggest__price { font-size: var(--st3-text-xs); font-weight: 700; color: var(--st3-red); }
.st3-search-suggest__status,
.st3-search-suggest__empty {
  padding: var(--st3-space-4);
  text-align: center;
  font-size: var(--st3-text-sm);
  color: var(--st3-muted);
}

/* ---------- Mobile nav drawer ---------- */
.st3-mobile-nav {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: min(88vw, 380px);
  background: var(--st3-white);
  z-index: var(--st3-z-mobile-nav);
  display: flex;
  flex-direction: column;
  box-shadow: var(--st3-shadow-lg);
}
.st3-mobile-nav[hidden] { display: none; }
.st3-mobile-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--st3-space-4);
  border-bottom: 1px solid var(--st3-border);
}
.st3-mobile-nav__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--st3-space-2) var(--st3-space-4);
  display: flex;
  flex-direction: column;
}
.st3-mobile-nav__link {
  padding: var(--st3-space-3) 0;
  font-size: var(--st3-text-md);
  font-weight: 600;
  color: var(--st3-ink);
  border-bottom: 1px solid var(--st3-border);
}
.st3-mobile-nav__group { border-bottom: 1px solid var(--st3-border); }
.st3-mobile-nav__group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--st3-space-3) 0;
  font-size: var(--st3-text-md);
  font-weight: 600;
  color: var(--st3-ink);
  cursor: pointer;
  list-style: none;
}
.st3-mobile-nav__group summary::-webkit-details-marker { display: none; }
.st3-mobile-nav__chevron { width: 16px; height: 16px; transition: transform var(--st3-fast) var(--st3-ease); }
.st3-mobile-nav__group[open] .st3-mobile-nav__chevron { transform: rotate(180deg); }
.st3-mobile-nav__sublist {
  display: flex;
  flex-direction: column;
  padding-bottom: var(--st3-space-3);
}
.st3-mobile-nav__sublist a {
  padding: var(--st3-space-2) 0 var(--st3-space-2) var(--st3-space-3);
  font-size: var(--st3-text-base);
  color: var(--st3-body);
}
.st3-mobile-nav__footer {
  padding: var(--st3-space-4);
  border-top: 1px solid var(--st3-border);
}

.st3-nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 125;
  background: rgba(21,21,21,.5);
}
.st3-nav-scrim[hidden] { display: none; }

/* ---------- Secondary nav row (flat links, below the search row) ---------- */
.st3-subnav {
  background: var(--st3-base);
  border-bottom: 1px solid var(--st3-border);
}
.st3-subnav__list {
  display: flex;
  align-items: center;
  gap: var(--st3-space-1);
}
.st3-subnav__item { position: relative; }
.st3-subnav__link {
  display: block;
  padding: var(--st3-space-3) var(--st3-space-3);
  font-size: var(--st3-text-sm);
  font-weight: 600;
  color: var(--st3-body);
  transition: color var(--st3-fast) var(--st3-ease);
}
.st3-subnav__link:hover { color: var(--st3-red); }
.st3-subnav__item:first-child .st3-subnav__link { color: var(--st3-red); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .st3-nav-toggle { display: flex; }
  .st3-subnav { display: none; }
  .st3-utility__links { display: none; }
  /* Duplicate mobile menu trigger fix: `.st3-nav-toggle` (above) is
     the real, dedicated navigation trigger — it opens
     `#st3-mobile-nav`, which already includes every category under
     its own "المنتجات" group. `.st3-cat-trigger` is a DESKTOP-only
     affordance (a mega-menu quick-browse shortcut that opens on
     hover — see `.st3-cat-trigger-wrap:hover .st3-mega` — a pattern
     that doesn't exist on touch) that used to just shrink to an
     icon-only square at this breakpoint, reading as an unlabeled
     second hamburger sitting right next to the real one. Hiding the
     whole wrapper (trigger + its mega panel) removes the duplicate
     without touching `.st3-nav-toggle`, `#st3-mobile-nav`, or any nav
     markup/links — the equivalent category list is already reachable
     from the one real mobile menu. */
  .st3-cat-trigger-wrap { display: none; }
  .st3-cart-pill__label { display: none; }
  .st3-cart-pill { padding-inline: var(--st3-space-3); }
}
@media (max-width: 768px) {
  .st3-main-header__inner { min-height: 64px; padding-block: var(--st3-space-3); gap: var(--st3-space-2); flex-wrap: wrap; }
  .st3-nav-toggle { order: 1; }
  .st3-logo { order: 2; }
  .st3-header__actions { order: 4; margin-inline-start: auto; }
  .st3-logo img { height: 34px; }
  .st3-utility__inner { min-height: 34px; }
  .st3-utility__link span { display: none; }
  .st3-header-search { order: 5; flex-basis: 100%; height: 42px; margin-top: var(--st3-space-2); }
  .st3-header-search__results { top: calc(100% + 4px); }
}
@media (max-width: 430px) {
  .st3-header__actions { gap: 2px; }
  .st3-icon-btn { width: 38px; height: 38px; }
  .st3-cart-pill { height: 38px; }
}
