html {
    scroll-behavior: smooth;
}

:root {
    /* Colors */
    --bg-color: #ffffff;
    --text-color: #000000;
    --text-muted: #555555;
    --accent-color: #ff9100;
    /* Vibrant Orange */
    --accent-secondary: #ff2d55;
    /* Strawberry Red */
    --border-color: #e5e5e5;
    --surface-color: #f5f5f5;

    /* Typography */
    --font-heading: 'Syne', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --container-width: 1400px;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 4rem;

    /* Transitions */
    --transition-fast: 0.3s ease;
    --transition-smooth: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@media (pointer: fine) {
    * {
        cursor: none !important;
    }
}

@media (hover: none), (pointer: coarse), (max-width: 768px) {
    .cursor-follower {
        display: none !important;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.cursor-follower {
    width: 10px;
    height: 10px;
    background-color: #000;
    border: none;
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        background-color 0.3s ease;
    z-index: 100000;
    mix-blend-mode: difference;
    background-color: #fff;
    /* Always white so difference makes it useful */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-color);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

ul {
    list-style: none;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.main-header {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    width: auto;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 100px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
    /* mix-blend-mode removed from container to make background visible */
}

.main-header.header-hidden {
    transform: translateY(-150%);
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #000000;
    /* mix-blend-mode removed for readability on the white capsule */
    position: relative;
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    position: relative;
}

.logo-text {
    position: relative;
    z-index: 2;
}

.logo-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 100px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3;
}

.particle {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
    opacity: 0.8;
}


.main-nav ul {
    display: flex;
    gap: var(--spacing-lg);
}

.main-nav a {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    /* Made slightly bolder for color */
    position: relative;
    opacity: 1;
    /* Removed opacity to make color vivid */
    color: #000000;
    /* mix-blend-mode removed for readability on the white capsule */
}

.main-nav a:hover {
    color: var(--accent-color);
    /* Orange hover for 'Sobre mí' and 'Diseño gráfico' */
}

.main-nav li:nth-child(2) a:hover,
.main-nav li:nth-child(4) a:hover {
    color: var(--accent-secondary);
    /* Red-pink hover for 'Diseño de producto' and 'Contacto' */
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 1px;
    background-color: currentColor;
    transition: width var(--transition-fast);
}

.main-nav a:hover::after {
    width: 100%;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lang-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #000;
    opacity: 0.3;
    transition: opacity 0.3s, color 0.3s;
}

.lang-btn.active {
    opacity: 1;
}

.lang-btn:hover:not(.active) {
    opacity: 0.6;
}

.lang-divider {
    opacity: 0.2;
    font-weight: 300;
}

.menu-toggle {
    display: none;
    /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 10px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: #000;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s;
}

/* Hero Section */
.hero-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-top: var(--spacing-xl);
    overflow: hidden;
    /* Ensure slider doesn't spill */
}

/* Continuous Marquee Animation */
.hero-bg-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: max-content;
    height: 100%;
    z-index: 0;
    display: flex;
    /* Animation: Move translateX from 0 to end of first set */
    animation: carouselMove 16s linear infinite;
    /* 8 images * 2s */
}

.slide {
    position: relative;
    flex: 0 0 100vw;
    /* Each slide is full viewport width */
    width: 100vw;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 1;
    animation: none;
    /* Disable individual animations */
}

/* Clear manual delays */
.slide:nth-child(n) {
    animation-delay: 0s;
}

.hero-overlay {
    display: none;
}

.container {
    position: relative;
    /* z-index removed to allow mix-blend-mode in children to work with background */
}

/* Move from 0 (start) to -800vw (end of 8th slide, start of 9th duplicate) */
@keyframes carouselMove {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-800vw);
    }

    /* 8 slides * 100vw = 800vw distance */
}

/* About Section Specifics */
#about {
    background-color: #000000;
    color: #ffffff;
    padding: 0;
    /* Remove vertical padding to fit image height */
    overflow: hidden;
    position: relative;
    z-index: 1;
}

#about .container {
    max-width: 100%;
    /* Optional: allows full width if desired, or keep generic container */
    padding: 0;
    /* Remove horizontal padding impact on height if any */
}

#about h2,
#about h3,
#about p,
#about .section-tag {
    color: #ffffff;
}

.subtitle {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.hero-title {
    font-size: clamp(3rem, 8vw, 7rem);
    margin-bottom: var(--spacing-lg);
    color: #ffffff;
    mix-blend-mode: difference;
    -webkit-mix-blend-mode: difference;
    transform: translateZ(0);
    position: relative;
    z-index: 10;
}

.highlight {
    color: var(--accent-secondary);
    -webkit-text-stroke: 0;
    position: relative;
}

.hero-footer {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 0;
    width: 100%;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: flex-end;
    /* Align right since contact info is gone */
    align-items: flex-end;
}

.scroll-indicator {
    margin-top: 4rem;
    /* Lowering it "4 points" (interpretation: spacing units) */
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.contact-info a {
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast), color var(--transition-fast);
    display: inline-block;
    width: fit-content;
}

.contact-info a:hover {
    transform: translateY(-5px);
}

/* Sections General */
section {
    padding: var(--spacing-xl) 0;
}

/* About Section */
.about-section {
    border-top: 1px solid var(--border-color);
}

.section-header {
    margin-bottom: var(--spacing-lg);
}

.section-lead {
    font-size: 2rem;
    max-width: 800px;
    margin-top: var(--spacing-md);
    font-weight: 300;
    font-style: italic;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Image Left, Text Right */
    gap: var(--spacing-xl);
    align-items: center;
    position: relative;
    isolation: isolate;
    padding: 0;
    /* Tight fit to content as requested */
}

.about-image {
    position: relative;
    z-index: 1;
}

.about-image-wrapper {
    position: relative;
    width: 100%;
}

.about-blob-container {
    position: absolute;
    width: 650px;
    height: 650px;
    top: 50%;
    left: 50%;
    /* Centered behind the portrait */
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    overflow: visible;
}

.about-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

.about-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 2;
    /* Layer text ABOVE the blob */
}

.skills-title {
    margin-top: var(--spacing-lg);
    /* Increased separation from text above */
    margin-bottom: 0px;
    /* Reduced separation from image below */
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ffffff;
}

.skills-image {
    width: auto;
    max-width: 400px;
    height: auto;
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
    /* Ensuring auto margins for centering */
}

@media (max-width: 768px) {
    .about-content {
        grid-template-columns: 1fr;
    }

    .about-blob-container {
        width: 400px;
        height: 400px;
        left: 50%;
    }

    #about {
        padding: 40px 0;
    }

    .about-details {
        padding: 0 var(--spacing-md);
        width: 100%;
    }

    .about-text {
        padding: 0;
        width: 100%;
    }

    .skills-image {
        width: 100% !important;
        max-width: 220px !important;
        height: auto !important;
        margin: 2rem auto !important;
        display: block;
    }
}

.about-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.about-text p {
    color: #ffffff;
    /* Keep white as the section is black background */
    max-width: 500px;
    line-height: 1.6;
}

/* Services Section */
.services-list {
    display: flex;
    flex-direction: column;
}

.service-item {
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    transition: padding var(--transition-fast);
    cursor: pointer;
}

.service-item:hover {
    padding-left: var(--spacing-sm);
}

.service-item:last-child {
    border-bottom: 1px solid var(--border-color);
}

.service-item h2 a {
    font-size: clamp(2rem, 4vw, 4rem);
    color: var(--text-muted);
}

.service-item:hover h2 a {
    color: var(--text-color);
}

.service-num {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--accent-secondary);
}

.portfolio-section {
    padding: calc(var(--spacing-xl) / 2) 0;
}

/* Portfolio Section */
.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--spacing-md);
}

.btn-link {
    font-size: 1rem;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    width: 100%;
}

.portfolio-grid--2col {
    grid-template-columns: repeat(2, 1fr);
}

.portfolio-grid--2col .portfolio-item {
    aspect-ratio: 9/8;
}

.portfolio-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    aspect-ratio: 3/4;
    /* Make them vertical frames */

    /* Entrance Animation Initial State */
    opacity: 0;
    transform: translateY(30px);
    transition: transform var(--transition-smooth), opacity var(--transition-smooth);
}

.portfolio-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.portfolio-item:hover::before {
    opacity: 0.5;
}

/* Diseño gráfico Colors */
#services .portfolio-grid .portfolio-item:nth-child(2n+1)::before {
    background-color: var(--accent-secondary);
    /* Magenta */
}

#services .portfolio-grid .portfolio-item:nth-child(2n)::before {
    background-color: var(--accent-color);
    /* Orange */
}

/* Diseño de producto Colors */
#portfolio .portfolio-grid .portfolio-item:nth-child(2n+1)::before {
    background-color: var(--accent-color);
    /* Orange */
}

#portfolio .portfolio-grid .portfolio-item:nth-child(2n)::before {
    background-color: var(--accent-secondary);
    /* Magenta */
}

.portfolio-image-wrapper {
    width: 100%;
    height: 100%;
    margin-bottom: 0;
    background-color: var(--surface-color);
}

.placeholder-image {
    width: 100%;
    height: 100%;
    transition: transform var(--transition-smooth);
    object-fit: cover;
}

.portfolio-item:hover .placeholder-image {
    transform: scale(1.05);
}

.portfolio-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    z-index: 2;
    pointer-events: none;
    /* Let click pass to item */
}

.portfolio-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
    color: #ffffff;
}

.portfolio-info span {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Contact Section */
.contact-section {
    padding-bottom: var(--spacing-xl);
}

.contact-title {
    font-size: clamp(3rem, 6vw, 6rem);
    margin: var(--spacing-md) 0;
}

.big-contact-link {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--accent-color);
    text-decoration: none;
    position: relative;
    display: inline-block;
}

.big-contact-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--accent-color);
    transition: width var(--transition-fast);
}

.big-contact-link:hover::after {
    width: 100%;
}

.footer-links {
    margin-top: var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.socials {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    /* Perfect vertical centering for different sized icons */
}

.socials a {
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    font-weight: 600;
    display: flex;
    align-items: center;
    line-height: 0;
    /* Remove line-height to prevent vertical offsets */
}

.socials a .social-icon {
    display: block;
    width: auto;
    filter: invert(0);
    transition: transform var(--transition-fast), filter var(--transition-fast);
}

.social-icon--linkedin {
    height: 22px !important;
}

.social-icon--behance {
    height: 32px !important;
    /* Larger as requested */
}

.socials a:hover .social-icon {
    transform: translateY(-5px);
    filter: brightness(0.8);
}

/* Footer */
.main-footer {
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* Project Details Gallery - Bento Style Grid */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    padding-bottom: 0;
    align-content: start;
    font-size: 0;
}

.project-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    display: block;
    margin: 0;
}

.project-gallery img:hover {
    transform: none;
}

.gallery-item {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-color);
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item.bg-white {
    background-color: #ffffff;
}

.gallery-item.img-centered img {
    width: 50% !important;
    height: auto !important;
    object-fit: contain !important;
}

.span-3 {
    grid-column: span 3;
}

.span-4 {
    grid-column: span 4;
}

.span-5 {
    grid-column: span 5;
}

.span-6 {
    grid-column: span 6;
}

.span-7 {
    grid-column: span 7;
}

.span-8 {
    grid-column: span 8;
}

.span-9 {
    grid-column: span 9;
}

.span-12 {
    grid-column: span 12;
}

/* Dynamic Heights for Bento Feel */
.h-small {
    aspect-ratio: 16/9;
}

.h-medium {
    aspect-ratio: 4/3;
}

.h-large {
    aspect-ratio: 1/1;
}

.h-tall {
    aspect-ratio: 3/4;
}

.h-banner {
    aspect-ratio: 1/2;
}

.h-wide {
    aspect-ratio: 2/1 !important;
}

.h-panoramic {
    aspect-ratio: 4/1 !important;
    /* Even less tall as requested */
}

.h-auto {
    height: auto !important;
    aspect-ratio: auto;
}

@media (max-width: 1024px) {

    .span-4,
    .span-3 {
        grid-column: span 6;
    }

    .span-8,
    .span-9,
    .span-7,
    .span-5 {
        grid-column: span 12;
    }
}

@media (max-width: 768px) {
    .project-gallery {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .span-3,
    .span-4,
    .span-5,
    .span-6,
    .span-7,
    .span-8,
    .span-9,
    .span-12 {
        grid-column: span 1;
    }

    .h-small,
    .h-medium,
    .h-large,
    .h-tall {
        aspect-ratio: auto;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        width: 250px;
        background-color: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        padding: 2rem;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        transform: translateY(-20px);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    }

    .main-nav.active {
        display: block;
        transform: translateY(0);
        opacity: 1;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: flex-end;
        /* Align right */
        gap: 1.5rem;
    }

    .menu-toggle {
        display: flex;
    }

    .hero-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }
}