/* =====================================================================
   HOME de la landing del candidato (index-version2.php) — versión 2
   Diseño creativo/animado: gradiente vivo, blobs flotantes, marquee de
   partidos, typewriter, contadores, countdown, galería con lightbox,
   dock social flotante y reveals con IntersectionObserver.
   (unete.php y unete-completado.php siguen usando estilos.css)
   ===================================================================== */
:root {
    --h-primario: #0d3b66;
    --h-primario-2: #14538c;
    --h-acento: #f4a300;
    --h-acento-2: #ffc94d;
    --h-oscuro: #06182b;
    --h-claro: #f7f9fc;
    --h-texto: #24344d;
    --h-gris: #6b7a90;
    --h-wa: #25d366;
}

* { scroll-behavior: smooth; }

body.home-candidato {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background: var(--h-claro);
    color: var(--h-texto);
    overflow-x: hidden;
}

/* ---------- Barra de progreso de scroll ---------- */
#barraProgreso {
    position: fixed;
    top: 0; left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, var(--h-acento), var(--h-acento-2));
    z-index: 3000;
    box-shadow: 0 0 12px rgba(244, 163, 0, .7);
    transition: width .12s linear;
}

/* ---------- Preloader ---------- */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--h-oscuro);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: opacity .6s, visibility .6s;
}

#preloader.oculto { opacity: 0; visibility: hidden; }

.preloader-sello {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    border: 3px solid rgba(244, 163, 0, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--h-acento);
    font-weight: 800;
    font-size: 1.9rem;
    letter-spacing: 1px;
    position: relative;
    animation: latido 1.4s ease-in-out infinite;
}

.preloader-sello::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--h-acento);
    animation: girar 1s linear infinite;
}

@keyframes girar { to { transform: rotate(360deg); } }
@keyframes latido { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- Navbar ---------- */
.h-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 2000;
    padding: 18px 0;
    transition: all .35s;
}

.h-navbar.compacta {
    background: rgba(6, 24, 43, .92);
    backdrop-filter: blur(10px);
    padding: 10px 0;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}

.h-navbar .navbar-brand {
    color: #fff;
    font-weight: 800;
    letter-spacing: -.5px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.h-navbar .brand-sello {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--h-acento), #d98f00);
    color: #142033;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 900;
    box-shadow: 0 6px 16px rgba(244, 163, 0, .4);
}

.h-navbar .nav-link {
    color: rgba(255, 255, 255, .82);
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    margin: 0 4px;
}

.h-navbar .nav-link::after {
    content: "";
    position: absolute;
    left: 50%; bottom: 2px;
    width: 0; height: 2px;
    background: var(--h-acento);
    transition: all .3s;
    transform: translateX(-50%);
}

.h-navbar .nav-link:hover { color: #fff; }
.h-navbar .nav-link:hover::after { width: 60%; }

.h-navbar .navbar-toggler { border-color: rgba(255,255,255,.4); }
.h-navbar .navbar-toggler-icon { filter: invert(1); }

@media (max-width: 991px) {
    .h-navbar .navbar-collapse {
        background: rgba(6, 24, 43, .97);
        border-radius: 14px;
        padding: 16px;
        margin-top: 10px;
    }
}

/* ---------- Botones ---------- */
.btn-h {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: none;
    border-radius: 50px;
    padding: 14px 30px;
    font-weight: 800;
    letter-spacing: .5px;
    text-decoration: none;
    transition: transform .25s, box-shadow .25s;
}

.btn-h:hover { transform: translateY(-3px); }

.btn-h-acento {
    background: linear-gradient(135deg, var(--h-acento), #e09400);
    color: #142033;
    box-shadow: 0 12px 28px rgba(244, 163, 0, .38);
}

.btn-h-acento:hover { color: #142033; box-shadow: 0 16px 34px rgba(244, 163, 0, .5); }

.btn-h-acento::after {
    content: "";
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: skewX(-25deg);
    animation: brillo 3.2s ease-in-out infinite;
}

@keyframes brillo { 0%, 60% { left: -80%; } 100% { left: 130%; } }

.btn-h-borde {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, .45);
}

.btn-h-borde:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .08); }

.btn-h-wa { background: var(--h-wa); color: #fff; box-shadow: 0 12px 28px rgba(37, 211, 102, .35); }
.btn-h-wa:hover { background: #128c7e; color: #fff; }

/* ---------- HERO ---------- */
.h-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(-45deg, #06182b, #0d3b66, #14538c, #0a2c4e);
    background-size: 380% 380%;
    animation: gradienteVivo 16s ease infinite;
    padding-top: 110px;
}

@keyframes gradienteVivo {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.h-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
    background-size: 34px 34px;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .5;
    pointer-events: none;
    animation: flotarBlob 12s ease-in-out infinite;
}

.blob-1 { width: 420px; height: 420px; background: rgba(244, 163, 0, .3); top: -120px; right: -80px; }
.blob-2 { width: 340px; height: 340px; background: rgba(20, 130, 220, .35); bottom: -100px; left: -90px; animation-delay: -4s; }
.blob-3 { width: 220px; height: 220px; background: rgba(255, 201, 77, .22); top: 40%; left: 30%; animation-delay: -8s; }

@keyframes flotarBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.08); }
    66% { transform: translate(-30px, 25px) scale(.94); }
}

.h-hero .container { position: relative; z-index: 3; }

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(244, 163, 0, .14);
    border: 1px solid rgba(244, 163, 0, .5);
    color: #ffd479;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 50px;
    padding: 8px 18px;
    margin-bottom: 20px;
    animation: aparecerArriba 1s ease .2s both;
}

.hero-nombre {
    font-weight: 800;
    font-size: clamp(2.6rem, 7vw, 5rem);
    line-height: .98;
    letter-spacing: -2px;
    margin-bottom: 8px;
    animation: aparecerArriba 1s ease .35s both;
}

.hero-nombre .resaltado {
    background: linear-gradient(120deg, var(--h-acento), var(--h-acento-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-lema {
    min-height: 2.4rem;
    font-size: clamp(1.05rem, 2.4vw, 1.45rem);
    color: #cfe1f5;
    font-style: italic;
    margin: 14px 0 30px;
    animation: aparecerArriba 1s ease .5s both;
}

.cursor-type {
    display: inline-block;
    width: 3px;
    background: var(--h-acento);
    margin-left: 4px;
    animation: parpadeo .8s steps(1) infinite;
}

@keyframes parpadeo { 50% { opacity: 0; } }

.hero-acciones { animation: aparecerArriba 1s ease .65s both; }

@keyframes aparecerArriba {
    from { opacity: 0; transform: translateY(35px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Foto PNG con aro giratorio + flotación + parallax por mouse */
.hero-foto-zona { position: relative; text-align: center; min-height: 380px; }

.aro-candidato {
    position: absolute;
    width: 430px; height: 430px;
    max-width: 92%;
    left: 50%; top: 52%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 2px dashed rgba(244, 163, 0, .5);
    animation: girar 40s linear infinite;
    pointer-events: none;
}

.aro-candidato::before, .aro-candidato::after {
    content: "";
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--h-acento);
    box-shadow: 0 0 16px var(--h-acento);
}

.aro-candidato::before { top: -7px; left: 50%; }
.aro-candidato::after { bottom: -7px; left: 20%; }

.halo-candidato {
    position: absolute;
    width: 340px; height: 340px;
    max-width: 80%;
    left: 50%; top: 55%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(244, 163, 0, .4) 0%, rgba(244, 163, 0, .08) 55%, transparent 75%);
    pointer-events: none;
    animation: latido 5s ease-in-out infinite;
}

.hero-foto {
    position: relative;
    z-index: 2;
    max-height: 480px;
    max-width: 100%;
    filter: drop-shadow(0 26px 38px rgba(0, 0, 0, .5));
    animation: flotarFoto 6s ease-in-out infinite;
    transition: transform .2s ease-out;
}

@keyframes flotarFoto {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -16px; }
}

.hero-sin-foto {
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: .3;
    font-size: 8rem;
}

/* indicador de scroll */
.scroll-abajo {
    position: absolute;
    bottom: 86px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    color: rgba(255, 255, 255, .7);
    font-size: 1.4rem;
    animation: rebote 1.8s ease-in-out infinite;
}

@keyframes rebote { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 12px); } }

/* ---------- Marquee de partidos ---------- */
.marquee-partidos {
    position: relative;
    z-index: 3;
    background: rgba(255, 255, 255, .07);
    border-top: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(6px);
    overflow: hidden;
    padding: 13px 0;
    white-space: nowrap;
}

.marquee-pista {
    display: inline-flex;
    align-items: center;
    animation: desplazar 28s linear infinite;
}

.marquee-partidos:hover .marquee-pista { animation-play-state: paused; }

@keyframes desplazar { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.m-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: rgba(255, 255, 255, .93);
    color: var(--h-oscuro);
    border-radius: 50px;
    padding: 6px 18px 6px 8px;
    font-weight: 800;
    font-size: .8rem;
    margin: 0 12px;
}

.m-chip img {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 1px solid #e3e9f2;
}

.m-chip .m-rol {
    display: block;
    font-size: .58rem;
    color: var(--h-gris);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.m-sep { color: var(--h-acento); font-size: .6rem; margin: 0 4px; }

/* ---------- Countdown ---------- */
.cuenta-regresiva {
    background: linear-gradient(135deg, #0a2c4e, var(--h-primario));
    border-radius: 24px;
    padding: 34px 26px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 24px 50px rgba(6, 24, 43, .3);
}

.cuenta-regresiva::after {
    content: "\F2F0";
    font-family: "bootstrap-icons";
    position: absolute;
    right: -20px; bottom: -50px;
    font-size: 11rem;
    opacity: .07;
    pointer-events: none;
}

.cr-caja {
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
    min-width: 86px;
    backdrop-filter: blur(4px);
}

.cr-caja b {
    display: block;
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 800;
    color: var(--h-acento-2);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cr-caja span {
    font-size: .66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, .65);
}

/* ---------- Secciones genéricas ---------- */
.h-tag {
    display: inline-block;
    background: rgba(13, 59, 102, .08);
    color: var(--h-primario);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 7px 18px;
    border-radius: 50px;
    margin-bottom: 14px;
}

.h-titulo { font-weight: 800; letter-spacing: -1px; color: var(--h-oscuro); }
.h-titulo .acento { color: var(--h-primario); }

/* ---------- Contadores ---------- */
.stat-card {
    background: #fff;
    border: 1px solid #e6ecf4;
    border-radius: 20px;
    padding: 26px 20px;
    text-align: center;
    height: 100%;
    box-shadow: 0 12px 30px rgba(8, 31, 54, .06);
    transition: transform .3s, box-shadow .3s;
    position: relative;
    overflow: hidden;
}

.stat-card:hover { transform: translateY(-8px); box-shadow: 0 22px 44px rgba(8, 31, 54, .12); }

.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--h-primario), var(--h-acento));
}

.stat-icono {
    width: 54px; height: 54px;
    border-radius: 16px;
    background: rgba(13, 59, 102, .08);
    color: var(--h-primario);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.stat-numero {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--h-oscuro);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: .74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--h-gris);
}

/* ---------- Biografía ---------- */
.bio-panel {
    position: relative;
    background: #fff;
    border-radius: 26px;
    padding: 48px 44px 42px;
    box-shadow: 0 20px 48px rgba(8, 31, 54, .08);
    border: 1px solid #e6ecf4;
    font-size: 1.05rem;
    line-height: 1.9;
    color: #37475f;
}

.bio-panel::before {
    content: "\F6B0";
    font-family: "bootstrap-icons";
    position: absolute;
    top: -26px; left: 34px;
    width: 56px; height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--h-acento), #d98f00);
    color: #142033;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 12px 26px rgba(244, 163, 0, .4);
}

.bio-panel p:last-child { margin-bottom: 0; }

.bio-panel::first-letter {
    font-size: 3rem;
    font-weight: 800;
    color: var(--h-primario);
    float: left;
    line-height: .9;
    padding-right: 12px;
}

.bio-firma {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 2px dashed #e3eaf3;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    color: var(--h-oscuro);
}

/* ---------- Galería ---------- */
.gal-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 8px;
    gap: 14px;
}

.gal-item {
    display: block;
    width: 100%;
    margin: 0;
    border: 0;
    padding: 0;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: #dfe7f1;
    align-self: start;
    box-shadow: 0 8px 24px rgba(6, 24, 43, .12);
    transform: translateZ(0);
    transition: transform .3s ease, box-shadow .3s ease;
}

.gal-item:nth-child(5n+2) { border-radius: 18px 38px 18px 18px; }
.gal-item:nth-child(7n+4) { border-radius: 38px 18px 18px 18px; }

.gal-item img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform .5s cubic-bezier(.2, .8, .3, 1), filter .5s;
}

.gal-item:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(6, 24, 43, .2); }
.gal-item:hover img { transform: scale(1.04); filter: brightness(1.06); }

.gal-item::after {
    content: "\F52A";
    font-family: "bootstrap-icons";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    background: linear-gradient(180deg, transparent 30%, rgba(6, 24, 43, .65));
    opacity: 0;
    transition: opacity .3s;
}

.gal-item:hover::after { opacity: 1; }

@media (max-width: 767px) {
    .gal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 6px; gap: 10px; }
    .gal-item { border-radius: 14px; }
    .gal-item:nth-child(5n+2), .gal-item:nth-child(7n+4) { border-radius: 14px 26px 14px 14px; }
}

/* ---------- CTA Red de Amigos ---------- */
.cta-red {
    position: relative;
    overflow: hidden;
    border-radius: 30px;
    padding: 60px 46px;
    color: #fff;
    text-align: center;
    background: linear-gradient(-45deg, #0a2c4e, var(--h-primario), var(--h-primario-2), #0a2c4e);
    background-size: 320% 320%;
    animation: gradienteVivo 12s ease infinite;
    box-shadow: 0 30px 60px rgba(6, 24, 43, .3);
}

.anillo {
    position: absolute;
    left: 50%; top: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: expandir 5s ease-out infinite;
    pointer-events: none;
}

.anillo-1 { width: 300px; height: 300px; }
.anillo-2 { width: 300px; height: 300px; animation-delay: 1.6s; }
.anillo-3 { width: 300px; height: 300px; animation-delay: 3.2s; }

@keyframes expandir {
    from { width: 220px; height: 220px; opacity: .9; }
    to { width: 720px; height: 720px; opacity: 0; }
}

.cta-red > * { position: relative; z-index: 2; }

/* ---------- Dock social flotante ---------- */
.dock-social {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dock-social a {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: rgba(6, 24, 43, .85);
    backdrop-filter: blur(6px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    text-decoration: none;
    transition: .25s;
    border: 1px solid rgba(255, 255, 255, .1);
}

.dock-social a:hover { background: var(--h-acento); color: #142033; transform: translateX(-5px) scale(1.08); }

@media (max-width: 991px) { .dock-social { display: none; } }

/* ---------- Botones flotantes ---------- */
.fab-wa {
    position: fixed;
    right: 20px; bottom: 20px;
    z-index: 1600;
    width: 58px; height: 58px;
    border-radius: 50%;
    background: var(--h-wa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
    text-decoration: none;
    box-shadow: 0 14px 30px rgba(37, 211, 102, .45);
    animation: latido 2.4s ease-in-out infinite;
}

.fab-wa:hover { color: #fff; background: #128c7e; }

.btn-subir {
    position: fixed;
    right: 24px; bottom: 92px;
    z-index: 1600;
    width: 46px; height: 46px;
    border-radius: 14px;
    border: none;
    background: var(--h-oscuro);
    color: #fff;
    font-size: 1.15rem;
    opacity: 0;
    visibility: hidden;
    transition: .3s;
}

.btn-subir.visible { opacity: 1; visibility: visible; }
.btn-subir:hover { background: var(--h-primario); }

/* ---------- Footer ---------- */
.h-footer {
    background: var(--h-oscuro);
    color: #9db4cd;
    padding: 46px 0 26px;
    font-size: .9rem;
    position: relative;
    overflow: hidden;
}

.h-footer::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--h-primario), var(--h-acento), var(--h-primario));
}

.h-footer a { color: #cfe1f5; text-decoration: none; }
.h-footer a:hover { color: var(--h-acento-2); }

/* ---------- Reveals (IntersectionObserver) ---------- */
.reveal { opacity: 0; transform: translateY(46px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .3, 1); }
.reveal.izq { transform: translateX(-56px); }
.reveal.der { transform: translateX(56px); }
.reveal.zoom { transform: scale(.86); }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
