/* ===== VARIABLES Y ESTILOS BASE ===== */
:root {
    --color-background: #111111;
    --color-surface: #1D1D1F;
    --color-primary-text: #F5F5F7;
    --color-secondary-text: #A1A1A6;
    --color-border: #3A3A3C;
    --color-accent-start: #007AFF; /* Azul */
    --color-accent-end: #BF5AF2; /* Púrpura */

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius: 18px;
    --gradient: linear-gradient(90deg, var(--color-accent-start), var(--color-accent-end));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-primary-text);
    /* NUEVO: Sutil patrón de puntos para dar textura */
    background-image: radial-gradient(var(--color-border) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* NUEVO: Barra de progreso de scroll */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--gradient);
    width: 0%;
    z-index: 200;
    animation: progress-bar linear;
    animation-timeline: scroll(root);
}
@keyframes progress-bar { from { width: 0%; } to { width: 100%; } }

/* ===== HEADER Y NAVEGACIÓN ===== */
.main-header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 0;
    background-color: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary-text);
    text-decoration: none;
}

.main-nav ul { list-style: none; display: flex; gap: 2rem; }
.main-nav a {
    color: var(--color-secondary-text);
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}
.main-nav a:hover { color: var(--color-primary-text); }

/* ===== ESTILOS DE SECCIÓN ===== */
.section-container { 
    padding: 8rem 0; 
    opacity: 0;
    transform: translateY(30px);
    animation: fadeIn-up 1s ease forwards;
    animation-timeline: view();
    animation-range-start: entry 10%;
    animation-range-end: entry 40%;
}
.text-center { text-align: center; }

.section-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.section-intro {
    font-size: 1.25rem;
    color: var(--color-secondary-text);
    max-width: 750px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== HERO SECTION REFINADO ===== */
#hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 5rem;
    text-align: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: var(--color-primary-text);
    text-shadow: 0 0 20px rgba(245, 245, 247, 0.2);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn-up-delay 0.8s ease forwards;
}

.hero-subtitle.animated-gradient-text {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn-up-delay 0.8s 0.2s ease forwards;
}

.animated-gradient-text {
    background: var(--gradient);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text; /* estándar para compatibilidad */
    color: transparent; /* fallback para navegadores no-WebKit que soporten background-clip:text */
    -webkit-text-fill-color: transparent;
    animation: gradient-flow 4s linear infinite;
}

.hero-intro {
    font-size: 1.2rem;
    color: var(--color-secondary-text);
    max-width: 550px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn-up-delay 0.8s 0.3s ease forwards;
}

.button-primary {
    background: var(--gradient);
    color: #fff;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn-up-delay 0.8s 0.4s ease forwards;
    border: none;
    box-shadow: 0 8px 25px rgba(191, 90, 242, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.button-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(191, 90, 242, 0.6);
}

/* (El resto de los estilos base de botones, etc. se mantienen) */
.button {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}
.button-secondary {
    background-color: var(--color-surface);
    color: var(--color-primary-text);
    border: 1px solid var(--color-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.button-secondary:hover {
    background-color: #2c2c2e;
    border-color: #555;
}


/* ===== LÍNEA DE TIEMPO (TIMELINE) REFINADA ===== */
.timeline {
    position: relative;
    max-width: 900px;
    margin: 4rem auto 0;
}
.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background: var(--color-border);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
}
.timeline-item { padding: 10px 40px; position: relative; width: 50%; }
.timeline-item.left { left: 0; }
.timeline-item.right { left: 50%; }

.timeline-content {
    padding: 1.5rem;
    background-color: var(--color-surface);
    position: relative;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease;
}
.timeline-item:hover .timeline-content { transform: translateY(-5px); }

/* NUEVO: Borde con brillo al hover */
.timeline-content::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--border-radius);
    background: var(--gradient);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.timeline-item:hover .timeline-content::before { opacity: 1; }

.timeline-icon {
    position: absolute;
    top: 20px;
    width: 44px;
    height: 44px;
    background-color: var(--color-background);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: border-color 0.3s ease;
}
.timeline-icon svg { color: var(--color-secondary-text); transition: color 0.3s ease; }
.timeline-item.left .timeline-icon { right: -22px; }
.timeline-item.right .timeline-icon { left: -22px; }

.timeline-item:hover .timeline-icon { border-color: var(--color-accent-start); }
.timeline-item:hover .timeline-icon svg { color: var(--color-primary-text); }

.timeline-date {
    display: block;
    color: var(--color-secondary-text);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.timeline-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-primary-text);
    margin-bottom: 0.5rem;
}
.timeline-description {
    color: var(--color-secondary-text);
    line-height: 1.6;
}


/* ===== GRID DE PROYECTOS REFINADO ===== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
}

.project-card {
    background-color: var(--color-surface);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
    text-decoration: none;
    display: block;
    position: relative;
    transition: transform 0.4s ease;
}
.project-card:hover { transform: translateY(-8px); }

/* NUEVO: Borde con brillo al hover para proyectos */
.project-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--border-radius);
    background: var(--gradient);
    z-index: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.project-card:hover::before { opacity: 1; }

.project-image-wrapper {
    width: 100%;
    height: 250px;
    overflow: hidden;
    position: relative; /* Para que el borde no afecte a la imagen */
    z-index: 1;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}
.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.project-card:hover img { transform: scale(1.05); }

.card-content {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
    background-color: var(--color-surface); /* Esto cubre el borde inferior */
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}
/* ... resto de estilos de card-content, etc. ... */
.card-content h3 { font-size: 1.4rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--color-primary-text); }
.card-content p { color: var(--color-secondary-text); margin-bottom: 1.5rem; }
.card-link { color: var(--color-accent-start); font-weight: 600; }


/* ===== NUEVO: SECCIÓN DE HABILIDADES ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 4rem;
}
.skill-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    position: relative;
    transition: transform 0.3s ease;
}
.skill-card:hover { transform: translateY(-5px); }
.skill-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--border-radius);
    background: var(--gradient);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}
.skill-card:hover::before { opacity: 1; }
.skill-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-primary-text);
}
.skill-card ul {
    list-style: none;
    padding: 0;
}
.skill-card ul li {
    color: var(--color-secondary-text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}
.skill-card ul li::before {
    content: '›';
    color: var(--color-accent-start);
    font-weight: bold;
    margin-right: 0.75rem;
    font-size: 1.5rem;
}

/* ===== FOOTER Y ANIMACIONES ===== */
.main-footer {
    padding: 2.5rem 0;
    border-top: 1px solid var(--color-border);
    margin-top: 6rem;
}

.main-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-secondary-text);
    font-size: 0.9rem;
}

.footer-links { display: flex; gap: 1.5rem; }
.footer-links a { color: var(--color-secondary-text); text-decoration: none; }
.footer-links a:hover { color: var(--color-primary-text); text-decoration: underline; }

@keyframes fadeIn-up { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn-up-delay { to { opacity: 1; transform: translateY(0); } }
@keyframes gradient-flow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* ===== DISEÑO RESPONSIVE ===== */
@media (max-width: 768px) {
    .main-header .container { flex-direction: column; gap: 1rem; }
    
    .hero-title { font-size: 2.5rem; }
    .hero-subtitle.animated-gradient-text { font-size: 1.5rem; }
    .section-title { font-size: 2.2rem; }
    .section-intro { font-size: 1.1rem; }

    .timeline::after { left: 22px; margin-left: 0; }
    .timeline-item { width: 100%; padding-left: 60px; padding-right: 10px; }
    .timeline-item.left, .timeline-item.right { left: 0; }
    .timeline-item.left .timeline-icon, .timeline-item.right .timeline-icon { left: 0; }
}
