:root {
    --bg-color: #0a0a0a;
    --text-color: #e0e0e0;
    --accent-color: #505050;
    --hover-color: #ffffff;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
    /* Custom cursor */
}

/* Custom Cursor */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: white;
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: width 0.2s, height 0.2s;
}

/* Cursor Ripple Wave Effect */
.cursor-ripple {
    position: fixed;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 9998;
    animation: ripple-expand 1.5s ease-out;
}

@keyframes ripple-expand {
    0% {
        width: 20px;
        height: 20px;
        opacity: 1;
        border-width: 2px;
        border-color: rgba(255, 255, 255, 0.8);
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    25% {
        border-color: rgba(0, 255, 255, 0.7);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.6), 0 0 40px rgba(255, 0, 255, 0.3);
    }

    50% {
        border-color: rgba(255, 0, 255, 0.6);
        box-shadow: 0 0 20px rgba(255, 0, 255, 0.5), 0 0 40px rgba(0, 255, 255, 0.3);
    }

    75% {
        border-color: rgba(0, 255, 255, 0.4);
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    }

    100% {
        width: 200px;
        height: 200px;
        opacity: 0;
        border-width: 0.5px;
        border-color: rgba(255, 255, 255, 0);
        box-shadow: none;
    }
}

/* Typography & Layout */
a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

ul {
    list-style: none;
}

header {
    padding: 2rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

nav ul {
    display: flex;
    gap: 3rem;
}

nav a {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
}

nav a:hover {
    color: var(--hover-color);
}

main {
    padding-top: 100px;
}

section {
    padding: 6rem 4rem;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-detail h1,
.project-detail .subtitle {
    text-align: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Hero Standard */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: left;
    padding-top: 80px;
}

/* Hero Content Layer */
.hero-content {
    max-width: 1400px;
    width: 100%;
    padding: 2rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    text-align: left;
}

.hero-image-container {
    margin-bottom: 0;
    width: 80%;
    /* FOTO GIGANTE (80%) */
    display: flex;
    justify-content: flex-end;
}

.hero-image-container .hero-carousel {
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.7);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    border-radius: 4px;
    overflow: hidden;
}

.hero-image-container .hero-carousel:hover {
    transform: scale(1.02);
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
}

.hero-image-container .carousel-slide {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill the area for a premium horizontal look */
}

.hero-text-container {
    width: 20%;
    /* TEXTO MÍNIMO (20%) */
    z-index: 5;
}

#hero h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    /* Grande */
    line-height: 1.2;
    font-weight: 300;
    margin-bottom: 1rem;
    position: relative;
    color: var(--text-color);
    animation: glitch 3s infinite;
}

/* Glitch Animation */
@keyframes glitch {

    0%,
    90%,
    100% {
        transform: translate(0);
        text-shadow: none;
    }

    91% {
        transform: translate(-2px, 2px);
        text-shadow: 2px 0 #ff00ff, -2px 0 #00ffff;
    }

    92% {
        transform: translate(2px, -2px);
        text-shadow: -2px 0 #ff00ff, 2px 0 #00ffff;
    }

    93% {
        transform: translate(-1px, 1px);
        text-shadow: 1px 0 #ff00ff, -1px 0 #00ffff;
    }

    94% {
        transform: translate(1px, -1px);
        text-shadow: -1px 0 #ff00ff, 1px 0 #00ffff;
    }
}

/* Terminal Cursor */
.cursor-char {
    display: inline-block;
    width: 0.6em;
    height: 1.2em;
    background-color: var(--accent-color);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    margin-left: 5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Project Split Layout (Video Left / Text Right) */
.project-split-layout {
    display: flex;
    flex-direction: row;
    gap: 4rem;
    align-items: center;
    /* Vertical balance */
    margin-top: 3rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.project-split-media {
    flex: 1;
    /* Mitad izquierda */
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    /* Allow shrinking to prevent overflow */
}

.project-split-text {
    flex: 1;
    /* Mitad derecha */
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    /* Keep text readable */
}

.project-split-text .about-content {
    max-width: 100%;
    /* Prevent unbalanced columns */
}

/* Legacy style kept just in case, but unused in hero now */
.profile-img-circle {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid white;
    margin-bottom: 2rem;
}



#hero .accent {
    color: var(--accent-color);
}

.subtitle {
    font-size: 1.5rem;
    color: var(--accent-color);
    max-width: 800px;
    margin: 0;
}

/* Grid */
.section-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 1rem;
    display: inline-block;
}

.project-grid {
    display: grid;
    /* Proyectos aún más pequeños */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.project-card {
    position: relative;
    cursor: pointer;
    transition: z-index 0.3s;
}

.project-card:hover {
    z-index: 10;
}

.project-image {
    width: 100%;
    height: 300px;
    background-color: #1a1a1a;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.25);
}

.project-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.project-card:hover .project-image::after {
    opacity: 1;
}

.project-info h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.project-info p {
    color: var(--accent-color);
    font-size: 0.9rem;
}

/* About */
#about {
    align-items: flex-start;
}

/* About section on Homepage */
#about .about-content {
    font-size: 1.2rem;
}

.about-content {
    max-width: 800px;
}

/* Project Detail Text */
.project-split-text p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.tags {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
    /* Center tags for balance */
    flex-wrap: wrap;
}

.tags li {
    border: 1px solid var(--accent-color);
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 50px;
}

/* Contact */
#contact {
    text-align: center;
    align-items: center;
    min-height: 50vh;
}

.email-link {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin: 2rem 0;
    display: block;
}

.email-link:hover {
    text-decoration: underline;
}

footer {
    padding: 2rem 4rem;
    text-align: center;
    color: var(--accent-color);
    font-size: 0.8rem;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s ease;
}

.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Page Transitions */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f0f0f;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.9);
    transform: translateX(100%);
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-overlay.active {
    transform: translateX(0);
}

.page-transition-overlay.slide-in {
    transform: translateX(0);
}

.page-transition-overlay.slide-out {
    transform: translateX(-100%);
}

/* Mobile */
/* Mute Toggle */
.mute-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease, color 0.3s ease;
}

.mute-toggle:hover svg {
    color: var(--hover-color);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    header {
        padding: 1.5rem 2rem;
    }

    .hero-content,
    .project-split-layout {
        flex-direction: column;
        /* Apilar en vertical en móviles */
        gap: 2rem;
        text-align: center;
    }

    .hero-image-container,
    .hero-text-container,
    .project-split-media,
    .project-split-text {
        width: 100%;
        display: flex;
        justify-content: center;
        text-align: center;
        /* Centrar texto en móvil */
    }

    .about-content {
        text-align: left;
        /* Mantener lectura cómoda */
    }

    /* Revertir justificado de imagen hero en móvil */
    .hero-image-container {
        justify-content: center;
    }

    #hero h1 {
        font-size: 4rem;
        /* Grande en móvil */
    }

    section {
        padding: 4rem 2rem;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .email-link {
        font-size: 1.5rem;
    }
}

/* Carousel Styles */
.carousel-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 66.66%;
    /* 3:2 Aspect Ratio */
    overflow: hidden;
    border-radius: 4px;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    z-index: 1;
}

.carousel-container:hover {
    transform: scale(1.05);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.carousel-slide.active {
    opacity: 1;
}

/* Filter Container & Buttons */
.filter-container {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
    margin-top: -3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.25rem 0.6rem;
    font-family: var(--font-body);
    font-size: 0.65rem;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.filter-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--hover-color);
    color: var(--bg-color);
    border-color: var(--hover-color);
}

/* Project Card Hidden State for Filtering */
.project-card.hidden {
    display: none;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
}

/* Mobile Responsive for Filters */
@media (max-width: 768px) {
    .filter-container {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
    }
}