/**
 * Module Alfabet Mega Menu
 *
 * Zmienne ustawiane w nagłówku strony (konfiguracja modułu):
 * --amm-accent, --amm-list-width, --amm-cols, --amm-panel-max.
 *
 * @author    Alfabet Marki
 * @copyright 2026 Alfabet Marki
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

.amm,
.amm-m-overlay {
  --amm-text: #43474f;
  --amm-muted: #5f5f5f;
  --amm-border: #ececec;
  --amm-hover-bg: #f6f6f6;
  --amm-shadow: 0 14px 34px rgba(0, 0, 0, .12);
}

.amm *,
.amm *::before,
.amm *::after,
.amm-m *,
.amm-m-overlay,
.amm-m-overlay *,
.amm-m-overlay *::before,
.amm-m-overlay *::after {
  box-sizing: border-box;
}

.amm ul,
.amm-m-overlay ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.amm a,
.amm-m-overlay a {
  text-decoration: none;
}

/* Motyw nadaje obrazkom margin: auto i display: block — tu ma być jak w treści */
.amm img,
.amm-m-overlay img {
  margin: 0;
  max-width: 100%;
}

.amm svg,
.amm-m svg,
.amm-m-overlay svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.amm-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------
 * Desktop — pasek
 * ------------------------------------------------------------------ */

.amm {
  position: relative;
  color: var(--amm-text);
  font: inherit;
}

.amm__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0 30px;
}

.amm__top {
  position: static;
  margin: 0;
}

.amm__top-link {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 45px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s ease;
}

.amm__top-link:hover,
.amm__top-link:focus-visible,
.amm__top.is-open > .amm__top-link,
.amm__top.is-current > .amm__top-link {
  color: var(--amm-accent);
}

.amm__top-link:focus-visible,
.amm__item-link:focus-visible,
.amm__heading:focus-visible,
.amm__link:focus-visible {
  outline: 2px solid var(--amm-accent);
  outline-offset: 2px;
}

.amm__top-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.amm__chevron {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  transition: transform .2s ease;
}

.amm__top.is-open > .amm__top-link .amm__chevron {
  transform: rotate(180deg);
}

/* ------------------------------------------------------------------
 * Desktop — rozwijany blok (lista + panel)
 * ------------------------------------------------------------------ */

.amm__drop {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  display: none;
  width: 100%;
  /* Puste miejsce obok listy nie przechwytuje kursora ani kliknięć */
  pointer-events: none;
}

.amm__top.is-open > .amm__drop {
  display: block;
  animation: amm-fade .16s ease-out;
}

@keyframes amm-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.amm__drop-inner {
  display: flex;
  align-items: stretch;
  max-height: var(--amm-max-h, 75vh);
  background: #fff;
  border-radius: 0 0 6px 6px;
  box-shadow: var(--amm-shadow);
  pointer-events: auto;
}

.amm__drop--list .amm__drop-inner,
.amm__drop--mega:not(.has-panel) .amm__drop-inner {
  width: var(--amm-list-width, 300px);
  max-width: 100%;
}

.amm__list {
  flex: 0 0 var(--amm-list-width, 300px);
  width: var(--amm-list-width, 300px);
  max-width: 100%;
  padding: 6px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.amm__drop--mega.has-panel .amm__list {
  border-right: 1px solid var(--amm-border);
}

.amm__item {
  margin: 0;
}

.amm__item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 7px 14px 7px 12px;
  border-bottom: 1px solid var(--amm-border);
  color: var(--amm-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}

.amm__item:last-child > .amm__item-link {
  border-bottom: 0;
}

.amm__item-link:hover,
.amm__item.is-active > .amm__item-link {
  background: var(--amm-hover-bg);
}

.amm__item.is-current > .amm__item-link {
  color: var(--amm-accent);
}

.amm__icon {
  display: flex;
  flex: 0 0 28px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.amm__icon img {
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
}

.amm__list--no-icons .amm__icon {
  display: none;
}

.amm__label {
  flex: 1 1 auto;
  min-width: 0;
}

.amm__arrow {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: .45;
}

.amm__item.is-active > .amm__item-link .amm__arrow {
  opacity: .9;
}

.amm .is-bold,
.amm-m-overlay .is-bold {
  font-weight: 700 !important;
}

/* Panel mega menu */

.amm__panels {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.amm__drop--mega.has-panel .amm__panels {
  display: block;
}

.amm__panel {
  display: none;
  padding: 22px 30px 28px;
}

.amm__panel.is-active {
  display: block;
}

.amm__cols {
  /* Maksymalnie --amm-cols kolumn, każda min. 210 px — na węższych ekranach mniej */
  columns: 210px var(--amm-cols, 3);
  column-gap: 40px;
}

.amm__group {
  break-inside: avoid;
  page-break-inside: avoid;
  padding-bottom: 22px;
}

.amm__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--amm-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.amm__heading-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.amm__links li {
  margin: 0;
}

.amm__link {
  display: block;
  padding: 4px 0;
  color: var(--amm-muted);
  font-size: 14px;
  line-height: 1.35;
}

a.amm__heading:hover,
a.amm__link:hover {
  color: var(--amm-accent);
}

.amm__promo {
  break-inside: avoid;
  page-break-inside: avoid;
  margin: 4px 0 22px;
  text-align: center;
}

.amm__promo img {
  display: inline-block;
  max-width: 100%;
  height: auto;
}

.amm__promo figcaption {
  margin-top: 8px;
  color: var(--amm-muted);
  font-size: 14px;
}

@media (max-width: 1220px) {
  .amm__bar {
    gap: 0 15px;
  }

  .amm__top-link {
    font-size: 13px;
  }

  .amm__panel {
    padding: 18px 22px 22px;
  }

  .amm__cols {
    column-gap: 28px;
  }
}

/* ------------------------------------------------------------------
 * Mobile — przycisk
 * ------------------------------------------------------------------ */

.amm-m {
  display: inline-flex;
  align-items: center;
}

.amm-m__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #253237;
  cursor: pointer;
}

.amm-m__toggle:hover,
.amm-m__toggle:focus-visible {
  color: var(--amm-accent);
}

.amm-m__toggle svg {
  width: 28px;
  height: 28px;
}

/* ------------------------------------------------------------------
 * Mobile — nakładka na cały ekran
 * ------------------------------------------------------------------ */

html.amm-m-lock,
html.amm-m-lock body {
  overflow: hidden !important;
}

.amm-m-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  background: #fff;
  color: var(--amm-text);
  font-size: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-24px);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}

.amm-m-overlay[hidden] {
  display: none;
}

.amm-m-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .22s ease, transform .22s ease, visibility 0s;
}

/* Pasek jak w dotychczasowym menu: kolor akcentu, biały X po prawej */
.amm-m__head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  height: 40px;
  padding: 0 8px 0 20px;
  background: var(--amm-accent);
  color: #fff;
}

.amm-m__close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.amm-m__close svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
}

.amm-m__logo {
  display: flex;
  align-items: center;
  max-width: 60%;
  margin-right: auto;
}

.amm-m__logo img {
  display: block;
  max-height: 26px;
  width: auto;
  max-width: 100%;
}

.amm-m__viewport {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
}

.amm-m__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  visibility: hidden;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.6, 0, .6, 1), visibility 0s linear .25s;
}

.amm-m__panel.is-current,
.amm-m__panel.is-behind {
  visibility: visible;
  transition: transform .25s cubic-bezier(.6, 0, .6, 1), visibility 0s;
}

.amm-m__panel.is-current {
  transform: translateX(0);
}

.amm-m__panel.is-behind {
  transform: translateX(-30%);
}

.amm-m__list li {
  margin: 0;
}

/* Wiersze jak w dotychczasowym menu: 14 px, linia na całą szerokość */
.amm-m__row,
.amm-m__back {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 49px;
  margin: 0;
  padding: 10px 20px;
  border: 0;
  border-bottom: 1px solid #ebebeb;
  border-radius: 0;
  background: none;
  color: var(--amm-text);
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 28px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a.amm-m__row:active,
button.amm-m__row:active,
.amm-m__back:active {
  background: var(--amm-hover-bg);
}

.amm-m__row--heading {
  font-weight: 700;
}

.amm-m__icon {
  display: flex;
  flex: 0 0 26px;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.amm-m__icon img {
  max-width: 26px;
  max-height: 26px;
  object-fit: contain;
}

.amm-m__label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.4;
}

.amm-m__chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  opacity: .7;
}

.amm-m__back svg {
  width: 18px;
  height: 18px;
}

.amm-m__title {
  display: block;
  padding: 10px 20px;
  border-bottom: 1px solid #ebebeb;
  color: var(--amm-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 28px;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

span.amm-m__title {
  text-decoration: none !important;
}

.amm-m__promo {
  margin: 20px 20px 0;
  text-align: center;
}

.amm-m__promo img {
  max-width: 100%;
  height: auto;
}

.amm-m__promo figcaption {
  margin-top: 8px;
  color: var(--amm-muted);
  font-size: 14px;
}

/* Dodatki pod menu: linki z ikonami, przełączniki, tekst */

.amm-m__extra-icon {
  display: flex;
  flex: 0 0 20px;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.amm-m__extra-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.amm-m__row--text {
  align-items: flex-start;
  border-bottom: 0;
  padding-top: 14px;
  cursor: default;
}

.amm-m__row--text .amm-m__extra-icon {
  margin-top: 4px;
}

.amm-m__text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.6;
}

.amm-m__row--switcher {
  cursor: default;
}

/* Fragment CSS w module AM Custom Code chowa na ekranach do 1024 px przełącznik
   waluty i etykiety GTranslate poza starym kontenerem #mobile-megamenu — w tym
   menu mają być widoczne, stąd !important i wyższa specyficzność */
.amm-m-overlay .amm-m__row--switcher .alfabetgt-switcher {
  display: block !important;
  width: 100%;
}

.amm-m-overlay .amm-m__row--switcher .alfabetgt-menu-label {
  display: inline !important;
}

.amm-m__row--switcher .alfabetgt-menu-toggle {
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--amm-text);
  font-size: 14px;
  font-weight: 400;
}

.amm-m__row--switcher .alfabetgt-menu-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.amm-m__row--switcher .alfabetgt-menu-popover {
  position: static;
  display: none;
  min-width: 0;
  margin: 6px 0 0;
  padding: 0 0 0 30px;
  border: 0;
  box-shadow: none;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.amm-m__row--switcher .alfabetgt-switcher.is-open .alfabetgt-menu-popover {
  display: block;
}

/* Tryb „własny HTML” */

.amm-m__extra {
  padding: 18px 20px 0;
  font-size: 14px;
}

.amm-m__extra-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  color: inherit;
}

.amm-m__extra-links img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.amm-m__switchers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.amm-m__note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 14px;
}

.amm-m__note img {
  width: 20px;
  height: auto;
}

@media (prefers-reduced-motion: reduce) {
  .amm__top.is-open > .amm__drop {
    animation: none;
  }

  .amm-m-overlay,
  .amm-m-overlay.is-open,
  .amm-m__panel,
  .amm-m__panel.is-current,
  .amm-m__panel.is-behind {
    transition: none;
  }
}
