.comparison-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  user-select: none;
}

.comparison-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-before-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--slider-pos); /* Dynamische Breite via CSS-Variable */
  height: 100%;
  overflow: hidden;
  z-index: 1;
  border-right: 3px solid #ffffff; /* Sichtbare Trennlinie */
  box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.image-before {
  width: 856px !important; /* Wird via JS dynamisch überschrieben */
  max-width: none;
}

/* Neuer Schiebe-Button mit Pfeilen */
.slider-button {
  position: absolute;
  top: 50%;
  left: var(--slider-pos); /* Folgt der CSS-Variable */
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  pointer-events: none; /* Klicks gehen durch das Icon zum darunterliegenden Regler */
  color: #333333;
  transition: background-color 0.2s;
}

/* Styling der SVG-Pfeile */
.slider-button svg {
  width: 22px;
  height: 22px;
}

/* Visuelle Änderung, wenn der Nutzer den Slider fokussiert */
.comparison-container:focus-within .slider-button {
  background-color: #ef0000;
  color: #ffffff;
}

/* Visuelle Labels */
.label {
  position: absolute;
  top: 15px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  padding: 4px 8px;
  font-size: 0.65em;
  font-weight: bold;
  border-radius: 4px;
  pointer-events: none;
}
.label-before { left: 15px; }
.label-after { right: 15px; }

/* Der funktionale Slider */
.comparison-slider {
  position: absolute;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  background: transparent;
  top: 0;
  left: 0;
  margin: 0;
  z-index: 4;
  cursor: ew-resize;
}

.comparison-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 100vh;
  background: transparent;
  cursor: ew-resize;
}
.comparison-slider::-moz-range-thumb {
  width: 44px;
  height: 100vh;
  background: transparent;
  border: none;
  cursor: ew-resize;
}

/* Tastatur-Fokus-Rahmen um den gesamten Container */
.comparison-slider:focus-visible {
  outline: 3px solid #ef0000;
  outline-offset: -3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
