/* =========================================================================
   hero.css — Portada inmersiva: esfera de red 3D, luz ambiental y
   tipografía cinética a gran escala.
   ========================================================================= */

.hero {
    position: relative;
    display: grid;
    align-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--header-h) + 32px) 0 clamp(88px, 11vh, 130px);
    overflow: hidden;
    isolation: isolate;
    /* Fondo de respaldo si el canvas no está disponible */
    background:
        radial-gradient(700px 520px at 68% 42%, rgba(37, 99, 235, 0.28), transparent 70%),
        radial-gradient(500px 380px at 80% 70%, rgba(99, 102, 241, 0.16), transparent 70%);
}

.hero-stage {
    position: absolute;
    inset: 0;
    z-index: -1;
}

/* Luz ambiental: un foco que sigue al puntero y un halo detrás de la esfera. */
.hero-light {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(520px circle at var(--lx, 68%) var(--ly, 42%), rgba(59, 130, 246, 0.2), transparent 65%),
        radial-gradient(420px 420px at 66% 46%, rgba(56, 189, 248, 0.12), transparent 70%),
        radial-gradient(900px 640px at 66% 46%, rgba(29, 78, 216, 0.24), transparent 70%),
        radial-gradient(600px 400px at 90% 90%, rgba(99, 102, 241, 0.12), transparent 70%);
}

.hero-canvas {
    touch-action: pan-y;
    cursor: grab;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 1600ms ease 150ms, transform 2200ms var(--ease) 150ms;
}

.hero.is-ready .hero-canvas.is-live {
    opacity: 1;
    transform: none;
}

.hero-labels {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.node-label {
    position: absolute;
    top: 0;
    left: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 11px;
    border: 1px solid rgba(147, 197, 253, 0.26);
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 74%, transparent);
    box-shadow: 0 6px 20px -10px rgba(37, 99, 235, 0.8);
    color: var(--blue-ice);
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    opacity: 0;
    will-change: transform, opacity;
}

.node-label::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
}

.hero-vignette {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--ink) 88%, transparent) 0%, color-mix(in srgb, var(--ink) 50%, transparent) 34%, transparent 60%),
        linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--ink) 35%, transparent) 20%, transparent 42%),
        linear-gradient(180deg, color-mix(in srgb, var(--ink) 60%, transparent) 0%, transparent 16%);
}

/* Transición suave hacia "Sobre mí" */
.hero-fade {
    position: absolute;
    inset: auto 0 0;
    z-index: 0;
    height: 120px;
    background: linear-gradient(180deg, transparent, var(--bg));
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    pointer-events: none;   /* la esfera sigue recibiendo el arrastre fuera del texto */
    will-change: transform, opacity;
}

.hero-copy {
    max-width: min(640px, 56%);
    pointer-events: auto;
}

@media (max-width: 1023px) {
    .hero-copy { max-width: 620px; }
}

.hero-kicker {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 45%, transparent);
    color: var(--text-soft);
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.hero-kicker .sep { color: var(--blue); }

/* Nombre a gran escala: limitado por ancho y por alto para evitar saltos en anchos intermedios. */
.hero-name {
    margin: 22px 0 0 -0.05em;
    font-family: var(--display);
    font-size: clamp(3rem, min(9.4vw, 17vh), 8.6rem);
    font-weight: 900;
    line-height: 0.86;
    letter-spacing: -0.06em;
    white-space: nowrap;
}

.hero-line {
    display: block;
    padding: 0.02em 0.06em 0.2em 0;
    margin-bottom: -0.2em;
    overflow: hidden;
}

.hero-word { display: inline-block; }

.char {
    display: inline-block;
    will-change: transform;
}

.hero-line:first-child {
    color: #fff;
    text-shadow: 0 2px 40px rgba(37, 99, 235, 0.25);
}

/* Apellido en contorno: trazo más firme y un relleno sutil para mejorar la lectura. */
.hero-line--outline {
    color: rgba(59, 130, 246, 0.1);
    -webkit-text-stroke: clamp(1.6px, 0.2vw, 2.8px) #a5c8ff;
    text-shadow: 0 0 34px rgba(59, 130, 246, 0.28);
}

.hero-line--outline .char:last-child {
    color: var(--blue);
    -webkit-text-stroke: 0;
    text-shadow: 0 0 24px rgba(59, 130, 246, 0.8);
}

.hero-role {
    margin-top: clamp(22px, 3vw, 34px);
    font-size: clamp(1.2rem, 0.95rem + 1.1vw, 1.8rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.hero-role .mask > span {
    background: linear-gradient(90deg, #fff 0%, var(--blue-ice) 30%, var(--blue-pale) 60%, var(--blue) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mask {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    padding-bottom: 0.08em;
    vertical-align: bottom;
}

.mask > span { display: inline-block; }

.hero-focus {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin-top: 14px;
}

.hero-focus-label {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-focus-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 9px;
    border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--c) 7%, color-mix(in srgb, var(--ink) 60%, transparent));
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 600;
}

.hero-focus-item .i { color: var(--c); font-size: 1rem; }

.hero-lead {
    max-width: 50ch;
    margin-top: 18px;
    color: var(--text-soft);
    font-size: clamp(1rem, 0.94rem + 0.3vw, 1.1rem);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: clamp(26px, 3vw, 36px);
}

/* Indicador de desplazamiento */
.scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 2;
    display: grid;
    justify-items: center;
    gap: 9px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    transform: translateX(-50%);
    transition: color var(--fast) ease, opacity var(--mid) ease;
}

.scroll-cue:hover { color: var(--text); }

.scroll-cue-mouse {
    position: relative;
    width: 22px;
    height: 34px;
    border: 1.5px solid rgba(147, 197, 253, 0.45);
    border-radius: 12px;
}

.scroll-cue-mouse span {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 3px;
    height: 7px;
    margin-left: -1.5px;
    border-radius: 2px;
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
}

.hero.is-scrolled-out .scroll-cue { opacity: 0; }

@media (max-width: 1023px), (max-height: 620px) {
    .scroll-cue-text { display: none; }
    .scroll-cue { bottom: 16px; }
}

@media (max-height: 520px) {
    .scroll-cue { display: none; }
}

/* Tableta: el texto se apoya en una viñeta más fuerte porque la esfera queda detrás. */
@media (max-width: 1023px) and (min-width: 720px) {
    .hero-vignette {
        background:
            linear-gradient(90deg, color-mix(in srgb, var(--ink) 85%, transparent) 0%, color-mix(in srgb, var(--ink) 45%, transparent) 50%, transparent 80%),
            linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--ink) 50%, transparent) 35%, transparent 60%);
    }
}

/* Móvil: esfera arriba, texto abajo. */
@media (max-width: 719px) {
    .hero {
        align-items: end;
        padding-top: calc(var(--header-h) + min(62vw, 420px));
        padding-bottom: 72px;
    }

    .hero-copy { max-width: 100%; }

    .hero-vignette {
        background:
            linear-gradient(0deg, var(--bg) 0%, color-mix(in srgb, var(--ink) 86%, transparent) 40%, color-mix(in srgb, var(--ink) 15%, transparent) 68%, color-mix(in srgb, var(--ink) 45%, transparent) 100%);
    }

    .hero-light {
        background:
            radial-gradient(420px 380px at 50% 30%, rgba(37, 99, 235, 0.32), transparent 70%),
            radial-gradient(260px 240px at 50% 30%, rgba(56, 189, 248, 0.12), transparent 70%);
    }

    .hero-kicker {
        padding: 0;
        border: 0;
        background: none;
        font-size: 0.68rem;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .hero-name { margin-top: 16px; font-size: clamp(2.9rem, min(15.5vw, 22vh), 6rem); }
    .hero-role { margin-top: 18px; }
    .hero-focus-label { flex-basis: 100%; }
    .hero-lead { font-size: 0.98rem; }

    .hero-actions .btn { flex: 1 1 180px; }

    .node-label { font-size: 0.62rem; padding: 4px 9px; }
}

/* Móvil horizontal: poca altura, el nombre se limita por la altura. */
@media (max-height: 520px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: calc(var(--header-h) + 24px) 0 48px;
    }

    .hero-copy { max-width: 60%; }
    .hero-name { font-size: clamp(2.6rem, 15vh, 5rem); }
}

/* ------------------------------- Tema claro ------------------------------- */
/* Tema claro: iluminación mínima detrás de la esfera, sin capas de color acumuladas */
[data-theme="light"] .hero { background: none; }

[data-theme="light"] .hero-light {
    background: radial-gradient(520px circle at var(--lx, 68%) var(--ly, 42%), rgba(37, 99, 235, 0.06), transparent 65%);
}

[data-theme="light"] .hero-line:first-child { color: var(--text); text-shadow: none; }
[data-theme="light"] .hero-line--outline { color: transparent; -webkit-text-stroke-color: #2563eb; text-shadow: none; }
[data-theme="light"] .hero-line--outline .char:last-child { text-shadow: none; }
[data-theme="light"] .hero-role .mask > span { background-image: linear-gradient(90deg, #142139 0%, #1e3a8a 45%, #2563eb 100%); }
[data-theme="light"] .node-label { border-color: var(--line-2); background: rgba(255, 255, 255, 0.92); color: var(--text-soft); box-shadow: 0 6px 16px -10px rgba(20, 33, 57, 0.35); }
