/* Mega menu of the header (js/mega-menu.mjs): a bar of product families under the top row,
   each opening a full-width panel of category tiles. Below 1025 px it becomes 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: 700 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); }

.megamenu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  max-height: calc(100dvh - var(--header-h) - var(--megamenu-h) - 24px);
  overflow-y: auto;
  background: #f4f6f7;
  border-bottom: 3px solid var(--orange);
  box-shadow: 0 24px 40px #0910154d;
  color: #18232c;
}
.megamenu-panel-inner { max-width: 1480px; margin: 0 auto; padding: 22px 44px 28px; }
.megamenu-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.megamenu-head b { font: 800 var(--fs-card)/1.2 var(--font-display); letter-spacing: -.02em; }
.megamenu-head span { font-size: var(--fs-meta); color: #6b747a; }
.megamenu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 14px; }
.megamenu-tile { display: grid; justify-items: center; align-content: start; gap: 6px; text-align: center; color: #18232c; }
.megamenu-thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e6e9;
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.megamenu-thumb svg { width: 46%; height: 46%; fill: none; stroke: #2a3640; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s; }
.megamenu-thumb img { width: 100%; height: 100%; object-fit: cover; }
.megamenu-tile:hover .megamenu-thumb, .megamenu-tile:focus-visible .megamenu-thumb { border-color: var(--orange); box-shadow: 0 10px 24px #0c11161f; transform: translateY(-2px); }
.megamenu-tile:hover svg { stroke: var(--orange); }
.megamenu-tile:focus-visible { outline: none; }
.megamenu-name { margin-top: 4px; font-size: var(--fs-small); font-weight: 700; line-height: 1.3; }
.megamenu-tag { font-size: var(--fs-meta); line-height: 1.3; color: #6b747a; }
.megamenu-tile.is-available .megamenu-tag { color: #1d7a3a; font-weight: 700; }

@media (max-width: 1240px) {
  .megamenu-list { padding-inline: 20px; }
  .megamenu-trigger { padding-inline: 10px; gap: 6px; }
}
@media (max-width: 1150px) {
  .megamenu-trigger svg { display: none; }
}

/* Burger panel: families stacked, each unfolding its tiles in place. */
@media (max-width: 1024px) {
  .megamenu { display: none; }
  .megamenu.open {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: block;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    background: #091015;
    box-shadow: 0 18px 30px #00000059;
  }
  .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 { content: "+"; margin-left: auto; font-size: var(--fs-card); color: #8e9aa3; }
  .megamenu-trigger[aria-expanded="true"]::after { content: "−"; color: var(--orange); }
  .megamenu-trigger:hover, .megamenu-trigger[aria-expanded="true"] { background: transparent; }
  .megamenu-panel { position: static; max-height: none; overflow: visible; border-radius: 8px; border-bottom: 0; box-shadow: none; margin-bottom: 14px; }
  .megamenu-panel-inner { padding: 14px; }
  .megamenu-head { display: none; }
  .megamenu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }
  .megamenu-name { font-size: var(--fs-meta); }
  .megamenu-tag { display: none; }
}
@media (max-width: 600px) {
  .megamenu-list { padding-inline: 16px; }
}
