/* ============================================
   GALERIA DE espécies - biodiversidade TERESOPOLIS
   Cards 3:4 coloridos, com info taxonômica
   ============================================ */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  width: 100%;
  min-height: 400px;
}

/* ============================================
   CARD DE ESPECIE
   ============================================ */
.species-card {
  position: relative;
  overflow: hidden;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  animation: enter 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  transition: transform var(--t-base),
              box-shadow var(--t-base),
              border-color var(--t-base);
  aspect-ratio: 3 / 4;
  display: flex;
  flex-direction: column;
  border-radius: 2px;
}

.species-card:nth-child(1)  { animation-delay: 0.00s; }
.species-card:nth-child(2)  { animation-delay: 0.04s; }
.species-card:nth-child(3)  { animation-delay: 0.08s; }
.species-card:nth-child(4)  { animation-delay: 0.12s; }
.species-card:nth-child(5)  { animation-delay: 0.16s; }
.species-card:nth-child(6)  { animation-delay: 0.20s; }
.species-card:nth-child(7)  { animation-delay: 0.24s; }
.species-card:nth-child(8)  { animation-delay: 0.28s; }
.species-card:nth-child(9)  { animation-delay: 0.32s; }
.species-card:nth-child(10) { animation-delay: 0.36s; }
.species-card:nth-child(n+11) { animation-delay: 0.40s; }

.species-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-soft);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.45),
              0 0 0 1px var(--accent-soft);
}

.species-card::after {
  content: '';
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--t-base);
  pointer-events: none;
}

.species-card:hover::after {
  opacity: 1;
  transform: scale(1);
}

/* SVG zoom icon - aplicado via background */
.species-card::before {
  content: '';
  position: absolute;
  top: 22px;
  right: 22px;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 1px;
  z-index: 4;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--t-base);
  pointer-events: none;
  box-shadow:
    6px 6px 0 -4.5px var(--accent),
    6px 6px 0 -3px var(--paper);
}

.species-card:hover::before {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   IMAGEM
   ============================================ */
.species-image {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--paper-deep);
  position: relative;
}

.species-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(20, 32, 26, 0.92) 0%,
    rgba(20, 32, 26, 0.5) 30%,
    rgba(20, 32, 26, 0) 60%);
  pointer-events: none;
  z-index: 1;
}

.species-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1),
              filter var(--t-base);
  will-change: transform;
}

.species-card:hover .species-image img {
  transform: scale(1.06);
}

.photo-count-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(20, 32, 26, 0.78);
  color: #e8d9b5;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 2;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(201, 168, 105, 0.3);
  pointer-events: none;
}

/* ============================================
   INFO NO CARD
   ============================================ */
.species-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 18px 18px 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateY(0);
  transition: transform var(--t-base);
}

.species-card:hover .species-info {
  transform: translateY(-2px);
}

.species-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 2px 6px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 1px;
}

.species-name {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 1.12rem;
  color: var(--ink);
  line-height: 1.18;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.species-scientific {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  opacity: 0.92;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.species-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  opacity: 0.85;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  flex-wrap: wrap;
}

.species-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.species-meta-item::before {
  content: '';
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.7;
}

.species-meta-item:first-child::before {
  display: none;
}

.species-type {
  display: none;
}

/* ============================================
   LOADING / SKELETON
   ============================================ */
.species-card.loading {
  animation: none;
  opacity: 1;
  background: var(--paper-deep);
}

.species-card.loading .species-image {
  background: linear-gradient(90deg,
    var(--paper-deep) 25%,
    rgba(201, 168, 105, 0.08) 50%,
    var(--paper-deep) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.species-card.loading .species-info {
  display: none;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   PAGINACAO
   ============================================ */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: 36px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}

.pagination-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 2px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: all var(--t-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pagination-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
  font-weight: 600;
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--line-soft);
}

.pagination-btn:disabled:hover {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-soft);
}

.pagination-info {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 12px;
}

/* ============================================
   ESTADO VAZIO
   ============================================ */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--ink-soft);
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.4;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.empty-state p {
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto;
  font-style: italic;
  opacity: 0.8;
}

/* ============================================
   RESPONSIVO
   ============================================ */
@media (max-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
  }

  .species-name {
    font-size: 1.02rem;
  }

  .species-scientific {
    font-size: 0.78rem;
  }
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .species-info {
    padding: 14px 14px 12px;
  }

  .species-name {
    font-size: 0.92rem;
  }

  .species-scientific {
    font-size: 0.72rem;
  }

  .species-tag {
    font-size: 0.58rem;
  }

  .species-meta {
    display: none;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .species-info {
    padding: 10px 10px 8px;
  }

  .species-name {
    font-size: 0.85rem;
  }

  .species-scientific {
    font-size: 0.68rem;
  }

  .species-card::after,
  .species-card::before {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .species-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .species-image img {
    transition: none;
  }
}
