/* LaFeriaDeMary: fondo animado a pantalla completa (cielo nocturno, luna azul, neblina, árboles secos).
   Las estrellas, mariposas, chispas y pétalos los dibuja fondo.js en el <canvas>.
   Todo es decorativo: nunca recibe clics (pointer-events: none) y queda detrás del contenido. */

html { background: #05070c; }

.cielo {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* cielo: casi negro arriba, azul profundo abajo (los árboles se recortan contra esa luz) */
  background:
    radial-gradient(120% 70% at 78% 12%, rgba(63, 169, 245, .16), transparent 60%),
    radial-gradient(90% 60% at 50% 105%, rgba(27, 79, 138, .55), transparent 70%),
    linear-gradient(180deg, #05070c 0%, #070b14 38%, #0a1222 70%, #0f1f38 100%);
  contain: strict;
}

/* imagen de fondo opcional (ajustes.tema.fondo): muy oscura y casi transparente */
.cielo-foto {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  filter: brightness(.45) saturate(.75);
  transition: opacity 1.2s ease;
}
.cielo-foto.con-imagen { opacity: .2; }

.cielo-lienzo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ------------------------------------------------------------ luna */

.luna {
  position: absolute;
  top: 74px;
  right: -14vw;
  width: 62vw;
  aspect-ratio: 1;
  max-width: 340px;
}
@media (min-width: 760px) {
  .luna { top: 9vh; right: 9vw; width: 28vw; max-width: 360px; }
}

/* halo que "respira" */
.luna::before {
  content: "";
  position: absolute;
  inset: -55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 200, 255, .34) 0%, rgba(63, 169, 245, .16) 32%, rgba(63, 169, 245, 0) 66%);
  animation: luna-respira 9s ease-in-out infinite alternate;
  will-change: transform, opacity;
}

.luna-disco {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(27, 79, 138, .2) 0 7%, transparent 7.5%),
    radial-gradient(circle at 62% 58%, rgba(27, 79, 138, .2) 0 10%, transparent 10.5%),
    radial-gradient(circle at 45% 70%, rgba(27, 79, 138, .14) 0 5%, transparent 5.5%),
    radial-gradient(circle at 70% 32%, rgba(27, 79, 138, .14) 0 4%, transparent 4.5%),
    radial-gradient(circle at 36% 34%, #f2fbff 0%, #bfe6ff 30%, #7cc8ff 62%, #3fa9f5 86%, #1b4f8a 100%);
  box-shadow:
    0 0 40px 6px rgba(124, 200, 255, .5),
    0 0 120px 30px rgba(63, 169, 245, .22),
    inset -18px -22px 50px rgba(13, 42, 77, .45);
  opacity: .92;
}

@keyframes luna-respira {
  from { transform: scale(.94); opacity: .7; }
  to { transform: scale(1.08); opacity: 1; }
}

/* ------------------------------------------------------------ neblina (textura tileable que se desplaza) */

.niebla {
  position: absolute;
  left: 0;
  width: 200%;
  background: url("/tema/niebla.svg") repeat-x 0 0 / 50% 100%;
  animation: niebla-viaja 120s linear infinite;
  will-change: transform;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 35%, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 35%, #000 70%, transparent 100%);
}
.niebla-1 { bottom: 26vh; height: 34vh; opacity: .22; animation-duration: 170s; }
.niebla-2 { bottom: 6vh; height: 38vh; opacity: .3; animation-duration: 120s; animation-direction: reverse; }
.niebla-3 { bottom: -6vh; height: 30vh; opacity: .42; animation-duration: 90s; }

@keyframes niebla-viaja {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

/* ------------------------------------------------------------ árboles secos en los bordes (los genera fondo.js) */

.arboles {
  position: absolute;
  bottom: 0;
  height: min(86vh, 900px);
  width: auto;
  aspect-ratio: 420 / 900;
  max-width: 60vw;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(63, 169, 245, .16));
}
.arboles-izq { left: -8vw; }
.arboles-der { right: -8vw; transform: scaleX(-1); }
@media (max-width: 759px) {
  .arboles { height: 62vh; opacity: .9; }
  .arboles-izq { left: -24vw; }
  .arboles-der { right: -24vw; }
}

/* ------------------------------------------------------------ movimiento reducido: todo quieto */

@media (prefers-reduced-motion: reduce) {
  .luna::before, .niebla { animation: none; }
  .cielo-foto { transition: none; }
}
