/* ============================================
   MR. INSTALLATEUR — MEGA NAV
   Pattern A: full-width mega-dropdown
   Overrides legacy .site-header styles in components.css
   ============================================ */

:root {
  --mn-max: 1400px;
  --mn-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --mn-shadow: 0 24px 60px -20px rgba(10, 77, 104, 0.22), 0 2px 6px rgba(10, 77, 104, 0.06);
  --mn-border: #E5EAF0;
  --mn-bg: #ffffff;
  --mn-featured-bg: linear-gradient(180deg, #F5F7F9 0%, #EBF5FF 100%);
}

/* Reset legacy overrides so we own the header fully */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header, 100);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(150%) blur(8px);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--mn-border);
  transition: box-shadow .25s var(--mn-ease), background .25s var(--mn-ease);
}
.site-header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 12px rgba(10, 77, 104, 0.06);
}

.site-header .header-inner {
  max-width: var(--mn-max);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

/* Logo */
.site-header .logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
  font-size: 1.15rem;
  letter-spacing: -.01em;
}
.site-header .logo img { height: 40px; width: auto; }

/* Top-level nav */
.mn-nav { display: flex; justify-content: center; }
.mn-list {
  display: flex;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.mn-list > li { position: static; margin: 0; }

/* Always-on hover-extender on the TRIGGER BUTTON.
   Invisible 18px strip extending below the button keeps :hover on
   the button while the mouse crosses the gap to the mega-panel.
   Positioned on the button (which can be relative) so it does NOT
   disturb the mega's positioning context (header / viewport width). */
.mn-item[data-mega] .mn-trigger { position: relative; }
.mn-item[data-mega] .mn-trigger::after {
  content: "";
  position: absolute;
  top: 100%;
  left: -.5rem;
  right: -.5rem;
  height: 18px;
  pointer-events: auto;
}

.mn-link,
.mn-trigger {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .7rem 1rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
  text-decoration: none;
}
.mn-link:hover,
.mn-trigger:hover,
.mn-trigger[aria-expanded="true"] {
  background: var(--bg-light);
  color: var(--primary);
}
.mn-trigger:focus-visible,
.mn-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.mn-caret {
  width: 10px; height: 10px;
  transition: transform .2s var(--mn-ease);
}
.mn-trigger[aria-expanded="true"] .mn-caret { transform: rotate(180deg); }

/* CTA */
.mn-cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1.1rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .98rem;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  transition: transform .15s var(--mn-ease), box-shadow .2s var(--mn-ease), background .2s ease;
  white-space: nowrap;
}
.mn-cta:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.42);
  color: #fff;
}
.mn-cta svg { width: 18px; height: 18px; }

/* ============ MEGA PANEL ============ */
.mn-mega {
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  background: var(--mn-bg);
  border-top: 1px solid var(--mn-border);
  border-bottom: 1px solid var(--mn-border);
  box-shadow: var(--mn-shadow);
  padding: 2rem 1.5rem 2.25rem;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .2s var(--mn-ease), transform .2s var(--mn-ease), visibility 0s linear .2s;
  z-index: 300;
}
/* Invisible bridge — preserves hover when moving to/inside the panel.
   pointer-events: auto forces interaction even while mega is closed. */
.mn-mega::before {
  content: "";
  position: absolute;
  top: -18px; left: 0; right: 0; height: 18px;
  pointer-events: auto;
}
.mn-list > li:hover .mn-mega,
.mn-list > li:focus-within .mn-mega,
.mn-list > li.is-open .mn-mega {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
  transition: opacity .2s var(--mn-ease), transform .2s var(--mn-ease), visibility 0s linear 0s;
}

.mn-mega-inner {
  max-width: var(--mn-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.25fr;
  gap: 2rem;
}

/* Column */
.mn-col { min-width: 0; }
.mn-col-header {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding-bottom: .6rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid var(--mn-border);
  position: relative;
  text-decoration: none;
  color: var(--text);
}
.mn-col-header::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  height: 3px; width: 0;
  background: var(--accent);
  transition: width .2s var(--mn-ease);
}
.mn-col-header:hover::after,
.mn-col-header:focus-visible::after { width: 40px; }
.mn-col-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-brand-soft, #EBF5FF);
  color: var(--primary);
}
.mn-col-icon svg { width: 18px; height: 18px; }
.mn-col-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -.01em;
}

.mn-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.mn-sublist li { margin: 0; }
.mn-sublist a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .4rem .5rem .4rem .65rem;
  font-family: var(--font-body);
  font-size: .93rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease, padding-left .15s ease;
}
.mn-sublist a:hover,
.mn-sublist a:focus-visible {
  background: var(--bg-light);
  border-left-color: var(--accent);
  color: var(--primary);
  padding-left: .85rem;
}
.mn-volume {
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: #EEF2F6;
  color: var(--text-light, #5A6B7C);
  letter-spacing: .02em;
  flex-shrink: 0;
}
.mn-col-footer {
  margin-top: .9rem;
  padding-top: .6rem;
  border-top: 1px dashed var(--mn-border);
}
.mn-all-brands {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .88rem;
  color: var(--accent-dark);
  text-decoration: none;
}
.mn-all-brands:hover { color: var(--accent); }
.mn-all-brands::after {
  content: "→";
  transition: transform .2s var(--mn-ease);
}
.mn-all-brands:hover::after { transform: translateX(3px); }

/* Featured column */
.mn-featured {
  background: var(--mn-featured-bg);
  border-radius: 14px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  border: 1px solid var(--mn-border);
}
.mn-featured-label {
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: .15rem;
}
.mn-feat-card {
  display: block;
  padding: .7rem .85rem;
  background: #fff;
  border: 1px solid var(--mn-border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s var(--mn-ease), border-color .15s ease, box-shadow .2s ease;
}
.mn-feat-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(13, 134, 247, 0.1);
}
.mn-feat-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.3;
  color: var(--text);
  display: block;
}
.mn-feat-sub {
  display: block;
  font-size: .78rem;
  color: var(--text-light, #5A6B7C);
  margin-top: .15rem;
}
.mn-feat-card.mn-feat-cta {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}
.mn-feat-card.mn-feat-cta .mn-feat-title,
.mn-feat-card.mn-feat-cta .mn-feat-sub { color: #fff; }
.mn-feat-card.mn-feat-cta:hover {
  background: var(--accent-dark);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35);
}

/* Mobile toggle (hamburger) */
.mn-hamburger {
  display: none;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid var(--mn-border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.mn-hamburger span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s var(--mn-ease), opacity .2s ease;
}
.mn-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mn-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.mn-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Mobile phone icon CTA */
.mn-cta-mobile {
  display: none;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.mn-cta-mobile svg { width: 20px; height: 20px; }

/* Drawer backdrop */
.mn-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 27, 42, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s var(--mn-ease);
  z-index: calc(var(--z-header, 100) + 5);
}
body.mn-drawer-open .mn-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer */
.mn-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(92vw, 420px);
  background: #fff;
  box-shadow: -10px 0 40px rgba(15, 27, 42, 0.2);
  transform: translateX(100%);
  transition: transform .25s var(--mn-ease);
  z-index: calc(var(--z-header, 100) + 10);
  display: flex;
  flex-direction: column;
}
body.mn-drawer-open .mn-drawer { transform: translateX(0); }

.mn-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--mn-border);
}
.mn-drawer-close {
  width: 40px; height: 40px;
  border-radius: 8px;
  border: 1px solid var(--mn-border);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mn-drawer-close svg { width: 18px; height: 18px; }

.mn-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0 1rem;
}
.mn-acc { border-bottom: 1px solid var(--mn-border); }
.mn-acc-trigger,
.mn-acc > a {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: 1rem 1.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.mn-acc-trigger .mn-caret {
  transition: transform .2s var(--mn-ease);
}
.mn-acc.is-open > .mn-acc-trigger .mn-caret { transform: rotate(180deg); }
.mn-acc-body {
  display: none;
  padding: 0 1.25rem 1rem;
}
.mn-acc.is-open > .mn-acc-body { display: block; }

.mn-acc-group { margin-bottom: .9rem; }
.mn-acc-group:last-child { margin-bottom: 0; }
.mn-acc-group-title {
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-light, #5A6B7C);
  margin: .4rem 0 .3rem;
}
.mn-acc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mn-acc-list li { margin: 0; }
.mn-acc-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .55rem .25rem;
  font-size: .97rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid #F2F5F8;
}
.mn-acc-list a:hover { color: var(--primary); }

.mn-drawer-foot {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--mn-border);
  background: var(--bg-light);
}
.mn-drawer-foot .mn-cta {
  width: 100%;
  justify-content: center;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 968px) {
  .mn-nav,
  .mn-cta-desktop { display: none !important; }
  .mn-hamburger { display: inline-flex; }
  .mn-cta-mobile { display: inline-flex; }
  .site-header .header-inner {
    grid-template-columns: auto 1fr auto auto;
    padding: .7rem 1rem;
    gap: .5rem;
  }
  .site-header .logo img { height: 36px; }
  .site-header .logo-spacer { display: none; }
}

@media (min-width: 969px) {
  .mn-drawer,
  .mn-backdrop { display: none !important; }
}

/* Suppress legacy styles from components.css so they don't fight */
.site-header .nav-list,
.site-header .dropdown,
.site-header .subdropdown,
.site-header .has-dropdown,
.site-header .mobile-menu-toggle,
.site-header .mobile-menu-cta,
.site-header .header-cta { display: none !important; }

/* Our elements should not inherit hidden state from legacy selectors */
.site-header .mn-nav,
.site-header .mn-list,
.site-header .mn-list > li,
.site-header .mn-cta,
.site-header .mn-cta-mobile,
.site-header .mn-hamburger { display: flex !important; }
.site-header .mn-list > li { display: list-item !important; }
@media (max-width: 968px) {
  .site-header .mn-nav,
  .site-header .mn-cta-desktop { display: none !important; }
}
@media (min-width: 969px) {
  .site-header .mn-hamburger,
  .site-header .mn-cta-mobile { display: none !important; }
}
