:root {
    --background-color: #0F1215;
    --text-color: #efefef;
    --second-text-color: #cfcfcf;
    --elements-color: #181c20;
    --contact-color: #5f635f;
    --contact-color-hover: #3d413d;
}

.light-mode {
    --background-color: #fafafa;
    --text-color: #111517;
    --second-text-color: #1f1f1f;
    --elements-color: #e0e0e0;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.main-container {
    margin-right: 6.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--background-color);
    backdrop-filter: blur(10px);
    padding: 0.25rem;
    z-index: 1000;
    display: flex;
}

.nav-container {
    max-width: 75rem;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 1.25rem;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    color: var(--text-color);
}

.nav-links {
    display: flex;
    gap: 6rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Light-mode toggle */ 
.toggle-switch {
    position: relative;
    width: 4.5rem;
    height: 3rem;
    margin: 0.5rem 1rem 0 0;
}

.switch-label {
    position: absolute;
    width: 100%;
    height: 2.3rem;
    background-color: var(--elements-color);
    border-radius: 1.5rem;
    cursor: pointer;
    box-shadow: 0.125rem 0.125rem 0.75rem rgba(0, 0, 0, 0.5);
}

.checkbox {
    position: absolute;
    display: none;
}

.slider {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 1.5rem;
    transition: 0.3s;
}

.checkbox:checked ~ .slider {
    background-color: var(--elements-color);
}

.slider::before {
    content: "";
    position: absolute;
    top: 0.3rem;
    left: 0.3rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    box-shadow: inset 0.75rem -0.25rem 0px 0px var(--text-color);
    background-color: var(--elements-color);
    transition: 0.3s;
}

.checkbox:checked ~ .slider::before {
    transform: translateX(2.5rem);
    background-color: var(--second-text-color);
    box-shadow: none;
}

/* Header */
.encabezado {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 10%;
    background-color: var(--background-color);
}

.header-content {
    position: relative;
    z-index: 1;
}

.nombre {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 5rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.saludo {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0 2rem;
}

.presentacion {
    font-size: 1rem;
    font-weight: 400;
    margin: 0 auto;
    padding: 0 2rem;
    color: var(--second-text-color);
}

/* Projects Section */
.proyectos {
    padding: 3rem 5%;
    padding-top: 1rem;
    background: var(--elements-color);
    margin: 3rem;
    margin-left: 3.75rem;
    border-radius: 0.6rem;
    scroll-margin-top: 4.5rem;
    box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.3);
}

.proyectos,
.contact {
    opacity: 0;
    transform: translateY(3rem);
    transition: all 0.8s ease; /* Transición suave */
}

.proyectos.visible,
.contact.visible {
    opacity: 1;
    transform: translateY(0);
}

.titulo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    font-weight: 400;
}

.descrip {
    font-size: 1rem;
    font-weight: 400;
    color: var(--second-text-color);
    margin-bottom: 2rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(21rem, 0.95fr));
    gap: 3rem;
    justify-content: center;
}

.project-card {
    background: var(--background-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: transform 0.3s ease;
}

.project-card:hover {
    transform: scale(1.03);
}

.project-card img {
    width: 100%;
    height: 12.5rem;
    object-fit: cover;
    object-position: top; /* Asegura que la parte superior sea visible */
    border-radius: 0.25rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.project-card:hover img {
    opacity: 1;
}

.project-card h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.project-card:hover h3 {
    opacity: 1;
}

.project-card p {
    color: var(--second-text-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.project-card:hover p {
    opacity: 1;
}

.icon-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: xx-large;
}

.tech-stack {
    display: flex;
    gap: 1rem;
    margin: 0rem 1rem;
    align-items: center;
}

.tech-stack i, .tech-stack img {
    opacity: 0.7;
}

.tech-stack img {
    width: 40px;
    height: 40px;
}

.tech-stack i:hover, img:hover {
    cursor: pointer;
} 

.project-card:hover .tech-stack i {
    opacity: 1;
}

.project-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 0rem 1rem;
}

.project-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.project-links a:hover {
    opacity: 1;
}

/* Contact Section */
.contact {
    background: var(--elements-color);
    max-width: 40rem;
    display: flex;
    flex-direction: column;
    margin: 5rem 0;
    padding: 2.5rem;
    border-radius: 0.6rem;
    scroll-margin-top: 2rem;
    box-shadow: 0 0.1rem 1rem rgba(0, 0, 0, 0.3);
}

.contact-title {
    margin-bottom: 2rem;
    text-align: center;
}

.contact-title h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 3rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0 3rem;
}

.contact-form label {
    font-size: 1rem;
}

.contact-form input, 
.contact-form textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

.contact-form textarea {
    height: 7.5rem;
    resize: none;
    overflow-y: auto;
}

.contact-form button {
    font-family: 'Poppins', sans-serif;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: white;
    background-color: var(--contact-color);
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    user-select: none;
}

.contact-form button:hover {
    background-color: var(--contact-color-hover);
}

/* Social Sidebar */
.social-sidebar {
    position: fixed;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 1000;
}

.social-sidebar a {
    color: var(--second-text-color);
    text-decoration: none;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    padding: 0 0.5rem;
}

.social-sidebar a:hover {
    color: var(--text-color);
    transform: scale(1.2) translateX(-0.3rem);
}

.toast-message {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background-color: var(--contact-color-hover);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0px 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 1rem;
    opacity: 1; /* Inicialmente visible */
    transition: opacity 1s ease-in-out; /* Transición suave de opacidad */
}

.toast-message.fade-out {
    opacity: 0; /* Hace que el mensaje sea invisible */
}


/* Footer */
footer {
    font-family: 'Bebas Neue', sans-serif;
    color: var(--second-text-color);
    text-align: center;
    padding: 2rem;
}

/* Responsive Design */
@media (max-width: 48rem) {
    body {
        padding: 0 1rem;
        display: flex;
        flex-direction: column;
    }

    .main-container {
        margin-right: 0;
    }

    .navbar {
        padding: 1rem;
        border-bottom: 1px solid var(--contact-color);
    }
    
    .hamburger {
        display: block;
        margin-left: 0.5rem;
    }
    
    .nav-links {
        position: absolute;
        top: 5.4rem;
        left: 0;
        background-color: var(--background-color);
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem 2rem;
        display: none;
        width: 11rem;
        border-radius: 0 0 0.5rem 0.5rem;
        border-bottom: 1px solid var(--contact-color);
        border-right: 1px solid var(--contact-color);
    }
    
    .nav-links.active {
        display: flex;
        align-items: flex-start;
    }

    .nav-links a {
        padding: 0.2rem 0.5rem;
    }
    
    .nav-links a:hover {
        color: var(--background-color);
        background: var(--contact-color);
        border-radius: 1rem;
    }

    .encabezado {
        padding: 2rem;
        text-align: center;
    }

    .nombre {
        font-size: 3rem;
    }
    
    .saludo,
    .presentacion {
        padding: 0 1rem;
    }
    
    .proyectos {
        padding: 2rem 1rem;
        margin: 2rem 0;
        max-width: 100%;
    }
    
    .titulo {
        font-size: 2rem;
        padding: 0 0.5rem;
    }
    
    .descrip {
        padding: 0 0.5rem;
    }
    
    .projects-grid {
        grid-template-columns: 100%; /* Una sola columna */
        justify-content: center; 
        gap: 1.5rem;
        padding: 1rem 0;
        margin: 0 auto;
    }
    
    .project-card {
        max-width: 100%;
    }
    
    .project-card img {
        height: 9rem;
    }
    
    .project-card h3 {
        font-size: 1.5rem;
    }
    
    .icon-container {
        font-size: x-large;
    }
    
    .tech-stack img {
        width: 30px;
        height: 30px;
    }

    .contact {
        max-width: 100%;
        margin: 2rem 0;
        padding: 2rem 1rem;
        margin-left: 0;
    }
    
    .contact-title h2 {
        font-size: 2rem;
    }
    
    .contact-form {
        gap: 0.5rem;
        margin: 0;
    }
    
    .social-sidebar {
        position: static; /* Cambia la barra lateral a estática */
        flex-direction: row; /* Cambia los íconos a una fila */
        justify-content: center;
        padding: 0;
        margin: 0;
    }
    
    .social-sidebar a, .social-sidebar a:hover {
        transition: none;
        transform: none;
    }
    
    footer {
        font-size: 0.9rem;
        padding: 1rem 0;
    }
}