/* --- CSS Variables para paleta moderna y elegante --- */
:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --gradient-1: #3b82f6;
    --gradient-2: #8b5cf6;
}

/* Modo Claro */
body.light-mode {
    --bg-color: #f1f5f9;
    --text-color: #0f172a;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --gradient-1: #2563eb;
    --gradient-2: #7c3aed;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    position: relative;
    overflow-x: hidden;
}

/* --- Fondo Dinámico con gradientes suaves --- */
body::before, body::after {
    content: '';
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.4;
    transition: all 0.5s ease;
    animation: float 10s infinite ease-in-out alternate;
}

body::before {
    top: -10vw;
    left: -10vw;
    background: var(--gradient-1);
}

body::after {
    bottom: -10vw;
    right: -10vw;
    background: var(--gradient-2);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(20px) scale(1.05); }
}

/* --- Utilidad Glassmorphism (Efecto Cristal) --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* --- Encabezado --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
    transition: all 0.3s ease;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px 30px;
    border-radius: 20px;
}

header h1 {
    font-weight: 800;
    font-size: 1.5em;
    background: linear-gradient(to right, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header ul {
    list-style-type: none;
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
}

header a {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}

/* Efecto hover en enlaces */
header a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

header a:hover {
    color: var(--accent-hover);
}

header a:hover::after {
    width: 100%;
}

/* --- Contenido Principal --- */
main {
    flex: 1;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 40px;
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Perfil --- */
.profile-container {
    text-align: center;
    padding: 40px 20px;
    border-radius: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

body.light-mode .profile-container:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

.profile-container img.avatar {
    border-radius: 50%;
    margin-bottom: 20px;
    border: 4px solid var(--accent-color);
    padding: 4px;
    transition: transform 0.5s ease;
}

.profile-container:hover img.avatar {
    transform: scale(1.05) rotate(3deg);
}

.profile-container h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 800;
}

/* --- Sección de Herramientas --- */
.section h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: 600;
}

.languages-tools {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

.languages-tools a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 65px;
    height: 65px;
    border-radius: 16px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.languages-tools a:hover {
    transform: translateY(-5px) scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

body.light-mode .languages-tools a:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* --- Bienvenida --- */
.welcome-section {
    text-align: center;
    padding: 40px;
    border-radius: 24px;
}

.welcome-section h2 {
    font-size: 2em;
    margin-bottom: 15px;
}

/* --- Repositorios --- */
.repos-section h3 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 25px;
}

.repos-list {
    list-style-type: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.repos-list li {
    padding: 25px;
    border-radius: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

.repos-list li:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

body.light-mode .repos-list li:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.repos-list a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2em;
    transition: color 0.3s ease;
}

.repos-list a:hover {
    color: var(--accent-hover);
}

.repos-desc {
    font-size: 0.95em;
    opacity: 0.8;
    flex: 1;
}

/* --- Redes Sociales --- */
.social-media {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 30px;
    border-radius: 24px;
}

.social-media a {
    transition: transform 0.3s ease;
}

.social-media a:hover {
    transform: scale(1.1) translateY(-3px);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 30px;
    margin-top: auto;
    font-size: 0.9em;
    opacity: 0.7;
    font-weight: 300;
}

/* --- Switch Toggle (Modo Oscuro) --- */
.theme-toggle-container {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* --- Responsivo --- */
@media (max-width: 768px) {
    header nav {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    header ul {
        flex-direction: column;
        gap: 15px;
    }
    .profile-container h2 {
        font-size: 2em;
    }
    .welcome-section h2 {
        font-size: 1.5em;
    }
}
