/**
 * Cruise Ship Gallery Styling
 * Modern grid gallery for ship images
 */

/* Gallery container - ensure full width */
.cruise-ship-gallery,
.view-cruise-ship-gallery {
  margin-top: 24px;
  width: 100% !important;
  max-width: 100% !important;
}

/* Tab panel content should be full width for gallery */
#gallery .tab-panel-content,
#gallery .views-element-container,
#gallery .view,
#gallery .view-content,
#gallery .views-infinite-scroll-content-wrapper {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
}

.cruise-ship-gallery .gallery__title,
.view-cruise-ship-gallery .block__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 24px;
}

/* Modern CSS Grid layout - 4 columns for gallery */
#gallery .views-view-grid,
#gallery .views-view-grid--horizontal,
.view-cruise-ship-gallery .views-view-grid,
.view-cruise-ship-gallery .views-view-grid--horizontal,
.cruise-ship-gallery .gallery__grid,
.field--name-field-image-gallery .field__items {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 16px !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
}

/* Override the inline CSS variable */
#gallery .views-view-grid--horizontal,
.view-cruise-ship-gallery .views-view-grid--horizontal {
  --views-grid--column-count: 4 !important;
}

/* Individual gallery items */
.cruise-ship-gallery .gallery__item,
.view-cruise-ship-gallery .views-view-grid .views-row,
.view-cruise-ship-gallery .views-view-grid .views-col,
.view-cruise-ship-gallery .views-view-grid__item {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Gallery image container */
.cruise-ship-gallery .gallery__item,
.cruise-ship-gallery .media,
.view-cruise-ship-gallery .views-field-field-media-image {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #f5f5f5;
}

/* Gallery grid item inner - ensure proper display */
.view-cruise-ship-gallery .views-view-grid__item-inner {
  position: relative;
  width: 100% !important;
  display: block !important;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #f5f5f5;
}

.cruise-ship-gallery .gallery__item:hover,
.cruise-ship-gallery .media:hover,
.view-cruise-ship-gallery .views-field-field-media-image:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Images */
.cruise-ship-gallery img,
.view-cruise-ship-gallery .views-field-field-media-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.cruise-ship-gallery .gallery__item:hover img,
.cruise-ship-gallery .media:hover img,
.view-cruise-ship-gallery .views-field-field-media-image:hover img {
  transform: scale(1.05);
}

/* Gallery image links */
.view-cruise-ship-gallery .views-field-field-media-image a {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Lightbox clickable images */
.cruise-ship-gallery a.glightbox,
.deck-plan-card__image a.glightbox,
.view-cruise-ship-gallery a.glightbox {
  cursor: pointer;
  display: block;
}

.cruise-ship-gallery a.glightbox img,
.deck-plan-card__image a.glightbox img,
.view-cruise-ship-gallery a.glightbox img {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.cruise-ship-gallery a.glightbox:hover img,
.deck-plan-card__image a.glightbox:hover img,
.view-cruise-ship-gallery a.glightbox:hover img {
  opacity: 0.9;
}

.view-cruise-ship-gallery .views-field-field-media-image a::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
}

.view-cruise-ship-gallery .views-field-field-media-image a:hover::after {
  background: rgba(0, 0, 0, 0.1);
}

/* Image info/caption overlay */
.media-info-image,
.info-image-grallery {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.7));
  padding: 12px 16px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 10;
}

.media--type-image:hover .media-info-image,
article.media:hover .media-info-image,
.views-view-grid__item-inner:hover .info-image-grallery {
  opacity: 1;
}

/* Filename display */
.media-info-image .field--name-name,
.info-image-grallery .field-media-image-credit {
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Description/category display */
.media-info-image .field--name-field-description,
.info-image-grallery .field-media-description {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.95;
  color: #ffd700;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Make sure media container has position relative */
.media--type-image,
article.media,
.views-view-grid__item-inner {
  position: relative;
}

/* Infinite scroll styling */
.views-infinite-scroll-content-wrapper {
  position: relative;
}

.view-cruise-ship-gallery .pager {
  text-align: center;
  margin-top: 32px;
}

.view-cruise-ship-gallery .pager__item {
  display: inline-block;
}

.view-cruise-ship-gallery .button {
  background: #667eea;
  color: #fff;
  padding: 12px 32px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.view-cruise-ship-gallery .button:hover {
  background: #5568d3;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  #gallery .views-view-grid,
  #gallery .views-view-grid--horizontal,
  .cruise-ship-gallery .gallery__grid,
  .view-cruise-ship-gallery .views-view-grid,
  .view-cruise-ship-gallery .views-view-grid--horizontal {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }
}

@media (max-width: 768px) {
  #gallery .views-view-grid,
  #gallery .views-view-grid--horizontal,
  .cruise-ship-gallery .gallery__grid,
  .view-cruise-ship-gallery .views-view-grid,
  .view-cruise-ship-gallery .views-view-grid--horizontal {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .cruise-ship-gallery .gallery__title,
  .view-cruise-ship-gallery .block__title {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }
}

@media (max-width: 480px) {
  #gallery .views-view-grid,
  #gallery .views-view-grid--horizontal,
  .cruise-ship-gallery .gallery__grid,
  .view-cruise-ship-gallery .views-view-grid,
  .view-cruise-ship-gallery .views-view-grid--horizontal {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

/* Loading states */
.view-cruise-ship-gallery .ajax-progress {
  text-align: center;
  padding: 24px;
}

.view-cruise-ship-gallery .ajax-progress-throbber {
  display: inline-block;
}
