/* ==========================================================================
   MODAL LIGHTBOX Y FICHA TÉCNICA — ANGÉLICA RICAURTE
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: var(--color-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 1240px;
  max-height: 92vh;
  background-color: var(--color-ground-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transform: scale(0.96) translateY(12px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

@media (min-width: 900px) {
  .modal-dialog {
    flex-direction: row;
    height: 86vh;
  }
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--color-ground-subtle);
  color: var(--color-ink);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.modal-close-btn:hover {
  transform: scale(1.1);
}

.modal-image-col {
  flex: 1.25;
  position: relative;
  background-color: var(--color-ground-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  overflow: hidden;
  user-select: none;
}

.modal-image-col img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  cursor: crosshair;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Barra de herramientas sobre la imagen (Rotar y Pantalla Completa) */
.modal-img-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}

.img-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background-color: var(--color-ground-elevated);
  border: 1px solid var(--color-border);
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.img-tool-btn:hover {
  background-color: var(--color-ground-subtle);
  transform: translateY(-2px);
}

.img-tool-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

/* Modo Pantalla Completa */
.modal-image-col:fullscreen,
.modal-image-col:-webkit-full-screen,
.modal-image-col.fullscreen-active {
  background-color: #000000 !important;
  padding: 20px !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
}

.modal-image-col:fullscreen img,
.modal-image-col:-webkit-full-screen img,
.modal-image-col.fullscreen-active img {
  max-width: 94vw;
  max-height: 94vh;
  box-shadow: none;
}

/* Lupa interactiva estilo Amazon / MercadoLibre */
.modal-loupe {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), inset 0 0 16px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  display: none;
  background-repeat: no-repeat;
  z-index: 50;
  background-color: var(--color-ground-subtle);
}

.loupe-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background-color: rgba(10, 10, 10, 0.8);
  color: #FFFFFF;
  font-size: 13px;
  border-radius: var(--radius-full);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0.92;
  transition: opacity var(--transition-fast);
  z-index: 15;
}

.nav-arrow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-ground-elevated);
  border-radius: 50%;
  color: var(--color-ink);
  cursor: pointer;
  z-index: 10;
  transition: transform var(--transition-fast);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.nav-arrow-btn:hover {
  transform: translateY(-50%) scale(1.1);
}

.nav-arrow-btn.prev {
  left: 16px;
}

.nav-arrow-btn.next {
  right: 16px;
}

.modal-info-col {
  flex: 0.85;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-color: var(--color-ground-elevated);
}

@media (min-width: 900px) {
  .modal-info-col {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
  }
}

.modal-info-header {
  margin-bottom: var(--space-md);
}

.modal-obra-id {
  font-size: var(--step-small);
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 4px;
}

.modal-obra-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  line-height: 1.15;
}

.modal-obra-year {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  color: var(--color-ink-muted);
  margin-top: 4px;
}

.specs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: var(--space-sm) 0 var(--space-lg);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--step-small);
}

.spec-label {
  color: var(--color-ink-faint);
  font-size: 14px;
}

.spec-value {
  color: var(--color-ink);
  font-weight: 500;
  text-align: right;
  max-width: 65%;
  font-size: 15px;
}

.modal-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding-top: var(--space-sm);
}

.btn-whatsapp-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 22px;
  background-color: #25D366;
  color: #FFFFFF;
  font-weight: 600;
  font-size: var(--step-body);
  border-radius: var(--radius-sm);
  text-align: center;
  transition: all var(--transition-fast);
}

.btn-whatsapp-cta:hover {
  background-color: #1EBE5D;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.4);
}

.secondary-actions {
  display: flex;
  gap: var(--space-xs);
}

.btn-secondary-contact {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: var(--step-small);
  border-radius: var(--radius-sm);
  background-color: var(--color-ground-subtle);
  color: var(--color-ink);
  transition: all var(--transition-fast);
}

.btn-secondary-contact:hover {
  background-color: var(--color-ground-card);
}

/* ==========================================================================
   VISOR DE OBRAS EN MÓVIL (ART-FIRST CON SCROLL NATURAL)
   ========================================================================== */
@media (max-width: 899px) {
  .modal-backdrop {
    padding: 0;
    align-items: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-dialog {
    width: 100%;
    min-height: 100vh;
    max-height: none;
    border-radius: 0;
    flex-direction: column;
    overflow: visible;
    box-shadow: none;
    margin: 0;
    transform: none !important;
  }

  .modal-close-btn {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 100;
    width: 38px;
    height: 38px;
    background-color: var(--color-ground-elevated);
    border: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }

  .modal-image-col {
    flex: none;
    width: 100%;
    min-height: 54vh;
    max-height: 65vh;
    padding: 58px 16px 20px;
    background-color: var(--color-ground-card);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }

  .modal-image-col img {
    max-width: 100%;
    max-height: 56vh;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  }

  .modal-img-toolbar {
    top: 14px;
    left: 14px;
    gap: 6px;
    z-index: 50;
  }

  .img-tool-btn {
    padding: 6px 10px;
    font-size: 12px;
    gap: 5px;
    background-color: var(--color-ground-elevated);
  }

  .img-tool-btn svg {
    width: 14px;
    height: 14px;
  }

  .nav-arrow-btn {
    display: none;
  }

  .loupe-hint {
    display: none;
  }

  .modal-info-col {
    flex: none;
    width: 100%;
    padding: 24px 20px 48px;
    overflow: visible;
    background-color: var(--color-ground-elevated);
  }

  .modal-obra-title {
    font-size: 26px;
    line-height: 1.15;
  }

  .spec-value {
    max-width: 68%;
  }

  .modal-actions {
    margin-top: 24px;
    padding-top: 16px;
  }
}
