/* =====================================================
   galeria.css  —  Parede/carrossel 3D Estilo Ositron
   ===================================================== */

/* -----------------------------------------------------
   Variaveis de geometria da parede 3D
----------------------------------------------------- */
:root {
  --tile-w: 625px;
  --tile-h: 325px;
  --cena-h: 552px;
  --passo-x: 525px;
  --recuo-z: 216px;
  --giro-y: 42;
  --persp: 1320px;
  --tile-bg: #ffffff;   /* fundo do tile no tema claro */
}

/* Fundo do tile no tema escuro: a faixa que sobra do object-fit
   contain deixa de ser branca e passa a integrar-se ao fundo. */
html[data-theme="dark"] {
  --tile-bg: #0c1524;
}

/* -----------------------------------------------------
   Reset e Fundo Claro (Integrado ao tema)
----------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.galeria-page {
  background: #f8fafc !important; /* Fundo claro do site */
  font-family: "Inter", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.galeria-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* alinha ao topo: carrossel sobe em direcao ao texto */
  padding: 10px 20px 60px; /* topo reduzido para aproximar do texto */
  background: transparent;
  width: 100%;

  /* Barreira secundaria: mesmo com a .cena recortando o eixo X, o
     contêiner nao deve permitir rolagem horizontal propria. */
  overflow-x: clip;
}

/* Introdução da Galeria */
.galeria-intro {
  text-align: center;
  margin-bottom: 0; /* intro vazio no HTML: nao reservar espaco */
}
.galeria-intro h2 {
  font-size: 2.2rem;
  color: var(--brand-blue);
  font-weight: 700;
  margin-top: 5px;
}

/* -----------------------------------------------------
   .cena  —  Viewport 3D
----------------------------------------------------- */
.cena {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: var(--cena-h);
  perspective: var(--persp);
  perspective-origin: 50% 45%;
  cursor: grab;
  user-select: none;
  touch-action: pan-y;

  /* Recorte horizontal do palco 3D: os tiles laterais sao projetados
     em translate3d(+-Npx) muito alem da largura da cena e, mesmo com
     opacity:0, mantem caixa de layout — gerando rolagem horizontal na
     pagina. Esse overflow alargava a viewport de layout (~15px medidos
     no getBoundingClientRect) e empurrava a ancora right:0 do menu
     mobile para dentro da tela. Recortamos apenas o eixo X (clip-x)
     para nao achatar a profundidade Z da cena. */
  overflow-x: clip;
}

.cena:active {
  cursor: grabbing;
}

/* -----------------------------------------------------
   .palco  —  Container 3D
----------------------------------------------------- */
.palco {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/* -----------------------------------------------------
   .tile  —  Imagens em 3D
----------------------------------------------------- */
.tile {
  position: absolute;
  top: 33%;
  left: 50%;
  width: var(--tile-w);
  height: var(--tile-h);
  margin-left: calc(var(--tile-w) / -2);
  margin-top: calc(var(--tile-h) / -2);
  border-radius: 12px;
  overflow: hidden;
  /* Fundo do tile acompanha o tema. As imagens (dashboards) tem
     proporcoes variadas (1.92:1 a 2.29:1) e o tile e 2:1, entao com
     object-fit:contain sobra faixa acima/abaixo. Antes essa faixa era
     branca fixa (#ffffff) e destoava no modo noite; agora usa a
     variavel de tema, integrando-se ao fundo. */
  background: var(--tile-bg, #ffffff);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08); /* Sombra suave */
  will-change: transform, opacity;
  backface-visibility: hidden;
  border: 1px solid #e2e8f0; /* Borda sutil */
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  border-radius: 12px;
}

/* Vinheta escura sobre tiles laterais */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #091E45; /* Azul escuro da marca */
  opacity: var(--sombra, 0);
  transition: opacity .05s linear;
  pointer-events: none;
  border-radius: 12px;
}

/* -----------------------------------------------------
   Setas de Navegação (Estilo Laranja da Marca)
----------------------------------------------------- */
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--brand-orange); /* Laranja da Marca */
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  transition: background 0.3s, transform 0.15s;
  box-shadow: 0 4px 10px rgba(250, 80, 28, 0.3);
}

.nav:hover { 
  background: var(--brand-orange-hover); 
  transform: translateY(-50%) scale(1.05);
}
.nav:active { transform: translateY(-50%) scale(.92); }
.nav.esq { left: 20px; }
.nav.dir { right: 20px; }

/* Acessibilidade */
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}

/* =====================================================
   RESPONSIVIDADE DA GALERIA
   ===================================================== */

@media (min-width: 1920px) {
  :root {
    --tile-w: 750px;
    --tile-h: 475px;
    --cena-h: 600px;
    --passo-x: 625px;
    --recuo-z: 264px;
    --persp: 1540px;
  }
  .cena { max-width: 1600px; }
}

@media (max-width: 1440px) {
  :root {
    --tile-w: 600px;
    --tile-h: 375px;
    --cena-h: 504px;
    --passo-x: 475px;
    --recuo-z: 216px;
    --persp: 1320px;
  }
  .cena { max-width: min(1200px, 92%); }
}

@media (max-width: 1200px) {
  :root {
    --tile-w: 500px;
    --tile-h: 312px;
    --cena-h: 456px;
    --passo-x: 400px;
    --recuo-z: 192px;
    --persp: 1210px;
  }
}

@media (max-width: 992px) {
  :root {
    --tile-w: 425px;
    --tile-h: 262px;
    --cena-h: 408px;
    --passo-x: 325px;
    --recuo-z: 168px;
    --persp: 1100px;
  }
}

@media (max-width: 768px) {
  :root {
    --tile-w: 350px;
    --tile-h: 212px;
    --cena-h: 360px;
    --passo-x: 238px;
    --recuo-z: 156px;
    --giro-y: 38;
    --persp: 990px;
  }
  .nav {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  :root {
    --tile-w: 300px;
    --tile-h: 188px;
    --cena-h: 312px;
    --passo-x: 188px;
    --recuo-z: 132px;
    --giro-y: 34;
    --persp: 880px;
  }
  .nav {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .nav.esq { left: 10px; }
  .nav.dir { right: 10px; }
  .galeria-main {
    padding: 20px 10px 40px;
  }
}

@media (max-width: 360px) {
  :root {
    --tile-w: 250px;
    --tile-h: 150px;
    --cena-h: 264px;
    --passo-x: 150px;
    --recuo-z: 108px;
    --giro-y: 30;
    --persp: 770px;
  }
  .nav {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
}