/**
 * Styles pour la galerie publique d'albums
 * CEP-TchadElec - Bibliothèques
 */

/* ============================================
   GALLERY CARDS
   ============================================ */

.gallery-card {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  overflow: hidden;
}

.gallery-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* ============================================
   CARD MEDIA
   ============================================ */

.card-media {
  position: relative;
  overflow: hidden;
  height: 300px;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-card:hover .card-media img {
  transform: scale(1.1);
}

/* ============================================
   GRADIENTS & OVERLAYS
   ============================================ */

.bg-gradient-to-top {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
  pointer-events: none;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-card:hover .card-overlay {
  opacity: 1;
}

.card-overlay .btn {
  pointer-events: auto;
}

.card-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  text-decoration: none;
}

.card-link-overlay:focus {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

/* ============================================
   UTILITIES
   ============================================ */

.object-fit-cover {
  object-fit: cover;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.hover-effect-scale {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-effect-scale:hover {
  transform: scale(1.02);
}

.transition-opacity {
  transition: opacity 0.3s ease;
}

/* ============================================
   MEDIA GRID
   ============================================ */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.media-grid-item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0.5rem;
}

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

@media (max-width: 768px) {
  .card-media {
    height: 220px;
  }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .gallery-card:hover {
    transform: translateY(-4px);
  }
}

@media (max-width: 576px) {
  .card-media {
    height: 200px;
  }

  .media-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   MEDIA CARDS (Page détails album)
   ============================================ */

.media-card {
  transition: all 0.3s ease;
}

.media-link {
  display: block;
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
}

.media-img {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.media-link:hover .media-img {
  transform: scale(1.1);
}

.media-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.media-link:hover .media-overlay {
  opacity: 1;
}

.media-overlay .btn {
  pointer-events: auto;
}

.media-info {
  padding: 0.5rem;
  background-color: rgba(248, 249, 250, 0.95);
  border-top: 1px solid #dee2e6;
}

/* ============================================
   HOVER INTERACTIONS
   ============================================ */

.hover-text-primary:hover {
  color: var(--bs-primary) !important;
  transition: color 0.2s ease;
}

.hover-text-success:hover {
  color: var(--bs-success) !important;
  transition: color 0.2s ease;
}

.stretched-link::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  content: "";
}

/* ============================================
   FINDER HOVER EFFECTS
   ============================================ */

/* Hover effect scale - Pattern Finder */
.hover-effect-scale {
  overflow: hidden;
}

.hover-effect-scale .hover-effect-target {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-effect-opacity .hover-effect-target {
  transition: opacity 0.3s ease;
}

/* Desktop avec souris : effets hover normaux */
@media (hover: hover) and (pointer: fine) {
  .hover-effect-scale:hover .hover-effect-target {
    transform: scale(1.05);
  }

  .hover-effect-opacity:hover .hover-effect-target {
    opacity: 1 !important;
  }
}

/* Appareils tactiles : adaptations */
@media (hover: none) and (pointer: coarse) {
  /* Afficher l'overlay par défaut sur tactile */
  .hover-effect-opacity .hover-effect-target {
    opacity: 0.3 !important;
  }

  /* Feedback tactile au tap */
  .hover-effect-scale:active .hover-effect-target {
    transform: scale(0.98);
  }

  /* Icône zoom toujours légèrement visible */
  .fi-zoom-in.hover-effect-target {
    opacity: 0.7 !important;
  }
}

/* ============================================
   RATIO SYSTEM (évite content shifts)
   ============================================ */

.ratio {
  position: relative;
  width: 100%;
}

.ratio::before {
  display: block;
  padding-top: var(--fn-aspect-ratio, 100%);
  content: "";
}

.ratio > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ratio > img {
  object-fit: cover;
}

/* Ratios responsive pour galerie d'albums */
@media (max-width: 767.98px) {
  .gallery-card .ratio {
    --fn-aspect-ratio: calc(250 / 350 * 100%);
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .gallery-card .ratio {
    --fn-aspect-ratio: calc(280 / 350 * 100%);
  }
}

@media (min-width: 992px) {
  .gallery-card .ratio {
    --fn-aspect-ratio: calc(300 / 400 * 100%);
  }
}

/* Ratios responsive pour médias d'album */
@media (max-width: 767.98px) {
  .media-card .ratio {
    --fn-aspect-ratio: calc(250 / 350 * 100%);
  }

  /* Badges et boutons plus petits sur mobile */
  .media-card .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }

  .media-card .btn-sm {
    padding: 0.375rem;
    font-size: 0.75rem;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .media-card .ratio {
    --fn-aspect-ratio: calc(280 / 350 * 100%);
  }
}

@media (min-width: 1200px) {
  .media-card .ratio {
    --fn-aspect-ratio: calc(280 / 400 * 100%);
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border-width: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-card,
  .card-media img,
  .card-overlay,
  .hover-effect-scale {
    transition: none !important;
  }
}

/* ============================================
   SWIPER GALLERY - Navigation Buttons
   ============================================ */

.gallery-btn-prev,
.gallery-btn-next {
  opacity: 0.8;
  transition: opacity 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.gallery-btn-prev:hover,
.gallery-btn-next:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* ============================================
   SWIPER GALLERY - Thumbnails
   ============================================ */

/* Thumbnails actifs avec bordure verte CEP */
.swiper-thumbs .swiper-slide-thumb-active {
  opacity: 1;
  border: 2px solid #16a34a;
}

.swiper-thumbs .swiper-slide {
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.swiper-thumbs .swiper-slide:hover {
  opacity: 0.9;
}

/* ============================================
   SWIPER GALLERY - Responsive
   ============================================ */

/* Cacher les boutons de navigation sur mobile (navigation par swipe) */
@media (max-width: 767.98px) {
  .gallery-btn-prev,
  .gallery-btn-next {
    display: none;
  }
}

/* ============================================
   FINDER ANIMATIONS
   ============================================ */

/* Pulse animation pour bouton wishlist */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Slide animations pour boutons navigation */
.animate-slide-start,
.animate-slide-end {
  transition: transform 0.3s ease;
}

.animate-slide-start:hover {
  transform: translateX(-0.25rem);
}

.animate-slide-end:hover {
  transform: translateX(0.25rem);
}

/* Animation target pour icônes */
.animate-target {
  transition: transform 0.2s ease;
}

.btn:hover .animate-target {
  transform: scale(1.1);
}

/* ============================================
   RESPONSIVE LAYOUT ADJUSTMENTS
   ============================================ */

/* Sidebar sticky avec offset navbar */
@media (min-width: 992px) {
  aside .position-sticky {
    top: 120px;
  }
}

/* Desktop: hover effects boutons navigation */
@media (hover: hover) and (pointer: fine) {
  .hover-effect-opacity:hover .hover-effect-target.opacity-0 {
    opacity: 0.9 !important;
  }
}

/* Mobile: boutons navigation toujours visibles */
@media (max-width: 991.98px) {
  .hover-effect-target.opacity-0 {
    opacity: 1 !important;
  }
}
