/* ============================================================
   JUNGAL SAFARI — AI GALLERY + HERO TOGGLE + VISUAL POLISH
   ============================================================ */

/* ────────────────────────────────────────────────────────────
   HERO PARALLAX ENHANCEMENTS
   ──────────────────────────────────────────────────────────── */
.animal-hero__bg {
  will-change: transform;
  transform-origin: center center;
}

/* View toggle — Photo vs AI Art */
.hero-view-toggle {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  z-index: 20;
  display: flex;
  gap: 0.4rem;
  background: rgba(0,0,0,0.35);
  padding: 0.3rem;
  border-radius: 100px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
}
.hero-view-toggle__btn {
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.65);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.22s, color 0.22s;
  white-space: nowrap;
}
.hero-view-toggle__btn.is-active {
  background: var(--gold, #d4af37);
  color: #0d2818;
}
.hero-view-toggle__btn:not(.is-active):hover {
  color: #fff;
}

/* Hero art layer (AI image overlaid) */
.animal-hero__ai-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 2;
}
.animal-hero__ai-layer.is-visible {
  opacity: 1;
}
.animal-hero__overlay { z-index: 3 !important; }
.animal-hero__content { z-index: 4 !important; }

/* ────────────────────────────────────────────────────────────
   AI GALLERY SECTION
   ──────────────────────────────────────────────────────────── */
.ai-gallery-section {
  background: var(--jungle-dark, #0d2818);
  padding: 5rem 0;
  position: relative;
  overflow: hidden;
}
.ai-gallery-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(212,175,55,0.05) 0%, transparent 70%);
  pointer-events: none;
}

/* Section header */
.ai-gallery-section__header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #6b46c1, #9333ea);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  margin-bottom: 0.75rem;
}
.ai-gallery-section__title {
  font-family: var(--font-display, 'Playfair Display', serif);
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.5rem;
  line-height: 1.15;
}
.ai-gallery-section__subtitle {
  font-size: 0.92rem;
  color: rgba(245,240,232,0.5);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Style toggle tabs */
.ai-gallery__style-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.ai-gallery__style-btn {
  padding: 0.4rem 1rem;
  border-radius: 100px;
  border: 1px solid rgba(212,175,55,0.25);
  background: transparent;
  color: rgba(245,240,232,0.5);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.22s;
}
.ai-gallery__style-btn.is-active {
  background: var(--gold, #d4af37);
  color: #0d2818;
  border-color: var(--gold, #d4af37);
}
.ai-gallery__style-btn:not(.is-active):hover {
  border-color: rgba(212,175,55,0.5);
  color: rgba(245,240,232,0.8);
}

/* Gallery grid — mosaic layout */
.ai-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto;
  gap: 0.75rem;
}
.ai-gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(255,255,255,0.04);
}
.ai-gallery__item:nth-child(1) {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}
.ai-gallery__item:nth-child(2),
.ai-gallery__item:nth-child(3) {
  aspect-ratio: 4 / 3;
}
.ai-gallery__item:nth-child(4),
.ai-gallery__item:nth-child(5),
.ai-gallery__item:nth-child(6) {
  aspect-ratio: 1;
}

.ai-gallery__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.ai-gallery__item:hover .ai-gallery__image {
  transform: scale(1.07);
}

/* Overlay on hover */
.ai-gallery__item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}
.ai-gallery__item:hover .ai-gallery__item-overlay {
  opacity: 1;
}
.ai-gallery__item-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(245,240,232,0.9);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ai-gallery__item-label::before {
  content: '✦';
  color: var(--gold, #d4af37);
}

/* Placeholder tiles (before images generate) */
.ai-gallery__placeholder {
  width: 100%;
  height: 100%;
  min-height: 180px;
  background: linear-gradient(135deg, rgba(13,40,24,0.8), rgba(26,74,46,0.6));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid rgba(212,175,55,0.1);
}
.ai-gallery__placeholder-icon {
  font-size: 2.5rem;
  opacity: 0.4;
}
.ai-gallery__placeholder-text {
  font-size: 0.72rem;
  color: rgba(245,240,232,0.3);
  text-align: center;
  padding: 0 1rem;
  line-height: 1.4;
}

/* Loading spinner */
.ai-gallery__generating {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  gap: 1rem;
  color: rgba(245,240,232,0.5);
  font-size: 0.9rem;
}
.ai-gallery__spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(212,175,55,0.15);
  border-top-color: var(--gold, #d4af37);
  border-radius: 50%;
  animation: jsSpinAI 0.8s linear infinite;
}
@keyframes jsSpinAI {
  to { transform: rotate(360deg); }
}

/* Generate button */
.ai-gallery__generate-cta {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
}
.ai-gallery__generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, #6b46c1, #9333ea);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.22s, box-shadow 0.22s;
  box-shadow: 0 4px 24px rgba(107,70,193,0.35);
}
.ai-gallery__generate-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(107,70,193,0.5);
}
.ai-gallery__generate-btn span { font-size: 1.1rem; }

/* Full-screen lightbox */
.ai-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.ai-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.ai-lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 80px rgba(0,0,0,0.8);
}
.ai-lightbox__close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.ai-lightbox__close:hover { background: rgba(255,255,255,0.2); }
.ai-lightbox__caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  text-align: center;
  white-space: nowrap;
}

/* ────────────────────────────────────────────────────────────
   ANIMATION WILL-CHANGE HINTS
   ──────────────────────────────────────────────────────────── */
.adaptation-card,
.threat-card,
.diet-item,
.stat-chip,
.range-fact,
.ai-gallery__item {
  will-change: transform, opacity;
}

/* Smooth entrance state */
.js-anim-ready .adaptation-card,
.js-anim-ready .threat-card,
.js-anim-ready .diet-item,
.js-anim-ready .ai-gallery__item {
  opacity: 0;
}

/* ────────────────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-view-toggle { bottom: 1rem; right: 1rem; }
  .hero-view-toggle__btn { font-size: 0.65rem; padding: 0.3rem 0.7rem; }

  .ai-gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .ai-gallery__item:nth-child(1) { grid-column: span 2; }
  .ai-gallery__item:nth-child(4),
  .ai-gallery__item:nth-child(5),
  .ai-gallery__item:nth-child(6) { aspect-ratio: 4/3; }
}

@media (max-width: 480px) {
  .ai-gallery__grid { grid-template-columns: 1fr; }
  .ai-gallery__item:nth-child(1),
  .ai-gallery__item:nth-child(2) { grid-column: span 1; aspect-ratio: 16/9; }
}
