/* ==========================================================
   RANDOMLY VISIONARY
   HEADER
   ========================================================== */

/* ---------------------------------------------
   Light Mode Header Overrides
   --------------------------------------------- */

[data-theme="light"] .site-header {
  color: var(--alabaster-grey);
}

[data-theme="light"] .primary-nav__list a {
  color: var(--alabaster-grey);
}

[data-theme="light"] .header-icon-btn svg,
[data-theme="light"] .header-theme-toggle svg,
[data-theme="light"] .header-account svg,
[data-theme="light"] .header-account-icon svg {
  color: var(--alabaster-grey);
  stroke: var(--alabaster-grey);
}

/* ---------------------------------------------
   Header Structure
   --------------------------------------------- */

.site-header {
  background-color: #000000;
  color: var(--color-text);
}

.site-header__inner {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-block: var(--space-sm);
}

/* ---------------------------------------------
   Top Row
   --------------------------------------------- */

.header-top {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-block: var(--space-sm);
  background-color: #000000;
}

.header-logo {
  text-align: center;
}

/* ---------------------------------------------
   Desktop Header Controls
   --------------------------------------------- */

.header-top-right {
  position: absolute;
  top: 50%;
  right: var(--space-md);
  transform: translateY(-50%);

  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.6rem;

  background: transparent;
}

.header-top-right-row,
.header-top-right-row--icons {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ---------------------------------------------
   Header Icon Buttons
   --------------------------------------------- */

.header-icon-btn,
.header-theme-toggle,
.header-account-icon {
  width: auto;
  height: auto;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: transparent !important;
  border: none !important;
  box-shadow: none !important;

  color: var(--color-text);
  cursor: pointer;
}

.header-icon-btn svg,
.header-theme-toggle svg,
.header-account-icon svg,
.header-icon-btn i[data-lucide],
.header-theme-toggle i[data-lucide],
.header-account-icon i[data-lucide],
.header-cart-summary i[data-lucide] {
  width: 25px;
  height: 25px;
}

/* ---------------------------------------------
   Cart
   --------------------------------------------- */

.header-cart-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.header-cart-stack .header-icon-btn {
  margin: 0;
}

.header-cart-summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-text);
  text-decoration: none;
}

.header-cart-total {
  font-size: 0.9rem;
}

.header-cart-total--desktop,
.header-cart-total--mobile {
  margin: 0;
  line-height: 1;
}

.header-cart-total--desktop {
  padding-top: 0;
}

.header-cart-total--mobile {
  padding-top: 1px;
}

.header-cart-stack i[data-lucide] {
  display: block;
}

svg.lucide-shopping-cart {
  transform: scaleX(-1);
}

.header-cart-stack svg.lucide-shopping-cart,
.header-mobile-cart svg.lucide-shopping-cart {
  width: 30px;
  height: 30px;
  transform-origin: center;
}

.header-cart-stack.cart-has-items svg.lucide-shopping-cart {
  animation: cartGlowPulse 1.5s ease-in-out infinite;
}

@keyframes cartGlowPulse {
  0% {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
  }

  50% {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7));
  }

  100% {
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
  }
}

/* ---------------------------------------------
   Mobile Actions
   --------------------------------------------- */

.header-mobile-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.header-mobile-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;

  color: var(--color-text);
  text-decoration: none;
}

/* ---------------------------------------------
   Hamburger Button
   --------------------------------------------- */

.header-menu-toggle,
.header-mobile-actions .header-menu-toggle {
  width: auto;
  height: auto;
  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  color: var(--color-text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

/* ---------------------------------------------
   Main Navigation Bar
   --------------------------------------------- */

.header-bottom {
  width: 100vw;
  min-height: 30px;
  margin-left: calc(50% - 50vw);
  padding-block: 2px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background-color: var(--shadow-grey);
  border-top: 1px solid var(--color-border);
}

.primary-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding-block: 2px;
}

.primary-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-lg);

  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------
   Mobile Navigation Panel
   --------------------------------------------- */

.mobile-nav-panel {
  width: 100vw;
  max-height: 0;
  margin-left: calc(50% - 50vw);

  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);

  background-color: var(--shadow-grey);

  transition:
    max-height 0.25s ease,
    opacity 0.25s ease,
    transform 0.25s ease;
}

.mobile-nav-panel.is-open {
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------
   Search Bar
   --------------------------------------------- */

.header-search-bar {
  width: 100vw;
  min-height: 44px;
  margin-left: calc(50% - 50vw);
  padding-block: 2px;

  display: none;
  align-items: center;
  justify-content: center;

  background-color: var(--shadow-grey);
}

.header-search-bar.is-open {
  display: flex;
}

.header-search-form {
  width: 100%;
  max-width: 800px;
  padding-inline: var(--space-md);

  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.header-search-form input[type="search"] {
  height: 36px;
  flex: 1;
  padding: 0 0.75rem;

  background-color: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

.header-search-submit {
  height: 30px;
  padding: 0 0.9rem;

  background-color: var(--onyx);
  border: 1px solid var(--dim-grey);
  border-radius: var(--radius-pill);
  box-shadow: none;

  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-search-submit:hover,
.header-search-submit:focus-visible {
  background-color: var(--graphite);
  border-color: var(--graphite);
  box-shadow: none;
}

/* ---------------------------------------------
   Theme Toggle Icons
   --------------------------------------------- */

.theme-icon--light {
  display: none;
}

[data-theme="dark"] .theme-icon--light {
  display: inline-flex;
}

[data-theme="dark"] .theme-icon--dark {
  display: none;
}

[data-theme="light"] .theme-icon--dark {
  display: inline-flex;
}

[data-theme="light"] .theme-icon--light {
  display: none;
}

/* ---------------------------------------------
   Mobile Layout
   --------------------------------------------- */

@media (max-width: 767px) {
  .header-top-right {
    display: none;
  }

  .header-bottom {
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
  }

  .primary-nav__list {
    display: none;
  }

  .header-bottom-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
  }
}

/* ---------------------------------------------
   Tablet / Desktop Layout
   --------------------------------------------- */

@media (min-width: 768px) {
  .header-top-right {
    display: flex;
  }

  .header-mobile-actions {
    display: none;
  }

  .header-bottom {
    justify-content: center;
  }

  .primary-nav {
    flex: 0 0 auto;
  }

  .header-bottom-actions {
    display: none;
  }

  .mobile-nav-panel {
    display: none !important;
  }
}

/* ---------------------------------------------
   Header Icon Accent
   --------------------------------------------- */

.site-header .header-icon-btn,
.site-header .header-theme-toggle,
.site-header .header-account-icon,
.site-header .header-menu-toggle {
  color: #B84A00;
}

.site-header .header-icon-btn svg,
.site-header .header-theme-toggle svg,
.site-header .header-account svg,
.site-header .header-account-icon svg,
.site-header .header-cart-summary svg,
.site-header .header-mobile-cart svg {
  color: #B84A00;
  stroke: #B84A00;
}


/* ==========================================================
   1.4.5 MOBILE MENU CONTRAST
   Keep the collapsed/mobile menu dark in both site themes.
   ========================================================== */
.mobile-nav-panel,
[data-theme="light"] .mobile-nav-panel {
  background-color: #232323;
  color: #f4f4f4;
}

.mobile-nav-panel__list,
.mobile-nav-panel__list ul {
  color: #f4f4f4;
}

.mobile-nav-panel__list a,
[data-theme="light"] .mobile-nav-panel__list a {
  color: #f4f4f4;
}

.mobile-nav-panel__list li::marker,
[data-theme="light"] .mobile-nav-panel__list li::marker {
  color: #f4f4f4;
}

.mobile-nav-panel__list a:hover,
.mobile-nav-panel__list a:focus-visible,
[data-theme="light"] .mobile-nav-panel__list a:hover,
[data-theme="light"] .mobile-nav-panel__list a:focus-visible {
  color: #ffffff;
}

/* ==========================================================
   1.4.6 DYNAMIC TITLES SUBMENU
   ========================================================== */
.primary-nav__list > li { position: relative; }
.primary-nav__list .rv-titles-submenu {
  position: absolute;
  z-index: 40;
  top: 100%;
  left: 50%;
  min-width: 220px;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  margin: 0;
  padding: .5rem 0;
  list-style: none;
  background: #232323;
  border: 1px solid #3b3b3b;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.primary-nav__list > li:hover > .rv-titles-submenu,
.primary-nav__list > li:focus-within > .rv-titles-submenu {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.primary-nav__list .rv-titles-submenu a { display: block; padding: .55rem .85rem; color: #f4f4f4; white-space: nowrap; }
.primary-nav__list .rv-titles-submenu a:hover,
.primary-nav__list .rv-titles-submenu a:focus-visible { background: #303030; color: #fff; }
.rv-submenu-toggle { display: none; }

@media (max-width: 767px) {
  .mobile-nav-panel.is-open { max-height: 70vh; overflow-y: auto; }
  .mobile-nav-panel__list > li { position: relative; }
  .mobile-nav-panel__list .rv-submenu-toggle {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    margin-left: .35rem;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    color: #f4f4f4;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }
  .mobile-nav-panel__list .rv-titles-submenu { display: none; margin: .35rem 0 .5rem 1rem; padding-left: .85rem; border-left: 1px solid #555; list-style: none; }
  .mobile-nav-panel__list li.is-submenu-open > .rv-titles-submenu { display: block; }
  .mobile-nav-panel__list .rv-titles-submenu a { display: block; padding: .4rem 0; color: #f4f4f4; }
}
