:root {
    --transition-speed: 0.3s;
}

body {
    background-color: rgb(249 250 251);
    color: rgb(17 24 39);
    transition: background-color 0.3s ease, color 0.3s ease;
}

html.dark body {
    background-color: rgb(17 24 39);
    color: rgb(243 244 246);
}

/* Navegación */
nav {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgb(229 231 235);
    transition: all 0.3s ease;
}

html.dark nav {
    background-color: rgba(17, 24, 39, 0.9);
    border-color: rgb(31 41 55);
}

/* Botones y enlaces */
.btn-primary {
    background-color: rgb(59 130 246);
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: rgb(37 99 235);
}


.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

html.dark .btn-primary {
    background-color: rgb(37 99 235);
}

html.dark .btn-primary:hover {
    background-color: rgb(29 78 216);
}


/* Tarjetas de proyectos */
.project-card {
    background-color: white;
    border: 1px solid rgb(243 244 246);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

html.dark .project-card {
    background-color: rgb(31 41 55);
    border-color: rgb(55 65 81);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Etiquetas de categoría */
.category-tag {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background-color: rgb(219 234 254);
    color: rgb(29 78 216);
}

html.dark .category-tag {
    background-color: rgba(30, 58, 138, 0.3);
    color: rgb(147 197 253);
}

/* Formulario */
input, textarea {
    background-color: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    width: 100%;
    transition: all 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

html.dark input,
html.dark textarea {
    background-color: rgb(31 41 55);
    border-color: rgb(55 65 81);
}

html.dark input:focus,
html.dark textarea:focus {
    border-color: rgb(96 165 250);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

/* Modal */
#about-modal {
    transition: opacity var(--transition-speed);
    opacity: 0;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#about-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#about-modal .modal-content {
    background-color: white;
    border-radius: 1rem;
    padding: 2rem;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    touch-action: pan-y;
    will-change: transform;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    margin-top: 0;
}

@media (max-width: 768px) {
    #about-modal {
        align-items: stretch;
        padding-top: 0;
    }
    
    #about-modal .modal-content {
        width: 100%;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        padding-top: 3rem;
        max-height: 100vh;
        margin: 0;
        transform: translateY(100%);
    }

    #about-modal.active .modal-content {
        transform: translateY(0);
    }
}

html.dark #about-modal .modal-content {
    background-color: rgb(17 24 39);
}

#about-modal .modal-content::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

html.dark #about-modal .modal-content::after {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Estilos para la imagen del perfil en el modal */
#about-modal .profile-image {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 1rem;
    margin: 0 auto 2rem;
}

@media (max-width: 768px) {
    #about-modal .profile-image {
        width: 150px;
        height: 150px;
    }
    
    #about-modal .skill-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
}

/* Habilidades */
.skill-tag {
    background-color: rgb(239 246 255);
    color: rgb(29 78 216);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: transform 0.2s ease;
}

html.dark .skill-tag {
    background-color: rgba(30, 58, 138, 0.3);
    color: rgb(147 197 253);
}

.skill-tag:hover {
    transform: scale(1.05);
}

/* Animaciones */
.fade-in {
    animation: fadeIn 0.6s ease-in forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevenir scroll cuando el modal está abierto */
body.modal-open {
    overflow: hidden;
}

/* Fuente */
.font-poppins {
    font-family: 'Poppins', sans-serif;
}

/* Ajustes de peso de fuente */
h1, h2, h3 {
    font-weight: 300;
}

.font-thin {
    font-weight: 100;
}

.font-extralight {
    font-weight: 200;
}

.font-light {
    font-weight: 300;
}

/* Ajustes para textos descriptivos */
p {
    font-weight: 300;
    line-height: 1.7;
}

/* Botones y elementos interactivos */
button, a {
    font-weight: 300;
}

/* Elementos que necesitan más énfasis */
.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

/* Para títulos y elementos que necesitan destacar */
.font-bold {
    font-weight: 700;
}

/* Portafolio Multimedia */
.masonry-grid {
    columns: 1;
    column-gap: 1.5rem;
}

@media (min-width: 640px) {
    .masonry-grid {
        columns: 2;
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        columns: 3;
    }
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    transform: translateY(50px);
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.masonry-item:hover .media-overlay {
    opacity: 1;
    transform: translateY(0);
}

.media-item {
    width: 100%;
    display: block;
    border-radius: 1rem;
    transition: transform 0.5s ease;
}

.media-item.landing-preview {
    height: 300px;
    object-fit: cover;
    object-position: top;
}

.media-item.tall {
    height: 600px;
    object-fit: cover;
}

.masonry-item:hover .media-item {
    transform: scale(1.05);
}

.media-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0) 100%);
    padding: 2rem;
    color: white;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ajustes para modo oscuro */
html.dark .masonry-item {
    background: rgb(17 24 39 / 0.3);
    backdrop-filter: blur(8px);
}

html.dark .media-overlay {
    background: linear-gradient(to top, 
        rgba(17, 24, 39, 0.9) 0%,
        rgba(17, 24, 39, 0) 100%);
}

/* Botón Mostrar más */
#load-more-container {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.6s ease-in forwards;
    animation-delay: 0.3s;
    width: 100%;
}

#load-more {
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 2px;
}

#load-more::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: currentColor;
    transition: width 0.3s ease;
}

#load-more:hover::after {
    width: 100%;
}

/* Estilos específicos para videos */
video.media-item {
    object-fit: cover;
    height: 100%;
    min-height: 300px;
    background-color: rgb(17 24 39 / 0.1); /* Fondo mientras carga */
}

html.dark video.media-item {
    background-color: rgb(255 255 255 / 0.1);
}

/* Lightbox Modal */
#content-modal {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#content-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#content-modal .content-container {
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#content-modal.active .content-container {
    transform: scale(1);
}

#content-modal video,
#content-modal img {
    max-height: 90vh;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 0.5rem;
    box-shadow: 0 0 2rem rgba(0, 0, 0, 0.3);
}

#content-modal .content-info {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    padding: 2rem;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0) 100%);
    color: white;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* En desktop, desvanecer el overlay al hover */
@media (min-width: 768px) {
    #content-modal .content-container:hover .content-info {
        opacity: 0;
    }
}

/* En móvil, mover el overlay debajo del video */
@media (max-width: 767px) {
    #content-modal .content-info {
        position: relative;
        background: rgba(0, 0, 0, 0.9);
        margin-top: 1rem;
        border-radius: 0.5rem;
    }
}

/* Menú móvil */
#mobile-menu {
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

#mobile-menu.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Animación del botón hamburguesa */
#mobile-menu-button {
    transition: transform 0.3s ease;
}

#mobile-menu-button.active {
    transform: rotate(90deg);
}

/* Botón seguir */
#scroll-down {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
    animation-delay: 1s;
}

#scroll-down svg {
    transition: transform 0.3s ease;
}

#scroll-down:hover svg {
    transform: translateY(4px);
}

/* Estilos para zoom en lightbox */
.lightbox-zoom-container {
    overflow: auto;
    max-height: 90vh;
    max-width: 100%;
}

.lightbox-zoom-container img {
    transition: transform 0.3s ease;
}

.lightbox-zoom-container img.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
}

/* Modal de Proyecto */
#project-modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: black;
    z-index: 50;
    overflow: hidden; /* Previene scroll horizontal */
}

#project-modal:not(.hidden) {
    display: block;
}

#project-modal .h-screen {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden; /* Previene scroll horizontal */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Estilos para la barra de desplazamiento */
#project-modal .h-screen::-webkit-scrollbar {
    width: 8px;
}

#project-modal .h-screen::-webkit-scrollbar-track {
    background: transparent;
}

#project-modal .h-screen::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

#project-modal .h-screen::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Ajustes para el contenido */
#project-modal .relative.w-full.h-screen {
    height: 100vh;
    width: 100%;
    position: relative;
}

#project-modal .project-hero {
    width: 100%;
    height: 100vh;
    object-fit: cover;
}

#project-modal .bg-white {
    width: 100%;
    position: relative;
}

#project-modal .max-w-6xl {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
    box-sizing: border-box;
}

#project-modal .project-process img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Ajustes para el contenido del proceso */
#project-modal .project-process > div {
    width: 100%;
    margin: 0 auto;
    overflow: hidden; /* Contiene las imágenes dentro del contenedor */
}

/* Ajustes para las imágenes de la galería */
#project-modal .project-gallery {
    width: 100%;
    margin: 0 auto;
}

#project-modal .project-gallery img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    transition: transform 0.3s ease;
}

#project-modal .project-gallery img:hover {
    transform: scale(1.05);
}

/* Carrusel */
.carousel {
    overflow: hidden;
    position: relative;
    border-radius: 0.5rem;
}

.carousel-container {
    display: flex;
    width: 100%;
}

.carousel-container img {
    width: 100%;
    flex-shrink: 0;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transition: background-color 0.3s ease;
}

.carousel-dot.active {
    background-color: rgba(255, 255, 255, 1);
}

@media (max-width: 768px) {
    .carousel {
        max-width: 100%;
    }
}