/* ========================================
   DAVID MARCHIONI — PHOTOGRAPHY PORTFOLIO
   ======================================== */

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

:root {
    --bg: #0a0a0a;
    --bg-surface: #111111;
    --bg-card: #161616;
    --text: #f0ece6;
    --text-muted: #8a8580;
    --accent: #c9a96e;
    --accent-light: #dfc08a;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   NAVIGATION
   ======================================== */

#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 48px;
    transition: all 0.5s var(--ease-smooth);
}

#main-nav.scrolled {
    padding: 16px 48px;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nav-logo a {
    color: var(--text);
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-links a {
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    position: relative;
    transition: color 0.3s;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.4s var(--ease-out);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 1001;
}

.nav-burger span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s;
}

.nav-burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-burger.active span:nth-child(2) {
    opacity: 0;
}

.nav-burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(30px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    z-index: 999;
    transition: right 0.5s var(--ease-out);
}

.mobile-nav.open {
    right: 0;
}

.mobile-nav a {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.mobile-nav a:hover {
    color: var(--text);
}

/* ========================================
   HERO SECTION
   ======================================== */

#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image {
    position: absolute;
    inset: -10%;
    background-size: cover;
    background-position: center top;
    transform: scale(1.1);
    transition: transform 0.1s linear;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(10, 10, 10, 0.3) 0%,
        rgba(10, 10, 10, 0.1) 40%,
        rgba(10, 10, 10, 0.5) 70%,
        rgba(10, 10, 10, 0.9) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 0 24px;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.1;
    margin-bottom: 24px;
}

.hero-line {
    display: block;
    overflow: hidden;
}

.hero-line-1 {
    font-size: clamp(3rem, 8vw, 7rem);
    animation: slideUp 1s var(--ease-out) 0.3s both;
}

.hero-line-2 {
    font-size: clamp(3.5rem, 10vw, 9rem);
    font-style: italic;
    color: var(--accent);
    animation: slideUp 1s var(--ease-out) 0.5s both;
}

.hero-subtitle {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 48px;
    animation: fadeIn 1s var(--ease-out) 0.8s both;
}

.hero-cta {
    display: inline-block;
    padding: 16px 48px;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    transition: all 0.4s var(--ease-smooth);
    animation: fadeIn 1s var(--ease-out) 1s both;
}

.hero-cta:hover {
    background: var(--accent);
    color: var(--bg);
}

.scroll-indicator {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: fadeIn 1s var(--ease-out) 1.5s both;
}

.scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scrollPulse 2s infinite;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ========================================
   SECTIONS COMMON
   ======================================== */

.section-header {
    text-align: center;
    padding: 120px 24px 60px;
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.8s var(--ease-out);
}

.section-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    position: relative;
}

.section-tag::before,
.section-tag::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 1px;
    background: var(--accent);
    opacity: 0.3;
}

.section-tag::before { right: calc(100% + 16px); }
.section-tag::after { left: calc(100% + 16px); }

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 400;
}

/* ========================================
   SHOWCASE GRID (Homepage)
   ======================================== */

.showcase-grid {
    display: columns;
    columns: 3;
    column-gap: 16px;
    padding: 0 48px 120px;
}

.showcase-item {
    break-inside: avoid;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.showcase-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.showcase-item img {
    width: 100%;
    height: auto;
    transition: transform 0.8s var(--ease-out);
}

.showcase-item:hover img {
    transform: scale(1.05);
}

.showcase-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0);
    transition: background 0.4s;
}

.showcase-item:hover .showcase-item-overlay {
    background: rgba(10, 10, 10, 0.2);
}

/* ========================================
   GALLERIES CAROUSEL (Homepage)
   ======================================== */

.galleries-carousel {
    display: flex;
    gap: 24px;
    padding: 0 48px 120px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.galleries-carousel::-webkit-scrollbar {
    display: none;
}

.gallery-card {
    flex: 0 0 380px;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: var(--bg-card);
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s var(--ease-out);
}

.gallery-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.gallery-card-img {
    height: 460px;
    overflow: hidden;
}

.gallery-card-img img {
    transition: transform 0.8s var(--ease-out);
}

.gallery-card:hover .gallery-card-img img {
    transform: scale(1.08);
}

.gallery-card-info {
    padding: 24px;
}

.gallery-card-info h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    margin-bottom: 4px;
}

.gallery-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ========================================
   GALLERIES PAGE
   ======================================== */

.page-header {
    padding: 140px 48px 60px;
    text-align: center;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 400;
    margin-bottom: 12px;
}

.page-header p {
    font-size: 1rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.galleries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 32px;
    padding: 20px 48px 120px;
}

.gallery-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.6s var(--ease-out), transform 0.3s var(--ease-smooth);
}

.gallery-tile.revealed {
    opacity: 1;
    transform: translateY(0);
}

.gallery-tile-stack {
    position: relative;
    height: 360px;
    overflow: hidden;
}

.gallery-tile-layer {
    position: absolute;
    inset: 0;
    transition: transform 0.6s var(--ease-out);
}

.gallery-tile-layer[style*="--layer: 0"] {
    transform: scale(0.92) translateY(-8px);
    opacity: 0.3;
}

.gallery-tile-layer[style*="--layer: 1"] {
    transform: scale(0.96) translateY(-4px);
    opacity: 0.6;
}

.gallery-tile-layer[style*="--layer: 2"] {
    transform: scale(1);
}

.gallery-tile:hover .gallery-tile-layer[style*="--layer: 0"] {
    transform: scale(0.88) translateY(-16px) rotate(-2deg);
}

.gallery-tile:hover .gallery-tile-layer[style*="--layer: 1"] {
    transform: scale(0.92) translateY(-10px) rotate(1deg);
}

.gallery-tile:hover .gallery-tile-layer[style*="--layer: 2"] {
    transform: scale(1.03);
}

.gallery-tile-info {
    padding: 28px 32px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.gallery-tile-info h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
}

.gallery-tile-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.gallery-tile-arrow {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.4s var(--ease-out);
}

.gallery-tile:hover .gallery-tile-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ========================================
   INDIVIDUAL GALLERY PAGE
   ======================================== */

.gallery-header {
    padding-bottom: 20px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent);
}

.view-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0 48px 32px;
}

.view-btn {
    background: var(--bg-surface);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.view-btn.active,
.view-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    color: var(--accent);
}

/* Masonry View */
.gallery-masonry {
    columns: 4;
    column-gap: 12px;
    padding: 0 48px 120px;
    display: none;
}

.gallery-masonry.active {
    display: block;
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 3px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.gallery-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item img {
    width: 100%;
    height: auto;
    transition: transform 0.7s var(--ease-out);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 10, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.4s;
}

.gallery-item:hover .gallery-item-overlay {
    background: rgba(10, 10, 10, 0.3);
}

.gallery-item-zoom {
    color: white;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s var(--ease-out);
}

.gallery-item:hover .gallery-item-zoom {
    opacity: 1;
    transform: scale(1);
}

/* Cinematic View */
.gallery-cinematic {
    display: none;
    flex-direction: column;
    padding-bottom: 120px;
}

.gallery-cinematic.active {
    display: flex;
}

.cinematic-track {
    display: flex;
    gap: 24px;
    padding: 0 48px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 75vh;
}

.cinematic-track::-webkit-scrollbar {
    display: none;
}

.cinematic-slide {
    flex: 0 0 auto;
    height: 100%;
    scroll-snap-align: center;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.4s var(--ease-out), opacity 0.4s;
}

.cinematic-slide img {
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: cover;
}

.cinematic-progress {
    width: 200px;
    height: 2px;
    background: rgba(255,255,255,0.1);
    margin: 24px auto 0;
    border-radius: 1px;
    overflow: hidden;
}

.cinematic-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.1s;
}

/* ========================================
   LIGHTBOX
   ======================================== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s var(--ease-smooth);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-img-wrap {
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img-wrap img {
    max-width: 92vw;
    max-height: 88vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 2px;
    animation: lightboxIn 0.4s var(--ease-out);
}

@keyframes lightboxIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
    z-index: 10;
    line-height: 1;
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    font-size: 2.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: all 0.3s;
    z-index: 10;
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.1em;
}

/* ========================================
   CONTACT SECTION
   ======================================== */

#contact {
    padding-bottom: 80px;
}

.contact-content {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
    padding: 0 24px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s var(--ease-out);
}

.contact-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.contact-content p {
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.8;
}

.contact-email {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--accent);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

.contact-email:hover {
    border-color: var(--accent);
}

/* ========================================
   FOOTER
   ======================================== */

footer {
    text-align: center;
    padding: 40px 24px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ========================================
   GALLERY EMPTY STATE
   ======================================== */

.gallery-empty {
    text-align: center;
    padding: 120px 24px;
    color: var(--text-muted);
}

.gallery-empty a {
    display: inline-block;
    margin-top: 24px;
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .showcase-grid {
        columns: 2;
        padding: 0 24px 80px;
    }

    .gallery-masonry {
        columns: 3;
        padding: 0 24px 80px;
    }

    .galleries-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 24px;
        padding: 20px 24px 80px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-burger {
        display: flex;
    }

    #main-nav {
        padding: 20px 24px;
    }

    #main-nav.scrolled {
        padding: 16px 24px;
    }

    .showcase-grid {
        columns: 1;
        padding: 0 16px 60px;
    }

    .gallery-masonry {
        columns: 2;
        column-gap: 8px;
        padding: 0 16px 60px;
    }

    .gallery-item {
        margin-bottom: 8px;
    }

    .galleries-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 16px 60px;
    }

    .gallery-tile-stack {
        height: 280px;
    }

    .galleries-carousel {
        padding: 0 24px 60px;
        gap: 16px;
    }

    .gallery-card {
        flex: 0 0 300px;
    }

    .gallery-card-img {
        height: 360px;
    }

    .page-header {
        padding: 120px 24px 40px;
    }

    .section-header {
        padding: 80px 24px 40px;
    }

    .view-controls {
        padding: 0 16px 24px;
    }

    .cinematic-track {
        padding: 0 16px;
        height: 50vh;
        gap: 12px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
    }

    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
}

@media (max-width: 480px) {
    .gallery-masonry {
        columns: 1;
    }

    .hero-cta {
        padding: 14px 36px;
    }

    .gallery-tile-info {
        flex-direction: column;
        gap: 4px;
        padding: 20px 24px;
    }
}

/* ========================================
   SELECTION & CUSTOM SCROLLBAR
   ======================================== */

::selection {
    background: var(--accent);
    color: var(--bg);
}

body::-webkit-scrollbar {
    width: 6px;
}

body::-webkit-scrollbar-track {
    background: var(--bg);
}

body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
}

body::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.25);
}
