/* ───────── 06 · Fechamento (rei aceso no centro, peças em volta) ───────── */
.closing {
  --mx: 0;                         /* posição do cursor, de -1 a 1 (o JS atualiza) */
  --my: 0;
  --kh: min(112vh, 78vw);          /* altura do vídeo */
  --kw: calc(var(--kh) * .5625);   /* largura do vídeo (9:16) */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(var(--kw) * .78) minmax(0, 1fr);
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 6.5rem clamp(1.4rem, 5.5vw, 7rem) 3.5rem;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

/* ── cena: o vídeo do xadrez, com as bordas sumindo no preto ── */
.closing__scene {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -2;
  height: var(--kh);
  aspect-ratio: 9 / 16;
  translate: calc(-47% + var(--mx) * -.7rem) calc(-50% + var(--my) * -.5rem);   /* o rei fica a 47% da largura do vídeo */
  scale: 1.07;
  opacity: 0;
  transition: opacity 1.6s ease .1s, scale 2.4s cubic-bezier(.16, 1, .3, 1) .1s, filter .8s ease;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%), linear-gradient(180deg, transparent 5%, #000 22%, #000 80%, transparent 97%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 22%, #000 78%, transparent 100%), linear-gradient(180deg, transparent 5%, #000 22%, #000 80%, transparent 97%);
  mask-composite: intersect;
}
.closing.is-on .closing__scene { opacity: 1; scale: 1; }
.closing__scene video { width: 100%; height: 100%; object-fit: cover; display: block; }
.closing.is-hot .closing__scene { filter: brightness(1.16); }

/* clarão do rei: respira, acompanha um pouco o cursor e cresce quando o botão está em foco */
.closing__halo {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: calc(var(--kh) * .62);
  aspect-ratio: 1;
  translate: calc(-50% + var(--mx) * 1.8rem) calc(-48% + var(--my) * 1.3rem);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236, 243, 248, .3) 0, rgba(163, 190, 212, .13) 34%, rgba(98, 127, 146, .04) 56%, transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
  scale: .8;
  transition: opacity 1.4s ease .5s, scale 1.1s cubic-bezier(.3, 0, .2, 1);
  animation: closing-breathe 5.5s ease-in-out infinite;
  pointer-events: none;
}
.closing.is-on .closing__halo { opacity: .75; scale: 1; }
.closing.is-on.is-hot .closing__halo { opacity: 1; scale: 1.28; }
@keyframes closing-breathe { 0%, 100% { filter: brightness(.85); } 50% { filter: brightness(1.2); } }

/* ── textos: a coluna esquerda entra pela esquerda, a direita pela direita ── */
.closing [data-in] {
  opacity: 0;
  filter: blur(8px);
  transition: opacity .9s ease var(--d, 0s), translate 1.2s cubic-bezier(.16, 1, .3, 1) var(--d, 0s), filter .9s ease var(--d, 0s);
}
.closing__copy [data-in] { translate: -5rem 0; }
.closing__side [data-in] { translate: 5rem 0; }
.closing.is-on [data-in] { opacity: 1; translate: 0 0; filter: none; }

.closing__copy { grid-column: 1; text-shadow: 0 2px 22px #000; }
.closing__title {
  margin: 1.1rem 0 0;
  font-weight: 400;
  font-size: clamp(2.2rem, 3.5vw, 4.3rem);
  line-height: 1.02;
  letter-spacing: -.045em;
  color: #9aa6b0;
}
.closing__title > span { display: block; }
.closing__title > span:last-child { font-weight: 500; color: #fff; }
.closing__title .w {
  display: inline-block;
  opacity: 0;
  translate: 0 .35em;
  filter: blur(7px);
  transition: opacity .7s ease calc(.35s + var(--i) * .12s), translate .9s cubic-bezier(.2, .7, .2, 1) calc(.35s + var(--i) * .12s), filter .7s ease calc(.35s + var(--i) * .12s);
}
.closing.is-on .closing__title .w { opacity: 1; translate: 0 0; filter: none; }

.closing__side { grid-column: 3; justify-self: end; max-width: 25rem; text-shadow: 0 2px 18px #000; }
.closing__side .sec-sub { margin: 0; color: rgba(229, 229, 229, .78); }
.closing__cta { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: clamp(1.3rem, 3vh, 2rem); text-shadow: none; }
.closing__list { list-style: none; margin: clamp(1.4rem, 3.4vh, 2.2rem) 0 0; padding: 1.1rem 0 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.closing__list li { display: flex; align-items: center; gap: .65rem; padding: .28rem 0; font-size: .92rem; color: rgba(229, 229, 229, .74); }
.closing__list li::before {
  content: "";
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23D1DEE8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='8.2'/%3E%3Cpath d='M6.4 10.3l2.4 2.4 4.8-5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ───────── 07 · Rodapé (prisma de vidro sobre a água) ───────── */
.footer {
  --mx: 0;
  --my: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2.4rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: 7.2rem clamp(1.4rem, 5.5vw, 7rem) 1.5rem;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}
/* arte: a imagem do prisma, maior que a tela, com o horizonte um pouco abaixo do meio */
.footer__art {
  position: absolute;
  left: 50%;
  top: -24%;
  z-index: -2;
  height: 150%;
  aspect-ratio: 3272 / 2626;      /* a imagem foi alargada dos dois lados (bordas esticadas) para sumir aos poucos, sem recorte visível */
  translate: calc(-54.5% + var(--mx) * -.9rem) calc(var(--my) * -.5rem);
  scale: 1.05;
  opacity: 0;
  transition: opacity 1.8s ease .1s, scale 2.6s cubic-bezier(.16, 1, .3, 1) .1s;
  -webkit-mask-image: linear-gradient(90deg, transparent 3%, #000 30%, #000 70%, transparent 97%), linear-gradient(180deg, transparent 12%, #000 26%, #000 74%, transparent 84%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 3%, #000 30%, #000 70%, transparent 97%), linear-gradient(180deg, transparent 12%, #000 26%, #000 74%, transparent 84%);
  mask-composite: intersect;
}
.footer.is-on .footer__art { opacity: 1; scale: 1; }
.footer__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* o ponto de luz na base do prisma respira */
.footer__art i {
  position: absolute;
  left: 48.9%;
  top: 53.4%;
  width: 15.3%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 221, 160, .55) 0, rgba(255, 190, 110, .2) 28%, rgba(163, 190, 212, .08) 50%, transparent 68%);
  mix-blend-mode: screen;
  animation: footer-breathe 6s ease-in-out infinite;
}
@keyframes footer-breathe { 0%, 100% { opacity: .35; scale: .85; } 50% { opacity: 1; scale: 1.1; } }
.footer [data-in] {
  opacity: 0;
  translate: 0 1.8rem;
  filter: blur(6px);
  transition: opacity .9s ease var(--d, 0s), translate 1.1s cubic-bezier(.16, 1, .3, 1) var(--d, 0s), filter .9s ease var(--d, 0s);
}
.footer.is-on [data-in] { opacity: 1; translate: 0 0; filter: none; }

.footer__top { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; text-shadow: 0 1px 14px #000; }
.footer__brand p { margin: 1.1rem 0 0; font-size: 1.05rem; line-height: 1.45; color: rgba(229, 229, 229, .66); }
.footer__brand .btn { margin-top: 1.4rem; }
.footer__nav { display: flex; gap: clamp(2.5rem, 5vw, 5.5rem); }
.footer__nav h3 { margin: 0 0 .9rem; font-size: .76rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: rgba(229, 229, 229, .45); }
.footer__nav a, .footer__bar a {
  display: block;
  width: fit-content;
  padding: .3rem 0;
  font-size: .98rem;
  text-decoration: none;
  color: rgba(229, 229, 229, .8);
  background: linear-gradient(var(--hydr-blue), var(--hydr-blue)) 0 100% / 0 1px no-repeat;
  transition: color .4s ease, background-size .5s cubic-bezier(.2, .7, .2, 1);
}
.footer__nav a:hover, .footer__bar a:hover { color: #fff; background-size: 100% 1px; }
.footer__nav a:focus-visible, .footer__bar a:focus-visible { outline: 1px solid var(--hydr-blue); outline-offset: 3px; }

.footer__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, .09);
  font-size: .84rem;
  color: rgba(229, 229, 229, .55);
  text-shadow: 0 1px 12px #000;
}
.footer__bar a { font-size: .84rem; }
.footer__credit { justify-self: end; }
.footer__credit b { font-weight: 500; color: var(--hydr-blue-light); }

/* saída: ao deixar a seção tudo volta ao ponto de partida na hora */
.closing:not(.is-on) [data-in], .closing:not(.is-on) .closing__title .w, .closing:not(.is-on) .closing__scene, .closing:not(.is-on) .closing__halo,
.footer:not(.is-on) [data-in], .footer:not(.is-on) .footer__art { transition-duration: .01s; transition-delay: 0s; }

@media (max-width: 900px) {
  .closing { --kh: 120vh; grid-template-columns: minmax(0, 1fr); gap: 2rem; align-content: center; padding-top: 7rem; }
  .closing.is-on .closing__scene { opacity: .5; }
  .closing__copy, .closing__side { grid-column: 1; justify-self: start; }
  .closing__copy [data-in], .closing__side [data-in] { translate: 0 2rem; }
  .footer { min-height: 0; gap: 4rem; padding-top: 5rem; }
  .footer.is-on .footer__art { opacity: .55; }
  .footer__top { flex-direction: column; }
  .footer__bar { grid-template-columns: 1fr; justify-items: start; gap: .3rem; }
  .footer__credit { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .closing [data-in], .closing__title .w, .closing__scene, .closing__halo, .footer [data-in], .footer__art { transition-duration: .01ms; transition-delay: 0s; }
  .closing__halo, .footer__art i { animation: none; }
  .closing__scene { translate: -47% -50%; }
  .closing__halo { translate: -50% -48%; }
  .footer__art { translate: -54.5% 0; }
}
