/* =========================================================
   Margin Store — eBay-inspired affiliate header
   ========================================================= */
.site-header,
.site-header input,
.site-header button,
.site-header select {
  font-family:var(--font-main,Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 999;
  background: #fff;
  border-bottom: 1px solid #d8d8d8;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.site-header .wrap {
  max-width: 1240px;
  margin: 0 auto;
}

/* ---------- eBay-like small top utility row ---------- */
.mb-topbar {
  background: #fff;
  border-bottom: 1px solid #eee;
  color: #333;
  font-size: 12px;
  line-height: 1.2;
}

.mb-topbar-inner {
  min-height: 30px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mb-topbar-left,
.mb-topbar-links {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mb-topbar a {
  color: #0654ba;
  text-decoration: none;
}

.mb-topbar a:hover,
.mb-topbar a:focus {
  text-decoration: underline;
}

.mb-topbar-muted { color: #777; }

/* ---------- Main shopping row ---------- */
.header-main {
  padding: 12px 12px 10px;
  min-height: 66px;
  display: grid;
  grid-template-columns: auto auto minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  background: #fff;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #dcdcdc;
  background: #fff;
  border-radius: 999px;
  padding: 0;
  color: #111;
  cursor: pointer;
}

.brand {
  min-width: 132px;
  max-width: 208px;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  color: #111;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.brand a { color: inherit; text-decoration: none; }
.brand img,
.custom-logo {
  display: block;
  max-height: 42px;
  max-width: 208px;
  width: auto;
}

.brand strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.mb-shop-category {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: #555;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.05;
  cursor: pointer;
}

.mb-shop-category span {
  max-width: 76px;
  display: inline-block;
  white-space: normal;
  text-align: left;
}

.mb-shop-category:hover,
.mb-shop-category:focus { color: #111; }

/* ---------- eBay-like bordered search ---------- */
.mb-header-search {
  min-width: 0;
  height: 46px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto 158px;
  align-items: stretch;
  border: 2px solid #111;
  border-radius: 0;
  background: #fff;
  overflow: hidden;
}

.mb-header-search input[type="search"] {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 16px;
  background: #fff;
  color: #111;
  font-size: 15px;
}

.mb-search-category-select,
.mb-search-category-label {
  min-width: 142px;
  height: 100%;
  border: 0;
  border-left: 1px solid #d8d8d8;
  background: #fff;
  color: #444;
  padding: 0 32px 0 12px;
  font-size: 13px;
  outline: 0;
}

.mb-search-category-label {
  display: inline-flex;
  align-items: center;
  padding-right: 14px;
  white-space: nowrap;
}

.mb-header-search button {
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: #3665f3;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}

.mb-header-search button svg { display: none; }
.mb-header-search button:hover,
.mb-header-search button:focus { filter: brightness(.94); }

.mb-advanced-link {
  color: #555;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.mb-advanced-link:hover,
.mb-advanced-link:focus { color: #0654ba; text-decoration: underline; }

.account-link {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #fff;
  color: #111;
  padding: 0;
  text-decoration: none;
}

.account-link:hover,
.account-link:focus { border-color: #ddd; background: #f7f7f7; }
.account-link span { display: none; }

/* ---------- Category flyout ---------- */
.mb-category-panel {
  background: #fff;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #ddd;
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
}

.mb-category-grid {
  padding: 14px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.mb-category-grid a {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fff;
  color: #222;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.mb-category-grid a:hover,
.mb-category-grid a:focus,
.mb-category-grid a.is-strong { border-color: #111; }

/* ---------- Primary navigation row ---------- */
.site-header .site-nav {
  display: block;
  background: #fff;
  border-top: 1px solid #eee;
}

.site-header .site-nav .wrap { padding: 0 12px; }

.site-header .mb-menu,
.site-header .mb-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-header .mb-menu {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-header .mb-menu::-webkit-scrollbar { display: none; }
.site-header .mb-menu li { position: relative; margin: 0; padding: 0; flex: 0 0 auto; }

.site-header .mb-menu a {
  display: block;
  padding: 11px 11px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.site-header .mb-menu a:hover,
.site-header .mb-menu a:focus { color: #0654ba; text-decoration: underline; }

.site-header .mb-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 210px;
  margin: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(0,0,0,.08);
  z-index: 10;
}

.site-header .mb-menu li:hover > .sub-menu,
.site-header .mb-menu li:focus-within > .sub-menu { display: block; }

.site-header .mb-menu .sub-menu a {
  padding: 9px 10px;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Trending tags row ---------- */
.trend-wrap {
  padding: 8px 12px 10px;
  background: #fff;
}

.trend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.trend-row::-webkit-scrollbar { display: none; }
.trend-label { display: none; }

.trend-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  background: #f8f8f8;
  color: #222;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -.01em;
  text-decoration: none;
}

.trend-tag:hover,
.trend-tag:focus { background: #fff; border-color: #aaa; }

/* ---------- A11y helpers ---------- */
.skip-link,
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed !important;
  top: 10px;
  left: 10px;
  z-index: 10000;
  width: auto;
  height: auto;
  padding: 10px 14px;
  clip: auto;
  overflow: visible;
  white-space: normal;
  border-radius: 10px;
  background: #111;
  color: #fff;
}

/* ---------- Tablet/mobile ---------- */
@media (max-width: 900px) {
  .mb-topbar { display: none; }
  .header-main {
    grid-template-columns: auto auto 1fr auto;
    gap: 8px;
    padding: 8px;
    min-height: 58px;
  }
  .menu-toggle { display: inline-flex; }
  .brand { min-width: 104px; max-width: 132px; font-size: 19px; }
  .brand img, .custom-logo { max-width: 132px; max-height: 34px; }
  .mb-shop-category,
  .mb-advanced-link,
  .account-link { display: none; }
  .mb-header-search { grid-column: 3 / 5; height: 42px; grid-template-columns: minmax(80px, 1fr) 46px; }
  .mb-search-category-select,
  .mb-search-category-label { display: none; }
  .mb-header-search button { width: 46px; padding: 0; }
  .mb-header-search button span { display: none; }
  .mb-header-search button svg { display: block; }

  .site-header .site-nav { display: none; border-top: 1px solid #e8e8e8; }
  .site-header .site-nav.is-open { display: block; }
  body.menu-open .site-header .site-nav { display: block; }
  .site-header .site-nav .wrap { padding: 8px; }
  .site-header .mb-menu {
    display: block;
    overflow: visible;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 14px 28px rgba(0,0,0,.08);
  }
  .site-header .mb-menu a { padding: 11px 12px; font-size: 14px; text-decoration: none; }
  .site-header .mb-menu .sub-menu {
    display: block;
    position: static;
    margin: 0 0 0 12px;
    padding: 0 0 0 10px;
    background: transparent;
    border: 0;
    border-left: 1px solid #eee;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
  }
  .mb-category-panel { display: none !important; }
  .trend-wrap { padding: 7px 8px 9px; }
}

@media (max-width: 520px) {
  .header-main { grid-template-columns: auto auto 1fr; gap: 6px; }
  .brand { min-width: 88px; max-width: 112px; }
  .brand img, .custom-logo { max-width: 112px; max-height: 30px; }
  .mb-header-search { grid-column: 1 / -1; order: 5; height: 40px; }
  .mb-header-search input[type="search"] { padding: 0 11px; font-size: 13px; }
  .trend-tag { padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 380px) {
  .brand { min-width: 76px; max-width: 96px; }
  .brand img, .custom-logo { max-width: 96px; }
}
