/*
 * Pop-up-Hinweis (library/aebi-hinweis-popup.php, library/js/hinweis-popup.js)
 * Bewusst als eigene Datei ohne SCSS-Build: wird nur geladen, wenn ein Hinweis aktiv ist.
 */

.aebi-hinweis {
  box-sizing: border-box;
  /* Breite folgt dem Bild (Hoch- und Querformat ohne Ränder), Text bricht auf Bildbreite um */
  width: fit-content;
  min-width: min(320px, calc(100vw - 32px));
  max-width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #e8ede6;
  color: #000;
  font-family: "Rotis", Helvetica, Arial, sans-serif;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
}

.aebi-hinweis::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.aebi-hinweis:focus {
  outline: none;
}

.aebi-hinweis[open] {
  animation: aebi-hinweis-ein 0.25s ease-out;
}

@keyframes aebi-hinweis-ein {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aebi-hinweis[open] { animation: none; }
}

/* Seite hinter dem offenen Dialog nicht scrollen */
html:has(.aebi-hinweis[open]) {
  overflow: hidden;
}

.aebi-hinweis *,
.aebi-hinweis *::before,
.aebi-hinweis *::after {
  box-sizing: border-box;
}

.aebi-hinweis__inner {
  position: relative;
}

/* Bild */
.aebi-hinweis__bild-link {
  display: block;
  text-decoration: none !important;
}

.aebi-hinweis__bild {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 60vh;
  max-height: 60dvh;
  margin: 0 auto;
}

/* Nur Bild, kein Text darunter: Bild darf fast die ganze Höhe nutzen */
.aebi-hinweis__inner.is-nur-bild .aebi-hinweis__bild {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

/* Schliessen */
.aebi-hinweis__close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #e8ede6;
  color: #000;
  cursor: pointer;
  transition: background-color 0.14s ease-in-out, color 0.14s ease-in-out;
}

.aebi-hinweis__close svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.aebi-hinweis__close:hover {
  background: #000;
  color: #fff;
}

/* Text */
.aebi-hinweis__body {
  padding: 1.5rem 1.5rem 1.75rem;
}

/* Mit Bild: Textblock zählt nicht zur Dialogbreite, die Breite gibt das Bild vor */
.aebi-hinweis__inner.has-bild .aebi-hinweis__body {
  width: 0;
  min-width: 100%;
}

.aebi-hinweis__inner:not(.has-bild) .aebi-hinweis__body {
  padding-top: 1.75rem;
  padding-right: 3.75rem;
}

.aebi-hinweis__body.is-leer {
  padding: 0;
}

.aebi-hinweis__body > * {
  margin: 0;
}

.aebi-hinweis__body > * + * {
  margin-top: 1rem;
}

.aebi-hinweis__body > .aebi-hinweis__sr-only + * {
  margin-top: 0;
}

.aebi-hinweis__titel {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.aebi-hinweis__text {
  font-size: 1rem;
  line-height: 1.5;
}

.aebi-hinweis__text p {
  margin: 0 0 0.75rem;
}

.aebi-hinweis__text > :last-child {
  margin-bottom: 0;
}

.aebi-hinweis__text a {
  color: #000 !important;
  text-decoration: underline;
}

/* Button: Theme setzt a { color: #444 !important }, daher hier !important */
.aebi-hinweis__button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.25rem;
  background: #000;
  color: #fff !important;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05rem;
  text-decoration: none !important;
  transition: background-color 0.14s ease-in-out, color 0.14s ease-in-out;
}

.aebi-hinweis__button:hover {
  background: #e4625d;
  color: #000 !important;
}

/* Fokus sichtbar halten (Theme entfernt Outlines global) */
.aebi-hinweis :focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.aebi-hinweis__bild-link:focus-visible,
.aebi-hinweis__close:focus-visible {
  outline-offset: -4px;
}

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