/* ===========================
   CSS Variables & Reset
   =========================== */

:root {
    /* Colors */
    --color-bg: #f9f7f4;
    --color-text: #1a1a1a;
    --color-accent: #d32f2f;
    --color-text-muted: #666;

    /* Typography */
    --font-primary: 'Inter', sans-serif;
    --font-size-base: 23.9pt;
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 6rem;

    /* Layout */
    --max-width: 1400px;
    --header-height: 80px;

    /* Animation */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-light);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    cursor: auto;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-smooth);
}

/* Impostiamo la pagina per occupare tutto lo schermo */
body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    /* Fondamentale per definire l'altezza */
}

.page-container {
    position: relative;
    /* Serve da riferimento per il blocco assoluto */
    min-height: 100vh;
    /* Assicura che il contenitore sia alto quanto lo schermo */
    width: 100%;
    font-family: sans-serif;
    /* Metti qui il tuo font */
}

/* IL BLOCCO CHE CONTIENE TUTTO IL TESTO IN BASSO */
.bottom-left-wrapper {
    position: absolute;
    /* Lo sgancia dal flusso normale */
    bottom: 50px;
    /* Distanza dal fondo */
    left: 50px;
    /* Distanza da sinistra */
    text-align: left;
    /* Allinea il testo a sinistra */
    color: #333;
    /* Colore del testo (grigio scuro) */
}

/* Spaziatura tra la scritta "Diseñadora" e i contatti */
.designer-info {
    margin-bottom: 40px;
    /* Crea lo spazio vuoto verticale */
}

/* Stile per le righe di testo */
p {
    margin: 5px 0;
    /* Un po' di spazio tra le righe */
    font-size: 14px;
    font-weight: 300;
    /* Testo sottile come nell'immagine */
}

/* Se vuoi la parola "Contacto" leggermente diversa */
.label {
    margin-bottom: 10px;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===========================
   Custom Cursor
   =========================== */

.custom-cursor {
    display: none;
}

.custom-cursor.hover {
    display: none;
}

/* Restore default cursor */
* {
    cursor: auto !important;
}

/* ===========================
   Header & Navigation
   =========================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: transparent;
    backdrop-filter: none;
    border-bottom: none;
    transition: transform 0.3s ease;
}

.header.header-hidden {
    transform: translateY(-100%);
}

/* Solid header for non-homepage pages */
.header-solid {
    background-color: rgba(249, 247, 244, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(26, 26, 26, 0.1);
}

.header-solid .nav-link {
    color: var(--color-text);
    text-shadow: none;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-right {
    display: flex;
    gap: var(--spacing-md);
}

.nav-link {
    font-size: 16px;
    font-weight: var(--font-weight-light);
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: var(--transition-smooth);
    color: rgb(0, 0, 0);
}

.nav-link.active {
    color: var(--color-accent);
}

/* ===========================
   Video Hero Section
   =========================== */

.video-hero {
    position: relative;
    width: 100%;
    height: 66.67vh;
    overflow: hidden;
    margin-top: 33.33vh;
    /* Sposta il video nella parte bassa (1/3 spazio sopra) */
}

.hero-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ===========================
   Projects Section
   =========================== */

.projects {
    padding: var(--spacing-xl) var(--spacing-md);
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    place-items: center;
    /* Centers both horizontally and vertically */
    align-content: center;
    position: relative;
    background-color: var(--color-bg);
}

.projects-background {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 650px;
    height: 650px;
    margin-top: -325px;
    margin-left: -325px;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    background-size: contain;
    -webkit-background-size: contain;
    -moz-background-size: contain;
    -o-background-size: contain;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    -webkit-transition: opacity 0.8s ease-out;
    -moz-transition: opacity 0.8s ease-out;
    -o-transition: opacity 0.8s ease-out;
    transition: opacity 0.8s ease-out;
    pointer-events: none;
    z-index: 1;
}

.projects-background.active {
    opacity: 1;
}

#projectsBackgroundVideo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 650px;
    height: 650px;
    margin-top: -325px;
    margin-left: -325px;
    object-fit: contain;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

#projectsBackgroundVideo.active {
    opacity: 1;
}

.projects-text-wrapper {
    position: relative;
    z-index: 2;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

.projects-text {
    font-size: clamp(0.85rem, 1.35vw, 1.05rem);
    font-weight: var(--font-weight-light);
    line-height: 2;
    letter-spacing: 0px;
    text-align: center;
    display: block;
    width: 100%;
}

.project-name {
    display: inline;
    transition: color 0.3s ease;
    position: relative;
}

/* On desktop, hide the background-image and video that JS sets for mobile grid */
@media (min-width: 641px) {
    .project-name {
        background-image: none !important;
    }

    .mobile-preview-video {
        display: none !important;
    }
}

.project-name:hover {
    color: var(--color-accent);
}

.project-name.fade-away {
    transform: translateY(-100vh);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease;
}

.project-separator {
    display: inline;
    margin: 0 0.5rem;
    color: var(--color-text);
}

/* ===========================
   Gallery Modal
   =========================== */

.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(249, 247, 244, 0.98);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
}

.gallery-header {
    position: sticky;
    top: 0;
    background-color: rgba(249, 247, 244, 0.95);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(26, 26, 26, 0.1);
    z-index: 2001;
}

.gallery-title {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: var(--font-weight-regular);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.gallery-close {
    background: none;
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    cursor: none;
}

.gallery-close:hover {
    background-color: var(--color-accent);
    color: white;
    transform: rotate(90deg);
}

.gallery-content {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 4rem;
    padding-left: 350px;
    /* Space for sidebar */
    max-width: none;
    margin: 0;
    align-items: flex-start;
}

.gallery-image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    flex-shrink: 0;
}

.gallery-image {
    width: auto;
    height: auto;
    max-width: 400px;
    max-height: 500px;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-image-wrapper:hover .gallery-image {
    transform: scale(1.05);
}

/* Scroll Animation - Text turns red */
.scroll-text {
    transition: color 0.6s ease;
}

.scroll-text.active {
    color: var(--color-accent) !important;
}

.gallery-sidebar {
    position: fixed;
    left: var(--spacing-lg);
    top: 120px;
    width: 300px;
    z-index: 2002;
    transition: top 0.3s ease;
}

.gallery-title-sticky {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: var(--font-weight-regular);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

.gallery-description {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.gallery-description.visible {
    opacity: 1;
    transform: translateY(0);
}

.description-text {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text);
    text-transform: uppercase;
}

/* ===========================
   Scroll Animation - Text turns red
   =========================== */





/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 1200px) {
    .gallery-content {
        columns: 3;
    }
}

@media (max-width: 968px) {
    .nav {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .nav-right {
        gap: var(--spacing-md);
    }

    .projects-text {
        font-size: clamp(1rem, 3vw, 1.5rem);
    }

    .gallery-content {
        padding: var(--spacing-md);
        padding-left: var(--spacing-md);
        gap: 1.5rem;
    }

    .gallery-sidebar {
        position: relative;
        left: 0;
        top: 0;
        width: 100%;
        margin-bottom: var(--spacing-md);
    }

    .gallery-image {
        max-width: 300px;
        max-height: 400px;
    }
}

@media (max-width: 640px) {
    :root {
        --font-size-base: 16pt;
    }

    .nav {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }

    .nav-right {
        gap: var(--spacing-sm);
        font-size: 12px;
    }

    .custom-cursor {
        display: none;
    }

    /* Keep custom cursor hidden on mobile */
    * {
        cursor: auto !important;
    }

    .hero {
        min-height: 80vh;
    }

    .projects-text {
        font-size: clamp(0.9rem, 4vw, 1.2rem);
    }

    .project-separator {
        margin: 0 0.25rem;
    }

    .gallery-content {
        padding: var(--spacing-sm);
        gap: 1rem;
    }

    .gallery-image {
        max-width: 250px;
        max-height: 350px;
    }

    .gallery-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .contact-social {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}

/* ===========================
   Animations
   =========================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.8s ease forwards;
}

/* Smooth scrolling enhancement */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ===========================
   Mobile Navigation
   =========================== */

@media (max-width: 640px) {
    .nav {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding: var(--spacing-sm);
    }

    .nav-center {
        position: static;
        transform: none;
    }

    .nav-right {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .nav-link {
        font-size: 14px;
        letter-spacing: 1.5px;
    }

    /* Mobile Project Grid - Show images instead of text */
    /* Push projects section below fixed navbar */
    .projects {
        padding-top: calc(var(--header-height) + 2rem);
    }

    .projects-text-wrapper {
        max-width: 100%;
        padding: 2rem 1rem;
    }

    .projects-text {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        text-align: left;
    }

    /* Hide separators on mobile */
    .project-separator {
        display: none !important;
    }

    /* Show images in grid */
    .project-name {
        display: block;
        position: relative;
        aspect-ratio: 4/3;
        background-size: cover;
        background-position: center;
        border-radius: 4px;
        transition: transform 0.3s ease, opacity 0.3s ease;
        font-size: 0;
        color: transparent;
        overflow: hidden;
    }

    .mobile-preview-video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 4px;
        pointer-events: none;
    }

    .project-name:hover {
        transform: scale(1.05);
        opacity: 0.9;
        color: transparent;
    }

    /* Hide background image/video on mobile */
    .projects-background,
    #projectsBackgroundVideo {
        display: none !important;
    }
}