:root {
    --bg: #05070a;
    --card-bg: #0f172a;
    --graphite: #1e293b;
    --teal: #0d9488;
    --teal-bright: #5eead4;
    --indigo: #6366f1;
    --indigo-bright: #818cf8;
    --text: #f1f5f9;
    --text-dim: #64748b;
    --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

/* --- MODERN SCROLLBAR --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, var(--teal), var(--indigo));
    border-radius: 10px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, var(--teal-bright), var(--indigo-bright));
}

#particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.3;
}

/* --- HEADER --- */
.avatar-container {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    transition: var(--transition);
    overflow: visible;
    /* Fix clipping of drop-shadow/halo */
}

.avatar-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--indigo));
    padding: 3px;
    position: relative;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: #000;
    filter: drop-shadow(0 0 10px var(--teal)) brightness(1.2) contrast(1.1) saturate(1.2);
}

.logo-letter {
    font-family: 'Allerta Stencil', sans-serif;
    background: linear-gradient(135deg, var(--teal-bright), var(--indigo-bright));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 400;
}

.header-info h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1;
}

.highlight {
    background: var(--teal);
    color: var(--bg);
    padding: 0 12px;
    border-radius: 4px;
    font-family: 'Allerta Stencil', sans-serif;
    font-weight: 400;
    display: inline-block;
    transform: rotate(-1deg);
    box-shadow: 0 0 20px rgba(13, 148, 136, 0.4);
}

.blink-cursor {
    animation: blink 1s step-end infinite;
    color: var(--teal-bright);
    font-weight: 800;
}

@keyframes blink {

    from,
    to {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* --- NARRATIVE SCRAMBLE EFFECTS --- */
.scramble-glow {
    box-shadow: 0 0 30px rgba(13, 148, 136, 0.6) !important;
    text-shadow: 0 0 10px rgba(94, 234, 212, 0.8);
    transition: all 0.5s ease;
}

.scramble-pulse {
    animation: heartbeat 0.5s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1);
    }

    50% {
        opacity: 0.6;
        filter: brightness(1.2);
    }
}

.header-subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    margin-top: 12px;
    font-weight: 400;
    letter-spacing: 1px;
}

/* --- REFLECTION BAR (Motto) --- */
.reflection-bar {
    width: 100%;
    max-width: 900px;
    margin: 30px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 10;
    position: relative;
    /* Advanced Anti-Ghosting & Isolation */
    isolation: isolate;
    contain: layout paint;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    transform: translateZ(0);
}

.motto-slash {
    width: 2px;
    /* Narrower as requested */
    height: 40px;
    /* More discrete for single line */
    background: linear-gradient(to bottom, var(--teal), var(--indigo));
    opacity: 0.8;
    flex-shrink: 0;
    border-radius: 0;
    /* Subtle glow shadow */
    box-shadow: 0 0 8px rgba(94, 234, 212, 0.4);
    /* Layer Isolation */
    backface-visibility: hidden;
    will-change: transform;
}

.reflection-content {
    max-width: 850px;
    /* Expanded for alignment with Core Focus cards */
    width: 100%;
    font-style: italic;
    color: #e9e4d1;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 1px;
    font-size: clamp(0.6rem, 0.5rem + 0.5vw, 0.75rem);
    /* Fluid typography */
    opacity: 0.6;
    /* Lower white color intensity */

    /* Subtle mirror/reflection effect */
    -webkit-box-reflect: below -2px linear-gradient(transparent 30%, rgba(233, 228, 209, 0.1));

    /* Extra isolation for ghosting */
    backface-visibility: hidden;
    transform: translateZ(0);
}

.post-hub-variant {
    margin: 40px auto;
    padding: 0 10px;
    border-top: none;
}

@media (max-width: 600px) {
    .reflection-bar {
        gap: 12px;
    }

    .motto-slash {
        height: 50px;
        /* Slightly taller for wrapping text */
    }

    .reflection-content {
        max-width: 90%;
        /* Allow more width on mobile for the single line */
    }
}



/* --- GDPR COOKIE CONSENT --- */
#cookie-consent {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#cookie-consent.hidden {
    opacity: 0;
    transform: translate(-50%, 20px);
    pointer-events: none;
}

.cookie-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-text {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.cookie-text a {
    color: var(--teal-bright);
    text-decoration: none;
    border-bottom: 1px solid var(--teal-bright);
}

.cookie-btn {
    background: var(--teal);
    color: var(--bg);
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.cookie-btn:hover {
    background: var(--teal-bright);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 148, 136, 0.3);
}

@media (max-width: 600px) {
    .cookie-content {
        flex-direction: column;
        text-align: center;
    }
}

/* --- CONTENEDORES --- */
.container {
    max-width: 900px;
    margin: 0 auto 60px;
    padding: 0 20px;
    z-index: 10;
    position: relative;
}

.section-title {
    font-size: 0.85rem;
    letter-spacing: 5px;
    color: var(--teal-bright);
    margin-bottom: 25px;
    text-transform: uppercase;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 60px;
}

/* Cards con efecto pulso */
/* --- SHARED CARD BASE --- */
.interactive-card,
.lab-box {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 20px;
    padding: 30px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        inset 0 -1px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    isolation: isolate;
}

/* --- EXPERIMENTAL LABS (Solid Laboratory) --- */
.lab-box {
    background: #0f172a;
    border-color: rgba(99, 102, 241, 0.3);
}

/* --- CORE FOCUS (Solid Core) --- */
.interactive-card {
    background: #05070a;
    border-color: rgba(13, 148, 136, 0.3);
}


.interactive-card:hover {
    border-color: var(--teal-bright);
    transform: translateY(-8px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(13, 148, 136, 0.3),
        inset 0 0 15px rgba(13, 148, 136, 0.2);
}

.lab-box:hover {
    border-color: var(--indigo-bright);
    transform: translateY(-8px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(99, 102, 241, 0.3),
        inset 0 0 15px rgba(99, 102, 241, 0.2);
}

.interactive-card i {
    color: var(--teal-bright);
    font-size: 1.5rem;
    margin-bottom: 15px;
    display: block;
}

.lab-box i {
    color: var(--indigo-bright);
    font-size: 1.5rem;
    margin-bottom: 15px;
    display: block;
}

.card-action {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.8rem;
    text-decoration: none;
    transition: var(--transition);
    z-index: 5;
    background: linear-gradient(135deg, var(--teal-bright), var(--indigo-bright));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    /* Static premium button */
}

@keyframes floating-brand {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.interactive-card:hover .card-action {
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(94, 234, 212, 0.4));
}

.card-action:hover {
    transform: scale(1.1);
    animation-play-state: paused;
}

.lab-box:hover .card-action {
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
}

.lab-box .card-action {
    background: linear-gradient(135deg, var(--indigo-bright), #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.labs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* --- CINTA SKILLS --- */
.skills-banner {
    width: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    z-index: 10;
    position: relative;
    margin-top: 40px;
}

.skills-track {
    display: flex;
    width: calc(180px * 24);
    animation: scroll-left 40s linear infinite;
}

.skills-banner:hover .skills-track {
    animation-play-state: paused;
}

.skill-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 180px;
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    transition: var(--transition);
    cursor: default;
}

.skill-separator {
    width: 80px;
    display: flex;
    justify-content: center;
    color: var(--teal);
    font-size: 1.2rem;
    pointer-events: none;
}

a.skill-item:hover {
    color: var(--teal-bright);
    cursor: pointer;
}

.skill-item i {
    color: var(--indigo);
    transition: var(--transition);
}

/* --- ANIMACIONES --- */
@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-180px * 12 - 80px * 2));
    }
}

@keyframes pulse-teal {
    0% {
        box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.4);
    }

    100% {
        box-shadow: 0 0 0 15px rgba(94, 234, 212, 0);
    }
}

@keyframes pulse-indigo {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    100% {
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
    }
}

footer {
    padding: 40px 20px;
    text-align: center;
    opacity: 0.8;
    position: relative;
    z-index: 10;
}

.main-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 35px;
    padding: 20px 20px 25px 20px;
    /* Internal padding to protect halo */
    margin: 0 auto;
    max-width: 900px;
    z-index: 1000;
    background: var(--bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: visible;
    /* Hardware Acceleration to prevent ghosting */
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* --- LARSON SCANNER (Knight Rider Effect) --- */
.larson-scanner {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 0, 0, 0.1);
    overflow: hidden;
}

.larson-scanner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -20%;
    width: 20%;
    height: 100%;
    background: linear-gradient(to right, transparent, #ff0000, transparent);
    box-shadow: 0 0 15px #ff0000;
    animation: scanner-loop 5s linear infinite;
}

@keyframes scanner-loop {
    0% {
        left: -20%;
    }

    45% {
        left: 100%;
    }

    50% {
        left: 100%;
    }

    95% {
        left: -20%;
    }

    100% {
        left: -20%;
    }
}

/* --- SOCIAL HUB --- */
.social-hub {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 30px auto 20px;
    max-width: 900px;
    padding: 0 20px;
    flex-wrap: wrap;
    z-index: 10;
    position: relative;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
}

.social-icon {
    color: var(--text-dim);
    font-size: 1.5rem;
    transition: var(--transition);
    text-decoration: none;
}

.social-icon:hover {
    color: var(--teal-bright);
    transform: translateY(-3px);
    text-shadow: 0 0 15px rgba(94, 234, 212, 0.4);
}

.footer-brand {
    font-size: 0.7rem;
    letter-spacing: 2px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }

    .main-header.scrolled .avatar-container {
        transform: scale(0);
        opacity: 0;
        margin-top: -80px;
        /* Pull up to save space without squashing content */
        margin-bottom: -15px;
        pointer-events: none;
    }

    .main-header .avatar-container {
        width: 80px;
        height: 80px;
        transform: scale(1);
        transition: transform 0.4s var(--transition), opacity 0.4s var(--transition), margin 0.4s var(--transition);
        /* GPU Layer Isolation */
        will-change: transform, opacity;
        backface-visibility: hidden;
    }

    .header-info h1 {
        font-size: 1.8rem;
    }

    .header-subtitle {
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }

    .section-title {
        margin-top: 0;
        margin-bottom: 15px;
    }

    .labs-grid {
        grid-template-columns: 1fr;
    }



    .container {
        margin-bottom: 30px;
    }

    .project-grid {
        margin-bottom: 30px;
    }
}

/* --- DIGITAL GARDEN ACCESS --- */
.garden-access {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 15px;
    border-radius: 50px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* margin-left: auto; - Removed for social-hub placement */
    flex-shrink: 0;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.garden-access::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50px;
    padding: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            transparent 35%,
            var(--indigo-bright) 50%,
            transparent 65%,
            transparent 100%);
    background-size: 150% 100%;
    -webkit-mask: linear-gradient(#f00 0 0) content-box, linear-gradient(#f00 0 0);
    mask: linear-gradient(#f00 0 0) content-box, linear-gradient(#f00 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: garden-scanner 2.5s ease-in-out infinite alternate;
    opacity: 0.6;
    transition: var(--transition);
}

.garden-access:hover::after {
    opacity: 1;
    animation-duration: 1s;
}

@keyframes garden-scanner {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.garden-access:hover {
    background: rgba(13, 148, 136, 0.15);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.garden-access i {
    color: var(--teal-bright);
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px rgba(94, 234, 212, 0.5));
}

.garden-label {
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

@media (max-width: 600px) {
    .garden-access {
        width: fit-content;
        padding: 8px 15px;
    }

    .garden-label {
        display: inline-block;
        font-size: 0.65rem;
    }
}

/* --- CUSTOM CURSOR --- */
@media (hover: hover) and (pointer: fine) {

    body,
    a,
    button,
    .interactive-card,
    .lab-box,
    .garden-access {
        cursor: none !important;
    }

    .cursor-dot {
        width: 14px;
        height: 18px;
        /* 3D Volume Effect for Arrow (Amber) */
        background: radial-gradient(circle at 20% 20%, #ffe066, #ffaa00 60%, #996600);
        position: fixed;
        z-index: 9999;
        pointer-events: none;
        transform: translate(-1px, -1px);
        /* Aligns tip with mouse coordinates */
        transition: width 0.2s, height 0.2s, background 0.2s;
        /* Custom Arrow Shape (pointing top-left) */
        clip-path: polygon(0% 0%, 0% 100%, 35% 70%, 100% 70%);
        filter: drop-shadow(0 0 5px #ffaa00);
    }

    .cursor-glow {
        width: 45px;
        height: 45px;
        border: none;
        position: fixed;
        border-radius: 50%;
        z-index: 9998;
        pointer-events: none;
        transform: translate(-50%, -50%);
        background: radial-gradient(circle, rgba(255, 170, 0, 0.05) 0%, transparent 70%);
        transition: width 0.3s ease-out, height 0.3s ease-out;
        will-change: transform;
        overflow: hidden;
    }

    /* KITT LED Scanner Effect (Infinite Circular Mode) */
    .cursor-glow::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        /* Sharper, brighter LED-style segment (Amber) */
        background: conic-gradient(from 0deg,
                transparent 0deg,
                transparent 160deg,
                rgba(255, 170, 0, 0.6) 175deg,
                #ffaa00 180deg,
                rgba(255, 170, 0, 0.6) 185deg,
                transparent 200deg,
                transparent 360deg);
        border-radius: 50%;
        /* Thicker ring for better visibility */
        mask: radial-gradient(circle, transparent 58%, black 59%);
        -webkit-mask: radial-gradient(circle, transparent 58%, black 59%);
        /* Brightness pop */
        filter: drop-shadow(0 0 8px #ffaa00);
        animation: kitt-rotate 1.2s linear infinite;
    }

    @keyframes kitt-rotate {
        from {
            transform: rotate(0deg);
        }

        to {
            transform: rotate(360deg);
        }
    }

    /* Hover States (Amber) */
    body.cursor-hover .cursor-dot {
        width: 18px;
        height: 24px;
        background: radial-gradient(circle at 20% 20%, #fff0b3, #ffaa00 60%, #cc8800);
        filter: drop-shadow(0 0 10px #ffaa00);
    }

    body.cursor-hover .cursor-glow {
        width: 65px;
        height: 65px;
        background: radial-gradient(circle, rgba(255, 170, 0, 0.2) 0%, transparent 70%);
    }
}

/* Fallback for touch devices */
@media (pointer: coarse) {

    .cursor-dot,
    .cursor-glow {
        display: none !important;
    }
}