/* css/gallery-modal.css */

/* --- 1. MODAL GRUNDLAGEN (Das Overlay) --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1.8vw, 18px);
  z-index: 2000; /* Sehr hoch, über der Nav */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0; /* Standardmäßig unsichtbar */
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Wenn das Modal geöffnet ist (Klasse .is-open) */
.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85); /* Sehr dunkles Overlay */
  cursor: pointer;
}

.modal-content {
  position: relative;
  width: min(100%, 1200px);
  height: min(86dvh, 820px);
  max-height: calc(100dvh - clamp(16px, 3vw, 36px));
  background: transparent;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-close {
  position: absolute;
  top: clamp(-44px, -4.8vw, -28px); /* Über dem Inhalt */
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1;
  cursor: pointer;
  z-index: 20;
  padding: 0;
  transition: color 0.3s ease;
}

.modal-close:hover {
  color: var(--amber-soft); /* Nutzt deine Primärfarbe */
}

/* Versteckt die Überschrift für Screenreader */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- 2. CAROUSEL IM MODAL (fokussiert ein Bild) --- */
.modal .carousel-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.modal .carousel-track-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal .carousel-track {
  display: flex;
  padding: 0;
  margin: 0;
  list-style: none;
  height: 100%;
  transition: transform 0.5s ease-in-out;
  position: relative;
  width: 100%;
  will-change: transform;
}

.modal .carousel-slide {
  flex: 0 0 100%;
  position: relative;
  min-width: 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(4px, 1.2vw, 10px); /* Kleiner Puffer */
  box-sizing: border-box;
}

.modal .carousel-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Ganze Bild sichtbar, keine Verzerrung */
  object-position: center;
  background: #111;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

/* Positionierung der Buttons (Pfeile) im Modal */
.modal .carousel-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  border: none;
  width: clamp(42px, 5vw, 60px);
  height: clamp(42px, 5vw, 60px);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: #fff;
  transition: background 0.3s ease, color 0.3s ease;
}

.modal .carousel-button:hover {
  background: rgba(255, 255, 255, 0.3);
  color: var(--amber-soft);
}

.modal .carousel-button svg {
  width: clamp(20px, 2.5vw, 30px);
  height: clamp(20px, 2.5vw, 30px);
}

.modal .carousel-button--left {
  left: clamp(8px, 1.8vw, 20px);
}

.modal .carousel-button--right {
  right: clamp(8px, 1.8vw, 20px);
}

/* Versteckt Pfeile am Anfang/Ende */
.modal .carousel-button.is-hidden {
  display: none;
}

@media (max-width: 700px) {
  .modal-content {
    height: min(78dvh, 560px);
  }

  .modal-close {
    right: 2px;
  }

  .modal .carousel-button {
    top: auto;
    bottom: 10px;
    transform: none;
  }

  .modal .carousel-button--left {
    left: 10px;
  }

  .modal .carousel-button--right {
    right: 10px;
  }
}

@media (max-height: 560px) {
  .modal-content {
    height: min(82dvh, 460px);
  }

  .modal-close {
    top: -30px;
  }

  .modal .carousel-slide {
    padding-bottom: 56px;
  }
}