/**
 * Header 4 — Ceramide Cosmetics-style three-tier header.
 */

.bsp-h4 {
  --bsp-container: 1600px;
  --bsp-h4-topbar-bg: #f7ebe6;
  --bsp-h4-topbar-text: #4b4b4b;
  --bsp-h4-main-bg: #ffffff;
  --bsp-h4-main-text: #1a1a1a;
  --bsp-h4-logo: #1a1a1a;
  --bsp-h4-nav-bg: #1c1c1c;
  --bsp-h4-nav-text: #ffffff;
  --bsp-h4-sale-bg: #e11d2e;
  --bsp-h4-sale-text: #ffffff;
  --bsp-h4-search-border: #d1d5db;
  --bsp-h4-font-serif: "Cormorant Garamond", "Times New Roman", serif;
  --bsp-h4-font-sans: "DM Sans", system-ui, sans-serif;

  background: var(--bsp-h4-main-bg);
  font-family: var(--bsp-h4-font-sans);
  color: var(--bsp-h4-main-text);
}

/* ============ Top bar ============ */

.bsp-h4-topbar {
  background: var(--bsp-h4-topbar-bg);
  color: var(--bsp-h4-topbar-text);
}

.bsp-h4-topbar__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  padding: 8px 0;
  font-size: 13px;
}

.bsp-h4-topbar__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  justify-self: start;
}

.bsp-h4-topbar__links a {
  color: inherit;
  text-decoration: none;
  font-weight: 400;
  white-space: nowrap;
}

.bsp-h4-topbar__links a:hover,
.bsp-h4-topbar__links a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bsp-h4-topbar__announcement {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.bsp-h4-topbar__truck {
  font-size: 14px;
  line-height: 1;
}

.bsp-h4-topbar__meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  justify-self: end;
}

.bsp-h4-topbar__currency .bsp-mcx__trigger,
.bsp-h4-topbar__currency .bsp-mcx__current {
  color: var(--bsp-h4-topbar-text);
  font-size: 13px;
}

.bsp-h4-topbar__socials {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.bsp-h4-topbar__socials a {
  color: inherit;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  opacity: 0.9;
}

.bsp-h4-topbar__socials a:hover,
.bsp-h4-topbar__socials a:focus-visible {
  opacity: 1;
}

/* ============ Main row ============ */

.bsp-h4-main {
  background: var(--bsp-h4-main-bg);
  border-bottom: 1px solid #f0f0f0;
}

.bsp-h4-main__inner {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 96px;
  padding: 18px 0;
}

.bsp-h4-mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.bsp-h4-mobile-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--bsp-h4-main-text);
}

.bsp-h4-search {
  justify-self: start;
  width: 100%;
  max-width: 360px;
  position: relative;
  z-index: 40;
}

.bsp-h4-search__form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid var(--bsp-h4-search-border);
  border-radius: 999px;
  background: #ffffff;
  overflow: visible;
}

.bsp-h4-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 18px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--bsp-h4-main-text);
  font-size: 14px;
  font-family: inherit;
}

.bsp-h4-search__input::placeholder {
  color: #9ca3af;
}

.bsp-h4-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 46px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  flex-shrink: 0;
}

.bsp-h4-search__submit:hover,
.bsp-h4-search__submit:focus-visible {
  color: var(--bsp-h4-main-text);
}

.bsp-h4-search .bsp-live-search {
  top: calc(100% + 10px);
  z-index: 90;
  border-radius: 14px;
}

.bsp-h4-brand {
  justify-self: center;
  text-align: center;
}

.bsp-h4-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--bsp-h4-logo);
  line-height: 1;
}

.bsp-h4-logo__image img,
.bsp-h4-logo__image .custom-logo {
  display: block;
  max-height: 64px;
  width: auto;
}

.bsp-h4-logo__title {
  font-family: var(--bsp-h4-font-serif);
  font-size: clamp(1.75rem, 2.2vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--bsp-h4-logo);
}

.bsp-h4-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  justify-self: end;
}

.bsp-h4-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--bsp-h4-main-text);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.bsp-h4-action i {
  font-size: 16px;
}

.bsp-h4-action--wishlist,
.bsp-h4-action--cart {
  position: relative;
}

.bsp-h4-action__bag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
}

.bsp-h4-action__count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bsp-h4-sale-bg);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.bsp-h4-action__count[data-count="0"],
.bsp-h4-action__count:empty {
  display: none;
}

/* ============ Navbar ============ */

.bsp-h4-navbar {
  background: var(--bsp-h4-nav-bg);
  color: var(--bsp-h4-nav-text);
}

.bsp-h4-navbar__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 52px;
  position: relative;
}

.bsp-h4-nav {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.bsp-h4-nav__menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bsp-h4-nav__menu > li > a,
.bsp-h4-nav__menu > .menu-item > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 0;
  color: var(--bsp-h4-nav-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.bsp-h4-nav .bsp-has-dropdown > a::after,
.bsp-h4-nav .menu-item-has-children > a::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.85;
}

.bsp-h4-nav .bsp-nav-menu .sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.12);
  z-index: 80;
}

.bsp-h4-nav .bsp-nav-menu > .menu-item-has-children {
  position: relative;
}

@media (min-width: 993px) {
  .bsp-h4-nav .bsp-nav-menu > .menu-item-has-children:not(.bsp-mega-menu-parent):hover > .sub-menu,
  .bsp-h4-nav .bsp-nav-menu > .menu-item-has-children:not(.bsp-mega-menu-parent):focus-within > .sub-menu {
    display: block;
  }
}

.bsp-h4-nav .bsp-nav-menu .sub-menu a {
  display: block;
  padding: 9px 16px;
  color: #1a1a1a;
  text-decoration: none;
  font-size: 13px;
}

.bsp-h4-nav .bsp-nav-menu .sub-menu a:hover {
  background: #f8f9fb;
}

.bsp-h4-sale {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--bsp-h4-sale-bg);
  color: var(--bsp-h4-sale-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  z-index: 2;
}

.bsp-h4-sale:hover,
.bsp-h4-sale:focus-visible {
  filter: brightness(0.95);
}

.bsp-h4-nav .bsp-submenu-toggle {
  display: none;
}

/* ============ Responsive ============ */

@media (max-width: 1100px) {
  .bsp-h4-action span:not(.bsp-h4-action__bag):not(.bsp-h4-action__count):not(.screen-reader-text) {
    display: none;
  }

  .bsp-h4-actions {
    gap: 14px;
  }

  .bsp-h4-nav__menu {
    gap: 4px 18px;
  }
}

@media (max-width: 992px) {
  .bsp-h4-topbar {
    display: none;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar {
    display: block;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 14px;
    min-height: 0;
    padding: 8px 0;
    text-align: center;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar__links {
    display: none;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar__announcement {
    flex: 1 1 100%;
    order: 1;
    white-space: normal;
    font-size: 12px;
    line-height: 1.35;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar__meta {
    order: 2;
    justify-content: center;
    justify-self: center;
    gap: 12px;
  }

  .bsp-h4-mobile-toggle {
    display: flex;
    order: 1;
  }

  .bsp-h4-main__inner {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    min-height: 72px;
    padding: 12px 0;
  }

  .bsp-h4-search {
    order: 4;
    grid-column: 1 / -1;
    max-width: none;
    justify-self: stretch;
  }

  .bsp-h4-brand {
    order: 2;
    justify-self: center;
  }

  .bsp-h4-actions {
    order: 3;
  }

  .bsp-h4-logo__title {
    font-size: 1.5rem;
  }

  .bsp-h4-navbar__inner {
    justify-content: flex-start;
    min-height: 0;
    padding: 0;
  }

  .bsp-h4-sale {
    display: none;
  }

  .bsp-h4-nav {
    justify-content: flex-start;
  }

  .bsp-h4-nav:not(.is-open) {
    display: none;
  }

  .bsp-h4-nav.is-open {
    display: block;
    position: fixed;
    top: var(--bsp-mobile-nav-top, 60px);
    left: 0;
    right: 0;
    z-index: 499;
    max-height: calc(100vh - var(--bsp-mobile-nav-top, 60px));
    overflow-y: auto;
    padding: 8px 16px 16px;
    background: var(--bsp-h4-nav-bg);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.18);
  }

  .bsp-h4-navbar {
    position: relative;
  }

  body.bsp-mobile-nav-open .bsp-h4-navbar {
    /* Keep bar in document so sticky/main measurements stay correct. */
    min-height: 0;
  }

  .bsp-h4-nav__menu {
    display: block;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .bsp-h4-nav__menu > li {
    display: block;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .bsp-h4-nav__menu > li > a {
    display: block;
    width: auto;
    padding: 12px 0;
    border-bottom: 0;
  }

  .bsp-h4-nav .bsp-has-dropdown > a::after,
  .bsp-h4-nav .menu-item-has-children > a::after {
    display: none;
  }

  .bsp-h4-nav .bsp-has-dropdown,
  .bsp-h4-nav .menu-item-has-children,
  .bsp-h4-nav .bsp-h4-has-toggle,
  .bsp-h4-nav .bsp-mega-menu-parent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
  }

  .bsp-h4-nav .bsp-has-dropdown > a,
  .bsp-h4-nav .menu-item-has-children > a,
  .bsp-h4-nav .bsp-h4-has-toggle > a,
  .bsp-h4-nav .bsp-mega-menu-parent > a,
  .bsp-h4-nav .bsp-mega-menu-parent > .bsp-mega-menu-trigger {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
  }

  .bsp-h4-nav .bsp-submenu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--bsp-h4-nav-text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
  }

  .bsp-h4-nav .bsp-submenu-toggle__icon {
    display: block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    border-bottom: 0;
    transform: none;
    transition: transform 0.2s ease;
  }

  .bsp-h4-nav .is-submenu-open > .bsp-submenu-toggle .bsp-submenu-toggle__icon,
  .bsp-h4-nav .is-open > .bsp-submenu-toggle .bsp-submenu-toggle__icon,
  .bsp-h4-nav .bsp-submenu-toggle[aria-expanded="true"] .bsp-submenu-toggle__icon {
    transform: rotate(180deg);
  }

  .bsp-h4-nav .bsp-nav-menu .sub-menu {
    position: static;
    display: none;
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 0 8px 14px;
    list-style: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .bsp-h4-nav .bsp-has-dropdown.is-submenu-open > .sub-menu,
  .bsp-h4-nav .menu-item-has-children.is-submenu-open > .sub-menu,
  .bsp-h4-nav .bsp-mega-menu-parent.is-open > .bsp-mega-menu {
    display: block;
  }

  .bsp-h4-nav .bsp-nav-menu .sub-menu a {
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 0;
    border-bottom: 0;
  }

  .bsp-h4-nav .bsp-mega-menu {
    position: static;
    display: none;
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 0 8px 14px;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
}

@media (max-width: 576px) {
  .bsp-h4-action--store {
    display: none;
  }

  .bsp-h4-sale {
    font-size: 12px;
    min-height: 30px;
    padding: 0 14px;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar__socials {
    display: none;
  }

  body.bsp-show-topbar-mobile .bsp-h4-topbar__inner {
    padding: 6px 0;
  }

  .bsp-h4-main__inner {
    min-height: 64px;
    padding: 10px 0;
  }

  .bsp-h4-logo__title {
    font-size: 1.35rem;
  }
}
