/* moForte Shared Header — fresh layout rebuild */

/* Social bar — reduced desktop utility strip */
.mf-social-bar {
  background-color: var(--mf-bg-social-bar);
  min-height: 18px;
  padding: 4px 20px 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.mf-social-bar a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
}
.mf-social-bar a:hover { color: var(--mf-accent-green); transform: translateY(-1px); }
.mf-social-bar svg { width: 18px; height: 18px; fill: rgba(255, 255, 255, 0.7); }
.mf-social-bar a:hover svg { fill: var(--mf-accent-green); }


/* Main header bar — CSS Grid + explicit row height so vertical centering matches
   Safari/Chrome/Firefox (flex + stretch + nested flex was still inconsistent). */
.mf-header {
  position: sticky;
  top: var(--mf-promo-banner-height);
  z-index: 999;
  background-color: var(--mf-bg-header);
  height: var(--mf-header-height);
  min-height: var(--mf-header-height);
  /* Ensure it always paints above hero/background layers */
  isolation: isolate;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: var(--mf-header-height);
  align-items: center;
  column-gap: 8px;
  line-height: normal;
  padding: 0 14px;
  overflow: visible;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================================
   LOCAL PREVIEW (Live Server): ensure injected header is visible
   ============================================================ */
html.mf-local-preview .mf-social-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
}

html.mf-local-preview .mf-header {
  position: fixed;
  top: var(--mf-social-bar-height);
  left: 0;
  right: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.92);
}

html.mf-local-preview body {
  padding-top: calc(var(--mf-social-bar-height) + var(--mf-header-height));
}

.mf-header-logo {
  grid-column: 1;
  grid-row: 1;
}

.mf-product-icons {
  grid-column: 2;
  grid-row: 1;
}

.mf-header-nav {
  grid-column: 3;
  grid-row: 1;
}

/* Block display on all header images — kill baseline gaps */
.mf-header img,
.mf-header-logo img,
.mf-product-icon img {
  display: block;
}

.mf-header-logo {
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  align-self: stretch;
  min-width: 0;
}
.mf-header-logo img {
  width: 148px;
  height: auto;
  max-height: 58px;
  object-fit: contain;
}

/* Product icon buttons — smaller desktop rail */
.mf-product-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  align-self: stretch;
  /* Clear top edge / outline on taller bar */
  padding-top: 10px;
  padding-bottom: 6px;
}
.mf-product-icon {
  display: flex;
  align-items: center;
  padding: 2px 3px;
  line-height: 0;
}
.mf-product-icon img {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
}
.mf-product-icon:hover img,
.mf-product-icon.active img {
  outline: 2px solid var(--mf-accent-orange);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Nav toggle (mobile only) */
.mf-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--mf-text-white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  margin-left: auto;
}

/* Main navigation — last column; stretch to row height so inner flex centers reliably */
.mf-header-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  min-width: 0;
  align-self: stretch;
  height: auto;
}

.mf-header-nav > a {
  display: flex;
  align-items: center;
  line-height: 1.2;
}

/* Top-level nav links — size to sit with 22px account/search SVGs */
.mf-header-nav > a,
.mf-nav-item > a:first-child {
  color: var(--mf-text-primary);
  font-family: var(--mf-font-display);
  font-size: 1.0625rem;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 10px;
  line-height: 1.15;
  transition: color var(--mf-transition);
  white-space: nowrap;
  cursor: pointer;
}
.mf-header-nav > a:hover,
.mf-nav-item:hover > a:first-child { color: var(--mf-text-white); }

/* Dropdown menu items */
.mf-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  line-height: 1.2;
}

/* Dropdown caret */
.mf-has-dropdown > a:first-child::after {
  content: " \25BE";
  font-size: 0.7em;
  opacity: 0.6;
}

/* Dropdown panel */
ul.mf-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: #000;
  min-width: 220px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.mf-nav-item:hover > ul.mf-dropdown {
  display: block;
}
ul.mf-dropdown li {
  list-style: none;
  margin: 0;
  padding: 0;
}
ul.mf-dropdown li a {
  display: block;
  padding: 10px 20px;
  color: var(--mf-text-primary);
  font-family: var(--mf-font-display);
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
ul.mf-dropdown li a:hover {
  color: var(--mf-text-white);
  background: rgba(255,255,255,0.08);
}

/* Account & search icons */
.mf-header-acct,
.mf-header-search {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  line-height: 1;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.mf-header-acct:hover,
.mf-header-search:hover { opacity: 0.8; }
.mf-header-acct svg,
.mf-header-search svg { display: block; }

/* Search button is a real <button>; strip browser chrome */
button.mf-header-search {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

/* Label is hidden on desktop (icon-only); mobile rules below show it. */
.mf-search-label { display: none; }

/* Search panel — slides under the header bar when toggled. Position
   absolute relative to the .mf-header so it tracks the sticky header. */
.mf-search-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--mf-bg-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 20px;
  z-index: 998;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.mf-search-panel[hidden] { display: none; }
.mf-search-panel form {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}
.mf-search-panel input[type="search"] {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--mf-text-white);
  font-family: var(--mf-font-display);
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: 4px;
  -webkit-appearance: none;
  appearance: none;
}
.mf-search-panel input[type="search"]::placeholder { color: rgba(255, 255, 255, 0.5); }
.mf-search-panel input[type="search"]:focus {
  outline: none;
  border-color: var(--mf-accent-orange);
}
.mf-search-panel button[type="submit"] {
  background: var(--mf-accent-orange);
  color: #000;
  border: none;
  padding: 0 18px;
  font-family: var(--mf-font-display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.mf-search-panel button[type="submit"]:hover {
  background: var(--mf-accent-orange-hover);
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 921px) {
  .mf-social-bar {
    min-height: 30px;
    justify-content: center;
  }

  .mf-header {
    grid-template-columns: auto 1fr;
    grid-template-rows: var(--mf-header-height);
  }

  .mf-header-logo {
    grid-column: 1;
    grid-row: 1;
  }

  .mf-nav-toggle {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
  }
  .mf-product-icons { display: none; }
  .mf-header-search { display: none; }

  .mf-header-nav {
    grid-column: auto;
    grid-row: auto;
    display: none;
    position: absolute;
    top: var(--mf-header-height);
    left: 0;
    right: 0;
    background: #263238;
    flex-direction: column;
    padding: 0;
    border-bottom: 2px solid #37474f;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    align-items: stretch;
  }
  .mf-header-nav.open {
    display: flex;
    max-height: calc(100vh - var(--mf-header-height));
    overflow-y: auto;
  }

  /* Stack each top-level item's link above its submenu (override desktop
     flex-row). Without this, the dropdown becomes a flex sibling of the
     link and bleeds off the right edge of the viewport. */
  .mf-nav-item {
    display: block;
    height: auto;
  }

  /* On mobile the search button becomes a full-width row at the top of
     the drawer, with the magnifier + "Search" label aligned with the
     other menu items. Reset the desktop icon-button look. */
  .mf-header-nav .mf-header-search {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    width: 100%;
    padding: 14px 20px;
    font-size: 17px;
    font-family: var(--mf-font-display);
    color: var(--mf-text-primary);
    border-bottom: 1px solid #37474f;
    /* Pull to top of drawer (drawer is flex-direction: column) */
    order: -1;
  }
  .mf-header-nav .mf-header-search .mf-search-label { display: inline; }
  .mf-header-nav .mf-header-search svg { width: 20px; height: 20px; }

  .mf-header-nav > a,
  .mf-nav-item > a:first-child {
    padding: 14px 20px;
    font-size: 17px;
    border-bottom: 1px solid #37474f;
    display: block;
  }

  ul.mf-dropdown {
    position: static;
    display: none;
    background: #000;
    box-shadow: none;
    padding: 0;
    min-width: 0;
  }
  .mf-nav-item:hover > ul.mf-dropdown {
    display: none;
  }
  .mf-nav-item.open > ul.mf-dropdown {
    display: block;
  }
  ul.mf-dropdown li a {
    padding: 12px 20px 12px 36px;
    font-size: 15px;
    border-bottom: 1px solid #37474f;
  }

  .mf-header-acct {
    padding: 14px 20px;
    border-bottom: 1px solid #37474f;
  }
}
