/* ==========================
   VARIABLES GLOBALES
========================== */
:root {
    transition: background-color 0.4s ease, color 0.4s ease;
}

body,
header,
main,
section,
article,
footer,
.hero {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

:root[data-theme="light"] {
    --bg: #f0f0f0;
    --header-bg: #f5f5f5e6;
    --header-shadow: #0000001a;
    --hero-gradient: #4e96ff26;
    --profile-shadow: #4e96ff4d;
    --hero-bg: #e1efe9;
    --title-gradient-start: #242424;
    --title-gradient-end: #0c0c0c;
    --switch-track-bg: #b9cfe7;
    /* Barra del interruptor que cambia el tema */
    --switch-thumb-bg: #3955f0;
    --button-active-text: #f5f5f5;
    --text-gradient-start: #383838;
    --text-gradient-end: #2b2b2b;
    --green-bg: #49b42f;
    --cyan-bg: #268bd2;
    --magenta-bg: #bc36c6;
    --card-border: #c2c2c2;
    --card-shadow: #0000001a;
    --hover-color: #eaeaea;
    --external-link: #2563eb;
    --date-border-start: #02fcef70;
    --date-border-middle: #ffb52b70;
    --date-border-end: #a02bfe70;
}

:root[data-theme="dark"] {
    --bg: #101010;
    --header-bg: #141414e6;
    --hero-bg: #292a2b;
    --header-shadow: #0000004d;
    --hero-gradient: #4e96ff26;
    --profile-shadow: #4e96ff4d;
    --title-gradient-start: #EAEAEA;
    --title-gradient-end: #FFFFFF;
    --switch-track-bg: #b9cfe7;
    /* Barra del interruptor que cambia el tema */
    --switch-thumb-bg: #003892;
    --button-active-text: #1E1E1E;
    --text-gradient-start: #F9FAFB;
    --text-gradient-end: #A0A0A0;
    --green-bg: #A7FC8F;
    --cyan-bg: #59B2EA;
    --magenta-bg: #E131F3;
    --card-border: #333333;
    --card-shadow: #0000004d;
    --hover-color: #1f2225;
    --external-link: #60A5FA;
    --date-border-start: #02fcef70;
    --date-border-middle: #ffb52b70;
    --date-border-end: #a02bfe70;
}

/* ==========================
   REGLAS GENERALES
========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: Inter, sans-serif;
    color: var(--text-gradient-start);
    line-height: 1.6;
    background-color: var(--bg);
    transition: background-color 0.4s ease, color 0.4s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem
}

.hero h1 {
    background: linear-gradient(135deg, var(--title-gradient-start), var(--title-gradient-end))
}

.hero p,
.language-btn {
    color: var(--title-gradient-start)
}

.hero,
.social-link {
    background-color: var(--hero-bg)
}

.social-links {
    gap: 1rem;
    display: flex
}

.contact-icon,
.hero,
.section-title,
.skill,
footer {
    text-align: center
}

.language-en .en,
.language-es .es,
.logo img {
    display: block
}

/* ==========================
   HEADER
========================== */
header {
    background-color: var(--header-bg);
    box-shadow: 0 1px 3px var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px)
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0
}

.logo {
    display: inline-block;
    width: 40px;
    height: auto
}

.logo img {
    width: 100%;
    height: auto
}

/* ==========================
   BOTONES DE IDIOMA
========================== */
.language-switch {
    gap: 1rem;
    display: flex;
    align-items: center;
}

.language-btn {
    background: none;
    border: 1px solid var(--card-border);
    font-size: .875rem;
    cursor: pointer;
    padding: .5rem 1rem;
    border-radius: calc(infinity * 1px);
    font-weight: 600;
    transition: .3s
}

.language-btn.active {
    background: linear-gradient(135deg, var(--title-gradient-start), var(--title-gradient-end));
    color: var(--button-active-text);
}

.language-btn:hover:not(.active),
.social-link:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px)
}

/* ==========================
   HERO SECTION
========================== */
.hero {
    padding: 5rem 0;
    background-image: radial-gradient(circle at 50% 0, var(--hero-gradient), transparent 50%);
    border-bottom: 1px solid var(--card-border)
}

.education-container,
.hero-content,
.timeline {
    max-width: 800px;
    margin: 0 auto
}

.hero h1 {
    font-family: Poppins, sans-serif;
    font-size: 3rem;
    font-weight: 500;
    letter-spacing: -.025em;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent
}

.hero h2,
.section-title {
    font-family: Poppins, sans-serif;
    font-weight: 400;
    letter-spacing: -.025em;
    -webkit-text-fill-color: transparent
}

.hero h2 {
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--text-gradient-start), var(--text-gradient-end));
    -webkit-background-clip: text;
    background-clip: text;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem
}

.profile-img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2rem;
    border: 3px solid var(--title-gradient-start);
    box-shadow: 0 0 25px var(--profile-shadow)
}

/* ==========================
   SOCIAL LINKS
========================== */
.social-links {
    justify-content: center;
    margin-top: 2rem
}

.social-link {
    display: flex;
    align-items: center;
    padding: .5rem 1rem;
    border-radius: .375rem;
    text-decoration: none;
    color: var(--text-gradient-start);
    border: 1px solid var(--card-border);
    transition: .3s
}

.social-link:hover {
    border-color: var(--title-gradient-start)
}

.social-link i {
    margin-right: .5rem;
    color: var(--title-gradient-start)
}

/* ==========================
SECCIONES GENERALES
========================== */
.section {
    padding: 5rem 0;
    border-bottom: 1px solid var(--card-border)
}

.section-title,
.section-title::after {
    background: linear-gradient(135deg, var(--title-gradient-start), var(--title-gradient-end))
}

.section:last-child {
    border-bottom: none
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    -webkit-background-clip: text;
    background-clip: text;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%)
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 30%;
    right: 30%;
    height: 3px;
    border-radius: 3px
}

/* ==========================
   HABILIDADES
========================== */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center
}

.skill {
    padding: .75rem 1.5rem;
    border-radius: calc(infinity * 1px);
    font-weight: 500;
    border: 1px solid transparent;
    background-image: linear-gradient(var(--bg), var(--bg)), linear-gradient(135deg, var(--magenta-bg), var(--cyan-bg), var(--green-bg));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    transition: .3s
}

/* ==========================
   EXPERIENCIA
========================== */
.education-item,
.timeline-item {
    transition: transform .3s, box-shadow .3s;
    position: relative;
    box-shadow: 0 5px 15px var(--card-shadow)
}

.skill:hover {
    border-color: var(--title-gradient-start);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--card-shadow)
}

.timeline-item {
    display: grid;
    grid-template-columns: 1fr;
    margin-bottom: 3rem;
    background-color: none;
    border-radius: .5rem;
    padding: 2rem;
    border: 1px solid var(--card-border)
}

.education-item:hover,
.timeline-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--card-shadow);
    border-color: var(--title-gradient-start)
}

.contact-item:last-child,
.education-item:last-child,
.timeline-item:last-child {
    margin-bottom: 0
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem
}

.timeline-title {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--cyan-bg), var(--green-bg));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent
}

.education-date,
.timeline-date {
    background-image: linear-gradient(var(--bg), var(--bg)), linear-gradient(135deg, var(--date-border-start) 0, var(--date-border-middle) 50%, var(--date-border-end) 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box
}

.timeline-company {
    font-size: 1.1rem;
    color: var(--title-gradient-start);
    font-weight: 500
}

.timeline-date {
    font-size: .8rem;
    color: var(--text-gradient-start);
    font-weight: 300;
    padding: .25rem .75rem;
    border-radius: 1rem;
    border: 1px solid transparent
}

.timeline-location {
    color: var(--text-gradient-end);
    font-size: .875rem;
    font-weight: 300;
    margin-bottom: 1rem
}

.timeline-content {
    margin-top: 1rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1rem
}

.timeline-section-title {
    font-weight: 700;
    margin-bottom: .5rem;
    color: var(--title-gradient-start)
}

.timeline-list {
    list-style-type: none;
    margin-bottom: 1.5rem;
    font-weight: 400
}

.timeline-list li {
    margin-bottom: .5rem;
    position: relative;
    padding-left: 1.5rem
}

.timeline-list li::before {
    content: "•";
    color: var(--magenta-bg);
    position: absolute;
    left: 0;
    font-weight: 700
}

/* ==========================
   EDUCACIÓN Y CERTIFICACIONES
========================== */
.education-item {
    background-color: none;
    padding: 2rem;
    border-radius: .5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--card-border)
}

.education-date,
.education-title {
    margin-bottom: .5rem;
    color: var(--text-gradient-start)
}

.education-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    color: var(--text-gradient-end);
    cursor: pointer
}

.education-icon:hover {
    color: var(--external-link)
}

.education-date {
    font-size: .8rem;
    font-weight: 300;
    padding: .25rem .75rem;
    border-radius: 1rem;
    border: 1px solid transparent;
    display: inline-block
}

.education-title {
    font-size: 1.1rem;
    font-weight: 600
}

.education-institution {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gradient-end);
    font-weight: 300
}

.institution-icon {
    flex-shrink: 0;
    /* Evita que el ícono cambie de tamaño */
    color: var(--title-gradient-start);
    /* Color del ícono */
}

/* ==========================
   BOTÓN PARA VOLVER ARRIBA
========================== */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    color: var(--text-gradient-end);
    background-color: var(--bg);
    border: 1px solid var(--text-gradient-end);
    border-radius: 50%;
    box-shadow: 0 5px 15px var(--card-shadow);
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: .3s
}

.scroll-to-top i {
    font-size: 1.5rem
}

.scroll-to-top:hover {
    background-color: var(--title-gradient-end);
    color: var(--button-active-text);
    transform: translateY(-5px)
}

/* ==========================
   MEDIA QUERIES
========================== */
@media (max-width:768px) {
    .hero h1 {
        font-size: 2.5rem
    }

    .timeline-header {
        flex-direction: column;
        gap: .5rem
    }

    .contact-container,
    .education-item,
    .timeline-item {
        padding: 1.5rem
    }
}

@media (max-width:480px) {
    .hero h1 {
        font-size: 2rem
    }

    .social-links {
        flex-direction: column;
        align-items: center
    }

    .social-link {
        width: 100%;
        justify-content: center
    }
}

/* ==========================
   ANIMACIONES
========================== */
.en,
.es {
    display: none
}

::-webkit-scrollbar {
    width: 10px
}

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

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 5px
}

::-webkit-scrollbar-thumb:hover {
    background: var(--title-gradient-start)
}

/* ==========================
   FOOTER
========================== */
.footer {
    background-color: var(--header-bg);
    box-shadow: 0 0px 3px var(--card-shadow);
    color: var(--title-gradient-start);
    text-align: center;
    font-family: Poppins, sans-serif;
    font-weight: 400;
    padding: 20px 0;
    font-size: 14px;
}

.footer p {
    margin: 0;
}

/* ==========================
   THEME SWITCH
========================== */

/* Ocultar el checkbox original */
input[type="checkbox"] {
    display: none;
}

/* El contenedor completo del switch */
.theme-switch {
    position: relative;
    display: inline-block;
    /* Definimos el tamaño del track (barra) */
    width: 50px;
    height: 20px;
    cursor: pointer;
}

/* La barra del switch */
.switch-track {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 20px;
    border: 1px solid var(--switch-track-bg);
    /* background-color: var(--switch-track-bg); */
    border-radius: 10px;
    transform: translateY(-50%);
    transition: background-color 0.3s;
}

/* El thumb (círculo) */
.switch-thumb {
    position: absolute;
    top: 50%;
    left: -4px;
    /* Posición inicial: sale 4px a la izquierda */
    width: 28px;
    height: 28px;
    border: 1px solid var(--switch-track-bg);
    background-color: var(--header-bg);
    /* background-color: var(--switch-thumb-bg); */
    border-radius: 50%;
    transform: translateY(-50%);
    transition: left 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Íconos dentro del thumb */
.switch-thumb i {
    color: var(--text-gradient-start);
    font-size: 14px;
    transition: opacity 0.3s;
    position: absolute;
}

.switch-thumb .sun {
    opacity: 1;
}

.switch-thumb .moon {
    opacity: 0;
}

/* Cuando el checkbox está marcado (tema oscuro) */
input:checked+.theme-switch .switch-thumb {
    left: 26px;
    /* Calculado: 26px = 50 - 28 + (-4 + 8) */
}

input:checked+.theme-switch .switch-thumb .sun {
    opacity: 0;
}

input:checked+.theme-switch .switch-thumb .moon {
    opacity: 1;
}

/* ==========================
   ANIMACIONES DEL SWITCH
========================== */
/* Animación glow temporal */
@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 0px 0 #003994b3;
    }

    50% {
        box-shadow: 0 0 12px 6px #003892b3;
    }

    100% {
        box-shadow: 0 0 0px 0 #003892b3;
    }
}

/* Clase que activa el glow */
.switch-thumb.glow {
    animation: glow-pulse 0.5s ease;
}

/* ==========================
   ANIMACIÓN DE TRANSICIÓN DEL TEMA
========================== */
#theme-fade {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg);
    pointer-events: none;
    opacity: 0;
    z-index: 9999;
    transition: opacity 0.8s ease-in-out;
}

/* Cuando activamos la clase fade-effect */
#theme-fade.active {
    opacity: 1;
}