/* =====================================================================
   FX — efeitos de movimento por cima de site.css (index, historia, privacidade).
   Inspirados na "Proposta comercial — modelo".
   Tudo que esconde conteúdo depende da classe .fx (posta pelo fx.js),
   então sem JavaScript a página aparece normal.
   ===================================================================== */
:root { --ease: cubic-bezier(.22, 1, .36, 1); }

/* ---------- comum a todas as páginas ---------- */

/* barra de progresso de leitura */
.fx-progresso { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: linear-gradient(90deg, var(--cyan), #7fd6ea); pointer-events: none; }

/* cabeçalho fica translúcido ao rolar */
.site-header { transition: background-color .35s, box-shadow .35s; }
.site-header.rolou { background: rgba(255, 255, 255, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 30px -22px rgba(20, 42, 98, .55); }

/* bolinha do pronto-socorro pulsando */
.er::before { animation: fx-pulsa 2s infinite; }
@keyframes fx-pulsa { 50% { box-shadow: 0 0 0 7px rgba(63, 209, 138, 0); opacity: .55; } }

/* aura animada + granulado: slides do carrossel e aberturas das páginas */
.slide::before, .page-hero::before, .priv-hero::before {
  /* sem filter: blur (pesado demais ao trocar de slide); o degradê já é suave por si */
  content: ""; position: absolute; inset: -30%; z-index: 0; pointer-events: none; opacity: .5;
  background:
    radial-gradient(circle at 32% 58%, rgba(27, 168, 198, .5), rgba(27, 168, 198, .22) 14%, rgba(27, 168, 198, .06) 28%, transparent 40%),
    radial-gradient(circle at 62% 22%, rgba(58, 92, 255, .45), rgba(58, 92, 255, .2) 13%, rgba(58, 92, 255, .05) 26%, transparent 38%);
  will-change: transform;
  animation: fx-flutua 18s var(--ease) infinite alternate;
}
.s-30::before { opacity: .35; background: radial-gradient(circle at 32% 58%, rgba(27, 168, 198, .35), rgba(27, 168, 198, .12) 16%, transparent 40%); }
/* só o slide visível anima; os outros ficam parados */
.slide:not(.ativo)::before { animation-play-state: paused; }
.slide-visual img { will-change: transform; }
@keyframes fx-flutua { to { transform: translate(8%, -6%) scale(1.12); } }
.slide::after, .page-hero::after, .priv-hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* anel ciano se desenha quando a seção aparece (oncologia, LGPD) */
.fx .onco-ring circle { stroke-dashoffset: 1100; transition: stroke-dashoffset 2.6s var(--ease); }
.fx .em-vista .onco-ring circle { stroke-dashoffset: 0; }

/* cruz do HSM+ girando devagar */
.plus-cross { animation: fx-gira 80s linear infinite; }
@keyframes fx-gira { to { transform: rotate(90deg); } }

/* elementos aparecem ao rolar */
.fx .revela { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.fx .revela.visivel { opacity: 1; transform: none; }

/* entrada da abertura: filhos de .fx-entrada sobem em sequência ao carregar */
.fx .fx-entrada > * { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.fx .fx-entrada.ativo > * { opacity: 1; transform: none; }
.fx .fx-entrada.ativo > :nth-child(2) { transition-delay: .1s; }
.fx .fx-entrada.ativo > :nth-child(3) { transition-delay: .2s; }
.fx .fx-entrada.ativo > :nth-child(4) { transition-delay: .3s; }
.fx .fx-entrada.ativo > :nth-child(5) { transition-delay: .4s; }

/* ---------- home ---------- */

/* carrossel: foto do slide atual dá um zoom lento */
.slide-visual img { transition: transform 7s linear; }
.slide.ativo .slide-visual img { transform: scale(1.06); }

/* carrossel: texto do slide entra em sequência */
.fx .slide .inner > * { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.fx .slide.ativo .inner > * { opacity: 1; transform: none; }
.fx .slide.ativo .inner > :nth-child(2) { transition-delay: .1s; }
.fx .slide.ativo .inner > :nth-child(3) { transition-delay: .2s; }
.fx .slide.ativo .inner > :nth-child(4) { transition-delay: .3s; }
.fx .slide.ativo .inner > :nth-child(5) { transition-delay: .4s; }

/* carrossel: pontinho ativo mostra o tempo até o próximo slide */
.dots button { position: relative; overflow: hidden; }
.hero.rodando .dots button[aria-current="true"] { background: var(--cyan-soft); }
.hero.rodando .dots button[aria-current="true"]::after {
  content: ""; position: absolute; inset: 0; background: var(--navy); transform-origin: left;
  animation: fx-tempo var(--fx-intervalo, 7s) linear forwards;
}
@keyframes fx-tempo { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* faixa de números */
.fx-numeros { padding: 80px 0 0; }
.fx-numeros ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.fx-numeros li { padding: 28px 24px 0; border-left: 1px solid var(--line); }
.fx-numeros li:first-child { border-left: 0; padding-left: 0; }
.fx-numeros strong { display: block; font-size: clamp(2.6rem, 1.6rem + 3vw, 4.2rem); font-weight: 800; letter-spacing: -0.05em; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.fx-numeros strong small { font-size: .45em; color: var(--cyan); margin-left: 2px; letter-spacing: -0.02em; }
.fx-numeros p { margin-top: 10px; color: var(--muted); font-size: .95rem; max-width: 22ch; }
@media (max-width: 760px) {
  .fx-numeros { padding-top: 56px; }
  .fx-numeros ul { grid-template-columns: 1fr 1fr; }
  .fx-numeros li { padding: 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .fx-numeros li:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
}

/* "Como ser atendido no HSM+": linha que se preenche ao rolar */
.steps { position: relative; --fx-fill: 0px; }
.steps::before, .steps::after { content: ""; position: absolute; left: 19px; top: 34px; width: 2px; border-radius: 2px; }
.steps::before { bottom: 34px; background: var(--line); }
.steps::after { height: var(--fx-fill); max-height: calc(100% - 68px); background: linear-gradient(var(--cyan), var(--plus)); box-shadow: 0 0 10px rgba(27, 168, 198, .6); }
.steps li::before { position: relative; z-index: 1; transition: background-color .5s var(--ease), color .5s, box-shadow .5s; }
.steps li.ativa::before { background: var(--plus); color: var(--white); box-shadow: 0 0 0 6px var(--cyan-soft); }

/* ---------- O HSM (historia.html) ---------- */

/* abertura: foto com zoom lento e arco que se desenha de cima para baixo */
.page-hero .slide-visual { z-index: 0; }
.page-hero .slide-visual img { animation: fx-zoom 14s var(--ease) forwards; }
@keyframes fx-zoom { from { transform: scale(1.12); } to { transform: scale(1); } }
.fx .page-hero .slide-arc { animation: fx-arco 1.6s .3s var(--ease) both; }
/* folga negativa nas laterais: o arco curva para fora da caixa do SVG (overflow visible) */
@keyframes fx-arco { from { clip-path: inset(-5% -50% 105% -200%); } to { clip-path: inset(-5% -50% -5% -200%); } }

/* números em destaque */
.fact strong { font-variant-numeric: tabular-nums; }
.fact strong span { display: inline; margin: 0; color: inherit; font-size: inherit; line-height: inherit; }

/* galeria: foto abre como uma cortina e aproxima no hover */
.gallery figure img { transition: transform 1.2s var(--ease), clip-path 1.3s var(--ease); }
.gallery figure:hover img { transform: scale(1.05); }
/* o quadro fica visível (o observador precisa dele); a cortina é na foto */
.fx .gallery figure.revela { opacity: 1; transform: none; }
.fx .gallery figure.revela img { clip-path: inset(0 0 100% 0); }
.fx .gallery figure.revela.visivel img { clip-path: inset(0 0 0 0); }
.fx .gallery figcaption { opacity: 0; transform: translateY(8px); transition: opacity .6s .9s, transform .6s .9s var(--ease); }
.fx .gallery .visivel figcaption { opacity: 1; transform: none; }

/* lista da estrutura: linha ciano corre por baixo de cada item */
.structure-list li { position: relative; }
.structure-list li::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--cyan), var(--navy)); transform: scaleX(0); transform-origin: left; transition: transform 1.1s .2s var(--ease); }
.fx .structure-list li.visivel::after { transform: scaleX(1); }

/* ---------- Privacidade (privacidade.html) ---------- */

.priv-hero .wrap { z-index: 2; }

/* atalhos sobem um pouco no hover */
.hub a { transition: box-shadow .15s, transform .35s var(--ease); }
.hub a:hover { transform: translateY(-4px); }

/* índice lateral: a borda vira uma barra de leitura da política */
.toc ol { position: relative; }
.toc ol::after { content: ""; position: absolute; left: -2px; top: 0; width: 2px; height: var(--fx-fill, 0%); background: linear-gradient(var(--cyan), var(--navy)); box-shadow: 0 0 8px rgba(27, 168, 198, .5); transition: height .15s linear; }
.toc a { transition: color .25s, border-color .25s, padding-left .35s var(--ease); }
.toc a[aria-current="true"] { padding-left: 22px; }

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx .revela, .fx .slide .inner > *, .fx .fx-entrada > *, .fx .gallery figcaption { opacity: 1; transform: none; }
  .fx .gallery figure.revela img { clip-path: none; }
  .fx .onco-ring circle { stroke-dashoffset: 0; }
  .structure-list li::after { transform: scaleX(1); }
}
