/* =====================================================================
   ROBOTICA-ESPACIAL.CSS
   Estilos específicos de la página Robótica Espacial.
   Carga DESPUÉS de style.css y reutiliza sus variables, .container,
   botones (.btn-primary, .btn-secondary, .btn-light), .cta-section,
   .section-label, .reveal y los glow orbs (.hero-glow).
   ===================================================================== */

/* ---------------------------------------------------------------------
   0. FONDO GENERAL DE LA PÁGINA — tema "espacio"
--------------------------------------------------------------------- */
body.pagina-espacial {
    background-color: #0b1330;
    background-image:
        radial-gradient(circle at 12% 18%, rgba(26,110,232,0.16), transparent 34%),
        radial-gradient(circle at 88% 42%, rgba(63,163,156,0.14), transparent 36%),
        radial-gradient(circle at 25% 78%, rgba(26,110,232,0.12), transparent 32%),
        radial-gradient(circle at 75% 92%, rgba(63,163,156,0.10), transparent 30%),
        radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: auto, auto, auto, auto, 36px 36px;
    background-attachment: fixed;
    color: rgba(255,255,255,0.82);
}

body.pagina-espacial .footer-column p,
body.pagina-espacial .footer-column a {
    color: #c3cbdc;
}


/* ---------------------------------------------------------------------
   1. PAGE HERO
--------------------------------------------------------------------- */
.page-hero {
    width: 100%;
    min-height: calc(100vh - 72px);
    display: flex;
    align-items: center;
    background:
        radial-gradient(ellipse 65% 70% at 80% 40%, rgba(0, 200, 255, 0.35), transparent 65%),
        radial-gradient(ellipse 50% 60% at 20% 70%, rgba(0, 80, 200, 0.3), transparent 60%),
        radial-gradient(ellipse 35% 40% at 50% 10%, rgba(0, 140, 220, 0.2), transparent 55%),
        #03081a;
    position: relative;
    overflow: hidden;
    padding: 2px 0 60px;
}

.page-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 1;
}

.page-hero .container {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    text-align: center;
}

.page-hero .hero-eyebrow {
    margin-bottom: 16px;
}

.page-hero .hero-title {
    font-size: clamp(2.4rem, 5vw, 4rem);
    margin: 0 auto 22px;
    max-width: 1050px;
}

.page-hero .hero-subtitle {
    max-width: 720px;
    font-size: clamp(1rem, 1.8vw, 1.12rem);
    margin: 0 auto 32px;
}

.page-hero .hero-ctas {
    justify-content: center;
}

/* Animación de entrada escalonada — igual que el Home */
.page-hero .hero-eyebrow  { animation: heroFadeUp 0.6s ease 0.10s both; }
.page-hero .hero-title     { animation: heroFadeUp 0.6s ease 0.26s both; }
.page-hero .hero-subtitle  { animation: heroFadeUp 0.6s ease 0.42s both; }
.page-hero .hero-ctas      { animation: heroFadeUp 0.6s ease 0.58s both; }

@media (prefers-reduced-motion: reduce) {
    .page-hero .hero-eyebrow,
    .page-hero .hero-title,
    .page-hero .hero-subtitle,
    .page-hero .hero-ctas { animation: none; }
}


/* ---------------------------------------------------------------------
   2. STATS STRIP — resultados clave en formato "telemetría"
--------------------------------------------------------------------- */
.stats-strip {
    background: rgba(255,255,255,0.03);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
    z-index: 2;
}

.stats-strip .container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding-top: 40px;
    padding-bottom: 40px;
}

.stat-item {
    text-align: center;
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 8px 12px;
    border-radius: var(--r-md);
    transition: background 0.25s ease;
    cursor: default;
}
.stat-item:last-child { border-right: none; }

.stat-item:hover {
    background: rgba(63,163,156,0.06);
}

.stat-value {
    font-family: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
    font-size: clamp(2rem, 3.4vw, 2.8rem);
    font-weight: 800;
    color: #ffffff;
    display: block;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    transition: color 0.25s ease, text-shadow 0.25s ease, transform 0.25s ease;
}

.stat-item:hover .stat-value {
    color: var(--teal);
    text-shadow: 0 0 24px rgba(63,163,156,0.55);
    transform: translateY(-2px);
}

.stat-item:hover .stat-value .stat-accent {
    color: #ffffff;
    text-shadow: 0 0 24px rgba(255,255,255,0.4);
}

.stat-value .stat-accent { color: var(--teal); transition: color 0.25s ease, text-shadow 0.25s ease; }

.stat-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.02em;
}


/* ---------------------------------------------------------------------
   3. BLOQUES DE CONTENIDO (alternados)
--------------------------------------------------------------------- */
.bloques-proyecto {
    padding: 90px 0;
}

.bloque {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 60px;
    padding: 60px 0;
}

.bloque:not(:last-child) {
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* Alterna el orden de imagen/texto */
.bloque--reverse .bloque-texto {
    order: 2;
}
.bloque--reverse .bloque-imagen {
    order: 1;
}

.bloque-numero {
    font-family: 'SFMono-Regular', 'Consolas', 'Menlo', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--teal);
    margin: 0 0 16px;
}

.bloque-titulo {
    font-size: clamp(2rem, 3.4vw, 2.8rem);
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 20px;
    line-height: 1.2;
}

.bloque-texto p {
    font-size: 1.12rem;
    color: rgba(255,255,255,0.68);
    line-height: 1.75;
    margin: 0 0 24px;
}

/* Tags tecnológicos bajo cada bloque */
.bloque-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.bloque-tag {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.65);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 5px 12px;
    border-radius: 20px;
}

/* Imagen del bloque */
.bloque-imagen {
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.06);
}

.bloque-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.bloque-imagen:hover img {
    transform: scale(1.03);
}

/* Botón "Leer más" */
.btn-leer-mas {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--teal);
    font-size: 0.92rem;
    font-weight: 700;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: gap 0.2s ease, color 0.2s ease;
}
.btn-leer-mas:hover {
    gap: 12px;
    color: #ffffff;
}
.btn-leer-mas i {
    font-size: 0.8rem;
}


/* ---------------------------------------------------------------------
   4. MODAL "LEER MÁS" — restyle sobre #learnMoreModal
--------------------------------------------------------------------- */

/* FIX: el modal usa la clase "show" (no el atributo style),
   y .modal base solo tenía display:none — sin esta regla
   el modal nunca llegaba a mostrarse. */
.modal.show {
    display: flex !important;
}

#learnMoreModal .modal-content {
    background: linear-gradient(160deg, #0c1230 0%, #14205c 100%);
    color: rgba(255,255,255,0.85);
    border-radius: var(--r-lg);
    border: 1px solid rgba(77,184,177,0.2);
    max-width: 640px;
    width: 92%;
    padding: 40px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

#learnMoreModal #modalTitle {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 18px;
    padding-right: 30px;
}

#learnMoreModal #modalText {
    font-size: 0.98rem;
    line-height: 1.8;
    color: rgba(255,255,255,0.75);
}

#learnMoreModal #modalText ul {
    margin: 14px 0;
    padding-left: 0;
}

#learnMoreModal #modalText li {
    list-style: none;
    padding-left: 26px;
    position: relative;
    margin-bottom: 12px;
}

#learnMoreModal #modalText li::before {
    content: "\f061"; /* fa-arrow-right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: var(--teal);
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 0.8rem;
}

#learnMoreModal .modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    font-size: 26px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}
#learnMoreModal .modal-close:hover {
    color: var(--teal);
}


/* ---------------------------------------------------------------------
   5. BITÁCORA DE DESARROLLO — mesa 3D con cubos-satélite (versión original)
--------------------------------------------------------------------- */
.bitacora-section {
    padding: 90px 0 60px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.bitacora-titulo {
    font-size: clamp(2rem, 3.4vw, 2.8rem);
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 20px;
    line-height: 1.2;
}

.bitacora-desc {
    font-size: 1.12rem;
    font-weight: 400;
    color: rgba(255,255,255,0.68);
    max-width: 760px;
    margin: 0 auto 60px auto;
    line-height: 1.75;
}

/* =====================================
   MESA 3D ESTILO AIR-HOCKEY
   ===================================== */

/* Contenedor de la mesa 3D */
.mesa-airhockey {
    width: 100%;
    max-width: 1080px;
    height: 460px;
    margin: 0 auto;
    position: relative;

    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;

    perspective: 1300px;
    perspective-origin: 50% 10%;

    /* Aparición al hacer scroll, controlado por script.js (generalObs) */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.mesa-airhockey.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Superficie principal (la "tabla") */
.mesa-superficie {
    position: relative;
    width: 100%;
    height: 400px;

    background: radial-gradient(circle at 20% 0%, #294067 0%, #18284f 55%, #0b2049 100%);
    border-radius: 0px;

    transform-style: preserve-3d;
    transform: rotateX(60deg);

    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.85);
    overflow: visible;
}

/* Grosor frontal de la mesa */
.mesa-superficie::before {
    content: "";
    position: absolute;
    left: 0;
    top: 100%;
    width: 100%;
    height: 34px;

    background: linear-gradient(#050914, #020309);
    border-radius: 0 0 22px 22px;

    transform-origin: top;
    transform: rotateX(-90deg);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.9);
}

/* =====================================
   Estela que une los cubos
   ===================================== */

/* Línea principal: fina, limpia y con levitación suave */
.linea-cubo {
    position: absolute;
    height: 3px;
    transform-origin: left center;
    border-radius: 999px;

    background: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0),
        rgba(120, 190, 255, 0.95),
        rgba(0, 0, 0, 0)
    );

    box-shadow: 0 0 8px rgba(120,190,255,0.7);
    overflow: hidden;
    z-index: 1;

    animation: estela-levita 3s ease-in-out infinite;
}

/* Flujo interior muy discreto */
.linea-cubo::before {
    content: "";
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;

    background: linear-gradient(
        90deg,
        transparent,
        rgba(230,245,255,0.9),
        transparent
    );
    opacity: 0.45;
    animation: flujo-suave 4s linear infinite;
    pointer-events: none;
}

/* Halo suave alrededor de la estela */
.linea-cubo::after {
    content: "";
    position: absolute;
    inset: -4px 0;
    border-radius: 999px;
    background: radial-gradient(
        ellipse at center,
        rgba(120, 190, 255, 0.2),
        transparent 70%
    );
    pointer-events: none;
}

/* Levitación de la estela respetando el ángulo */
@keyframes estela-levita {
    0%   { transform: translateY(0)     rotate(var(--rot)); }
    50%  { transform: translateY(-12px) rotate(var(--rot)); }
    100% { transform: translateY(0)     rotate(var(--rot)); }
}

/* Animación del flujo interior */
@keyframes flujo-suave {
    0%   { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* =====================================
   CUBO 3D
   ===================================== */
.cubo {
    position: absolute;
    width: 70px;
    height: 70px;
    z-index: 2;

    transform-style: preserve-3d;
    animation: flotar 3s ease-in-out infinite;
    cursor: pointer;
}

/* Cada cara del cubo */
.cubo .cara {
    position: absolute;
    width: 70px;
    height: 70px;
    background: linear-gradient(150deg, #2a4080, #131f44);
    border: 1px solid rgba(63,163,156,0.4);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;

    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;

    box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.cubo .front  { transform: translateZ(35px); }
.cubo .back   { transform: rotateY(180deg) translateZ(35px); background: linear-gradient(150deg, #1c2c5e, #0a1230); }
.cubo .left   { transform: rotateY(-90deg) translateZ(35px); background: linear-gradient(150deg, #1c2c5e, #0a1230); }
.cubo .right  { transform: rotateY(90deg)  translateZ(35px); }
.cubo .top    { transform: rotateX(90deg)  translateZ(35px); background: linear-gradient(150deg, #3fa39c, #1c2c5e); border-color: rgba(63,163,156,0.7); }
.cubo .bottom { transform: rotateX(-90deg) translateZ(35px); background: #0a1230; }

/* Animación de flotar */
@keyframes flotar {
    0%   { transform: translateY(0px)   rotateX(0deg) rotateY(0deg); }
    50%  { transform: translateY(-12px) rotateX(6deg) rotateY(-6deg); }
    100% { transform: translateY(0px)   rotateX(0deg) rotateY(0deg); }
}

/* Sombra del cubo */
.cubo::after {
    content: "";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);

    width: 75px;
    height: 20px;
    background: rgba(0,0,0,0.45);
    border-radius: 50%;
    filter: blur(10px);
    transition: all 0.3s;
}

/* Efecto hover */
.cubo:hover .cara {
    background: #4db8ff;
    color: #0f2d60;
    box-shadow: inset 0 0 25px rgba(255,255,255,0.8);
}

.cubo:hover::after {
    background: rgba(77,184,255,0.7);
    width: 90px;
    height: 24px;
    filter: blur(14px);
}

/* Posición de cada cubo en el espacio */
.cubo[data-mes="NOV"] { top: 80px;  left: 10%; }
.cubo[data-mes="DIC"] { top: 245px; left: 20%; }
.cubo[data-mes="ENE"] { top: 155px; left: 30%; }
.cubo[data-mes="FEB"] { top: 94px;  left: 47%; }
.cubo[data-mes="MAR"] { top: 265px; left: 50%; }
.cubo[data-mes="ABR"] { top: 170px; left: 63%; }
.cubo[data-mes="MAY"] { top: 200px; left: 75%; }
.cubo[data-mes="JUN"] { top: 104px; left: 87%; }


/* ---------------------------------------------------------------------
   6. RESPONSIVE
--------------------------------------------------------------------- */
@media (max-width: 980px) {
    .bloque {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 40px 0;
    }
    .bloque--reverse .bloque-texto,
    .bloque--reverse .bloque-imagen {
        order: initial;
    }
    .bloque-imagen { order: -1; }

    .stats-strip .container {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 12px;
    }
    .stat-item:nth-child(odd) { border-right: 1px solid rgba(255,255,255,0.06); }
    .stat-item:nth-child(even) { border-right: none; }
    .stat-item:nth-child(n+3) {
        padding-top: 16px;
        border-top: 1px solid rgba(255,255,255,0.06);
    }

    .bloques-proyecto { padding: 60px 0; }
}

@media (max-width: 700px) {
    .cubo {
        width: 55px;
        height: 55px;
    }

    .cubo .cara {
        width: 55px;
        height: 55px;
        font-size: 0.9rem;
    }

    .mesa-superficie {
        transform: rotateX(60deg);
    }

    .bitacora-desc { margin-bottom: 40px; }
}

@media (max-width: 600px) {
    .stats-strip .container {
        grid-template-columns: repeat(2, 1fr);
    }

    body.pagina-espacial {
        background-attachment: scroll;
    }
}
