/* hover-expand core — scoped for editor, demo, and builders */
.mm-hover-expand {
  --page-bg: #121212;
  --page-fg: #f1f1f1;
  --inactive: rgba(241, 241, 241, 0.3);
  --gap: 0px;
  --radius: 16px;
  --collapsed: 4rem;
  --expanded: 28rem;
  --expanded-v: 500px;
  --gallery-pad: clamp(0.75rem, 2vw, 1.5rem);
  --caption-color: #fff;
  --action-color: #fff;
  --title-size: 15px;
  --caption-size: 12px;
  --page-overlay: transparent;
  --line: color-mix(in srgb, var(--page-fg) 14%, transparent);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  height: auto;
  padding: var(--gallery-pad);
  position: relative;
  isolation: isolate;
  background-color: var(--page-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--page-fg);
  /* no font-family here on purpose: module text inherits the builder theme typography (K10) */
  -webkit-font-smoothing: antialiased;
}

.mm-hover-expand::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--page-overlay);
  pointer-events: none;
  z-index: 0;
}

.mm-hover-expand > * {
  position: relative;
  z-index: 1;
}

.mm-hover-expand *,
.mm-hover-expand *::before,
.mm-hover-expand *::after {
  box-sizing: border-box;
}

.mm-hover-expand .gallery-shell {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.mm-hover-expand:has(.gallery.is-horizontal) {
  min-height: 0;
  height: auto;
}

.mm-hover-expand:has(.gallery.is-horizontal) .gallery-shell {
  flex: 0 0 auto;
}

.mm-hover-expand:has(.gallery.is-vertical) {
  padding-block: 1.5rem;
}

.mm-hover-expand:has(.gallery.is-vertical) .gallery-shell {
  flex: 0 0 auto;
  min-height: min-content;
  align-items: flex-start;
}

.mm-hover-expand .gallery {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: var(--gap);
  width: 100%;
  height: min(82vh, 860px);
  min-height: 360px;
  position: relative;
}

.mm-hover-expand .gallery.is-vertical {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: auto;
  min-height: min-content;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  overflow-anchor: none;
}

.mm-hover-expand .panel {
  position: relative;
  flex: 0 0 auto;
  width: var(--collapsed);
  height: 100%;
  overflow: hidden;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  isolation: isolate;
}

.mm-hover-expand .gallery.is-vertical .panel {
  width: 100%;
  height: var(--collapsed);
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  scroll-margin-block: 1.25rem;
  overflow-anchor: none;
}

.mm-hover-expand .gallery.is-vertical .panel:first-child {
  border-top: 1px solid var(--line);
}

.mm-hover-expand .panel:focus-visible {
  box-shadow: inset 0 0 0 2px var(--page-fg);
}

.mm-hover-expand .panel__rule {
  position: absolute;
  top: 6%;
  bottom: 6%;
  right: 0;
  width: 1px;
  background: var(--line);
  pointer-events: none;
  z-index: 4;
}

.mm-hover-expand .gallery.is-horizontal .panel:last-child .panel__rule { display: none; }
.mm-hover-expand .gallery.is-vertical .panel__rule { display: none; }

.mm-hover-expand .panel__label {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1.15rem 0.2rem;
  margin: 0;
  color: var(--inactive);
  font-size: var(--title-size);
  font-weight: 450;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.mm-hover-expand .gallery.is-horizontal .panel__label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
}

.mm-hover-expand .gallery.is-vertical .panel__label {
  writing-mode: horizontal-tb;
  transform: none;
  align-items: center;
  justify-content: flex-start;
  padding: 0 0.35rem;
  font-size: var(--title-size);
}

.mm-hover-expand .panel.is-expanded .panel__label {
  color: var(--page-fg);
}

.mm-hover-expand .gallery.is-horizontal .panel.is-expanded .panel__label {
  opacity: 0;
}

.mm-hover-expand .gallery.is-vertical .panel.is-expanded .panel__label {
  opacity: 1;
  align-items: flex-end;
  padding-bottom: 0.85rem;
  z-index: 5;
}

.mm-hover-expand .panel__media {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.mm-hover-expand .gallery.is-horizontal .panel__media {
  inset: 0.35rem;
  border-radius: var(--radius);
}

.mm-hover-expand .gallery.is-vertical .panel__media {
  left: 0.15rem;
  right: 0.15rem;
  top: 0.5rem;
  bottom: 3.1rem;
  border-radius: var(--radius);
}

.mm-hover-expand .panel.is-expanded .panel__media {
  pointer-events: auto;
}

.mm-hover-expand .panel__media img,
.mm-hover-expand .panel__ph {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  user-select: none;
  pointer-events: none;
}

.mm-hover-expand .panel__ph {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.mm-hover-expand .panel__chrome {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.mm-hover-expand .panel.is-expanded .panel__chrome {
  opacity: 1;
}

.mm-hover-expand .panel__year {
  position: absolute;
  top: 1rem;
  left: 1.1rem;
  font-size: var(--caption-size);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--caption-color);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  transform: translateY(-10px);
  opacity: 0;
}

.mm-hover-expand .gallery.is-vertical .panel__year {
  left: 1rem;
  top: 1.1rem;
}

.mm-hover-expand .panel__title-h {
  position: absolute;
  left: 1.1rem;
  bottom: 1.05rem;
  right: 1.1rem;
  margin: 0;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--page-fg);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  max-width: 18ch;
  line-height: 1.15;
  opacity: 0;
  transform: translateY(8px);
}

.mm-hover-expand .gallery.is-vertical .panel__title-h { display: none; }

.mm-hover-expand .panel__open {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--action-color) 40%, transparent);
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--action-color);
  font: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: background 0.15s, border-color 0.15s;
}

.mm-hover-expand .panel__open:hover {
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.6);
}

.mm-hover-expand .gallery.is-vertical .panel__open {
  top: 1rem;
  right: 1rem;
}

.mm-hover-expand .lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
           max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: rgba(8, 8, 10, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mm-hover-expand .lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mm-hover-expand .lightbox__dialog {
  position: relative;
  max-width: min(1100px, 96vw);
  z-index: 1;
}

.mm-hover-expand .lightbox__img {
  display: block;
  max-width: 96vw;
  max-height: min(82vh, 82dvh);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  background: #1a1a1e;
}

.mm-hover-expand .lightbox__caption {
  margin-top: 0.75rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  font-weight: 500;
}

.mm-hover-expand .lightbox__close {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  transform: translate(40%, -40%);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: none;
  background: #fff;
  color: #111;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.mm-hover-expand .lightbox__close:hover { background: #f0f0f0; }

.mm-hover-expand .lightbox__backdrop {
  position: absolute;
  inset: 0;
  cursor: zoom-out;
}

/* 1.2.79: lift the module ROOT above later BB rows while the lightbox is
   open. isolation:isolate on the root turns it into a stacking context,
   so the fixed lightbox only ranked inside it - later rows painted over
   it. A z-index on the root itself wins over the auto-level siblings. */
.mm-hover-expand.is-lightbox-open { overflow: hidden; z-index: 1000000; }

.mm-hover-expand.reduced-motion .panel,
.mm-hover-expand.reduced-motion .panel__media,
.mm-hover-expand.reduced-motion .panel__year,
.mm-hover-expand.reduced-motion .panel__title-h,
.mm-hover-expand.reduced-motion .panel__open {
  transition: none !important;
}

@media (max-width: 767px) {
  .mm-hover-expand { --radius: 18px; }
  .mm-hover-expand .lightbox__close {
    top: 0.5rem;
    right: 0.5rem;
    transform: none;
  }
}

/* ---- Close-Icon App-Dialog-Look (Runde 60j): Inline-SVG statt Text-Glyphe,
   theme-sicher zentriert, duenner Ring wie im App-Modal. ---- */
.mm-hover-expand .lightbox__close {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 1px solid rgba(17, 17, 17, 0.2) !important;
}

.mm-hover-expand .lightbox__close svg {
  width: 45% !important;
  height: 45% !important;
  display: block !important;
  pointer-events: none;
}


/* ---- BB theme hardening (precedence bounce-cards 1.2.60 / card-stack 60g):
   the runtime sets the design values inline (they beat any stylesheet),
   this block is the second belt for states the inline styles cannot cover. ---- */
.mm-hover-expand .panel__open:hover,
.mm-hover-expand .panel__open:focus-visible {
  background: rgba(0, 0, 0, 0.55) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
}
.mm-hover-expand .panel__media img {
  border: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.mm-hover-expand .lightbox__img {
  border: 0 !important;
  padding: 0 !important;
}
.mm-hover-expand .lightbox__close:hover,
.mm-hover-expand .lightbox__close:focus-visible {
  background: #f0f0f0 !important;
}
