/* ==========================================================
   MODAL — Galería por categoría (productos)
   ========================================================== */

/* Los .category son clickeables */
.category {
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
}

.category:focus-visible {
  outline: 3px solid var(--verde);
  outline-offset: 3px;
}

/* Overlay full-screen */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.92);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal.is-open {
  display: flex;
  opacity: 1;
}

@media (max-width: 768px) {
  .modal {
    padding: 0;
  }
}

/* Contenedor del contenido */
.modal__content {
  position: relative;
  width: 100%;
  max-width: 1100px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Botón de cierre */
.modal__close {
  position: absolute;
  top: -3rem;
  right: 0;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: var(--blanco);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--t-base);
  z-index: 10;
}

.modal__close:hover {
  transform: rotate(90deg);
}

.modal__close svg {
  width: 28px;
  height: 28px;
}

@media (max-width: 768px) {
  .modal__close {
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
  }
}

/* Título de la categoría */
.modal__title {
  color: var(--blanco);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-align: center;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .modal__title {
    padding: 3.5rem 1rem 0.5rem;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
}

/* Contenedor de la imagen con navegación */
.modal__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.modal__image {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal__image.is-loading {
  opacity: 0.3;
}

@media (max-width: 768px) {
  .modal__image {
    max-height: 55vh;
  }
}

/* Flechas de navegación */
.modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: var(--blanco);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-base);
  z-index: 5;
}

.modal__nav:hover {
  background: var(--verde);
}

.modal__nav--prev {
  left: 1rem;
}

.modal__nav--next {
  right: 1rem;
}

.modal__nav svg {
  width: 24px;
  height: 24px;
}

.modal__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Descripción al pie */
.modal__caption {
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 1.5rem 3rem 0.5rem;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .modal__caption {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* Dots indicadores */
.modal__dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 0 0;
}

.modal__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all var(--t-base);
}

.modal__dot.is-active {
  background: var(--verde);
  width: 24px;
  border-radius: 4px;
}

.modal__counter {
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-align: center;
  padding-top: 0.5rem;
}

/* Body con scroll bloqueado cuando el modal está abierto */
body.modal-open {
  overflow: hidden;
}

/* ==========================================================
   CATEGORY CARDS — Hover expandido con descripción larga
   ========================================================== */

/* Por defecto: descripción larga oculta, descripción corta visible.
   Usamos especificidad alta (.category__content .category__desc-*) y
   !important en las propiedades clave para ganar a .category__desc del style.css. */

.category__content .category__desc-long {
  max-height: 0 !important;
  opacity: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.85rem;
  line-height: 1.55;
  transition: opacity 0.3s ease, max-height 0.35s ease, margin 0.3s ease;
  display: block;
}

.category__content .category__desc-short {
  max-height: 200px;
  opacity: 1;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.3s ease, margin 0.3s ease;
}

/* Solo en desktop con puntero fino: efecto hover */
@media (hover: hover) and (pointer: fine) {

  /* Overlay verde sutil al hacer hover */
  .category:hover .category__overlay {
    background: linear-gradient(to top, rgba(20, 20, 20, 0.92) 0%, rgba(20, 20, 20, 0.6) 60%, rgba(147, 213, 0, 0.15) 100%);
  }

  .category__content {
    transition: padding var(--t-base);
  }

  .category:hover .category__content {
    padding-bottom: 1.75rem;
  }

  /* En hover: la corta se colapsa */
  .category:hover .category__content .category__desc-short {
    opacity: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
  }

  /* En hover: la larga aparece */
  .category:hover .category__content .category__desc-long {
    max-height: 320px !important;
    opacity: 1 !important;
    margin-top: 0.25rem !important;
  }
}

/* En mobile / touch: la larga NUNCA se muestra en el card (queda para el modal) */
@media (hover: none), (pointer: coarse) {
  .category__content .category__desc-long {
    display: none !important;
  }
}
