/* =============================================================================
🎠 carrossel.css – Galeria Inteligente Agroverso (v12.3)
📱 Swipe mobile, botões flutuantes desktop, acessibilidade invisível e layout proporcional
============================================================================= */

/* 🧱 Container externo do carrossel */
.carrossel-container {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: fit-content;
  max-width: 100%;
  padding: 0;
}

/* 🎢 Linha horizontal de imagens com escopo posicional */
.carrossel {
  position: relative;
  display: flex;
  gap: var(--espaco-md);
  scroll-snap-type: x mandatory;
  scroll-snap-align: start;
  width: 100%;
}

/* 🖼️ Imagens do carrossel */
.carrossel img {
  flex-shrink: 0;
  scroll-snap-align: start;
  max-width: 100%;
  max-height: 480px;
  height: auto;
  width: auto;
  object-fit: contain;
  border-radius: 12px;
  background-color: #f9f9f9;
  box-shadow: var(--sombra-media);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 🧠 Acessibilidade por foco no teclado */
.carrossel img:focus {
  outline: 2px solid var(--cor-produto, #7bb661);
  outline-offset: 4px;
}

/* 🌟 Hover refinado (desktop) */
.carrossel img:hover {
  transform: scale(1.025);
  box-shadow: var(--sombra-forte);
}

/* 🎛️ Scrollbar refinada */
.carrossel-container::-webkit-scrollbar {
  height: 6px;
}
.carrossel-container::-webkit-scrollbar-thumb {
  background: #bbb;
  border-radius: 3px;
}
.carrossel-container::-webkit-scrollbar-track {
  background: transparent;
}

/* ♿ Texto oculto para leitores de tela */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ✨ Botões flutuantes no desktop */
.carrossel-controle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.95);
  color: #1c1c1c;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: background-color 0.3s ease, transform 0.2s ease;
}
.carrossel-controle:hover {
  background-color: #eeeeee;
  transform: translateY(-50%) scale(1.1);
}
.carrossel-prev {
  left: 0;
}
.carrossel-next {
  right: 0;
}

/* 🚫 Oculta botões no mobile/touch */
@media (hover: none) and (pointer: coarse) {
  .carrossel-controle {
    display: none;
  }
}

/* ✨ Transição suave */
.transicao {
  transition: all 0.25s ease-in-out;
}

/* 🎥 Suporte futuro a vídeos */
.carrossel video {
  border-radius: 12px;
  max-height: 480px;
  object-fit: cover;
}

/* 🌙 Tema escuro */
@media (prefers-color-scheme: dark) {
  .carrossel-container {
    background-color: #1e1e1e;
  }
  .carrossel img {
    background-color: #2a2a2a;
  }
}

/* =============================================================================
🎠 .carrossel.fullscreen – Modo de Galeria Expandida
============================================================================= */
.carrossel.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.92);
  padding: 2rem;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 2rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carrossel.fullscreen::-webkit-scrollbar {
  display: none;
}
.carrossel.fullscreen img {
  max-height: 85vh;
  max-width: 95vw;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.08);
}
@media (hover: hover) {
  .carrossel.fullscreen img:hover {
    transform: scale(1.02);
  }
}

/* 🔘 Botão de saída do fullscreen */
#fecharFullscreen {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 10000;
  background-color: #ffffff;
  color: #222222;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background-color 0.25s ease, transform 0.25s ease;
}
#fecharFullscreen:hover {
  background-color: #eeeeee;
  transform: scale(1.05);
}
@media (max-width: 768px) {
  #fecharFullscreen {
    font-size: 0.9rem;
    padding: 0.5rem 0.9rem;
  }
}

/* 🟢 Visibilidade controlada por classes */
.carrossel img.inativo {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  position: absolute;
  z-index: 0;
}
.carrossel img.ativo {
  opacity: 1;
  visibility: visible;
  position: relative;
  z-index: 1;
}
