/* =========================================================================
   Component: fm-header
   Layout modeled 1:1 on freedommobile.ca:
     Row 1: black utility bar, all content right-aligned.
     Row 2: white primary bar, logo + nav grouped left, sales link far right.
     Row 3: full-width mega panels (see mega-nav.css).
   ========================================================================= */

.fm-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--fm-white);
  /* Subtle drop shadow so the black nav stays visible over light content. */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

/* ---------- Shared caret (down chevron) ---------- */
.fm-caret {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.4em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-25%) rotate(45deg);
  transition: transform var(--fm-dur-fast) var(--fm-ease);
}

/* Rotate up when parent is open/hovered */
.fm-nav-item:hover .fm-caret,
.fm-nav-item.is-open .fm-caret,
.fm-province[aria-expanded="true"] .fm-caret {
  transform: translateY(0) rotate(-135deg);
}

/* ---------- Icons (minimal SVG-free set) ---------- */
.fm-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
  background: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}
.fm-icon--pin {
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/></svg>");
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/></svg>");
}

/* ---------- Row 1 : utility bar (inverted — white background) ---------- */
.fm-header__utility {
  background: var(--fm-white);
  color: var(--fm-text);
  font-size: 1rem;
}

.fm-header__utility-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--fm-sp-5);
  min-height: 40px;
}

.fm-header__utility-left,
.fm-header__utility-right {
  display: flex;
  align-items: center;
  gap: var(--fm-sp-5);
}

.fm-header__util-link {
  color: var(--fm-text);
  display: inline-flex;
  align-items: center;
}
.fm-header__util-link:hover { color: var(--fm-accent); }

/* Province dropdown */
.fm-province {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  color: var(--fm-text);
  cursor: pointer;
  user-select: none;
}
.fm-province:hover { color: var(--fm-accent); }

/* Personal / Business toggle */
.fm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.fm-toggle__opt {
  color: var(--fm-text);
  transition: color var(--fm-dur-fast) var(--fm-ease);
}
.fm-toggle__opt:hover { color: var(--fm-accent); }
.fm-toggle__opt[aria-current="true"] {
  color: var(--fm-accent);
}
.fm-toggle__sep {
  color: var(--fm-gray-200);
  user-select: none;
}

/* ---------- Row 2 : primary bar (inverted — black background) ---------- */
.fm-header__main {
  position: relative;   /* anchor for the full-width mega panel */
  background: var(--fm-black);
}

.fm-header__main-inner {
  display: flex;
  align-items: center;
  gap: var(--fm-sp-6);
  min-height: 64px;
}

@media (min-width: 992px) {
  .fm-header__main-inner { min-height: 77px; gap: var(--fm-sp-7); }
}

.fm-header__logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.fm-header__logo img { height: 72px; width: auto; } /* 48px + 50% */

.fm-header__nav {
  display: none;
}

@media (min-width: 992px) {
  .fm-header__nav {
    display: flex;
    align-items: center;
    gap: var(--fm-sp-6);
    flex: 1;
  }
}

.fm-nav-item { position: static; }

.fm-nav-item__link {
  display: inline-flex;
  align-items: center;
  color: var(--fm-white);
  font-size: 1.125rem;
  font-weight: 400;
  padding: 24px 0;
  white-space: nowrap;
  position: relative;
}

.fm-nav-item__link:hover,
.fm-nav-item.is-open .fm-nav-item__link,
.fm-nav-item[aria-current="page"] .fm-nav-item__link {
  color: var(--fm-accent);
}

/* Right-side action: matches Freedom's "My Freedom" pattern */
.fm-header__right {
  display: none;
}
@media (min-width: 992px) {
  .fm-header__right {
    display: inline-flex;
    align-items: center;
    gap: var(--fm-sp-5);
    margin-left: auto;
  }
}

/* "My account" link sits to the right of the sales CTA. */
.fm-header__account { padding: 24px 0; }

.fm-nav-item__link--strong { font-weight: var(--fm-fw-bold); }

/* Mobile menu toggle */
.fm-header__burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  color: var(--fm-white);
  font-size: 1.5rem;
  margin-left: auto;
}
@media (min-width: 992px) {
  .fm-header__burger { display: none; }
}
