/* ============================================================
   NAVIGATION & ABOUT OVERLAY
   ============================================================ */

.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    pointer-events: none; /* Allow clicks through to hero but enable for children */
}

.nav-left, .nav-right {
    pointer-events: auto;
}

.about-circle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.about-circle-btn:hover {
    background: #fff;
    color: #000;
    transform: scale(1.1);
}

.signature-nav {
    height: 180px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.signature-nav:hover {
    opacity: 1;
}

/* About Overlay */
.about-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.about-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.close-btn {
    position: absolute;
    top: 30px;
    left: 40px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 2001;
}

.about-content {
    max-width: 900px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.about-image-container {
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.about-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.05);
    transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.about-overlay.visible .about-image {
    transform: scale(1);
}

.about-text {
    font-family: 'Delius', cursive;
    font-size: clamp(1rem, 2vw, 1.75rem); /* Reduced 50% for better elegance */
    line-height: 1.4;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    text-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.about-signature {
    position: absolute;
    top: 35px;
    right: 40px;
}

@media (max-width: 768px) {
    .main-nav { padding: 15px 20px; }
    .about-circle-btn { width: 50px; height: 50px; font-size: 0.65rem; }
    .signature-nav { height: 120px; }
}

/* The section is taller than the viewport — this extra height
   is what drives the scroll progress (300vh = 3 screens of scroll). */
#hero-section {
    position: relative;
    height: 500vh; /* total scrollable distance */
    background: #000;
    margin-bottom: -100vh; /* Let the next section overlap the end of the video */
    z-index: 1;
}

/* Sticky container that locks to the viewport while scrolling */
#hero-sticky {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas fills the entire sticky area */
#heroCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Overlay Title ---- */
#hero-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    /* will-change helps the browser optimise opacity changes */
    will-change: opacity;
}

.hero-eyebrow {
    font-family: 'Delius', cursive;
    font-size: clamp(0.65rem, 1.2vw, 0.9rem);
    font-weight: 400;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(12px);
    animation: heroFadeUp 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

#hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 9vw, 8rem);
    font-weight: 700;
    line-height: 1.0;
    letter-spacing: -0.02em;
    color: #fff;
    text-shadow: 0 4px 40px rgba(0,0,0,0.8);
    margin: 0 0 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.5s forwards;
}

#hero-title span {
    color: rgba(255,255,255,0.75);
    font-style: italic;
}

.hero-subtitle {
    font-family: 'Delius', cursive;
    font-size: clamp(0.75rem, 1.4vw, 1rem);
    font-weight: 300;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    animation: heroFadeUp 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.8s forwards;
}

@keyframes heroFadeUp {
    to   { opacity: 1; transform: translateY(0); }
    from { opacity: 0; transform: translateY(var(--from-y, 20px)); }
}

/* ---- Loading Bar ---- */
#hero-loader {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 20;
    transition: opacity 0.6s ease;
}

.loader-bar {
    width: 200px;
    height: 2px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
}

.loader-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(255,255,255,0.4), #fff);
    border-radius: 2px;
    transition: width 0.1s linear;
}

#loaderPct {
    font-family: 'Delius', cursive;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.5);
}

#hero-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ---- Scroll Hint ---- */
#hero-scroll-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#hero-scroll-hint.visible {
    opacity: 1;
}

.scroll-line {
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.7));
    animation: lineGrow 2s ease-in-out infinite;
}

#hero-scroll-hint span {
    font-family: 'Delius', cursive;
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
}

@keyframes lineGrow {
    0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
    50%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
    100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ============================================================ */

:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --accent: #333;
    --transition: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Delius', cursive;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Landing */
.landing {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    background: transparent; /* Transparent to let the sticky video show through during transition */
    z-index: 10; /* Overlap the sticky hero video */
}

.logo-container {
    width: 80%;
    max-width: 600px;
    opacity: 0;
    animation: fadeIn 2s ease forwards 0.5s;
}

.logo {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

@keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
    from { opacity: 0; transform: translateY(20px); }
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.6;
    cursor: pointer;
    animation: pulse 2s infinite;
    transition: opacity 0.3s;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-indicator span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.arrow {
    width: 15px;
    height: 15px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}

@keyframes cameraFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.camera-body {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    z-index: 1;
    position: relative;
}

@keyframes pulse {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(10px); opacity: 1; }
}


/* Orbit */
.landing {
    /* overflow is not hidden so the bottom image can bleed over without being cut */
}

.logo-container {
    width: 80%;
    max-width: 600px;
    opacity: 0;
    animation: fadeIn 2s ease forwards 0.5s;
    z-index: 10;
}

/* Camera Slideshow */
.camera-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1000px;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Will be faded in by app.js */
}

.camera-container {
    position: relative;
    width: 100%;
    filter: drop-shadow(0 20px 50px rgba(0,0,0,0.8));
    /* Animation removed from here, added via .floating class in app.js after transition */
}

.camera-container.floating {
    animation: cameraFloat 6s ease-in-out infinite;
}

.camera-lcd {
    position: absolute;
    /* Posicionamiento 100% relativo para que funcione en móviles */
    top: 31%;
    left: 6.5%;
    width: 58.1%;
    height: 46.9%;
    background: transparent;
    overflow: hidden;
    z-index: 3;
}

.lcd-slideshow {
    width: 100%;
    height: 100%;
    position: relative;
}

.lcd-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.lcd-img.active {
    opacity: 1;
}


    
    /* Bring the logo and carousel closer by adjusting the landing container */
    .landing {
        height: 90vh; /* Slightly shorter landing on mobile */
        min-height: 600px;
    }

    .logo-container {
        width: 70%; /* Slightly smaller logo to leave more room for orbit */
    }
    
    /* Word cloud limits for mobile */
    .cloud-word {
        font-size: 1.8rem;
    }
    .cloud-word:nth-child(n+8) {
        display: none !important;
    }
}

/* Portfolio */
.portfolio-section {
    padding: 100px 5%;
    max-width: 1600px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-weight: 300;
    font-size: 2.5rem;
    letter-spacing: 5px;
    margin-bottom: 60px;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 1px;
    background-color: rgba(255,255,255,0.5);
}

.portfolio-grid {
    columns: 3 320px;
    column-gap: 25px;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 25px;
    break-inside: avoid;
    display: block;
}

.portfolio-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}

.portfolio-item::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.2) 100%);
    opacity: 0;
    transition: opacity var(--transition);
}

.portfolio-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 2;
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--transition);
    text-align: center;
    pointer-events: none;
}

.portfolio-overlay h3 {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8);
    margin: 0;
}

.portfolio-item:hover img {
    transform: scale(1.08);
}

.portfolio-item:hover::after {
    opacity: 1;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
    transform: translateY(0);
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

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

.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 30px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1010;
}

.lightbox-title {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    margin: 0;
}

.close-lightbox {
    position: absolute;
    right: 40px;
    font-size: 40px;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.3s;
    line-height: 1;
}

.close-lightbox:hover {
    transform: rotate(90deg);
}

.lightbox-content {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border-radius: 4px;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    font-size: 1.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev { left: 0; }
.lightbox-nav.next { right: 0; }

.lightbox-thumbnails {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    height: 90px;
    overflow-x: auto;
    padding-bottom: 10px;
    max-width: 90%;
    scroll-behavior: smooth;
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.lightbox-thumb {
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.4;
    transition: all 0.3s;
    border-radius: 6px;
}

.lightbox-thumb.active {
    opacity: 1;
    border: 2px solid white;
    transform: scale(1.05);
}

.lightbox-thumb:hover:not(.active) {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .carousel-section { height: 60vh; }
    .carousel-controls { padding: 0 15px; }
    .control-btn { width: 40px; height: 40px; font-size: 1.2rem; }
    .portfolio-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; }
    .lightbox-content { height: 60vh; }
    .lightbox-nav { width: 45px; height: 45px; font-size: 1.2rem; }
    .close-lightbox { top: 15px; right: 20px; }

    #hero-section {
        /* Increased scroll distance for mobile to make the animation smoother */
        height: 300vh;
    }

    #hero-sticky {
        /* Use dvh so the animation doesn't get hidden behind mobile browser chrome */
        height: 100dvh;
    }

    .loader-bar {
        width: 140px;
    }

    #hero-scroll-hint {
        bottom: 20px;
    }
}

/* Portrait phones: extra safe-area insets (notch / home-bar) */
@media (max-width: 480px) {
    #hero-section {
        height: 160vh;
    }

    #hero-sticky {
        height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}
