/* Modern Gallery Styles - ImageKit Enhanced */

/* Design Tokens */
:root {
    --brand-color: #A4C036;
    --brand-color-dark: #869C2A;
    --text-strong: #111827;
    --text-muted: #666;
    --panel: #f8f9fa;
    --ring: rgba(0,0,0,.08);
}

/* Loading States */
.gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.gallery-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid var(--brand-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Gallery Container */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Error Bar */
.gallery-error-bar {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}
.error-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #991b1b;
    font-size: 0.9rem;
}
.error-content i { color: #dc2626; }
.error-message { flex: 1; font-weight: 500; }
.error-retry-btn,
.error-close-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.error-retry-btn:hover { background: #b91c1c; }
.error-close-btn { background: #6b7280; padding: 0.5rem; }
.error-close-btn:hover { background: #4b5563; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header & Filters */
.gallery-title {
    font-size: 2.25rem;
    font-weight: 400;
    margin-bottom: 8px;
    color: #000000;
    margin: 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.1);
    letter-spacing: -0.025em;
    font-family: Chitos;
}
.gallery-filters { display: flex; gap: 1rem; align-items: center; }
.edition-filter {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: #fff;
    border: 1.5px solid rgba(0,0,0,.08);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}
.edition-filter:hover,
.edition-filter:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-color), transparent 80%);
    border-color: var(--brand-color);
}

/* Gallery Stats */
.gallery-stats { margin-top: 6px; margin-bottom: 1.5rem; text-align: center; }
.gallery-count {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(164, 192, 54, 0.1);
    color: var(--brand-color, #A4C036);
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
}
#gallery-count:empty { display: none; }

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
    padding: 0 0.5rem; /* respiro lateral */
    max-width: 1400px; /* Limita largura máxima */
    margin-left: auto;
    margin-right: auto;
}

/* Skeleton Loading */
.gallery-grid.skeleton .skeleton-card {
    height: 0;
    padding-bottom: 66%;
    border-radius: 12px;
    background: linear-gradient(90deg, #eee 0%, #f5f5f5 50%, #eee 100%);
    background-size: 200% 100%;
    animation: shimmer 1.25s infinite;
    box-shadow: 0 4px 6px var(--ring);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    background: var(--panel);
    box-shadow: 0 4px 6px var(--ring);
    content-visibility: auto;
    contain-intrinsic-size: 300px 220px;
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

.gallery-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background: linear-gradient(45deg, #f0f0f0 25%, #e0e0e0 25%, #e0e0e0 50%, #f0f0f0 50%, #f0f0f0 75%, #e0e0e0 75%);
    background-size: 20px 20px;
}

.gallery-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }
.overlay-content { color: white; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 500; }
.overlay-content i { font-size: 1.2rem; }

/* Gallery Controls */
.gallery-controls { text-align: center; margin: 3rem 0; }
.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.95rem 2rem;
    background: var(--brand-color, #A4C036);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(164,192,54,.35);
}

/* Responsive */
@media (max-width: 768px) { .gallery-header { flex-direction: column; text-align: center; } }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: 1fr; } }

/* Ajustes de alinhamento e respiro lateral */
#gallery-container {
  padding: 2rem 1.5rem;
  max-width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  #gallery-container { 
    padding: 3rem 2rem; 
  }
}

/* Garante que o container mantenha alinhamento central em todos os zooms */
.container {
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (min-width: 768px) {
  .container { 
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* 🔹 Customizações LightGallery (v2.8.3) */
.lg-backdrop {
  background-color: rgba(0, 0, 0, 0.92) !important;
}

.lg-toolbar {
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent) !important;
}

.lg-toolbar .lg-icon {
  color: #fff !important;
  font-size: 20px !important;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}
.lg-toolbar .lg-icon:hover {
  opacity: 1;
  color: var(--brand-color);
}

.lg-counter {
  color: #fff !important;
  font-weight: 500;
}

.lg-thumb-outer {
  background-color: rgba(0, 0, 0, 0.85) !important;
}

.lg-thumb-item {
  border: 2px solid transparent !important;
  border-radius: 4px !important;
  overflow: hidden !important;
}
.lg-thumb-item.active {
  border-color: var(--brand-color, #A4C036) !important;
}
