/* IFC — Sky v3: céu estrelado que acompanha a página e gira em torno de um ponto abaixo dela. */

:root {
  --ifc-sky-top: #061327;
  --ifc-sky-middle: #0b2038;
  --ifc-sky-bottom: #122b43;

  --ifc-page-height: 100vh;
  --ifc-star-rotation-speed: 12000s;
  --ifc-star-glow-duration: 5s;

  /* Centro da rotação: 400vh abaixo do final do documento. */
  --ifc-star-center-y: calc(var(--ifc-page-height) + 400vh);
  /* Margem extra mantém as estrelas cobrindo a página durante toda a rotação. */
  --ifc-star-field-radius: calc(var(--ifc-star-center-y) + max(100vw, 50vh));
}

html.ifc-has-site-sky {
  min-height: 100%;
  background: #010711;
}

body.ifc-has-site-sky {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  overflow-x: clip;
  background: transparent !important;
}

/* A camada é absoluta, não fixed: ela acompanha a rolagem 1:1. */
body.ifc-has-site-sky > #ifc-site-sky {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    var(--ifc-sky-top) 0%,
    var(--ifc-sky-middle) 48%,
    var(--ifc-sky-bottom) 100%
  );
}

/* Um único campo estrelado, ampliado e centrado abaixo do fim da página. */
#ifc-site-sky::before {
  position: absolute;
  top: calc(var(--ifc-star-center-y) - var(--ifc-star-field-radius));
  left: calc(50% - var(--ifc-star-field-radius));
  width: calc(var(--ifc-star-field-radius) + var(--ifc-star-field-radius));
  height: calc(var(--ifc-star-field-radius) + var(--ifc-star-field-radius));
  content: "";
  opacity: 0.68;
  background-image:
    radial-gradient(circle at 19% 63%, rgba(235, 246, 255, 0.75) 0.4px, transparent 0.95px),
    radial-gradient(circle at 71% 28%, rgba(210, 231, 250, 0.68) 0.85px, transparent 1.55px),
    radial-gradient(circle at 42% 81%, rgba(190, 220, 248, 0.6) 1.3px, transparent 2.1px),
    radial-gradient(circle at 84% 57%, rgba(235, 246, 255, 0.62) 1.75px, transparent 2.6px);
  background-size:
    117px 154px,
    194px 245px,
    299px 211px,
    401px 322px;
  background-position: 11px 23px, 57px 91px, 129px 47px, 203px 163px;
  transform-origin: 50% 50%;
  animation:
    ifc-sky-star-rotation var(--ifc-star-rotation-speed) linear infinite,
    ifc-sky-star-glow var(--ifc-star-glow-duration) ease-in-out infinite alternate;
}

/* No HTML real, estes são os painéis de conteúdo entre o cabeçalho e o footer. */
body.ifc-has-site-sky .page-container,
body.ifc-has-site-sky .page-container > .page-top-container .hero-top,
body.ifc-has-site-sky .page-container > #content-top-highlighted,
body.ifc-has-site-sky .page-container > #main-content,
body.ifc-has-site-sky .page-container > #featured {
  background-color: transparent !important;
}

@keyframes ifc-sky-star-rotation {
  to { transform: rotate(360deg); }
}

@keyframes ifc-sky-star-glow {
  from {
    filter: brightness(1) drop-shadow(0 0 1px rgba(220, 238, 255, 0.16));
  }
  to {
    filter: brightness(1.18) drop-shadow(0 0 4px rgba(220, 238, 255, 0.42));
  }
}

@media (prefers-reduced-motion: reduce) {
  #ifc-site-sky::before { animation: none; }
}
