.accordion-gallery {
  --ag-accent: #0d9488;
  --ag-overlay: #040909;
  --ag-text: #ffffff;
  --ag-gap: 12px;
  --ag-radius: 20px;
  --ag-media-size: 320px;

  display: flex;
  flex-direction: row;
  gap: var(--ag-gap);
  width: 100%;
  max-width: 100%;
  perspective: 1400px;
  perspective-origin: 50% 50%;
  user-select: none;
}

.ag-panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--ag-radius);
  cursor: pointer;
  display: block;
  text-decoration: none;
  outline: none;
  transform-style: preserve-3d;
  transform-origin: center center;
  background: #0b1516;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.65);
  will-change: flex-grow, transform;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ag-panel--active {
  border-color: rgba(45, 212, 191, 0.5);
  box-shadow: 0 20px 45px -10px rgba(13, 148, 136, 0.3), 0 0 0 1px rgba(45, 212, 191, 0.35);
}

.ag-panel:focus-visible {
  box-shadow:
    0 0 0 2px var(--ag-accent),
    0 10px 30px -18px rgba(0, 0, 0, 0.8);
}

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

.ag-panel__media {
  --ag-gray: 1;
  --ag-dim: 0.4;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--ag-media-size);
  height: 100%;
  filter: grayscale(var(--ag-gray));
  will-change: transform, filter;
  transform: translate(-50%, -50%);
}

.ag-panel__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.ag-panel__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 15, 15, 0.15) 0%, rgba(4, 9, 9, 0.82) 65%, rgba(4, 9, 9, 0.98) 100%),
    rgba(4, 9, 9, var(--ag-dim, 0.4));
}

.ag-panel__badge {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(13, 148, 136, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: #2dd4bf;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  transition: all 0.3s ease;
}

.ag-panel--active .ag-panel__badge {
  background: #0d9488;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(13, 148, 136, 0.5);
}

.ag-panel__label {
  position: absolute;
  left: 20px;
  bottom: 22px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 3;
}

.ag-panel__header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ag-panel__bar {
  flex: 0 0 auto;
  width: 4px;
  height: 28px;
  border-radius: 4px;
  background: var(--ag-accent);
  opacity: 0;
  box-shadow: 0 0 14px rgba(45, 212, 191, 0.8);
}

.ag-panel__text {
  color: var(--ag-text);
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(1.1rem, 1.6vw, 1.5rem);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.ag-panel__desc {
  color: #cbd5e1;
  font-size: 0.875rem;
  line-height: 1.45;
  opacity: 0;
  margin-left: 16px;
  max-width: 420px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ag-panel__collapsed-title {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) rotate(-90deg);
  transform-origin: center center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.3s ease;
}

.ag-panel--active .ag-panel__collapsed-title {
  opacity: 0;
}

/* ==========================================================================
   MOBILE UX/UI PREMIUM (< 768px)
   Diretrizes: Fitts (alvo min 48px), Jakob (chevron sanfona),
   Doherty (<400ms microinterações), Von Restorff (contraste e hierarquia)
   ========================================================================== */
@media (max-width: 768px) {
  .accordion-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto !important;
    perspective: none;
  }

  .ag-panel {
    position: relative;
    width: 100%;
    min-height: 72px;
    height: 72px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #091314;
    transform: none !important;
    will-change: height, border-color;
    transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.25s ease, 
                box-shadow 0.25s ease;
    overflow: hidden;
  }

  /* Efeito tátil de pressão (Doherty feedback) */
  .ag-panel:active {
    transform: scale(0.99) !important;
  }

  /* Card Expandido */
  .ag-panel.ag-panel--active {
    height: 220px !important;
    border-color: rgba(45, 212, 191, 0.5);
    box-shadow: 0 12px 30px -8px rgba(13, 148, 136, 0.35);
  }

  /* Imagem de fundo no mobile */
  .ag-panel__media {
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
  }

  .ag-panel__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.35;
    transition: opacity 0.3s ease;
  }

  .ag-panel--active .ag-panel__media img {
    opacity: 0.6;
    filter: none !important;
  }

  .ag-panel__overlay {
    background: linear-gradient(90deg, rgba(4, 9, 9, 0.95) 0%, rgba(4, 9, 9, 0.75) 60%, rgba(4, 9, 9, 0.85) 100%);
  }

  .ag-panel--active .ag-panel__overlay {
    background: linear-gradient(180deg, rgba(4, 9, 9, 0.4) 0%, rgba(4, 9, 9, 0.88) 55%, rgba(4, 9, 9, 0.98) 100%);
  }

  /* Cabeçalho do Card Mobile (Sempre visível em todos os cards) */
  .ag-panel__mobile-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 4;
    pointer-events: none;
  }

  .ag-panel__mobile-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  /* Ícone com Alvo de Toque visual 44px */
  .ag-panel__mobile-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(13, 148, 136, 0.2);
    border: 1px solid rgba(45, 212, 191, 0.3);
    color: #2dd4bf;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
  }

  .ag-panel--active .ag-panel__mobile-icon {
    background: #0d9488;
    color: #ffffff;
    box-shadow: 0 0 16px rgba(13, 148, 136, 0.6);
  }

  /* Nome do Serviço no Mobile (CLARO E NÍTIDO EM TODOS OS CARDS) */
  .ag-panel__mobile-title {
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Indicador Chevron de Accordion (Padrão Mental Jakob) */
  .ag-panel__mobile-chevron {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.35s ease, background-color 0.3s ease, color 0.3s ease;
  }

  .ag-panel--active .ag-panel__mobile-chevron {
    transform: rotate(180deg);
    background: rgba(13, 148, 136, 0.3);
    color: #2dd4bf;
  }

  /* Conteúdo Expandido no Mobile */
  .ag-panel__mobile-body {
    position: absolute;
    top: 72px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .ag-panel--active .ag-panel__mobile-body {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .ag-panel__mobile-desc {
    color: #cbd5e1;
    font-size: 0.875rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  }

  .ag-panel__mobile-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2dd4bf;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 6px;
  }

  /* Ocultar elementos desktop desnecessários no mobile */
  .ag-panel__badge,
  .ag-panel__label,
  .ag-panel__collapsed-title {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .ag-panel__mobile-bar,
  .ag-panel__mobile-body {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ag-panel,
  .ag-panel__media,
  .ag-panel__mobile-chevron {
    transition: none !important;
    animation: none !important;
  }
}
