@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;700;800&display=swap');

/* ── 1. VARIABLES DE TEMA (Azul Marino / Modo Oscuro por Defecto) ── */
:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #bae6fd;
    --text-muted: #94a3b8;
    --primary: #38bdf8;
    --sea-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    --sea-glow: rgba(56, 189, 248, 0.25);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(56, 189, 248, 0.4);
    --radius: 16px;
}

/* ── Tema Claro ── */
body.light-theme {
    --bg-main: #f0f9ff;
    --bg-card: #ffffff;
    --bg-card-hover: #e0f2fe;
    --text-primary: #0f172a;
    --text-secondary: #0284c7;
    --text-muted: #64748b;
    --border-color: rgba(2, 132, 199, 0.15);
    --border-hover: rgba(2, 132, 199, 0.4);
    --sea-glow: rgba(2, 132, 199, 0.2);
}

/* ── 2. RESET Y ESTILOS BASE ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── 3. HEADER FLOTANTE CON LOGO SIN CIRCULO ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    transition: background 0.3s ease;
}

body.light-theme .header {
    background: rgba(240, 249, 255, 0.85);
}

.header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.logo-container:hover {
    transform: translateY(-1px);
}

/* Contenedor del Logo (Adaptable, Sin Círculo) */
.header-logo-frame {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo-frame img {
    height: 50px !important;
    width: auto !important; /* Mantiene la proporción natural sin deformar */
    max-height: 50px !important;
    object-fit: contain; /* Muestra el logo completo sin recortes */
    display: block;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.logo-text span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 15px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Botón Conmutador de Tema */
.theme-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Botón Hamburguesa oculto por defecto en escritorio */
.menu-toggle {
    display: none;
}

/* ── 4. HERO SECTION INTERACTIVO & GLASSMORPHISM ── */
.hero-card {
    position: relative;
    padding: 50px 40px;
    margin: 40px 0;
    border-radius: 24px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out;
}

body.light-theme .hero-card {
    background: rgba(255, 255, 255, 0.6);
}

/* Resplandor dinámico en la esquina */
.hero-card::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-card * {
    position: relative;
    z-index: 1;
}

.gradient-text {
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.hero-card h1 {
    font-size: 3rem;
    letter-spacing: -1.5px;
    line-height: 1.15;
    margin-bottom: 10px;
}

.hero-card h2 {
    color: var(--text-secondary);
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.hero-card p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 650px;
    margin-bottom: 25px;
}

/* Badge con luz verde viva */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Skills Pills */
.hero-tech-stack {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.hero-tech-stack span {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.hero-tech-stack span:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* ── 5. BOTONES Y ACCIONES ── */
.hero-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sea-gradient);
    color: #ffffff;
    padding: 12px 26px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

.btn-glow {
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    transition: all 0.3s ease;
}

.btn-glow:hover {
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.7);
    transform: translateY(-2px);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    padding: 12px 22px;
    border-radius: var(--radius);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    border-color: var(--primary);
    background: rgba(56, 189, 248, 0.08);
}

/* ── 6. CARDS DE PROYECTOS (CON RELIEVE Y PROFUNDIDAD 3D) ── */
.proyectos {
    padding: 20px 0 60px;
}

.section-title {
    margin-bottom: 25px;
}

.section-title h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.section-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* Tarjeta principal con relieve */
.card {
    position: relative;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    
    /* Bisel superior (luz interior) + Sombra multinivel para efecto flotante */
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.5),
        0 4px 6px -2px rgba(0, 0, 0, 0.3),
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.12);
        
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.35s ease, 
                border-color 0.35s ease;
}

/* Línea de acento neón en la parte superior */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sea-gradient);
    opacity: 0.25;
    transition: opacity 0.3s ease;
}

/* Elevación 3D y resplandor al pasar el cursor */
.card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: var(--border-hover);
    box-shadow: 
        0 20px 35px -10px rgba(56, 189, 248, 0.3),
        0 10px 20px -5px rgba(0, 0, 0, 0.6),
        inset 0 1px 2px 0 rgba(255, 255, 255, 0.25);
}

.card:hover::before {
    opacity: 1;
}

/* Adaptación del relieve para el Tema Claro */
body.light-theme .card {
    background: linear-gradient(145deg, #ffffff 0%, #f0f9ff 100%);
    box-shadow: 
        0 12px 25px -5px rgba(2, 132, 199, 0.08),
        0 4px 10px -2px rgba(0, 0, 0, 0.04),
        inset 0 1px 1px 0 rgba(255, 255, 255, 1);
}

body.light-theme .card:hover {
    box-shadow: 
        0 20px 35px -10px rgba(2, 132, 199, 0.22),
        0 8px 15px -4px rgba(0, 0, 0, 0.06);
}

.card-img-wrapper {
    width: 100%;
    height: 180px;
    border-radius: calc(var(--radius) - 6px);
    overflow: hidden;
    margin-bottom: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 18px;
    flex-grow: 1;
}

.card-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.2s ease;
}

.card-link:hover {
    transform: translateX(4px);
}

.empty-box {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px dashed var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

.view-more {
    text-align: center;
    margin-top: 35px;
}

.link-more {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    font-size: 1.05rem;
}

/* ── 7. FOOTER ── */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 60px;
    background: rgba(0, 0, 0, 0.05);
}

.copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── 8. ADAPTATIVO PARA MÓVILES (Media Queries) ── */
/* ── 8. ADAPTATIVO PARA MÓVILES (Media Queries) ── */
@media (max-width: 768px) {
    .header {
        padding: 10px 0;
        position: relative; /* Evita conflictos de capas en móviles */
        z-index: 1000;
    }

    /* Activar y dar estilo al botón hamburguesa */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 26px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001; /* Asegura estar por encima de todo */
        -webkit-tap-highlight-color: transparent; /* Quita el recuadro gris al tocar en celular */
    }

    .menu-toggle span {
        width: 100%;
        height: 3px;
        background-color: var(--text-primary);
        border-radius: 3px;
        transition: all 0.3s ease;
    }

    /* Transformación del botón a una X al abrir */
    .menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* Menú flotante móvil totalmente corregido */
    .nav-links {
        position: absolute;
        top: 100%; /* Se posiciona exactamente debajo del header */
        left: 0;
        width: 100%;
        background: #0f172a; /* Color sólido para evitar transparencias fallidas en Safari mobile */
        flex-direction: column;
        align-items: center;
        gap: 20px;
        padding: 25px 0;
        border-bottom: 2px solid var(--primary);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
        z-index: 999;
        
        /* Control estricto de visibilidad */
        opacity: 0;
        visibility: hidden;
        pointer-events: none; /* Inhabilita eventos táctiles cuando está oculto */
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }

    body.light-theme .nav-links {
        background: #f0f9ff;
    }

    /* Clase que activa la apertura desde JS */
    .nav-links.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto; /* Habilita los clics/toques al desplegarse */
        transform: translateY(0);
    }

    .nav-links a {
        font-size: 1.1rem;
        width: 100%;
        text-align: center;
        padding: 8px 0;
    }

    /* Ajustes para el Hero y Main en móviles */
    main.container {
        padding-top: 10px;
    }

    .hero-card {
        padding: 30px 20px;CARDS DE PROYECTOS
        margin: 20px 0;
    }

    .hero-card h1 {
        font-size: 2rem;
    }

    .hero-card h2 {
        font-size: 1.15rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .btn, .btn-outline {
        text-align: center;
        width: 100%;
    }
}

/* ── CORRECCIÓN DE ESTRUCTURA Y ALINEACIÓN DE FORMULARIOS ── */
.form-container {
    max-width: 600px;
    margin: 0 auto 40px auto;
    padding: 35px;
    width: 100%;
}

.contacto-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 100%;
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.form-group label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.contacto-form input,
.contacto-form textarea {
    width: 100%;
    display: block;
    box-sizing: border-box;
    padding: 14px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.25s ease;
}

.contacto-form input:focus,
.contacto-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--sea-glow);
}

.contacto-form textarea {
    resize: vertical;
    min-height: 120px;
}

.contacto-form button {
    width: 100%;
    margin-top: 10px;
    padding: 14px;
    font-size: 1rem;
}