/* ========================================
   GALLERY-BENTO.CSS - Bento Grid Gallery Styles
   Apple-inspired mixed card sizes layout
   ======================================== */

/* ===== GALLERY SECTION ===== */
.gallery-bento-section {
  padding: var(--spacing-xl) 0;
  min-height: 100vh;
}

/* ===== GALLERY HERO ===== */
.gallery-bento-hero {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.gallery-bento-hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--spacing-sm);
}

.gallery-bento-hero-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
}

/* ===== CATEGORY TABS ===== */
.gallery-bento-tabs {
  display: flex;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

.gallery-bento-tab {
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--color-bg-card);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-full);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.gallery-bento-tab:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.gallery-bento-tab--active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-bg);
}

.gallery-bento-tab--active:hover {
  color: var(--color-bg);
}

/* ===== BENTO GRID ===== */
.gallery-bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  gap: 10px;
  margin-bottom: var(--spacing-xl);
}

/* ===== BENTO ITEM ===== */
.gallery-bento-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-card);
  cursor: pointer;
  /* Animation properties for filtering */
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Exiting animation */
.gallery-bento-item.is-exiting {
  opacity: 0;
  transform: scale(0.95);
}

/* Entering animation */
.gallery-bento-item.is-entering {
  opacity: 0;
  transform: scale(0.95);
  animation: bentoEnter 0.4s ease forwards;
}

@keyframes bentoEnter {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Staggered animation delay classes */
.gallery-bento-item.delay-1 { animation-delay: 0.05s; }
.gallery-bento-item.delay-2 { animation-delay: 0.1s; }
.gallery-bento-item.delay-3 { animation-delay: 0.15s; }
.gallery-bento-item.delay-4 { animation-delay: 0.2s; }
.gallery-bento-item.delay-5 { animation-delay: 0.25s; }
.gallery-bento-item.delay-6 { animation-delay: 0.3s; }
.gallery-bento-item.delay-7 { animation-delay: 0.35s; }
.gallery-bento-item.delay-8 { animation-delay: 0.4s; }

/* ===== BENTO SIZE VARIATIONS ===== */

/* Featured: 2 columns x 2 rows (large square) */
.gallery-bento-item--featured {
  grid-column: span 2;
  grid-row: span 2;
}

/* Wide: 2 columns x 1 row */
.gallery-bento-item--wide {
  grid-column: span 2;
}

/* Tall: 1 column x 2 rows */
.gallery-bento-item--tall {
  grid-row: span 2;
}

/* Standard: 1x1 (default, no extra class needed) */

/* ===== BENTO ITEM IMAGE ===== */
.gallery-bento-item-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Minimal hover - subtle zoom only */
.gallery-bento-item:hover .gallery-bento-item-image {
  transform: scale(1.03);
}

/* ===== BENTO ITEM OVERLAY ===== */
.gallery-bento-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--spacing-md);
  transition: background 0.3s ease;
}

/* Hover: subtle darkening */
.gallery-bento-item:hover .gallery-bento-item-overlay {
  background: rgba(0, 0, 0, 0.4);
}

/* Title hidden by default, revealed on hover */
.gallery-bento-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.gallery-bento-item:hover .gallery-bento-item-title {
  opacity: 1;
  transform: translateY(0);
}

/* Category label */
.gallery-bento-item-category {
  font-size: 0.7rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease 0.05s, transform 0.3s ease 0.05s;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gallery-bento-item:hover .gallery-bento-item-category {
  opacity: 1;
  transform: translateY(0);
}

/* Featured items get larger text */
.gallery-bento-item--featured .gallery-bento-item-title {
  font-size: 1.25rem;
}

.gallery-bento-item--featured .gallery-bento-item-category {
  font-size: 0.8rem;
}

/* ===== LOADING STATE ===== */
.gallery-bento-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xxl);
  color: var(--color-text-muted);
}

.gallery-bento-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--spacing-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== PURCHASE INFO BANNER ===== */
.gallery-bento-purchase-info {
  background: linear-gradient(135deg, rgba(74, 198, 255, 0.1), rgba(148, 103, 255, 0.1));
  border: var(--border-width) solid rgba(74, 198, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  text-align: center;
  margin-top: var(--spacing-xl);
}

.gallery-bento-purchase-content h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

.gallery-bento-purchase-content p {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-lg);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== LIGHTBOX ===== */
.gallery-bento-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-index-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.gallery-bento-lightbox[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}

.gallery-bento-lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.gallery-bento-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery-bento-lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: transparent;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: var(--spacing-sm);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
  z-index: 10;
}

.gallery-bento-lightbox-close:hover {
  opacity: 1;
}

.gallery-bento-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: var(--border-width) solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: var(--color-text);
  cursor: pointer;
  padding: var(--spacing-md);
  opacity: 0.7;
  transition: opacity var(--transition-fast), background var(--transition-fast);
  z-index: 10;
}

.gallery-bento-lightbox-nav:hover {
  opacity: 1;
  background: rgba(74, 198, 255, 0.3);
}

.gallery-bento-lightbox-prev {
  left: -80px;
}

.gallery-bento-lightbox-next {
  right: -80px;
}

.gallery-bento-lightbox-image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: calc(90vh - 100px);
}

.gallery-bento-lightbox-image {
  max-width: 100%;
  max-height: calc(90vh - 100px);
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.gallery-bento-lightbox-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-bg-card-alpha-96);
  border-radius: var(--radius-md);
  backdrop-filter: blur(12px);
}

.gallery-bento-lightbox-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.gallery-bento-lightbox-category {
  font-size: 0.8rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: rgba(74, 198, 255, 0.15);
  border-radius: var(--radius-sm);
}

.gallery-bento-lightbox-purchase {
  margin-left: auto;
}

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 1024px) {
  .gallery-bento-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 180px;
  }

  /* Prevent featured items from taking too much space */
  .gallery-bento-item--featured {
    grid-column: span 2;
    grid-row: span 2;
  }
}

/* Small tablet / large phone */
@media (max-width: 768px) {
  .gallery-bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 150px;
    gap: 8px;
  }

  /* Featured stays 2x2 but on 2-column grid */
  .gallery-bento-item--featured {
    grid-column: span 2;
    grid-row: span 2;
  }

  /* Wide items span full width */
  .gallery-bento-item--wide {
    grid-column: span 2;
  }

  /* Tall items stay tall */
  .gallery-bento-item--tall {
    grid-row: span 2;
  }

  .gallery-bento-lightbox-nav {
    display: none;
  }

  .gallery-bento-lightbox-info {
    flex-direction: column;
    text-align: center;
    gap: var(--spacing-sm);
  }

  .gallery-bento-lightbox-purchase {
    margin-left: 0;
    width: 100%;
  }

  .gallery-bento-tabs {
    gap: var(--spacing-xs);
  }

  .gallery-bento-tab {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.85rem;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .gallery-bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 120px;
    gap: 6px;
  }

  /* On mobile, limit featured to wide (2x1) */
  .gallery-bento-item--featured {
    grid-column: span 2;
    grid-row: span 1;
  }

  .gallery-bento-item--tall {
    grid-row: span 2;
  }

  .gallery-bento-item-title {
    font-size: 0.8rem;
  }

  .gallery-bento-item-category {
    font-size: 0.65rem;
  }

  .gallery-bento-item--featured .gallery-bento-item-title {
    font-size: 0.9rem;
  }

  .gallery-bento-item-overlay {
    padding: var(--spacing-sm);
  }
}

/* ===== IMAGE PROTECTION ===== */
.gallery-bento-item-image,
.gallery-bento-lightbox-image {
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

.gallery-bento-item,
.gallery-bento-lightbox-image-container {
  -webkit-touch-callout: none;
}
