/* ==========================================================================
   Accordion Gallery Component (Bright & Crisp Multi-Image Slider)
   ========================================================================== */

.accordion-gallery {
  --ag-accent: #10b981;
  --ag-accent-glow: rgba(16, 185, 129, 0.45);
  --ag-overlay: transparent;
  --ag-text: #ffffff;
  --ag-gap: 14px;
  --ag-radius: 20px;
  --ag-media-size: 640px;

  display: flex;
  flex-direction: row;
  gap: var(--ag-gap);
  width: 100%;
  max-width: 100%;
  height: 540px;
  box-sizing: border-box;
  position: relative;
  user-select: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.accordion-gallery::-webkit-scrollbar {
  display: none;
}

.accordion-gallery--vertical {
  flex-direction: column;
}

.ag-panel {
  position: relative;
  flex: 0 0 85% !important;
  max-width: 700px;
  min-width: 280px;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--ag-radius);
  cursor: pointer;
  display: block;
  text-decoration: none;
  outline: none;
  transform-origin: top left;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
  scroll-snap-align: center;
}

.ag-panel:hover,
.ag-panel.ag-panel--active {
  border-color: rgba(16, 185, 129, 0.45);
}

.ag-panel.ag-panel--active {
  z-index: 2;
}

.ag-panel:focus-visible {
  box-shadow:
    0 0 0 3px var(--ag-accent),
    0 20px 40px -10px rgba(0, 0, 0, 0.8);
}

.ag-panel__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

/* Multi-Image Slider Container */
.ag-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.ag-slider-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  pointer-events: auto;
  touch-action: pan-x pan-y;
  cursor: grab;
}

.ag-slider-track::-webkit-scrollbar {
  display: none;
}

.ag-slider-track:active {
  cursor: grabbing;
}

.ag-slider-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.ag-slider-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.ag-slider-slide--responsive img,
.ag-slider-slide--fit img {
  object-fit: contain;
  object-position: center;
}

.ag-panel:not(.ag-panel--active) .ag-slider-slide--responsive img,
.ag-panel:not(.ag-panel--active) .ag-slider-slide--fit img {
  object-fit: cover;
}

.ag-panel:not(.ag-panel--active) .ag-slider-slide--fit img {
  object-position: left center;
}

.ag-panel:not(.ag-panel--active) .ag-slider-slide--focus-right img {
  object-position: right center;
}

/* Image sub-caption (e.g. "Login Dark", "Home") */
.ag-img-caption {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f3f4f6;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.ag-panel--active .ag-img-caption {
  opacity: 1;
  transform: translateY(0);
}

/* Slider Controls (Prev / Next & Counter) */
.ag-slider-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  pointer-events: none;
  z-index: 4;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.ag-panel--active .ag-slider-controls {
  opacity: 1;
}

.ag-slider-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.ag-slider-btn:hover {
  transform: scale(1.12);
  background: rgba(16, 185, 129, 0.9);
  border-color: #10b981;
}

.ag-slider-btn:active {
  transform: scale(0.96);
}

.ag-slider-counter {
  position: absolute;
  bottom: -46px;
  right: 20px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e5e7eb;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* Subtle, clean bottom gradient - NOT dark everywhere */
.ag-panel__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 40%, rgba(8, 11, 20, 0.25) 65%, rgba(8, 11, 20, 0.88) 100%);
  transition: opacity 0.3s ease;
}

.ag-panel:not(.ag-panel--active) .ag-panel__overlay {
  background: linear-gradient(180deg, transparent 45%, rgba(8, 11, 20, 0.4) 75%, rgba(8, 11, 20, 0.85) 100%);
}

/* Panel Label & Info Card */
.ag-panel__label {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
  z-index: 5;
  max-width: calc(100% - 40px);
}

.ag-panel__bar {
  flex: 0 0 auto;
  width: 4px;
  height: 42px;
  border-radius: 4px;
  background: var(--ag-accent);
  opacity: 1;
  box-shadow: 0 0 16px var(--ag-accent-glow);
  transform: scaleY(1);
}

.ag-panel--active .ag-panel__bar {
  opacity: 1;
  transform: scaleY(1);
}

.ag-panel__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  max-width: min(78%, 420px);
  margin-left: auto;
  opacity: 1;
  transform: none;
}

.ag-panel--active .ag-panel__content {
  opacity: 1;
  transform: none;
}

.ag-panel:not(.ag-panel--active) .ag-panel__action,
.ag-gallery--hide-labels .ag-panel__label {
  pointer-events: auto;
}

.ag-gallery--hide-labels .ag-panel__bar,
.ag-gallery--hide-labels .ag-panel__content {
  opacity: 0;
}

.ag-panel__top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ag-panel__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ag-panel__scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
}

.ag-panel__scroll-hint i {
  color: var(--ag-accent);
  font-size: 0.85rem;
}

.ag-panel__text {
  color: var(--ag-text);
  font-family: var(--font-grande, inherit);
  font-weight: 700;
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.ag-panel__desc {
  color: rgba(243, 244, 246, 0.9);
  font-size: clamp(0.82rem, 0.95vw, 0.92rem);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}

.ag-panel__action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: #10b981;
  font-size: 0.86rem;
  font-weight: 600;
  pointer-events: auto;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  width: fit-content;
}

.ag-panel__action:hover {
  color: #34d399;
  transform: translateX(3px);
}

.ag-panel__action i {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.ag-panel__action:hover i {
  transform: translateX(3px);
}

/* Panel Index Pill */
.ag-panel__index {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  font-family: var(--font-grande, inherit);
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 0.06em;
  pointer-events: none;
}

.ag-panel--active .ag-panel__index {
  color: var(--ag-accent);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Navigation Hint / Indicators */
.ag-gallery-nav-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: -6px;
  padding: 0 4px;
  font-size: 0.85rem;
  color: var(--color-gray2, #6b7280);
}

.ag-gallery-indicators {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ag-gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.2);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.ag-gallery-dot.is-active {
  width: 24px;
  background: var(--color-destaque1, #10b981);
}

/* Responsive Adaptations */
@media (max-width: 900px) {
  .accordion-gallery {
    height: 480px;
    --ag-gap: 10px;
    --ag-radius: 16px;
  }
  
  .ag-panel {
    flex: 0 0 90% !important;
  }
  
  .ag-panel__label {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }

  .ag-panel__content {
    max-width: none;
    margin-left: 0;
  }
  
  .ag-panel__content {
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  .accordion-gallery {
    perspective: none !important;
    height: 540px !important;
    min-height: 540px;
    gap: 14px;
  }

  .ag-panel {
    width: 100%;
    min-height: 100%;
    height: 100%;
    flex: 0 0 90% !important;
  }

  .ag-panel.ag-panel--active {
    min-height: 100%;
    height: 100%;
  }

  .ag-slider-slide img {
    height: 100%;
    object-position: top center;
  }

  .ag-panel__label {
    left: 12px;
    right: 12px;
    bottom: 12px;
    gap: 10px;
    max-width: none;
  }

  .ag-panel__content {
    max-width: none;
    margin-left: 0;
  }

  .ag-panel__bar {
    height: 30px;
  }

  .ag-panel__desc {
    display: none;
  }

  .ag-panel.ag-panel--active .ag-panel__desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
  }

  .ag-gallery-nav-hint {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .ag-panel {
    min-height: 100%;
    height: 100%;
  }

  .ag-panel.ag-panel--active {
    min-height: 100%;
    height: 100%;
  }

  .ag-panel__text {
    font-size: 1.05rem;
  }
  
  .ag-slider-btn {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-panel,
  .ag-slider-track,
  .ag-slider-slide img,
  .ag-panel__bar,
  .ag-panel__content,
  .ag-panel__text,
  .ag-img-caption,
  .ag-slider-controls {
    transition: none !important;
  }

  .ag-slider-track {
    scroll-behavior: auto;
  }
}
