/* CodeCore Studio · Aurora definitiva — fondos de la portada (los dibuja fondos.js).
   Solo afecta la portada. Usa los colores de la paleta de Aurora. */

/* El contenido de la portada queda siempre por encima del fondo. */
.hero > .wrap { position: relative; z-index: 1; }

/* Capa del fondo: encima de las luces de aurora y debajo del texto. Aparece con un fundido. */
.fondo {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity 1.2s ease;
  /* Legibilidad: el fondo se atenúa detrás del titular, el texto y los botones (centro-arriba). */
  -webkit-mask-image: radial-gradient(ellipse 40% 27% at 50% 32%, rgba(0, 0, 0, 0.24) 0%, rgba(0, 0, 0, 0.34) 55%, #000 100%);
  mask-image: radial-gradient(ellipse 40% 27% at 50% 32%, rgba(0, 0, 0, 0.24) 0%, rgba(0, 0, 0, 0.34) 55%, #000 100%);
}
.fondo.is-on { opacity: 1; }
.fondo::after { /* fundido hacia el color de la página al final de la portada */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 18%; z-index: 2;
  background: linear-gradient(180deg, rgba(10, 16, 36, 0), #0A1024);
}
.fondo canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* A: los haces fijos se mueven apenas con el puntero (los desplaza la tarjeta gráfica). */
.fondo-codigo .fondo-static { transform: translate3d(calc(var(--px, 0) * 6px), calc(var(--py, 0) * 4px), 0); }

/* ---------- A · Muros de código en perspectiva ----------
   Texto real con perspectiva CSS. Se desplaza hacia arriba muy lento (cw-sube, 140 s) y se inclina
   apenas con el puntero (--px y --py los pone fondos.js). */
.cw { position: absolute; top: -8%; height: 116%; perspective: 760px; }
.cw-left { left: -1%; width: 40%; perspective-origin: 100% 42%; }
.cw-right { right: -1%; width: 30%; perspective-origin: 0% 42%; opacity: 0.7; }
.cw-plane {
  position: absolute; inset: 0; overflow: hidden; transform-origin: 0% 50%;
  transform: rotateY(calc(30deg + var(--px, 0) * 3deg)) rotateX(calc(var(--py, 0) * -2deg));
  -webkit-mask-image: linear-gradient(90deg, #000 38%, transparent 90%); mask-image: linear-gradient(90deg, #000 38%, transparent 90%);
}
.cw-right .cw-plane {
  transform-origin: 100% 50%;
  transform: rotateY(calc(-34deg + var(--px, 0) * 3deg)) rotateX(calc(var(--py, 0) * -2deg));
  -webkit-mask-image: linear-gradient(270deg, #000 35%, transparent 96%); mask-image: linear-gradient(270deg, #000 35%, transparent 96%);
}
.cw-text {
  margin: 0; padding: 0 0 0 6%; white-space: pre; font: 400 22px/1.75 "DM Mono", ui-monospace, monospace;
  color: rgba(167, 177, 208, 0.42); animation: cw-sube 140s linear infinite; will-change: transform;
}
.cw-right .cw-text { padding: 0 6% 0 0; text-align: right; font-size: 14px; color: rgba(146, 117, 255, 0.4); animation-duration: 170s; animation-direction: reverse; }
@keyframes cw-sube { to { transform: translateY(-50%); } }
.cw-text .ln { display: block; }
.cw-text .k { color: rgba(32, 213, 216, 0.72); }
.cw-text .s { color: rgba(146, 117, 255, 0.8); }
.cw-text .f { color: rgba(238, 242, 255, 0.62); }
.cw-text .n { color: rgba(120, 220, 255, 0.75); }
.cw-text .c { color: rgba(167, 177, 208, 0.3); }
.cw-text .hl { color: rgba(238, 242, 255, 0.8); text-shadow: 0 0 12px rgba(32, 213, 216, 0.75); }
.cw-right .cw-text .hl { text-shadow: 0 0 12px rgba(146, 117, 255, 0.75); }
/* Barrido de luz que baja por el muro izquierdo, como una línea que se ejecuta (9 s). */
.cw-left .cw-plane::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14%;
  background: linear-gradient(180deg, rgba(32, 213, 216, 0), rgba(32, 213, 216, 0.1) 50%, rgba(32, 213, 216, 0));
  animation: cw-barrido 9s linear infinite;
}
@keyframes cw-barrido { from { transform: translateY(-100%); } to { transform: translateY(720%); } }
.fondo.is-still .cw-text, .fondo.is-still .cw-plane::after { animation-play-state: paused; }

/* ---------- Selector para comparar los fondos (temporal) ---------- */
.fondo-switch {
  position: fixed; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 999px;
  background: rgba(12, 18, 42, 0.86); border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.8);
  font: 600 0.8rem/1 "Plus Jakarta Sans", system-ui, sans-serif; color: #A7B1D0;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
}
.fondo-switch.is-away { opacity: 0; transform: translateY(12px); visibility: hidden; transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s; }
.fs-label { padding: 0 8px 0 10px; font: 500 0.7rem/1 "DM Mono", ui-monospace, monospace; letter-spacing: 0.04em; }
.fondo-switch button {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: #EEF2FF; font: inherit; white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.fondo-switch button b { margin-right: 4px; color: #20D5D8; }
.fondo-switch button:hover { background: rgba(255, 255, 255, 0.08); }
.fondo-switch button[aria-pressed="true"] { background: linear-gradient(110deg, #20D5D8, #9275FF); color: #08102A; }
.fondo-switch button[aria-pressed="true"] b { color: #08102A; }
.fondo-switch button:focus-visible { outline: 2px solid #20D5D8; outline-offset: 2px; }

/* ---------- Celular y tableta ---------- */
@media (max-width: 700px) {
  .fondo {
    -webkit-mask-image: radial-gradient(ellipse 70% 22% at 50% 27%, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.42) 60%, #000 100%);
    mask-image: radial-gradient(ellipse 70% 22% at 50% 27%, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.42) 60%, #000 100%);
  }
  .cw-left { width: 92%; }
  .cw-left .cw-plane { transform: rotateY(38deg); }
  .cw-right { display: none; }
  .cw-text { font-size: 14px; color: rgba(167, 177, 208, 0.32); }
  .fondo-switch { left: 50%; transform: translateX(-50%); }
  .fondo-switch.is-away { transform: translate(-50%, 12px); }
}
@media (prefers-reduced-motion: reduce) {
  .cw-text, .cw-left .cw-plane::after { animation: none; }
}
