/* ============================================
   FERDINANDO LOIACONO — Portfolio v6.0
   Clean Minimal · Pure Black · Premium
   ============================================ */

@font-face {
    font-family: 'Blur Medium';
    src: url('fonts/blur-medium.woff2') format('woff2'),
         url('fonts/blur-medium.woff') format('woff'),
         url('fonts/blur-medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --color-bg: #000000;
    --color-text: #FFFFFF;
    --color-text-muted: #999999;
    --color-text-light: #666666;
    --color-border: #1A1A1A;
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-accent: 'Blur Medium', 'Inter', sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: 0.4s var(--ease);
}

html { scroll-behavior: smooth; }

body {
    background: var(--color-bg);
    font-family: var(--font-primary);
    color: var(--color-text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ========== LOADING ========== */
.loading-screen {
    position: fixed; inset: 0;
    background: #000;
    z-index: 99999;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

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

.loading-logo { margin-bottom: 40px; opacity: 0; animation: fadeUp 0.8s ease forwards; }

.loading-text {
    font-family: var(--font-accent);
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #FFF;
    text-align: center;
    animation: textPulse 2.5s ease infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.9; filter: blur(0px); }
    50% { opacity: 0.4; filter: blur(2px); }
}

.loading-bar-container {
    width: 200px; height: 1px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
    opacity: 0; animation: fadeUp 0.8s ease 0.2s forwards;
}

.loading-bar {
    width: 0%; height: 100%;
    background: #FFF;
    transition: width 0.3s ease;
}

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

/* ========== HEADER ========== */
header {
    position: fixed; top: 0; left: 0; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 24px 48px;
    z-index: 1000;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #FFF;
    transition: background var(--transition), border-color var(--transition);
}

header.scrolled {
    background: rgba(0,0,0,0.92);
    border-bottom: 1px solid var(--color-border);
}

.logo {
    font-family: var(--font-accent);
    text-transform: uppercase; font-weight: 500;
    font-size: 13px; letter-spacing: 0.18em;
    cursor: pointer; transition: opacity var(--transition);
}
.logo:hover { opacity: 0.6; }

.logo span {
    display: inline-block; width: 8px; height: 1px;
    background: #FFF; margin-right: 6px; vertical-align: middle;
    transition: width var(--transition);
}
.logo:hover span { width: 16px; }

/* Header action buttons */
.header-actions {
    display: flex; gap: 24px; align-items: center;
}

.header-btn {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; font-weight: 400;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: #FFF; opacity: 0.7;
    transition: opacity var(--transition);
}

.header-btn svg {
    flex-shrink: 0;
}

.header-btn:hover { opacity: 1; }

/* Hero Section and dividers removed */

/* ========== SECTION HEADER ========== */
.section-header {
    padding: 140px 48px 40px;
    display: flex; justify-content: space-between; align-items: flex-end;
}

.section-title {
    font-family: var(--font-accent);
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.08em; line-height: 1.1;
    color: #FFF;
}

.section-counter {
    font-size: 11px; font-weight: 400;
    letter-spacing: 0.2em; text-transform: uppercase;
    color: #FFF;
    opacity: 0.5;
}

/* ========== FILTER ========== */
.filter-container {
    padding: 0 48px 40px;
    display: flex; gap: 12px; flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border: 1px solid var(--color-border);
    background: transparent;
    font-family: var(--font-accent);
    font-size: 11px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.12em;
    cursor: pointer; transition: all var(--transition);
    color: #FFF;
}

.filter-btn:hover {
    border-color: #FFF;
    background: rgba(255,255,255,0.05);
}

.filter-btn.active {
    background: #FFF;
    border-color: #FFF;
    color: #000;
}

/* ========== PROJECT SECTIONS ========== */
.project-section {
    margin-bottom: 40px; opacity: 1;
    transition: opacity 0.5s ease, transform 0.5s ease;
    padding-bottom: 20px;
}
.project-section.hidden { display: none; opacity: 0; }

.project-label {
    padding: 0 48px; margin-bottom: -10px;
    display: flex; justify-content: space-between; align-items: flex-end;
}

.project-label .project-name {
    font-family: var(--font-accent);
    font-size: 12px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.15em;
    color: #FFF;
}

/* ========== GALLERY ========== */
.gallery {
    display: flex; width: 100%; height: 65vh;
    overflow-x: auto; overflow-y: hidden;
    scroll-behavior: smooth;
    -ms-overflow-style: none; scrollbar-width: none;
    padding: 20px 0;
    contain: layout style;
}
.gallery::-webkit-scrollbar { display: none; }

.gallery-item {
    flex: 0 0 25vw; height: 100%;
    position: relative; overflow: hidden;
    cursor: zoom-in; display: block;
    will-change: transform;
}

.gallery-item.featured {
    flex: 0 0 45vw;
}

.gallery-item img {
    width: 100%; height: 100%; object-fit: cover;
    filter: brightness(0.85) contrast(1.1);
    transition: filter 0.6s var(--ease), transform 0.6s var(--ease);
}

.gallery-item:hover img {
    filter: brightness(1.05) contrast(1.1);
    transform: scale(1.06);
}

.gallery-item::after {
    content: ''; position: absolute; bottom: 0; left: 0;
    width: 100%; height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
    opacity: 0; transition: opacity 0.5s ease;
    pointer-events: none;
}
.gallery-item:hover::after { opacity: 1; }

.gallery-item::before {
    content: '⤢'; position: absolute; bottom: 16px; right: 16px;
    font-size: 18px; color: rgba(255,255,255,0.8);
    z-index: 2; opacity: 0; transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s var(--ease);
    pointer-events: none;
}
.gallery-item:hover::before { opacity: 1; transform: scale(1); }

/* ========== SCROLL REVEAL & STAGGER ANIMATIONS ========== */
.reveal {
    opacity: 0;
    transition: opacity 1s ease;
}
.reveal.visible {
    opacity: 1;
}

.reveal:not(.visible) .gallery-item {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
}

.reveal.visible .gallery-item {
    animation: premiumFadeInUp 1s var(--ease) forwards;
}

.reveal.visible .gallery-item:nth-child(1) { animation-delay: 0.05s; }
.reveal.visible .gallery-item:nth-child(2) { animation-delay: 0.15s; }
.reveal.visible .gallery-item:nth-child(3) { animation-delay: 0.25s; }
.reveal.visible .gallery-item:nth-child(4) { animation-delay: 0.35s; }
.reveal.visible .gallery-item:nth-child(5) { animation-delay: 0.45s; }
.reveal.visible .gallery-item:nth-child(6) { animation-delay: 0.55s; }

@keyframes premiumFadeInUp {
    from {
        opacity: 0;
        transform: translateY(35px) scale(0.97);
        filter: blur(8px) brightness(0.6);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px) brightness(0.85);
    }
}

.reveal.visible .gallery-item:hover img {
    filter: brightness(1.05) contrast(1.1);
}

/* ========== FULLSCREEN ========== */
::view-transition-old(active-image),
::view-transition-new(active-image) {
    animation-duration: 0.6s;
    animation-timing-function: var(--ease);
}

.fullscreen-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.96);
    z-index: 9999;
    display: flex; justify-content: center; align-items: center;
    cursor: zoom-out;
}

.fullscreen-overlay img {
    max-width: 90vw; max-height: 90vh;
    object-fit: contain;
    transition: transform 0.3s var(--ease);
    cursor: grab;
}

.fullscreen-overlay img.zoomed {
    cursor: grabbing;
    transform: scale(2.5);
}

.close-btn {
    position: absolute; top: 30px; right: 48px;
    font-size: 11px; text-transform: uppercase;
    font-weight: 400; letter-spacing: 0.2em;
    cursor: pointer; transition: opacity var(--transition);
    display: flex; align-items: center; gap: 8px; color: #FFF;
}
.close-btn::before {
    content: ''; display: block; width: 16px; height: 1px;
    background: #FFF; transform: rotate(45deg);
}
.close-btn::after {
    content: ''; display: block; position: absolute; left: 0;
    width: 16px; height: 1px; background: #FFF;
    transform: rotate(-45deg);
}
.close-btn:hover { opacity: 0.5; }

.fullscreen-counter {
    position: absolute; bottom: 30px; left: 48px;
    font-size: 11px; letter-spacing: 0.2em;
    color: #FFF; opacity: 0.6;
}

.fullscreen-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    font-size: 24px; font-weight: 300;
    cursor: pointer; transition: opacity var(--transition);
    user-select: none; padding: 20px; color: #FFF;
}
.fullscreen-nav:hover { opacity: 0.5; }
.fullscreen-nav.prev { left: 20px; }
.fullscreen-nav.next { right: 20px; }

.fullscreen-zoom-hint {
    position: absolute; bottom: 30px; right: 48px;
    font-size: 10px; letter-spacing: 0.2em;
    text-transform: uppercase; color: #FFF; opacity: 0.4;
}

/* ========== FOOTER ========== */
footer {
    padding: 40px 48px;
    display: flex; justify-content: center; align-items: center;
    border-top: 1px solid var(--color-border);
    font-size: 11px; letter-spacing: 0.12em;
    color: #FFF; opacity: 0.4;
}

.footer-credit { text-transform: uppercase; }

/* ========== SCROLL REVEAL REMOVED (Replaced by Stagger) ========== */

/* ========== RESPONSIVE — TABLET ========== */
@media (max-width: 1024px) {
    header { padding: 20px 32px; }
    .section-header { padding: 110px 32px 32px; }
    .filter-container { padding: 0 32px 32px; }
    .project-label { padding: 0 32px; }
    .gallery-item { flex: 0 0 35vw; }
    footer { padding: 32px; }
}

/* ========== RESPONSIVE — MOBILE ========== */
@media (max-width: 768px) {
    .header-btn span { display: none; }
    .header-actions { gap: 20px; }

    .section-header {
        padding: 90px 20px 20px;
        flex-direction: column; align-items: flex-start; gap: 8px;
    }
    .section-title { font-size: clamp(24px, 8vw, 36px); }

    .filter-container {
        padding: 0 20px 20px; gap: 8px;
        overflow-x: auto; flex-wrap: nowrap;
        scrollbar-width: none;
    }
    .filter-container::-webkit-scrollbar { display: none; }
    .filter-btn {
        padding: 8px 16px; font-size: 10px;
        white-space: nowrap; flex-shrink: 0;
    }

    .project-label { padding: 0 20px; }

    .gallery {
        height: 45vh;
        scroll-snap-type: x mandatory;
        gap: 8px; padding: 12px 20px;
    }
    .gallery-item {
        flex: 0 0 78vw;
        scroll-snap-align: center;
        border-radius: 3px;
    }
    .gallery-item.featured {
        flex: 0 0 90vw;
    }
    .gallery-item:hover img { filter: brightness(0.85) contrast(1.1); transform: none; }
    .gallery-item:hover::after { opacity: 0; }
    .gallery-item::before { display: none; }

    footer {
        padding: 24px 20px;
    }

    .fullscreen-overlay img { max-width: 100vw; max-height: 100vh; }
    .close-btn {
        top: 16px; right: 20px;
        background: rgba(0,0,0,0.8);
        padding: 12px 16px; border-radius: 2px;
    }
    .fullscreen-counter { bottom: 20px; left: 20px; }
    .fullscreen-nav { display: none; }
    .fullscreen-zoom-hint { display: none; }
}

@media (max-width: 480px) {
    .gallery { height: 40vh; }
    .gallery-item { flex: 0 0 85vw; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
