/* ==================== ROOT VARIABLES ==================== */
:root {
    --highlight-color: #bdd69e; /* Default highlight color */
    --color-option-1: #bdd69e;
    --color-option-2: #d69e9e;
    --color-option-3: #9eced6;
    --color-option-4: #ab9ed6;

    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-header: #181818;

    --text-primary: #e0e0e0;
    --text-secondary: #b3b3b3;
    --border-color: #595959;
    --text-shadow-color: #00000049;
}

/* ==================== BASE STYLES ==================== */
body {
    font-family: 'PixelOperator', monospace;
    font-size: 1.25rem;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden; /* Prevenir scroll horizontal */
}

/* Custom container class that will override Tailwind's container */
.custom-container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 1280px; /* Default */
}

@media (min-width: 640px) {
    .custom-container {
        max-width: 640px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 768px) {
    .custom-container {
        max-width: 900px;
    }
}

@media (min-width: 1024px) {
    .custom-container {
        max-width: 1100px;
        padding-left: 4rem;
        padding-right: 4rem;
    }
}

@media (min-width: 1280px) {
    .custom-container {
        max-width: 1140px;
    }
}

@media (min-width: 1536px) {
    .custom-container {
        max-width: 1180px;
    }
}

h1, h2, h3, h4, h5, h6, .font-pixel {
    font-family: 'Montserrat', 'Chakra Petch', monospace;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.font-vt323 {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

/* Estilo para sombra de texto */
.text-shadow {
    text-shadow:5px 5px 0 var(--text-shadow-color);
}

/* Aplicar sombra a los títulos de sección */
section h2 {
    text-shadow: 5px 5px 0 var(--text-shadow-color);
}

/* ==================== ACCENT STYLES ==================== */
.neon-text {
    color: var(--highlight-color);
}

.neon-border {
    border-color: var(--highlight-color);
    border-radius: 50%;
}

.neon-button {
    background-color: transparent;
    border: 2px solid var(--highlight-color);
    color: var(--highlight-color); /* FIX: ensure text uses highlight color */
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
}

.neon-button:hover {
    background-color: var(--highlight-color);
    color: var(--bg-primary); /* On hover, text becomes dark for contrast */
}

.neon-button img, .neon-button svg {
    transition: filter 0.3s ease, fill 0.3s ease;
    width: 16px;
    height: 16px;
    /* Quitar filter: invert(84%) y dejar color por defecto */
}
/* SVG icon color: use currentColor for fill and stroke */
.neon-button svg {
    fill: none;
    stroke: currentColor;
}
.neon-button svg path {
    fill: none;
    stroke: currentColor;
}
/* On hover, text and icon both use --bg-primary */
.neon-button:hover {
    background-color: var(--highlight-color);
    color: var(--bg-primary);
}
.neon-button:hover svg {
    stroke: var(--bg-primary);
}
.neon-button:hover svg path {
    stroke: var(--bg-primary);
}

.neon-button:hover img {
    filter: brightness(0);
}

.neon-button:hover svg path {
    fill: var(--bg-primary);
    stroke: var(--bg-primary);
}

/* ==================== LAYOUT COMPONENTS ==================== */
/* Header and Navigation */
nav a {
    font-size: 1rem;
}

header nav a {
    font-size: 1rem !important;
}

nav a.active {
    color: var(--highlight-color);
    font-weight: bold;
    text-shadow: 0 0 8px var(--highlight-color);
}

/* Logo hover effect */
.logo-hover span {
    transition: text-shadow 0.3s ease, color 0.3s ease;
}

.logo-hover:hover span {
    text-shadow: 0 0 10px var(--highlight-color), 0 0 10px var(--highlight-color);
}

/* Color selector */
#color-selector div {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#color-selector div:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.selected-color {
    border-color: var(--highlight-color);
    border-width: 3px;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #181818;
}

::-webkit-scrollbar-thumb {
    background-color: var(--highlight-color);
    border-radius: 10px;
    border: 2px solid #181818;
}

/* ==================== SECTION SPECIFIC STYLES ==================== */
/* Profile section */
.highlight-circle {
    position: absolute;
    width: 200%;
    height: 200%;
    background-color: var(--highlight-color);
    border-radius: 50%;
    z-index: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.image-container {
    position: relative;
    display: inline-block;
}

.image-container img {
    position: relative;
    z-index: 1;
}

/* Projects section */
.project-card {
    background-color: #262626;
    border: 1px solid var(--border-color);
    position: relative;
    border-radius: 16px;
    opacity: 0;
    transform: scale(0.9);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 200px;
    max-height: 490px;
    max-width: 430px;
    box-shadow: 7px 7px 15px rgba(0, 0, 0, 0.5);
}

/* Transición para la animación de aparición (más lenta) */
.project-card.visible {
    opacity: 1;
    transform: scale(1);
    transition: all 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Transición para el hover (más rápida) */
.project-card:hover {
    transform: translateY(-5px) scale(1.03);
    border-color: var(--highlight-color);
    box-shadow: 13px 13px 20px rgba(0, 0, 0, 0.6);
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card .p-5 {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
}

.p-5 {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-card p {
    font-size: 1rem;
    line-height: 1.5;
}

.project-card h3 {
    color: #ececec;
    font-size: 1.4rem;
    font-weight: 600;
    }

.project-card .arrow-indicator {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: none;
    border: none;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.project-card .arrow-indicator::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border-right: 3px solid var(--highlight-color);
    border-top: 3px solid var(--highlight-color);
    transform: rotate(45deg);
}

.project-card:hover .arrow-indicator {
    opacity: 1;
    transform: translateY(-50%) translateX(-5px);
}

.arrow-box {
    flex-shrink: 0;
    width: 40px;
    height: 100%;
    position: relative;
    background: transparent;
}

.project-card .px-5.py-2 {
    border-bottom: 1px solid var(--border-color);
}

.project-card .tags {
    margin-top: auto;
    padding: 1rem;
    padding-top: 0;
    background-color: transparent;
    display: flex;
    justify-content: center;
}

/* Project media containers */
.media-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Add aspect ratio to maintain height */
    overflow: hidden;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    transition: opacity 0.3s ease;
    background-color: var(--bg-primary);
}

.project-card:hover .card-image {
    opacity: 0;
}

.project-card .card-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* This makes the video cover the entire container */
    z-index: 1;
}

/* Projects grid layout */
#project-cards {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 5rem;
    column-gap: 1rem;
    margin: 0 auto;
    padding: 0;
    justify-items: center;
}

.project-card {
    margin: 0;
}

/* ==================== TOOLTIPS ==================== */
.tooltip {
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgb(227, 227, 227);
    color: #121212;
    padding: 0.5rem 1rem;
    border-radius: 22px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: rgb(227, 227, 227) transparent transparent transparent;
}

.tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-5px);
}

.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ==================== MODAL STYLES ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* Permitir scroll en todo el modal */
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal.show { 
    display: block; /* Cambiado de flex a block para scroll global */
    animation: fadeIn 0.3s ease-out; 
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 40px auto; /* Centrado vertical con margen */
    padding: 20px 20px 20px 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 1000px;
    max-height: none; /* Quitar límite de altura para que crezca */
    overflow: visible; /* Quitar scroll interno */
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border: none;
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.45);
}

@media (max-width: 900px) {
    .modal-content {
        max-width: 98vw;
        padding: 10px;
    }
}

.modal-video-container {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    margin-top: 0; /* Remove top margin if there is any */
    position: relative;
}

/* Add styling to make modal video fill the container */
#modal-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* This makes the video cover the entire container */
}

/* Also apply similar styling to the card videos on the main page */
.card-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-title-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    z-index: 5;
}

.video-title {
    color: white;
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-cards-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.modal-card {
    flex: 1 1 220px;
    background: #262626; /* Use same gray as project cards */
    border-radius: 14px;
    padding: 1.2rem 1.5rem;
    min-width: 220px;
    min-height: 100px; /* Reduced height */
    box-shadow: 0 2px 12px #0002;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: none;
}

.modal-card-title {
    font-family: 'Montserrat', 'Chakra Petch', monospace;
    font-size: 1.6rem;
    color: var(--highlight-color);
    margin-bottom: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

.modal-section-title {
    font-family: 'Montserrat', 'Chakra Petch', monospace;
    font-size: 1.6rem;
    color: var(--highlight-color);
    margin-bottom: 0.7rem;
    margin-top: 1.5rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    font-weight: 600;

}

#modal-features {
    list-style-type: disc;
    padding-left: 1.5em;
    margin: 0;
    color: var(--text-primary);
}

#modal-features li {
    margin-bottom: 0.5rem;
    position: relative;
    font-size: 1rem; /* Smaller text */
}

#modal-intro, #modal-mechanics, #modal-about {
    font-size: 1rem; /* Smaller text */
    line-height: 1.5;
}

/* Add spacing between paragraphs in modal content */
#modal-intro p, #modal-about p, #modal-mechanics p {
    margin-bottom: 1.25rem; /* Add space after each paragraph */
}

/* Remove extra margin from last paragraph */
#modal-intro p:last-child, #modal-about p:last-child, #modal-mechanics p:last-child {
    margin-bottom: 0;
}

@media (max-width: 700px) {
    .modal-cards-row {
        flex-direction: column;
        gap: 1rem;
    }
    .modal-card {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 700px) {
    .modal-cards-row {
        flex-direction: column;
        gap: 1rem;
    }
    .modal-card {
        min-width: 0;
        width: 100%;
    }
    .modal-video-container {
        aspect-ratio: 16/9;
        min-height: 180px;
        gap: 1rem;
    }
    .modal-video-container {
        min-height: 120px;
        max-height: 50vw;
    }
    .modal-section-title {
        font-size: 1rem;
    }
    .modal-card-title {
        font-size: 1rem;
    }
    .modal-card {
        padding: 0.8rem 0.7rem;
    }
}

.close-button {
    position: fixed; 
    top: 20px;
    right: 20px;
    margin: 0;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 28px;
    line-height: 1;
    text-align: center;
    padding: 0;
    border: none;
    cursor: pointer;
    z-index: 105; 
    flex-shrink: 0;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.close-button:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes slideUp {
    from {
        transform: translateY(150%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideRight {
    from {
        transform: translateX(-100px); /* Cambiado: comienza desde más a la izquierda */
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Nueva animación para efecto pop de los botones */
@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    70% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==================== SECTION TITLE ANIMATION ==================== */
@keyframes sectionTitleSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-section-title {
    opacity: 0;
    transform: translateY(40px);
    animation: sectionTitleSlideUp 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Animaciones para la sección de inicio */
.animate-slide-up {
    animation: slideUp 1s ease-out forwards; /* Aumentada duración de 0.6s a 1s */
}

/* Animación del texto en la sección de inicio */
.text-container {
    animation: none; /* Asegurarse de que no tenga animación por defecto */
}

.text-container.animate-slide-right-delay-1 {
    animation: slideRight 0.8s ease-out forwards; /* Aumentada duración de 0.6s a 1s */
    animation-delay: 0.3s; /* Mantenemos el delay para la secuencia */
}

/* Nueva animación para deslizamiento desde la derecha */
@keyframes slideLeft {
    from {
        transform: translateX(100px) rotate(-10deg); /* Añadida rotación inicial */
        opacity: 0;
    }
    to {
        transform: translateX(0) rotate(0deg); /* Termina sin rotación */
        opacity: 1;
    }
}

/* Clases específicas para la sección "Sobre Mí" */
.about-text {
    animation: none; /* Reset para evitar conflictos */
    opacity: 0;
}

.about-image {
    animation: none; /* Reset para evitar conflictos */
    opacity: 0;
}

.about-text.animate-slide-right {
    animation: slideRight 1s ease-out forwards; /* Aumentada duración de 0.6s a 1s */
}

.about-image.animate-slide-left {
    animation: slideLeft 1s ease-out forwards; /* Aumentada duración de 0.6s a 1s */
}

/* Estilos para animación pop secuencial de botones */
.animate-pop-delay-1 {
    animation: popIn 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; /* Aumentada duración de 0.5s a 0.7s */
    animation-delay: 1s;
    opacity: 0;
    transform: scale(0);
}

.animate-pop-delay-2 {
    animation: popIn 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; /* Aumentada duración de 0.5s a 0.7s */
    animation-delay: 1.2s;
    opacity: 0;
    transform: scale(0);
}

.animate-pop-delay-3 {
    animation: popIn 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; /* Aumentada duración de 0.5s a 0.7s */
    animation-delay: 1.4s;
    opacity: 0;
    transform: scale(0);
}

.animate-pop-delay-4 {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 1.6s;
    opacity: 0;
    transform: scale(0);
}

/* ==================== RESPONSIVE STYLES ==================== */
@media (min-width: 640px) {
    #project-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tarjetas en posiciones impares (izquierda) */
    .project-card:nth-child(odd).visible {
        animation: slideInLeft 0.5s ease-out forwards;
        animation-delay: 0s; /* Sin retraso para las tarjetas de la izquierda */
    }

    /* Tarjetas en posiciones pares (derecha) */
    .project-card:nth-child(even).visible {
        animation: slideInRight 0.5s ease-out forwards;
        animation-delay: 0.2s; /* Añadimos 0.2s de retraso para las tarjetas de la derecha */
    }

    /* Mantener el efecto hover después de la animación */
    .project-card.visible:hover {
        animation: none; /* Desactiva la animación de entrada al hacer hover */
        transform: translateY(-5px) scale(1.03);
        border-color: var(--highlight-color);
        box-shadow: 13px 13px 20px rgba(0, 0, 0, 0.6);
    }

    #show-more-btn {
        display: none;
    }
}

@media (min-width: 768px) {
    .image-container img {
        opacity: 0;
    }

    .text-container {
        opacity: 0;
    }


}

@media (min-width: 1024px) {
    #project-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .image-container {
        width: 15rem !important;
        height: 15rem !important;
    }
}

@media (max-width: 768px) {
    .image-container {
        width: 12rem !important;
        height: 12rem !important;
    }

    .modal-content {
        width: 95%;
        max-height: 85%;
        padding: 15px;
    }

    .close-button {
        font-size: 20px;
        top: 8px;
        right: 10px;
    }

    .project-card {
        min-height: 250px;
    }

    .project-card p {
        font-size: 0.9rem;
    }
}

#inicio .neon-border, #sobre-mi .neon-border {
    border: none;
    border-radius: 0;
}

#proyectos h2 {
    margin-bottom: 5rem;
}

/* Añadir overflow-hidden a main también */
main {
    overflow-x: hidden;
}

/* Add container for mechanics video */


#mechanics-video-container .relative {
    padding-bottom: 56.25%; /* Mantener relación de aspecto 16:9 */
}

/* Mechanics modal videos más pequeños */
.modal-mechanics-video {
    width: 90%;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}
@media (max-width: 700px) {
    .modal-mechanics-video {
        width: 98%;
        max-width: 98vw;
    }
}
/* Mechanics code toggle button */

.mechanics-code-image {
    display: block;
    margin: 0.5em auto 1.5em auto;
    max-width: 98vw;
    width: 90%;
    border-radius: 10px;
    box-shadow: 0 4px 16px #0006;
    background: #181818;
}
/* Nueva clase para mostrar la imagen a la mitad de tamaño */


/* Estilos para la sección de Experiencia Técnica */
.tech-card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tech-icon-container {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.tech-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: brightness(0) invert(1); /* Mantener los iconos blancos */
}

.tech-card h3 {
    font-family: "PixelOperator", monospace;
    font-size: 1rem;
    margin-bottom: 0;
    text-align: center;
}

/* Definición del filtro para los iconos de las tarjetas */
.icon-filter {
    filter: invert(84%) sepia(6%) saturate(257%) hue-rotate(180deg) brightness(90%) contrast(85%);
}

/* ==================== LANGUAGE SELECTOR FIX ==================== */
.language-selector button {
    background: transparent;
    color: #b3b3b3;
    font-weight: 500;
}
.language-selector button.selected {
    background: var(--highlight-color) !important;
    color: #181818 !important;
    font-weight: bold;
    z-index: 1;
}
.language-selector button:not(.selected):hover {
    color: #fff;
}
.language-selector #lang-es.selected {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}
.language-selector #lang-en.selected {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}
/* Fuente manuscrita para el saludo */
.handwritten {
    font-family: 'Pacifico', cursive;
    font-size: 2.5rem;
    letter-spacing: 1px;
    padding-bottom: 0.3rem;
    color: rgb(236, 236, 236);
    text-shadow: 2px 2px 0 var(--text-shadow-color);
}
.wave-hand {
  display: inline-block;
  transform-origin: 70% 80%;
  animation: waveHand 3s cubic-bezier(0.42,0,0.58,1) 0.8s infinite;
}
@keyframes waveHand {
  0% { transform: rotate(0deg); }
  8% { transform: rotate(18deg); }
  16% { transform: rotate(-10deg); }
  24% { transform: rotate(18deg); }
  32% { transform: rotate(-4deg); }
  40% { transform: rotate(12deg); }
  48% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

/* The additional CV button can wrap instead of overflowing on narrow screens. */
.buttons-container { flex-wrap: wrap; }

/* Compact CV control alongside the original social buttons. */
.buttons-container .cv-button {
    font-size: 0.95rem;
    padding: 0.35rem 0.65rem;
    gap: 0.35rem;
    white-space: nowrap;
}
.buttons-container .cv-button svg { width: 14px; height: 14px; }
