/* ================================================
   gallery.css — Gallery Section
   LOKOTRE Platform — ARFF BDJ
   ================================================ */

.gallery-section {
  background: var(--bg-base);
  position: relative;
}

.gallery-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(67, 97, 238, 0.30),
    transparent);
}

/* ════════════════════════════════════════
   FILTER BUTTONS
   ════════════════════════════════════════ */

.gallery-filter {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-wrap: wrap !important;
  gap: 0.65rem !important;
  margin-bottom: 2.5rem !important;
}

.gallery-filter-btn {
  /* Reset Bootstrap */
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  box-shadow: none !important;
  outline: none !important;

  /* Layout */
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  white-space: nowrap !important;
  cursor: pointer !important;

  /* Ukuran */
  padding: 0.52rem 1.3rem !important;
  font-size: 0.83rem !important;
  font-weight: 600 !important;
  font-family: var(--font) !important;
  line-height: 1.4 !important;
  letter-spacing: 0.03em !important;

  /* Visual */
  background: var(--bg-card) !important;
  color: var(--tx-2) !important;
  border: 1px solid var(--bd-2) !important;
  border-radius: 100px !important;

  /* Transisi */
  transition: background 0.25s ease,
              color 0.25s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.gallery-filter-btn i {
  font-size: 0.78rem !important;
  opacity: 0.75;
  transition: opacity 0.2s ease !important;
}

/* ── Hover ── */
.gallery-filter-btn:hover {
  background: var(--bg-card-2) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: var(--tx-1) !important;
  transform: translateY(-2px) !important;
}

.gallery-filter-btn:hover i {
  opacity: 1;
}

/* ── Active ── */
.gallery-filter-btn.active {
  background: var(--c-primary) !important;
  border-color: var(--c-primary) !important;
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(230, 57, 70, 0.40) !important;
  transform: translateY(-1px) !important;
}

.gallery-filter-btn.active i {
  opacity: 1;
}

/* ── Focus (aksesibilitas) ── */
.gallery-filter-btn:focus-visible {
  outline: 2px solid var(--c-primary) !important;
  outline-offset: 3px !important;
}

/* ════════════════════════════════════════
   GALLERY GRID
   ════════════════════════════════════════ */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 991.98px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   GALLERY ITEM
   ════════════════════════════════════════ */

.gallery-item {
  position: relative;
  display: block !important;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--bd);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  cursor: zoom-in;
  text-decoration: none !important;
  background: var(--bg-card);
  min-height: 180px;
}

.gallery-item:hover {
  transform: scale(1.03);
  border-color: var(--bd-2);
  box-shadow: var(--sh-lg);
  z-index: 2;
}

/* ── Placeholder icon (saat gambar kosong) ── */
.gallery-item::before {
  content: '\f03e';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.8rem;
  color: rgba(255, 255, 255, 0.05);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.3s ease;
}

/* ════════════════════════════════════════
   GALLERY IMAGE
   ════════════════════════════════════════ */

.gallery-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  transition: transform 0.5s ease, opacity 0.4s ease;

  /* Sembunyikan broken image & alt text */
  color: transparent;
  font-size: 0;
  text-indent: -9999px;
}

.gallery-item:hover .gallery-img {
  transform: scale(1.08);
}

/* ── Shimmer saat belum loaded ── */
.gallery-img:not(.loaded) {
  background: linear-gradient(
    110deg,
    var(--bg-card)    30%,
    var(--bg-card-2)  50%,
    var(--bg-card)    70%
  );
  background-size: 200% 100%;
  animation: galleryShimmer 1.6s infinite linear;
}

.gallery-img.loaded {
  background: transparent !important;
  animation: none !important;
}

@keyframes galleryShimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════
   GALLERY OVERLAY
   ════════════════════════════════════════ */

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8, 13, 20, 0.92) 0%,
    rgba(8, 13, 20, 0.35) 45%,
    rgba(8, 13, 20, 0.00) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

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

.gallery-overlay > i {
  font-size: 1.6rem;
  color: rgba(255, 255, 255, 0.92);
  transform: scale(0.6);
  transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.gallery-item:hover .gallery-overlay > i {
  transform: scale(1);
}

/* ════════════════════════════════════════
   CATEGORY BADGE
   ════════════════════════════════════════ */

.gallery-cat-badge {
  position: absolute;
  bottom: 0.7rem;
  left: 0.7rem;
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.22rem 0.65rem;
  border-radius: 100px;
  color: #fff !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.5;
  opacity: 1 !important;
  visibility: visible !important;

  /* Animasi masuk */
  transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-cat-badge {
  transform: translateY(-3px);
}

.gallery-cat-badge i {
  font-size: 0.6rem;
}

.gallery-cat-badge.training {
  background: rgba(67, 97, 238, 0.85);
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.30);
}

.gallery-cat-badge.maintenance {
  background: rgba(247, 127, 0, 0.85);
  box-shadow: 0 2px 8px rgba(247, 127, 0, 0.30);
}

.gallery-cat-badge.operation {
  background: rgba(230, 57, 70, 0.85);
  box-shadow: 0 2px 8px rgba(230, 57, 70, 0.30);
}

/* ════════════════════════════════════════
   FILTER ANIMATION STATE
   ════════════════════════════════════════ */

.gallery-item[style*="display: none"] {
  display: none !important;
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */

@media (max-width: 767.98px) {
  .gallery-filter-btn {
    padding: 0.45rem 1rem !important;
    font-size: 0.78rem !important;
  }
}

@media (max-width: 575.98px) {
  .gallery-filter {
    gap: 0.45rem !important;
  }

  .gallery-filter-btn {
    padding: 0.4rem 0.85rem !important;
    font-size: 0.75rem !important;
  }
}