/* Fuente personalizada Archia Semibold */
@font-face {
    font-family: 'archia';
    src: url('fonts/archia-semibold-webfont.eot');
    src: url('fonts/archia-semibold-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/archia-semibold-webfont.woff2') format('woff2'),
         url('fonts/archia-semibold-webfont.woff') format('woff'),
         url('fonts/archia-semibold-webfont.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        scroll-snap-type: x mandatory;
    }
}

body {
    font-family: 'Doto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: #000;
    color: #fff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
    font-weight: 900;
}

@media (min-width: 768px) {
    body {
        overflow: hidden;
    }
}

/* Gradiente solo abajo en móvil */
@media (max-width: 767px) {
    body::after {
        content: '';
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        height: 250px;
        background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 40%, rgba(0,0,0,0.3) 70%, transparent 100%);
        pointer-events: none;
        z-index: 9999;
    }
}

/* Header fijo siempre visible */
.fixed-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 15px;
    z-index: 16000;
}

.director-name {
    font-size: 35px;
    font-weight: 900;
    letter-spacing: 0.3px;
    margin: 0;
    cursor: pointer;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    text-transform: lowercase;
}

.director-name:hover {
    opacity: 0.7;
}

/* Pantalla de carga */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-text {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.3px;
    color: #fff;
}

.container {
    transition: opacity 0.8s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    padding: 0 20px;
}

@media (min-width: 768px) {
    .container {
        padding: 0;
        width: 100%;
        height: 100vh;
        overflow: hidden;
    }
}

.spacer {
    height: 15px;
}

.spacer-bottom {
    height: calc(100vh - 200px);
}

@media (min-width: 768px) {
    .spacer-bottom {
        display: none;
    }
}

.projects {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 0 20px 0;
}

/* Móvil horizontal - scroll vertical más compacto */
@media (orientation: landscape) and (max-height: 500px) {
    .projects {
        gap: 10px !important;
        padding: 0 0 10px 0 !important;
    }
}

@media (min-width: 768px) {
    body {
        overflow: hidden;
    }
    
    .container {
        min-width: 100vw;
        height: 100vh;
        overflow: hidden;
    }
    
    .projects {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 120px;
        padding: 0 50vw 150px 50vw;
        min-height: 100vh;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        perspective: 1200px;
        -webkit-overflow-scrolling: touch;
        transform: translateY(-3vh);
    }
    
    .projects::-webkit-scrollbar {
        display: none;
    }
}

.project-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    scroll-snap-align: center;
    position: relative;
}

@media (min-width: 768px) {
    .project-item {
        flex-shrink: 0;
        scroll-snap-align: center;
        scroll-snap-stop: always;
        transition: transform 0.6s ease, opacity 0.6s ease;
        transform: scale(0.8);
        opacity: 0.4;
        cursor: pointer;
    }
    
    .project-item.centered {
        transform: scale(1.3);
        opacity: 1;
        cursor: default;
    }
}

.video-container {
    width: 100%;
    max-width: 483px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
    position: relative;
    margin-bottom: 10px;
    z-index: 1;
}

/* Móvil horizontal - videos más pequeños */
@media (orientation: landscape) and (max-height: 500px) {
    .video-container {
        max-width: 225px !important;
        max-height: 225px !important;
    }
    
    .project-item {
        margin: 5px 0 !important;
    }
}

@media (min-width: 768px) {
    .video-container {
        margin-bottom: 15px;
        max-width: min(600px, 48vh);
        max-height: min(600px, 48vh);
    }
    
    /* Videos no centrados no son interactivos */
    .project-item:not(.centered) .video-container {
        cursor: default;
        pointer-events: none;
    }
    
    /* Solo el centrado permite interacción */
    .project-item.centered .video-container {
        cursor: grab;
        pointer-events: auto;
    }
}

.video-container:active {
    cursor: grabbing;
}

/* Indicador de carga para videos */
.video-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.video-loading-indicator .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Indicador "drag to rotate" */
.rotate-hint {
    position: absolute;
    top: calc(50% - 10px);
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Doto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 100;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .rotate-hint {
        top: calc(50% - 7.5px);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.video-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: contain;
}

/* Todos los videos son clickeables */
.video-container {
    cursor: pointer;
}

/* Recortes dinámicos aplicados inline por JavaScript */

.video-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Lightbox para videos */
.video-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 1.5s ease-in-out, visibility 1.5s ease-in-out;
}

.video-lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-close {
    position: absolute;
    top: calc(50% - (min(90vw, 1200px) * 9 / 16) / 2 - 40px);
    right: calc(5% + 10px);
    cursor: pointer;
    z-index: 20001;
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    text-transform: lowercase;
}

@media (min-width: 1333px) {
    .lightbox-close {
        right: calc((100vw - 1200px) / 2 + 10px);
    }
}

.video-lightbox.active .lightbox-close {
    opacity: 1;
}

.video-lightbox:not(.active) .lightbox-close {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lightbox-close:hover {
    opacity: 0.7;
}
.lightbox-info {
    position: absolute;
    bottom: 40px;
    left: 40px;
    z-index: 20001;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.3px;
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

.video-lightbox.active .lightbox-info {
    opacity: 1;
}

.video-lightbox:not(.active) .lightbox-info {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lightbox-title {
    font-size: 16px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.lightbox-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.8;
}

.lightbox-separator::after {
    content: '•';
}

@media (max-width: 767px) {
    .lightbox-info {
        bottom: 25px;
        left: 25px;
        font-size: 11px;
    }
    
    .lightbox-title {
        font-size: 14px;
    }
}
.lightbox-content {
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 16 / 9;
    position: relative;
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

.video-lightbox.active .lightbox-content {
    opacity: 1;
}

.video-lightbox:not(.active) .lightbox-content {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lightbox-content iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Páginas overlay (Contact y About) */
.overlay-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.2s ease, visibility 1.2s ease;
    pointer-events: none;
}

.overlay-page.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.overlay-content {
    text-align: center;
    max-width: 90%;
    padding: 0 20px;
}

.overlay-text {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.3px;
    color: #fff;
    margin-bottom: 60px;
}

.about-text {
    max-width: 600px;
    line-height: 1.6;
}

.back-button {
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.3s ease;
    text-decoration: none;
}

.back-button:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.email-link {
    color: #fff;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.email-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

@media (min-width: 768px) {
    .overlay-text {
        font-size: 16px;
    }
    
    .about-text {
        max-width: 700px;
        font-size: 16px;
    }
    
    .back-button {
        font-size: 14px;
    }
}

.rotate-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-title {
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0.2px;
    background-color: transparent;
    color: #fff;
    padding: 5px 10px;
    display: inline-block;
    text-transform: uppercase;
}


.navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px 20px;
    background-color: transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.2s ease;
    z-index: 10000;
}

@media (min-width: 768px) {
    .navigation {
        justify-content: space-between;
        padding: 20px 50px;
        bottom: 20px;
    }
    
    .nav-link:nth-child(1) {
        order: 1; /* contact - izquierda */
    }
    
    .nav-link:nth-child(2) {
        order: 2; /* about - centro */
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .nav-link:nth-child(3) {
        order: 3; /* random - derecha */
    }
}

.nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    transition: opacity 0.3s ease;
    opacity: 0.75;
}

.nav-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Flechas de navegación desktop */
.carousel-nav {
    display: none;
}

@media (min-width: 768px) {
    .carousel-nav {
        display: block;
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: #fff;
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.3px;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: opacity 1.2s ease;
        z-index: 11000;
        padding: 10px;
    }

    .carousel-nav.visible {
        opacity: 0.5;
        visibility: visible;
    }

    .carousel-nav.visible:hover {
        opacity: 1;
        transition: opacity 0.3s ease;
    }

    .carousel-nav--prev {
        left: 24px;
    }

    .carousel-nav--next {
        right: 24px;
    }
}

        padding: 0 40px;
    }

    .fixed-header {
        padding: 25px 20px;
    }

    .spacer {
        height: 80px;
    }

    .projects {
        gap: 60px;
    }

    .video-container {
        max-width: 900px !important;
    }

    .project-title {
        font-size: 14px;
        padding: 8px 16px;
    }

    .nav-link {
        font-size: 13px;
    }
}

@media (min-width: 1024px) {
    .video-container {
        max-width: 1200px !important;
    }

    .projects {
        gap: 80px;
    }

    .project-title {
        font-size: 15px;
        padding: 8px 18px;
    }
}
