/* =====================================================================
   THE MINERS — мега-меню E-shop (логика — eshop-menu.js)
   ===================================================================== */
body.mh-on {
  --em-bg: #141414;
  --em-fg: #F7F7F7;
  --em-line: rgba(247, 247, 247, .45);
}

/* ссылки: жирный + подчёркивание на hover/текущей; ширина под жирный
   зарезервирована заранее (data-t), чтобы колонки не прыгали */
#em-panel .em-list a,
#em-sub .em-list a {
  display: inline-flex;
  flex-direction: column;
  color: var(--em-fg) !important;
  font-weight: 450 !important;
  text-decoration: none !important;
  text-underline-offset: 3px;
  white-space: nowrap;
}
#em-panel .em-list a::after,
#em-sub .em-list a::after {
  content: attr(data-t);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-weight: 700;
}
#em-panel .em-list a:hover,
#em-panel .em-list a.is-current,
#em-sub .em-list a:active,
#em-sub .em-list a.is-current {
  font-weight: 700 !important;
  text-decoration: underline !important;
  transition: unset !important;
}
.em-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.em-list li {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
}
.em-list li::before { content: none !important; }

.em-title {
  color: var(--em-fg);
  font-weight: 900 !important;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

/* промо-карточка */
.em-promo {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 1 / 1;
  background: #222;
  color: var(--em-fg) !important;
  text-decoration: none !important;
}
.em-promo img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  transition: transform .6s cubic-bezier(.22, 1, .36, 1);
}
.em-promo:hover img { transform: scale(1.04); }
.em-promo::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
}
.em-promo__txt {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 14px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  text-transform: uppercase;
  line-height: .95;
}
.em-promo__k { font-weight: 800 !important; font-size: 24px; }
.em-promo__t { font-weight: 900 !important; font-size: 48px; letter-spacing: -.01em; }

/* --- desktop ------------------------------------------------------- */
#em-panel { display: none; }
#em-shade { display: none; }

@media (min-width: 768px) {
  /* хедер, пока меню открыто: тёмный, как панель, без размытия-«стекла» */
  html body.mh-on.em-open {
    --mh-glass: var(--em-bg);
    --mh-fg: #F7F7F7;
    --mh-icon-filter: brightness(0) invert(1);
    --mh-panel: rgba(20, 20, 20, .9);
  }
  html body.mh-on.em-open #header #navigation .menu-item-706 > a,
  html body.mh-on.em-open #header #navigation .menu-item-706 > a b {
    text-decoration: underline !important;
    text-underline-offset: 4px;
  }

  #em-panel {
    display: block;
    position: fixed;
    top: var(--mh-h);
    left: 0;
    right: 0;
    z-index: 999;                      /* хедер — 1000 */
    max-height: calc(100vh - var(--mh-h));
    overflow: auto;
    background: var(--em-bg);
    border-radius: 0 0 40px 40px;
    color: var(--em-fg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity .25s ease, transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .35s;
  }
  body.em-open #em-panel {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity .25s ease, transform .35s cubic-bezier(.22, 1, .36, 1);
  }

  #em-panel .em-in {
    display: flex;
    align-items: stretch;
    padding: 18px var(--mh-gut) 60px;
  }
  #em-panel .em-col {
    display: flex !important;
    flex: none !important;
    flex-direction: column;
    justify-content: space-between;
    gap: 24px;
    padding: 0 clamp(20px, 4.4vw, 66px);
    border-right: 1px solid var(--em-line);
  }
  #em-panel .em-col:first-child { padding-left: 0; }
  #em-panel .em-list a {
    font-size: 20px !important;
    line-height: 40px !important;
  }
  #em-panel .em-list { margin-top: -10px !important; }   /* верх строки 40px — вровень с промо */
  #em-panel .em-title { font-size: 26px; }
  #em-panel .em-promo {
    flex: 0 1 384px;
    min-width: 220px;
    margin-left: auto;
    align-self: flex-start;
  }
  /* узкий десктоп: промо не влезает — прячем, колонки на всю ширину */
  @media (max-width: 1100px) {
    #em-panel .em-promo { display: none; }
    #em-panel .em-col:nth-child(4) { border-right: 0; }
    #em-panel .em-list a { font-size: 18px !important; }
    #em-panel .em-title { font-size: 22px; }
  }

  #em-shade {
    display: block;
    position: fixed;
    top: var(--mh-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 998;
    background: rgba(20, 20, 20, .12);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility 0s linear .25s;
  }
  body.em-open #em-shade {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s ease;
  }
  #em-sub { display: none !important; }
  #navigation .em-promo--nav { display: none !important; }   /* карточка бургер-меню — только мобилка */
}

/* --- mobile: экран внутри бургер-меню ------------------------------ */
@media (max-width: 767px) {
  #em-sub {
    position: fixed;
    inset: 0;
    z-index: 10;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--em-bg);
    color: var(--em-fg);
    padding: 0 24px 40px;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .35s;
  }
  #em-sub.is-open {
    transform: none;
    visibility: visible;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1);
  }

  #em-sub .em-back {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 64px;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--em-fg);
    font-size: 18px;
    font-weight: 800 !important;
    text-transform: uppercase;
    cursor: pointer;
  }
  #em-sub .em-back i {
    width: 10px;
    height: 10px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
  }

  /* !important: правило темы для первого div в меню делает его inline-block */
  #em-sub .em-col {
    display: flex !important;
    width: auto !important;
    flex: none !important;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 24px;
    margin: 0 0 24px;
    border-bottom: 1px solid var(--em-line);
  }
  #em-sub .em-list a {
    font-size: 16px !important;
    line-height: 27px !important;
  }
  #em-sub .em-title {
    font-size: 20px;
    line-height: 27px;
    text-align: right;
  }
  #em-sub .em-promo { margin-top: 12px; }
  #em-sub .em-promo__k { font-size: 20px; }
  #em-sub .em-promo__t { font-size: clamp(32px, 10.5vw, 44px); }
}
