/* Multimedia Gallery Styles */

.multimedia { 
  background-color: #2d2e32;
}

/* Header */
.multimedia-header {
  position: relative;
  margin-bottom: 2rem;
}

.multimedia-title {
  font-size: 3rem;
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.accent-text {
  color: #ac815e; /* Gold/Brown */
  font-weight: 400;
}

.white-text {
  color: #fff;
  font-weight: 700;
}

.multimedia-underline {
  width: 100px;
  height: 2px;
  background-color: #ac815e;
  margin: 0 auto;
}

/* Controls */
.pilot-tabs {
  /*
    Estrategia elegida (UX): Flexbox fluido + scroll horizontal táctil en mobile.
    - Desktop/Tablet: los botones envuelven (wrap) para que siempre sean visibles sin depender de JS.
    - Mobile: una sola fila con overflow-x: auto + scroll-snap para deslizar con el dedo sin “perder” botones.
    Esto evita introducir dependencias (Swiper) y mantiene el rendimiento y la coherencia visual.
  */
  display: flex;
  flex-wrap: wrap; /* Desktop: si hay muchos botones, saltan de línea y siguen accesibles */
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
}

.pilot-btn {
  /*
    Botón táctil-accesible:
    - Min-height 44px: objetivo táctil recomendado para móviles.
    - min-width: max-content: evita que el texto se “apriete” y ayuda al scroll horizontal en mobile.
  */
  background: transparent;
  border: 1px solid #666;
  color: #ccc;
  padding: 8px 25px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  border-radius: 4px; /* Slight rounding or none based on image */
  min-height: 44px;
  min-width: max-content;
  touch-action: manipulation; /* Reduce el delay de taps en algunos navegadores */
}

.pilot-btn.active,
.pilot-btn:hover {
  background-color: #ac815e;
  color: #fff;
  border-color: #ac815e;
}

/*
  Breakpoint Mobile (<= 576px):
  - Una sola fila deslizable para mantener la UI compacta.
  - scroll-snap mejora la precisión al deslizar entre botones.
*/
@media (max-width: 576px) {
  .pilot-tabs {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* Inercia en iOS */
    scroll-snap-type: x mandatory;
    gap: 0.5rem;
    padding: 0 0.5rem 1rem 0.25rem;
    scrollbar-width: thin; /* Firefox */    
  }

  .pilot-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}

/* Accesibilidad: foco visible claro en teclado sin afectar el diseño en mouse */
.pilot-btn:focus-visible {
  outline: 2px solid #ac815e;
  outline-offset: 2px;
}

.pilot-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  color: #fff;
  font-size: 1.1rem;
}

.info-item i {
  margin-right: 0.5rem;
  font-size: 1.2rem;
}

/* Grid Layout */
.multimedia-grid-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 200px; /* Fixed height for rows */
  gap: 10px;
}

/* Large Item: Spans 2 cols, 2 rows */
.large-item {
  grid-column: span 2;
  grid-row: span 2;
  position: relative;
}

/* Small Items: Span 1 col, 1 row */
.small-item {
  grid-column: span 1;
  grid-row: span 1;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
  .multimedia-grid-container {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
  }
  
  .large-item {
    grid-column: span 2;
    grid-row: span 2; /* Still large on tablet */
  }
}

@media (max-width: 576px) {
  .multimedia-grid-container {
    grid-template-columns: 1fr; /* Stack on mobile */
    grid-auto-rows: 200px;
  }
  
  .large-item {
    grid-column: span 1;
    grid-row: span 1;
  }
  
  .multimedia-title {
    font-size: 2rem;
  }
}

/* Items & Hover Effects */
.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s, opacity 0.3s, z-index 0s;
  border-radius: 4px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* Hover Logic */
/* When container is hovered, dim all items not hovered */
.multimedia-grid-container:hover .gallery-item:not(:hover) {
  opacity: 0.6;
}

/* When item is hovered, scale it and bring to front */
.gallery-item:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  opacity: 1; /* Ensure hovered item is full opacity */
}

.item-caption {
  position: absolute;
  bottom: 15px;
  left: 15px;
  color: #fff;
  font-style: italic;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
  font-size: 1rem;
  pointer-events: none;
}

.large-item .item-caption {
  font-size: 1.2rem;
  font-weight: 600;
}

/* Modal */
.gallery-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.modal-content-wrapper {
  max-width: 90%;
  max-height: 90%;
}

.modal-content-wrapper img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  box-shadow: 0 0 50px rgba(0,0,0,0.5);
  border-radius: 4px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: #fff;
  font-size: 3rem;
  cursor: pointer;
  transition: color 0.3s;
  z-index: 10001;
}

.modal-close:hover {
  color: #ac815e;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.modal-nav:hover {
  background: #ac815e;
  color: #fff;
}

.modal-nav.prev { left: 20px; }
.modal-nav.next { right: 20px; }
