/**
 * @author    Veo by Kebes <hola@kebes.es>
 * @copyright 2025 Veo by Kebes
 * @license   https://opensource.org/licenses/AFL-3.0  Academic Free License 3.0 (AFL-3.0)
 */
html.veopopup-open {
  overflow: hidden;
}

/* The dialog covers the screen and is the coloured background; the box is the popup */
.veopopup {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px;
  border: 0;
  box-sizing: border-box;
  background: var(--veopopup-overlay, rgba(0, 0, 0, .5));
  color: inherit;
}

.veopopup[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.veopopup::backdrop {
  background: transparent;
}

.veopopup-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--veopopup-width, 600px);
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  overflow: hidden;
  background: #fff;
  color: #222;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
  outline: 0;
}

@supports (height: 100dvh) {
  .veopopup-box {
    max-height: calc(100dvh - 32px);
  }
}

/* The body scrolls, so the close button inside the box never scrolls away */
.veopopup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 1.5rem;
  overscroll-behavior: contain;
}

.veopopup--close-inside .veopopup-body {
  padding-top: 3.25rem;
}

.veopopup--rounded .veopopup-box {
  border-radius: 12px;
}

.veopopup--dark .veopopup-box {
  background: #1e1f22;
  color: #f2f2f2;
}

.veopopup-content :where(p, li, span, td, th, h1, h2, h3, h4, h5, h6, strong, em) {
  color: inherit;
}

.veopopup--dark .veopopup-content a {
  color: inherit;
}

.veopopup-content a {
  text-decoration: underline;
}

.veopopup-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--veopopup-close, #222);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  cursor: pointer;
}

.veopopup--dark .veopopup-close {
  background: #1e1f22;
}

.veopopup > .veopopup-close {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 48px;
  height: 48px;
}

.veopopup-close:hover {
  filter: brightness(.92);
}

.veopopup--dark .veopopup-close:hover {
  filter: brightness(1.3);
}

@media (max-width: 575px) {
  .veopopup--close-outside {
    padding-top: 72px;
  }

  .veopopup--close-outside .veopopup-box {
    max-height: calc(100vh - 88px);
  }
}

.veopopup-close:focus-visible,
.veopopup-link:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.veopopup-image {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
}

.veopopup-content {
  overflow-wrap: anywhere;
}

.veopopup-content img,
.veopopup-content iframe,
.veopopup-content video {
  max-width: 100%;
  height: auto;
}

.veopopup-content > :last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .veopopup[open] .veopopup-box {
    animation: veopopup-in .25s ease-out;
  }
}

@keyframes veopopup-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
