/* ============================
   Alfa Romeo Gallery & Lightbox
   ============================ */

/* Utility text helpers used by the gallery script */
.text-center {
  text-align: center;
}

.muted {
  opacity: 0.75;
  font-size: 0.9rem;
}

/* Page wrapper inside SPA overlay */
.gallery-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.gallery-header {
  margin-bottom: 0.5rem;
}

.gallery-header h1 {
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.gallery-header p {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
}

/* ========== CATEGORY TABS ========== */

.gallery-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem auto 1.5rem;
}

.gallery-tab {
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(184,134,11,0.35);
  background: linear-gradient(135deg, rgba(20,20,20,0.9), rgba(10,10,10,0.95));
  color: rgba(255,255,255,0.8);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  transition: color 0.09s ease, border-color 0.09s ease,
              box-shadow 0.09s ease, transform 0.09s ease,
              background 0.09s ease;
}

.gallery-tab:hover {
  color: #fff;
  border-color: rgba(184,134,11,0.8);
  box-shadow: 0 0 18px rgba(184,134,11,0.7);
  background: linear-gradient(135deg, rgba(30,25,20,0.95), rgba(15,10,5,0.98));
  transform: translateY(-1px);
}

.gallery-tab.is-active {
  color: #fff;
  border-color: rgba(45,80,22,0.85);
  box-shadow: 0 0 24px rgba(45,80,22,0.9), 0 0 40px rgba(45,80,22,0.6);
  background: linear-gradient(135deg, rgba(25,45,20,0.95), rgba(10,25,10,0.98));
  transform: translateY(-2px);
}

/* ========== GALLERY GRID & ITEMS ========== */

.gallery-view {
  display: none;
  opacity: 0;
  transition: opacity 0.09s ease;
}

.gallery-view.is-visible {
  display: block;
  opacity: 1;
}

.gallery-view header {
  margin-bottom: 1rem;
}

.gallery-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: radial-gradient(circle at top, rgba(255,255,255,0.05), rgba(0,0,0,0.95));
  box-shadow: 0 10px 26px rgba(0,0,0,0.85);
  transition: border-color 0.09s ease, box-shadow 0.09s ease,
              transform 0.25s ease;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transform: scale(1);
  transition: transform 0.09s ease, filter 0.09s ease;
}

.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center,
    rgba(184,134,11,0.25) 0%,
    transparent 55%);
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  transition: opacity 0.09s ease;
}

.gallery-item:hover {
  border-color: rgba(184,134,11,0.65);
  box-shadow: 0 0 24px rgba(184,134,11,0.5);
}

.gallery-item-media img,
.gallery-item-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.09s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
  filter: brightness(1.1) contrast(1.05) saturate(1.05);
}

.gallery-item:hover::after {
  opacity: 1;
}

.gallery-play-icon {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 1.1rem;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 0 8px rgba(184,134,11,0.9);
  pointer-events: none;
}

/* ========== LIGHTBOX ========== */

.lightbox {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center,
    rgba(184,134,11,0.12) 0%,
    rgba(10,10,10,0.96) 52%,
    rgba(0,0,0,0.98) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.09s ease;
}

.lightbox.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
}

.lightbox-content {
  position: relative;
  z-index: 2;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: radial-gradient(circle at top,
    rgba(255,255,255,0.05) 0%,
    rgba(10,10,10,0.96) 40%,
    rgba(5,5,5,0.98) 100%);
  box-shadow: 0 18px 45px rgba(0,0,0,0.9),
              0 0 32px rgba(184,134,11,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1rem;
}

/* Media inside lightbox */

.lightbox-media {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image,
.lightbox-video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.09s ease;
}

.lightbox-image.loaded,
.lightbox-video.loaded {
  opacity: 1;
}

.lightbox-video {
  cursor: pointer;
}

/* Controls */

.lightbox-close {
  position: absolute;
  top: 0.1rem;
  right: 0.6rem;
  font-size: 2.3rem;
  color: rgba(255,255,255,0.9);
  background: none;
  border: none;
  cursor: pointer;
  text-shadow: 0 0 12px rgba(184,134,11,0.8);
  transition: transform 0.09s ease, color 0.09s ease;
  z-index: 3;
}

.lightbox-close:hover {
  transform: scale(1.15);
  color: rgba(196,30,58,1);
}

/* Arrows */

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  color: rgba(255,255,255,0.85);
  background: none;
  border: none;
  cursor: pointer;
  text-shadow: 0 0 12px rgba(184,134,11,0.85);
  z-index: 3;
  transition: transform 0.09s ease, color 0.09s ease;
}

.lightbox-prev {
  left: 0.5rem;
}

.lightbox-next {
  right: 0.5rem;
}

.lightbox-nav:hover {
  transform: translateY(-50%) scale(1.12);
  color: rgba(196,30,58,1);
}

/* Scroll lock class used by gallery.js */
body.no-scroll {
  overflow: hidden;
  margin-right: 0;
}

/* Responsive tweaks */

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .gallery-tab {
    font-size: 0.65rem;
    padding-inline: 0.8rem;
  }

  .lightbox-content {
    max-width: 96vw;
    max-height: 88vh;
    padding: 0.75rem;
  }

  .lightbox-nav {
    font-size: 2rem;
  }

  .lightbox-close {
    font-size: 2rem;
  }
}

.gallery-page {
  padding-bottom: 140px;
}
