/* Mega menu of the header (js/mega-menu.mjs): a bar of product families under the top row, each opening a
   floating panel (titled columns, tall cards, quote band) over a blurred page. Below 1025 px: the burger panel. */
.megamenu { position: relative; background: #111b22; border-top: 1px solid #ffffff10; }
.megamenu-list {
  display: flex;
  align-items: stretch;
  gap: 2px;
  max-width: 1480px;
  height: var(--megamenu-h);
  margin: 0 auto;
  padding: 0 36px;
  list-style: none;
}
.megamenu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: #c9d1d8;
  font: 500 var(--fs-small)/1 var(--font-body);
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s;
}
.megamenu-trigger svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.megamenu-trigger:hover, .megamenu-trigger[aria-expanded="true"] { color: #fff; background: #ffffff0d; border-bottom-color: var(--orange); }
.megamenu-trigger[aria-expanded="true"] svg { color: var(--orange); }
/* Chevron: tells the family opens a panel, turns over while it is open. */
.megamenu-trigger::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .55;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .22s ease, opacity .15s;
}
.megamenu-trigger[aria-expanded="true"]::after { opacity: 1; transform: translateY(1px) rotate(225deg); }


/* Veil over the page while a panel is open: blurred and dimmed, under the panel, clicks pass through. */
.megamenu-scrim {
  position: fixed;
  inset: var(--scrim-top, 0px) 0 0 0;
  z-index: 55;
  background: #0910154d;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.megamenu.has-open-panel .megamenu-scrim { opacity: 1; visibility: visible; transition-delay: 0s; }

/* Floating panel, its caret under the open family (--caret-x, js/mega-menu.mjs) and an invisible bridge
   over the gap so the pointer can travel from the bar to the panel without closing it.
   Closed: rendered but invisible and not focusable; opening fades and slides down. */
.megamenu-panel {
  position: absolute;
  top: calc(100% + 14px);
  left: max(24px, calc((100% - 1480px) / 2));
  right: max(24px, calc((100% - 1480px) / 2));
  z-index: 60;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 30px 60px #09101540, 0 2px 8px #0910151a;
  color: #18232c;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .26s;
}
.megamenu-panel::before {
  content: "";
  position: absolute;
  top: -8px;
  left: calc(var(--caret-x, 80px) - 9px);
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 3px 0 0 0;
  transform: rotate(45deg);
}
.megamenu-panel::after { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; }
.megamenu-panel.is-open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition-delay: 0s; }
/* Family to family while open: a short crossfade without the slide. */
.megamenu-panel.is-swap { transform: none; transition-duration: .14s, 0s, 0s; }
.megamenu-panel.is-swap:not(.is-open) { transition-delay: 0s, 0s, .14s; }
@keyframes megamenu-item-in { from { opacity: 0; transform: translateY(8px); } }
.megamenu-panel.is-open :is(.megamenu-link, .megamenu-card) {
  animation: megamenu-item-in .34s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: min(calc(var(--i, 0) * 22ms + 30ms), 260ms);
}
@media (prefers-reduced-motion: reduce) {
  .megamenu-panel.is-open :is(.megamenu-link, .megamenu-card) { animation: none; }
}
.megamenu-panel-inner {
  position: relative;
  max-height: calc(100dvh - var(--header-h) - var(--megamenu-h) - 40px);
  overflow-y: auto;
  border-radius: 16px;
}
.megamenu-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; padding: 30px 32px 28px; }

/* Columns of categories, one per group (js/catalog.mjs). */
.megamenu-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; }
.megamenu-group { padding: 0 18px; border-left: 1px solid #e6e9ec; }
.megamenu-group:first-child { padding-left: 0; border-left: 0; }
.megamenu-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid #e6e9ec;
  font: 800 var(--fs-lead)/1.15 var(--font-display);
  letter-spacing: -.01em;
}
.megamenu-group-title svg { flex: none; width: 28px; height: 28px; fill: none; stroke: var(--orange); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.megamenu-links { display: grid; }
.megamenu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-bottom: 1px solid #eef0f2;
  color: #18232c;
  font-size: var(--fs-ui);
  font-weight: 400;
  line-height: 1.3;
  transition: color .15s;
}
.megamenu-link::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s ease;
}
.megamenu-link:is(:hover, .is-hover, :focus-visible) { color: #c84a00; }
.megamenu-link:is(:hover, .is-hover, :focus-visible)::after { transform: translateX(3px) rotate(-45deg); }
.megamenu-link.is-available { font-weight: 500; }
.megamenu-link:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }

/* Tall cards: photo (or line icon) above a dark band with the name. */
.megamenu-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-content: start; }
.megamenu-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #111b22;
  border-radius: 12px;
  color: #fff;
  transition: box-shadow .2s, transform .2s;
}
.megamenu-card-media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 5;
  overflow: hidden;
  background: linear-gradient(170deg, #f6f7f8, #dde2e6);
}
.megamenu-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.megamenu-card-media svg { width: 46%; height: 46%; fill: none; stroke: #2a3640; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s, transform .45s cubic-bezier(.2, .8, .2, 1); }
.megamenu-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--orange);
  color: #fff;
  font-size: var(--fs-meta);
  font-weight: 700;
  line-height: 1.2;
}
.megamenu-card-name {
  display: grid;
  place-items: center;
  min-height: 72px;
  padding: 12px 14px;
  text-align: center;
  font-size: var(--fs-body);
  font-weight: 600;
  line-height: 1.25;
}
.megamenu-card:is(:hover, .is-hover, :focus-visible) { box-shadow: 0 16px 30px #0c111633, 0 0 0 2px var(--orange); }
.megamenu-card:is(:hover, .is-hover, :focus-visible) :is(img, svg) { transform: scale(1.05); }
.megamenu-card:is(:hover, .is-hover, :focus-visible) .megamenu-card-media svg { stroke: var(--orange); }
.megamenu-card:focus-visible { outline: none; }

/* Quote band at the foot of the panel. */
.megamenu-foot {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 18px 32px;
  background: #f1f3f5;
  border-radius: 0 0 16px 16px;
}
.megamenu-foot-lead {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding-right: 28px;
  border-right: 1px solid #d5dade;
  font: 800 var(--fs-card)/1.2 var(--font-display);
}
.megamenu-foot-lead svg { width: 30px; height: 30px; fill: none; stroke: #18232c; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.megamenu-foot-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 8px;
  background: var(--orange);
  color: #fff;
  font-size: var(--fs-ui);
  font-weight: 600;
  transition: background-color .15s;
}
.megamenu-foot-cta:hover { background: #e85b00; }
.megamenu-arrow { flex: none; transition: transform .2s ease; }
.megamenu-foot-cta:hover .megamenu-arrow { transform: translateX(4px); }
/* Link to the family page, pushed to the right end of the band. */
.megamenu-foot-all { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: #18232c; font: 800 var(--fs-ui)/1.2 var(--font-display); }
.megamenu-foot-all:hover { color: var(--orange); }
.megamenu-foot-all:hover .megamenu-arrow { transform: translateX(4px); }

@media (max-width: 1240px) {
  .megamenu-list { padding-inline: 20px; }
  .megamenu-trigger { padding-inline: 10px; gap: 6px; }
  .megamenu-body { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; padding: 26px 24px 24px; }
  .megamenu-group { padding-inline: 16px; }
  .megamenu-link { font-size: var(--fs-ui); }
  .megamenu-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .megamenu-card:nth-child(3) { display: none; }
}
@media (max-width: 1150px) {
  .megamenu-trigger svg { display: none; }
}

/* Burger panel: families stacked, each unfolding its grouped categories and quote band in place. */
@media (max-width: 1024px) {
  html.has-open-menu { overflow: hidden; }
  .megamenu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #091015;
    box-shadow: 0 18px 30px #00000059;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .2s ease, transform .26s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .26s;
  }
  .megamenu.open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition-delay: 0s; }
  .megamenu-list { display: grid; gap: 0; height: auto; padding: 6px 20px 18px; }
  .megamenu-item { border-bottom: 1px solid #ffffff12; }
  .megamenu-trigger { width: 100%; height: auto; padding: 15px 4px; border-bottom: 0; font-size: var(--fs-body); }
  .megamenu-trigger svg { display: block; }
  .megamenu-trigger::after { margin-left: auto; margin-right: 6px; width: 8px; height: 8px; border-color: #8e9aa3; opacity: 1; }
  .megamenu-trigger[aria-expanded="true"]::after { border-color: var(--orange); }
  .megamenu-trigger:hover, .megamenu-trigger[aria-expanded="true"] { background: transparent; }
  .megamenu-scrim, .megamenu-panel::before, .megamenu-panel::after, .megamenu-cards { display: none; }
  /* Accordion: the panel's single row grows from 0fr to 1fr, so the height animates without measuring it. */
  .megamenu-panel {
    position: static;
    display: grid;
    grid-template-rows: 0fr;
    margin-bottom: 0;
    border-radius: 10px;
    box-shadow: none;
    transform: none;
    transition: grid-template-rows .3s cubic-bezier(.2, .8, .2, 1), margin-bottom .3s, opacity .2s, visibility 0s linear .3s;
  }
  .megamenu-panel.is-open { grid-template-rows: 1fr; margin-bottom: 14px; }
  .megamenu-panel.is-swap, .megamenu-panel.is-swap:not(.is-open) { transition-duration: .3s, .3s, .2s, 0s; transition-delay: 0s, 0s, 0s, .3s; }
  .megamenu-panel.is-open.is-swap { transition-delay: 0s; }
  .megamenu-panel-inner { min-height: 0; max-height: none; overflow: hidden; border-radius: 10px; }
  .megamenu-body { display: block; padding: 6px 14px 4px; }
  .megamenu-groups { grid-template-columns: 1fr; gap: 6px; }
  .megamenu-group, .megamenu-group:first-child { padding: 0; border-left: 0; }
  .megamenu-group-title { padding: 12px 0 8px; border-bottom: 0; font-size: var(--fs-body); }
  .megamenu-group-title svg { width: 22px; height: 22px; }
  .megamenu-link { padding: 11px 2px; }
  .megamenu-foot { flex-wrap: wrap; gap: 10px 14px; padding: 14px; border-radius: 0 0 10px 10px; }
  .megamenu-foot-lead { padding-right: 0; border-right: 0; font-size: var(--fs-body); }
  .megamenu-foot-lead svg { width: 22px; height: 22px; }
  .megamenu-foot-all { flex-basis: 100%; margin-left: 0; }
}
@media (max-width: 600px) {
  .megamenu-list { padding-inline: 16px; }
}
