/* ============================================================
   TAGUS — Animações e interações modernas
   Estilos dependentes de JS ficam atrás de `html.js`:
   sem JavaScript, todo o conteúdo permanece visível.
   ============================================================ */

/* ===== Reveal on scroll ===== */
html.js [data-reveal],
html.js .reveal-item {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
html.js [data-reveal].in-view,
html.js [data-reveal-stagger].in-view .reveal-item {
  opacity: 1;
  transform: none;
}

/* Linha decorativa dos títulos cresce ao entrar na tela */
html.js .section-rule {
  width: 0;
  transition: width 0.8s ease 0.15s;
}
html.js .section-rule.in-view { width: 60px; }

/* ===== Hero — Ken Burns + entrada do título ===== */
.slide-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.slide.active .slide-bg {
  animation: kenburns 16s ease-out forwards;
}
@keyframes kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}
html.js .slide .slide-content h2 {
  opacity: 0;
  transform: translateY(18px);
}
html.js .slide.active .slide-content h2 {
  animation: slide-title 0.9s ease 0.25s forwards;
}
@keyframes slide-title {
  to { opacity: 1; transform: none; }
}

/* ===== Indicador de rolagem no hero ===== */
.hero-scroll {
  position: absolute;
  bottom: 26px;
  right: 40px;
  z-index: 5;
  width: 30px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 16px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.hero-scroll:hover { border-color: #fff; transform: translateY(2px); }
.hero-scroll-chevron {
  width: 4px;
  height: 10px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.9);
  animation: scroll-cue 1.8s ease-in-out infinite;
}
@keyframes scroll-cue {
  0%   { transform: translateY(0); opacity: 1; }
  60%  { transform: translateY(14px); opacity: 0; }
  61%  { transform: translateY(0); opacity: 0; }
  100% { opacity: 1; }
}
@media (max-width: 760px) {
  .hero-scroll { display: none; }
}

/* ===== Linha do rio — o traço se desenha ao entrar na tela ===== */
html.js .rio-divider path {
  stroke-dasharray: 1300;
  stroke-dashoffset: 1300;
}
html.js .rio-divider.in-view path {
  animation: rio-draw 2.4s ease-out 0.2s forwards;
}
@keyframes rio-draw {
  to { stroke-dashoffset: 0; }
}
html.js .rio-divider circle {
  opacity: 0;
  transition: opacity 0.6s ease;
}
html.js .rio-divider.in-view circle:first-of-type { opacity: 1; transition-delay: 0.2s; }
html.js .rio-divider.in-view circle:last-of-type { opacity: 1; transition-delay: 2.2s; }

/* ===== Header ao rolar ===== */
.site-header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 32, 56, 0.08);
}

/* ===== Tilt 3D + glow nos cards (aplicado via JS só em desktop) ===== */
html.js .tilt {
  position: relative;
  will-change: transform;
}
html.js .tilt:hover {
  transform: perspective(700px)
             rotateX(var(--rx, 0deg))
             rotateY(var(--ry, 0deg))
             translateY(-4px);
}
html.js .tilt::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: radial-gradient(
    220px circle at var(--mx, 50%) var(--my, 50%),
    rgba(110, 130, 181, 0.16),
    transparent 70%
  );
}
html.js .tilt:hover::after { opacity: 1; }

/* ===== Equipe — zoom suave + borda azul ===== */
.member-photo {
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
}
.member-photo img {
  transition: transform 0.6s ease;
}
.member:hover .member-photo,
.member:focus-visible .member-photo {
  border-color: var(--ouro);
  box-shadow: 0 14px 34px rgba(18, 58, 107, 0.22);
}
.member:hover .member-photo img,
.member:focus-visible .member-photo img {
  transform: scale(1.06);
}

/* ===== Botões — shine sweep ===== */
.btn,
.nav-cta,
.lamina-btn {
  position: relative;
  overflow: hidden;
}
.btn::after,
.nav-cta::after,
.lamina-btn::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 55%;
  background: linear-gradient(
    105deg,
    transparent,
    rgba(255, 255, 255, 0.28),
    transparent
  );
  transform: translateX(-180%) skewX(-15deg);
  pointer-events: none;
}
.btn:hover::after,
.nav-cta:hover::after,
.lamina-btn:hover::after {
  transform: translateX(320%) skewX(-15deg);
  transition: transform 0.7s ease;
}

/* ===== Stats — contadores institucionais ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 70px;
  border: 1px solid var(--cinza-100);
  background: var(--branco);
}
.stat {
  text-align: center;
  padding: 38px 20px;
  border-left: 1px solid var(--cinza-100);
}
.stat:first-child { border-left: 0; }
.stat strong {
  display: block;
  font-family: var(--ff-display);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.1rem, 2.5vw, 2.7rem);
  color: var(--navy);
  line-height: 1.05;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-family: var(--ff-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cinza-600);
}

/* ===== Vídeo do rio Tejo no hover ===== */
.origem-imagem {
  position: relative;
  overflow: hidden;
}
.origem-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.origem-imagem.is-playing .origem-video { opacity: 1; }

/* ===== Tabelas — painel moderno ===== */
.fundos-tabela {
  border: 1px solid var(--cinza-100);
  background: var(--branco);
  border-radius: var(--radius, 10px);
  box-shadow: 0 14px 40px rgba(0, 32, 56, 0.06);
  padding: 8px 18px 14px;
}

/* Cabeçalho gruda no topo ao rolar a tabela */
.fundos-tabela thead th {
  position: sticky;
  top: 76px;
  background: var(--branco);
  z-index: 5;
}

.fundos-tabela tbody tr,
.hist-perf tbody tr {
  transition: background-color 0.25s ease;
}
.fundos-tabela tbody tr:not(.grupo):hover,
.hist-perf tbody tr:hover {
  background-color: rgba(18, 58, 107, 0.05);
}
.fundos-tabela tbody tr:not(.grupo):not(.comparativo):hover td.col-nome {
  color: var(--azulejo);
}
.fundos-tabela tbody tr:not(.grupo):hover td:first-child {
  box-shadow: inset 3px 0 0 var(--ouro);
}
.fundos-tabela tbody td {
  font-variant-numeric: tabular-nums;
}

/* Linhas entram em cascata (classes aplicadas via JS) */
html.js .row-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
html.js .row-reveal.row-in {
  opacity: 1;
  transform: none;
}

/* Cards de dados dos fundos */
.fundo-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.fundo-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(18, 58, 107, 0.1);
}
.fundo-card strong {
  font-variant-numeric: tabular-nums;
}

/* ===== Gráficos interativos dos fundos ===== */
.fundo-chart-canvas {
  position: relative;
  height: 360px;
  padding: 18px 16px 10px;
}

/* ===== Responsivo ===== */
@media (max-width: 1000px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--cinza-100); }
}
@media (max-width: 760px) {
  .fundo-chart-canvas { height: 260px; padding: 12px 8px 6px; }
  .stat strong { font-size: 2.1rem; }
  .fundos-tabela { padding: 4px 10px 10px; }
  .fundos-tabela thead th { position: static; }
}

/* ===== Acessibilidade — usuário prefere menos movimento ===== */
@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal],
  html.js .reveal-item,
  html.js .slide .slide-content h2 {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  html.js .section-rule {
    width: 60px !important;
    transition: none !important;
  }
  html.js .row-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .slide.active .slide-bg { animation: none !important; }
  .hero-scroll-chevron { animation: none !important; }
  html.js .rio-divider path {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    animation: none !important;
  }
  html.js .rio-divider circle { opacity: 1 !important; transition: none !important; }
  html.js .tilt:hover { transform: none; }
  html.js .tilt::after { display: none; }
  .member-photo img,
  .member-photo,
  .origem-video { transition: none !important; }
  .member:hover .member-photo img { transform: none; }
  .btn::after,
  .nav-cta::after,
  .lamina-btn::after { display: none; }
}
