/* Popups programables (se carga solo en páginas que tienen alguno). */
html.yamaha-popup-open { overflow: hidden; }

.yamaha-popup {
  --pp-w: 640px;
  position: fixed;
  inset: 0;
  z-index: 10100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
  pointer-events: none;
}
.yamaha-popup.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity .25s ease;
}
.yamaha-popup--sm { --pp-w: 420px; }
.yamaha-popup--md { --pp-w: 640px; }
.yamaha-popup--lg { --pp-w: 880px; }

.yamaha-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, .72);
  pointer-events: auto;
}

.yamaha-popup__dialog {
  position: relative;
  z-index: 1;
  width: min(var(--pp-w), 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: #fff;
  color: var(--dark, #111);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  outline: none;
  pointer-events: auto;
  transform: translateY(14px) scale(.97);
  transition: transform .28s ease;
}
.yamaha-popup.is-open .yamaha-popup__dialog { transform: none; }

/* Solo imagen: la caja toma la medida de la imagen y nunca la recorta. */
.yamaha-popup--image .yamaha-popup__dialog {
  width: fit-content;
  max-width: min(var(--pp-w), 100%);
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.yamaha-popup__link,
.yamaha-popup__picture { display: block; }
.yamaha-popup__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}

/* Con texto y botón. */
.yamaha-popup--content .yamaha-popup__img {
  width: 100%;
  max-height: 46vh;
  object-fit: cover;
  border-radius: 10px 10px 0 0;
  box-shadow: none;
}
.yamaha-popup__body { padding: 24px 26px 28px; }
.yamaha-popup__title {
  margin: 0 0 10px;
  font-family: var(--font-display, inherit);
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  line-height: 1.1;
  text-transform: uppercase;
}
.yamaha-popup__text { color: #555; font-size: 1rem; line-height: 1.55; }
.yamaha-popup__text p { margin: 0 0 12px; }
.yamaha-popup__btn { margin-top: 8px; }

.yamaha-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}
.yamaha-popup__close span { display: block; margin-top: -2px; }
.yamaha-popup__close:hover,
.yamaha-popup__close:focus-visible { background: var(--red, #0033a0); outline: 2px solid #fff; outline-offset: 2px; }

/* Esquina inferior derecha: no bloquea la página. */
.yamaha-popup--corner {
  inset: auto 20px 20px auto;
  width: min(var(--pp-w), calc(100vw - 40px));
  padding: 0;
  display: block;
}
.yamaha-popup--corner .yamaha-popup__dialog { width: 100%; }
.yamaha-popup--corner.yamaha-popup--image .yamaha-popup__dialog { width: fit-content; max-width: 100%; margin-left: auto; }
.yamaha-popup--corner .yamaha-popup__img { max-height: 60vh; }

@media (max-width: 768px) {
  .yamaha-popup--corner { inset: auto 10px 10px 10px; width: auto; }
  .yamaha-popup--corner .yamaha-popup__dialog { width: 100%; }
  .yamaha-popup__body { padding: 20px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .yamaha-popup,
  .yamaha-popup__dialog { transition: none; transform: none; }
}
