/* ==================== MOBILE FIRST STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

main {
    margin-left: 0;
    transition: margin-left 0.5s ease-in-out;
}

/* ==================== CUSTOM CURSOR ==================== */
body {
    background-color: #050505;
    color: #f5f5f5;
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    cursor: none;
    /* Ocultar cursor por defecto */
}

/* Cursor personalizado - Círculo cyan simple */
/* Custom Cursor */
.custom-cursor {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 242, 254, 0.6);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 10002;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    will-change: transform;
}

/* Cursor hover - Animación sutil con fondo */
.custom-cursor.hover {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, rgba(0, 242, 254, 0.05) 70%, transparent 100%);
    border-color: rgba(0, 242, 254, 0.8);
    animation: pulse-cursor 1.5s ease-in-out infinite;
}

@keyframes pulse-cursor {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Eliminar cursor de todos los elementos */
*,
*::before,
*::after {
    cursor: none !important;
}



/* Añadir transición suave al botón hamburguesa */
#burger-btn {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

h1,
h2,
h3,
.font-syne {
    font-family: 'Syne', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Ajuste de leading mejorado para evitar colisiones verticales */
h1 {
    line-height: 1.05 !important;
}

h2 {
    line-height: 1.15 !important;
}

h3 {
    line-height: 1.2 !important;
}

.text-gradient {
    background: linear-gradient(90deg, #00f2fe 0%, #4facfe 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* SECCIONES FULL SCREEN */
#hero,
#pillars,
#about,
#playground,
#contact {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* Hero siempre estricto con la altura */
#hero {
    height: 100vh;
    height: 100dvh;
}

/* ==================== MOBILE & TABLET: Header + Menu Overlay ==================== */
@media (max-width: 1023px) {

    /* Ocultar sidebar completamente */
    #vertical-sidebar {
        display: none !important;
    }

    #burger-btn {
        display: none !important;
    }

    /* Mostrar header móvil */
    #mobile-header {
        display: flex !important;
    }

    /* Main con mínimo padding para el header */
    main {
        margin-left: 0 !important;
        padding-top: 4rem !important;
    }

    /* Menu overlay - SIEMPRE fullscreen */
    #mobile-menu-overlay {
        width: 100% !important;
        height: 100% !important;
        transform: translateX(-100%);
        transition: transform 0.3s ease-out;
    }

    #mobile-menu-overlay.active {
        display: flex !important;
        transform: translateX(0);
    }

    /* Links del menú móvil */
    .mobile-nav-link {
        opacity: 0;
        transform: translateX(-20px);
        transition: all 0.3s ease-out;
    }

    #mobile-menu-overlay.active .mobile-nav-link {
        opacity: 1;
        transform: translateX(0);
    }

    /* Delay escalonado */
    #mobile-menu-overlay.active .mobile-nav-link:nth-child(1) {
        transition-delay: 0.1s;
    }

    #mobile-menu-overlay.active .mobile-nav-link:nth-child(2) {
        transition-delay: 0.15s;
    }

    #mobile-menu-overlay.active .mobile-nav-link:nth-child(3) {
        transition-delay: 0.2s;
    }

    #mobile-menu-overlay.active .mobile-nav-link:nth-child(4) {
        transition-delay: 0.25s;
    }

    #mobile-menu-overlay.active .mobile-nav-link:nth-child(5) {
        transition-delay: 0.3s;
    }

    /* ==== TRAYECTORIA PROFESIONAL: Título arriba al 100% ==== */
    #about .flex {
        flex-direction: column !important;
    }

    #about>div>div:first-child {
        width: 100% !important;
        margin-bottom: 2rem;
    }

    #about>div>div:last-child {
        width: 100% !important;
    }

    #about .sticky {
        position: relative !important;
        top: 0 !important;
    }

    /* Experiencias sin altura fija en móvil */
    #experiences-container {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }

    /* Hamburguesa se transforma en X cuando menú abierto */
    #mobile-menu-btn.menu-open div:nth-child(1) {
        transform: rotate(45deg) translate(4px, 4px);
    }

    #mobile-menu-btn.menu-open div:nth-child(2) {
        opacity: 0;
    }

    #mobile-menu-btn.menu-open div:nth-child(3) {
        transform: rotate(-45deg) translate(4px, -4px);
    }

    /* Transición suave para las líneas */
    #mobile-menu-btn div {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
}

/* MOBILE SOLO (<768px): Hero compacto sin imagen */
@media (max-width: 767px) {
    #hero {
        padding-top: 4rem !important;
        /* Espacio para header */
        padding-bottom: 0 !important;
        min-height: 100dvh !important;
        height: 100dvh !important;
        align-items: flex-start !important;
    }

    #hero>div {
        height: 100% !important;
        /* Llenar altura */
    }

    #hero>div>div:first-child {
        justify-content: center !important;
        /* Centrar texto verticalmente si sobra espacio */
        padding-top: 0 !important;
        padding-bottom: 30vh !important;
        /* Dejar espacio para la imagen abajo */
    }
}

/* DESKTOP: Sidebar visible */
@media (min-width: 769px) {
    #vertical-sidebar {
        width: 80px;
        opacity: 1;
    }

    #vertical-sidebar.expanded {
        width: 430px;
    }

    /* Ocultar navegación vertical cuando está expandido */
    #vertical-sidebar.expanded nav {
        opacity: 0;
        pointer-events: none;
    }

    /* Mostrar iconos en pantallas con poca altura */
    @media (max-height: 900px) {
        .nav-icon {
            display: block !important;
            min-width: 20px;
            /* Ensure icon size stability */
        }

        #nav-menu {
            align-items: flex-start !important;
            /* Start from left to expand right */
            gap: 1.5rem !important;
            width: 100%;
            /* Ensure container fills width for alignment */
            overflow: visible !important;
        }

        .nav-link {
            /* Center icon: Sidebar 80px, Icon 20px -> Padding left ~30px */
            padding-left: 30px;
            padding-right: 0;
            height: 44px;
            display: flex;
            align-items: center;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            background: transparent;
            border-radius: 0 22px 22px 0;
            /* Pill shape expanding right */
            width: fit-content;
        }

        .nav-link:hover {
            background: rgba(255, 255, 255, 0.08);
            padding-right: 24px;
            backdrop-filter: blur(4px);
        }

        /* Texto desplegable */
        .nav-link-text {
            display: block !important;

            /* Reset vertical text props */
            writing-mode: horizontal-tb !important;
            text-orientation: mixed !important;
            font-size: 11px !important;
            white-space: nowrap;
            letter-spacing: 0.15em;

            /* Animation props */
            max-width: 0;
            opacity: 0;
            margin-left: 0;
            overflow: hidden;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

            /* Visual corrections */
            transform: translateY(1px);
            /* Optical alignment */
        }

        .nav-link:hover .nav-link-text {
            max-width: 200px;
            opacity: 1;
            margin-left: 16px;
        }
    }

    main {
        margin-left: 80px;
    }
}

/* ==================== TEXTO CON TRANSICIÓN VERTICAL → HORIZONTAL ==================== */
.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-link-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    white-space: nowrap;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

/* Cuando el sidebar se expande */
#vertical-sidebar.expanded .nav-link-text {
    writing-mode: horizontal-tb;
    font-size: 2rem;
    letter-spacing: 0.05em;
    transform: rotate(0deg);
}

@media (min-width: 769px) {
    .nav-link-text {
        font-size: 12px;
    }
}

/* ==================== ANIMACIÓN DEL MENÚ EXPANDIDO ==================== */
.expanded-content {
    opacity: 0;
}

.expanded-content.active {
    opacity: 1;
}

/* Animación del hamburger */
#vertical-sidebar.expanded .burger-line-1 {
    transform: rotate(45deg) translate(5px, 5px);
}

/* Mantener botón hamburguesa en posición fija cuando se expande */
#vertical-sidebar.expanded #burger-btn {
    position: fixed;
    left: 20px;
    top: 80px;
    width: 80px;
}

#vertical-sidebar.expanded .burger-line-2 {
    opacity: 0;
}

#vertical-sidebar.expanded .burger-line-3 {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==================== 3D CONTAINER ==================== */
#three-canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.outline-text {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.15);
    color: transparent;
}

.bento-card {
    background: rgba(15, 15, 15, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.bento-card:hover {
    border-color: rgba(0, 242, 254, 0.4);
    background: rgba(20, 20, 20, 0.8);
    transform: translateY(-5px);
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: #050505;
}

::-webkit-scrollbar-thumb {
    background: #222;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00f2fe;
}

section {
    position: relative;
    z-index: 10;
}

/* Sticky fix for mobile */
@media (max-width: 768px) {
    .sticky {
        position: relative !important;
        top: 0 !important;
    }
}

/* ==================== MOBILE & TABLET RESPONSIVE ==================== */

/* Restaurar cursor nativo en dispositivos táctiles */
@media (max-width: 1024px) {
    body {
        cursor: auto;
    }

    *,
    *::before,
    *::after {
        cursor: auto !important;
    }

    .custom-cursor {
        display: none !important;
    }
}

/* Tablet: 768px - 1024px */
@media (min-width: 768px) and (max-width: 1024px) {

    /* Reducir espaciado de secciones */
    section {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    /* Grid de proyectos más compacto */
    .bento-card {
        padding: 1.5rem !important;
    }

    /* AI Sprint stats en 2 columnas */
    #ai-sprint .grid {
        gap: 1rem;
    }
}

/* Mobile: < 768px */
@media (max-width: 767px) {

    /* Tipografía más pequeña */
    h1 {
        font-size: 2.5rem !important;
    }

    h2 {
        font-size: 1.75rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    /* Secciones con menos padding */
    section {
        padding: 3rem 1rem !important;
    }

    /* Hero ajustes */
    #hero {
        padding-top: 5rem !important;
        min-height: auto !important;
        height: auto !important;
    }

    #hero .grid {
        grid-template-columns: 1fr !important;
    }

    /* Ocultar imagen del hero en móvil */
    #hero>div>div:last-child {
        display: none !important;
    }

    /* Pillars en columna */
    #pillars .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Experiencias: altura auto en móvil */
    #experiences-container {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }

    /* Proyectos en 1 columna */
    #playground .grid {
        grid-template-columns: 1fr !important;
    }

    .project-card {
        min-height: 120px !important;
    }

    /* Blog cards en columna */
    #blog .grid {
        grid-template-columns: 1fr !important;
    }

    /* Contacto layout */
    #contact .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* AI Sprint: stats en columna */
    #ai-sprint .grid {
        grid-template-columns: 1fr !important;
    }

    #ai-sprint video {
        aspect-ratio: 16/9;
    }

    /* Ocultar notas manuscritas en móvil (muy pequeñas) */
    .font-hand {
        font-size: 1.25rem !important;
    }

    /* Footer más compacto */
    footer {
        flex-direction: column !important;
        text-align: center;
        gap: 1rem !important;
        padding: 2rem 1rem !important;
    }

    /* Bento cards más pequeñas */
    .bento-card {
        padding: 1.25rem !important;
        border-radius: 1.5rem !important;
    }

}

/* Responsive: Botones en móvil */
@media (max-width: 768px) {
    #btt-btn {
        width: 48px !important;
        height: 48px !important;
        bottom: 1.5rem !important;
        right: 1rem !important;
    }

    /* Ajustar botón de chat en móvil */
    #ai-assistant {
        bottom: 84px !important;
        right: 16px !important;
    }

    .ai-activate-btn {
        font-size: 11px !important;
        padding: 12px 20px !important;
    }
}

/* Extra small: < 400px */
@media (max-width: 400px) {
    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    section {
        padding: 2rem 0.75rem !important;
    }

    .bento-card {
        padding: 1rem !important;
        border-radius: 1rem !important;
    }

    /* Reducir tamaño de iconos y badges */
    .text-brand.text-\[10px\] {
        font-size: 8px !important;
    }
}

/* ==================== LEAFLET MAP CUSTOMIZATION ==================== */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(0, 242, 254, 0.2) !important;
    border-radius: 8px !important;
    color: #fff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.custom-map-popup .leaflet-popup-content {
    margin: 12px 16px !important;
    line-height: 1.4 !important;
}

.custom-map-popup h4 {
    color: #fff !important;
}

.custom-map-popup p {
    color: #bbb !important;
}

.leaflet-container {
    background: #050505 !important;
    /* Match body bg to avoid white flash */
    font-family: 'Inter', sans-serif !important;
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.5) !important;
    color: #666 !important;
    font-size: 9px !important;
}

.leaflet-control-attribution a {
    color: #888 !important;
}

/* ==================== BUTTON STYLES SYSTEM ==================== */
/* Base Button Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    /* Pill shape */
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
    letter-spacing: 0.15em;
    position: relative;
    overflow: hidden;
}

/* Primary Button (Solid Gradient) */
.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    background-size: 200% 200%;
    color: #000;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
    animation: gradientShift 3s ease infinite;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 30px rgba(0, 242, 254, 0.6);
}

/* Secondary/Outline Button */
.btn-outline {
    background: transparent;
    border: 1px solid rgba(0, 242, 254, 0.5);
    color: #00f2fe;
}

.btn-outline:hover {
    background: rgba(0, 242, 254, 0.1);
    border-color: #00f2fe;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
    transform: translateY(-2px);
}

/* Animation for gradients */
@keyframes gradientShift {

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

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