/* ============================================
   EXPLODING STACK PORTFOLIO
   ============================================ */

:root {
    --bg: #000;
    --text: #fff;
    --dim: #444;
    --dim2: #222;
    --font: 'Avenir Next', 'Avenir', -apple-system, 'Helvetica Neue', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

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

/* ==========================================
   CUSTOM CURSOR
   ========================================== */
.cursor {
    position: fixed;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.25s ease, height 0.25s ease, background 0.25s ease;
    mix-blend-mode: difference;
}

.cursor.drag {
    width: 52px;
    height: 52px;
}

/* ==========================================
   INTRO
   ========================================== */
.intro {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 60px;
    position: relative;
}

.intro-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.intro-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.8;
}

.intro-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, #000 100%);
}

.intro-content {
    margin-top: auto;
    margin-bottom: auto;
    position: relative;
    z-index: 10;
}

.intro-label {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: lowercase;
    color: #777;
    font-weight: 300;
    margin-bottom: 24px;
}

.intro-name {
    font-size: clamp(3.5rem, 9vw, 9rem);
    font-weight: 300;
    line-height: 0.92;
    letter-spacing: -0.02em;
    text-transform: none;
    color: #fff;
}

.intro-sub {
    margin-top: 28px;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: #777;
    font-weight: 300;
}

.intro-scroll-hint {
    display: flex;
    align-items: center;
    gap: 16px;
    position: absolute;
    bottom: 52px;
    right: 60px;
    z-index: 10;
}

.intro-scroll-hint span {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: #666;
    font-weight: 300;
}

.scroll-line {
    width: 40px;
    height: 1px;
    background: var(--dim2);
    position: relative;
    overflow: hidden;
}

.scroll-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--dim);
    animation: line-anim 2s ease infinite;
}

@keyframes line-anim {
    0%   { left: -100%; }
    50%  { left: 0%; }
    100% { left: 100%; }
}

/* ==========================================
   PROJECT BLOCK & HERO (Split Layout)
   ========================================== */
.project-block {
    width: 100%;
    border-top: 1px solid #111;
}

.project-hero {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 80px 60px 60px;
}

.project-hero-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 40px;
    position: relative;
    z-index: 200;
}

.project-index {
    font-size: 1.5rem;
    letter-spacing: 0.1em;
    color: #fff;
    font-weight: 300;
    text-transform: lowercase;
    padding-bottom: 16px;
}

.project-title {
    font-size: clamp(3rem, 7vw, 6rem);
    font-weight: 300;
    letter-spacing: -0.01em;
    line-height: 1;
    color: #fff;
    text-transform: none;
    margin-bottom: 12px;
}

.project-meta {
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    color: #666;
    font-weight: 300;
    text-transform: lowercase;
}

.project-hero-right {
    flex: 1.5;
    height: 380px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stack-hint {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: #888;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
    text-transform: lowercase;
}

.stack-hint.hidden {
    opacity: 0;
}

/* ==========================================
   GRID CONTAINER (Masonry Base)
   ========================================== */
.grid-container {
    position: relative;
    width: 100%;
    padding: 0 60px;
    margin: 0 auto 80px;
    z-index: 20;
    transition: height 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================
   ART CARD
   ========================================== */
.art-card {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--card-width, 30%); /* Set by JS */
    display: flex;
    flex-direction: column;
    align-items: center;
    
    /* Use CSS variables for transform to allow hover scaling without breaking position */
    transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--rot, 0deg)) scale(var(--scale, 1));
    
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.8s ease, 
                opacity 0.4s ease;
    
    /* Default stacked shadow */
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    transform-origin: center center;
    will-change: transform;
}

.art-card img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}



/* When in grid layout (exploded) */
.grid-container.exploded .art-card {
    /* Shadow reduces when in grid */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    cursor: none;
}

.grid-container.exploded .art-card:hover {
    --scale: 1.02;
    z-index: 100 !important;
}

/* ==========================================
   LIGHTBOX
   ========================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

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

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    display: block;
    transform: scale(0.96);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.active .lightbox-img {
    transform: scale(1);
}

.lightbox-caption {
    display: none;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    background: none;
    border: none;
    color: var(--dim);
    font-size: 2.2rem;
    cursor: none;
    font-family: var(--font);
    font-weight: 200;
    line-height: 1;
    transition: color 0.2s ease;
}

.lightbox-close:hover {
    color: #fff;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
    .intro { padding: 40px; }
    .intro-scroll-hint { right: 40px; bottom: 40px; }
    
    .project-block {
        overflow: hidden;
    }

    .project-block.exploded-mobile {
        overflow: visible;
    }
    
    .project-hero {
        flex-direction: column;
        padding: 60px 40px 0;
        height: auto;
        align-items: flex-start;
    }
    .project-hero-left {
        width: 100%;
        padding-right: 0;
        margin-bottom: 0;
        flex: none;
    }
    .project-hero-right {
        width: 100%;
        height: 420px;
        flex: none;
        margin-top: 20px;
    }
    
    .grid-container { padding: 0 40px; }
}

@media (max-width: 540px) {
    .intro { padding: 28px; }
    .intro-name { font-size: 3rem; }
    .project-hero { padding: 60px 28px 0; }
    .project-hero-right { height: 380px; }
    .grid-container { padding: 0 16px; }
}

.footer {
    padding: 100px 60px 60px;
    text-align: center;
}

.footer p {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: #444;
    font-weight: 300;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.8;
}
