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

:root {
    /* Palette: warm monochrome — zero rainbow */
    --bg:        #060605;
    --ink:       #e8e4dc;
    --ink-dim:   rgba(232,228,220,0.28);
    --ink-ghost: rgba(232,228,220,0.07);
    --gold:      #c49a62;
    --gap:       6px;
    --nav-h:     50px;
    --r:         8px;

    /* Easing */
    --out:    cubic-bezier(0.16,1,0.3,1);
    --spring: cubic-bezier(0.34,1.56,0.64,1);
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    cursor: none; /* hide default cursor */
}

/* ══════════════════════════════════════════
   CUSTOM CURSOR
══════════════════════════════════════════ */
.c-cursor { pointer-events: none; position: fixed; z-index: 9999; top: 0; left: 0; }

.c-ring {
    width: 36px; height: 36px;
    border: 1px solid rgba(232,228,220,0.55);
    border-radius: 50%;
    position: fixed;
    top: 0; left: 0;
    transform: translate(-50%,-50%);
    transition: width 0.3s var(--out), height 0.3s var(--out),
                border-color 0.3s ease, background 0.3s ease;
    will-change: transform;
}

.c-dot {
    width: 4px; height: 4px;
    background: var(--ink);
    border-radius: 50%;
    position: fixed;
    top: 0; left: 0;
    transform: translate(-50%,-50%);
    transition: transform 0.05s linear;
    will-change: transform;
}

/* Cursor expanded state on hover */
body.cursor-video .c-ring {
    width: 72px; height: 72px;
    border-color: rgba(196,154,98,0.6);
    background: rgba(196,154,98,0.06);
}
body.cursor-video .c-dot { opacity: 0; }

/* ══════════════════════════════════════════
   PRELOADER
══════════════════════════════════════════ */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s var(--out), transform 0.8s var(--out);
}

.preloader.out {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

.pre-center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.pre-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(2rem, 6vw, 5rem);
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0;
    transform: translateY(12px);
    animation: pre-fade 0.7s var(--out) 0.2s forwards;
}

@keyframes pre-fade {
    to { opacity: 1; transform: translateY(0); }
}

.pre-track {
    width: 180px;
    height: 1px;
    background: rgba(232,228,220,0.1);
    position: relative;
    overflow: hidden;
}

.pre-fill {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 0%;
    background: var(--gold);
    transition: width 0.1s linear;
}

.pre-pct {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.14em;
    color: var(--ink-dim);
}

/* ══════════════════════════════════════════
   AMBIENT — one warm glow, very restrained
══════════════════════════════════════════ */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 800px; height: 800px;
    background: radial-gradient(circle, rgba(100,60,20,0.32) 0%, transparent 68%);
    top: -200px; left: -200px;
    border-radius: 50%;
    filter: blur(120px);
    animation: blob-drift 30s ease-in-out infinite;
    will-change: transform;
}

@keyframes blob-drift {
    0%,100% { transform: translate(0,0); }
    33%      { transform: translate(60px,-40px); }
    66%      { transform: translate(-30px,50px); }
}

/* ══════════════════════════════════════════
   FILM GRAIN
══════════════════════════════════════════ */
.grain {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.042;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 200px 200px;
}

/* ══════════════════════════════════════════
   NAVIGATION
══════════════════════════════════════════ */
.nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 500;
    height: var(--nav-h);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(6,6,5,0.7);
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    border-bottom: 1px solid var(--ink-ghost);
}

/* Subtle top specular */
.nav::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(232,228,220,0.1) 30%,
        rgba(232,228,220,0.1) 70%,
        transparent
    );
}

.nav-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 17px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Vertical divider */
.nav-div {
    width: 1px;
    height: 14px;
    background: rgba(232,228,220,0.1);
}

/* Telegram link */
.nav-tg {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--ink-dim);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: none;
}
.nav-tg:hover { color: var(--gold); }
.tg-icon { flex-shrink: 0; }

/* Sound toggle button */
.nav-sound {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid rgba(232,228,220,0.08);
    border-radius: 99px;
    padding: 4px 11px 4px 9px;
    color: var(--ink-dim);
    cursor: none;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: border-color 0.2s, color 0.2s;
}
.nav-sound:hover {
    border-color: rgba(232,228,220,0.2);
    color: rgba(232,228,220,0.7);
}
.nav-sound.on {
    border-color: rgba(196,154,98,0.35);
    color: var(--gold);
}
.sound-label { line-height: 1; }

.nav-count {
    font-family: 'Cormorant Garamond', serif;
    font-size: 15px;
    font-weight: 300;
    color: var(--gold);
}

.nav-label {
    color: var(--ink-dim);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ══════════════════════════════════════════
   CUSTOM FULLSCREEN OVERLAY
   (no native controls = no download button)
══════════════════════════════════════════ */
.fs-overlay {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.fs-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.fs-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4,4,3,0.95);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: none;
}

/* Video/Image: no controls, no right-click possible since pointer-events off */
.fs-video, .fs-img {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    display: none;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

/* Base style for images inside the grid card */
.card img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    pointer-events: none;
    transition: opacity 0.4s ease;
    opacity: 0;
    background: #09090d;
}

.card.video-loaded img {
    opacity: 1;
}

.fs-close {
    position: absolute;
    top: 22px;
    right: 26px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(6,6,5,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(232,228,220,0.12);
    color: rgba(232,228,220,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: none;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.fs-close:hover {
    border-color: rgba(232,228,220,0.3);
    color: rgba(232,228,220,0.9);
    background: rgba(6,6,5,0.8);
}

/* ══════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════ */
.empty {
    position: relative;
    z-index: 1;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: var(--nav-h);
}

.empty-line {
    font-family: 'Cormorant Garamond', serif;
    font-size: 22px;
    font-weight: 300;
    color: var(--ink);
    letter-spacing: 0.04em;
}

.empty-line code {
    font-family: 'Space Grotesk', monospace;
    font-size: 15px;
    color: var(--gold);
    background: rgba(196,154,98,0.08);
    padding: 1px 7px;
    border-radius: 4px;
}

.empty-hint {
    font-size: 12px;
    color: var(--ink-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ══════════════════════════════════════════
   MASONRY GRID — Flex Column based to prevent jumping
══════════════════════════════════════════ */
.grid {
    position: relative;
    z-index: 1;
    padding: calc(var(--nav-h) + var(--gap) + 16px) var(--gap) 80px var(--gap);
    display: flex;
    gap: var(--gap);
    align-items: flex-start;
    max-width: 100%;
}

.grid-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    min-width: 0; /* prevents layout break */
}

/* ══════════════════════════════════════════
   VIDEO CARD
══════════════════════════════════════════ */
.card {
    position: relative;
    overflow: hidden;
    border-radius: var(--r);
    cursor: none;
    width: 100%;
    
    /* glass surface */
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--ink-ghost);

    /* Entrance */
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--out), transform 0.6s var(--out);
    will-change: transform, opacity;
}

.card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hover glow */
.card:hover {
    border-color: rgba(196,154,98,0.3);
    box-shadow:
        inset 0 1px 0 rgba(232,228,220,0.07),
        0 0 0 1px rgba(196,154,98,0.12),
        0 0 40px rgba(100,60,20,0.2),
        0 12px 36px rgba(0,0,0,0.5);
}

/* Glass shimmer */
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        130deg,
        transparent 25%,
        rgba(232,228,220,0.045) 50%,
        transparent 75%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 3;
}
.card:hover::after { opacity: 1; }

.card video {
    display: block;
    width: 100%;
    height: auto; /* natural aspect ratio restored */
    pointer-events: none;
    transition: filter 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    background: #09090d;
}

/* Skeleton pulse loading background */
.card:not(.video-loaded) {
    animation: card-pulse 1.6s ease-in-out infinite;
    aspect-ratio: 9 / 16; /* temporary ratio until metadata loads */
}

@keyframes card-pulse {
    0%, 100% { background-color: rgba(232,228,220,0.015); }
    50%      { background-color: rgba(232,228,220,0.045); }
}

/* Fade in video once loaded */
.card.video-loaded video {
    opacity: 1;
}

/* Subtle desaturate at rest, vivid on hover */
.card video { filter: saturate(0.88); }
.card:hover video { filter: saturate(1.05); }

/* Bottom vignette */
.card-vignette {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(6,6,5,0.7) 0%,
        rgba(6,6,5,0.08) 28%,
        transparent 50%
    );
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.35s ease;
}
.card:hover .card-vignette { opacity: 0; }

/* Title */
.card-title {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 2;
    padding: 14px 16px;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(232,228,220,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.3s ease;
}
.card:hover .card-title { opacity: 0; }

/* Sound indicator — elegant line badge */
.card-sound {
    position: absolute;
    top: 14px; right: 14px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: rgba(6,6,5,0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(232,228,220,0.1);
    border-radius: 99px;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.25s ease, transform 0.3s var(--spring);
}
.card:hover .card-sound {
    opacity: 1;
    transform: translateY(0);
}

.wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
}
.wave i {
    display: block;
    width: 2px;
    border-radius: 1px;
    background: var(--gold);
    animation: wv 0.95s ease-in-out infinite;
}
.wave i:nth-child(1) { height:3px;  animation-delay:0s;    }
.wave i:nth-child(2) { height:8px;  animation-delay:0.14s; }
.wave i:nth-child(3) { height:5px;  animation-delay:0.28s; }
.wave i:nth-child(4) { height:10px; animation-delay:0.14s; }
.wave i:nth-child(5) { height:3px;  animation-delay:0s;    }

@keyframes wv {
    0%,100% { transform: scaleY(0.3); opacity:0.4; }
    50%      { transform: scaleY(1);   opacity:1;   }
}

.sound-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(232,228,220,0.5);
}

/* ══════════════════════════════════════════
   PORTFOLIO FOOTER & FIREWORKS
══════════════════════════════════════════ */
.p-footer {
    position: relative;
    width: 100%;
    min-height: 480px;
    margin-top: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(20,15,30,0.6) 0%, var(--bg) 80%);
    border-top: 1px solid var(--ink-ghost);
}

.fw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.p-footer-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px;
    border-radius: 20px;
    background: rgba(255,255,255,0.015);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(232,228,220,0.06);
    box-shadow: 
        inset 0 1px 0 rgba(232,228,220,0.05),
        0 24px 80px rgba(0,0,0,0.7);
    max-width: 440px;
    width: 90%;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 1s var(--out), opacity 1s var(--out);
}

.p-footer.triggered .p-footer-content {
    transform: translateY(0);
    opacity: 1;
}

.p-footer-cup {
    font-size: 54px;
    line-height: 1;
    display: block;
    margin-bottom: 8px;
    filter: drop-shadow(0 10px 20px rgba(196,154,98,0.3));
    animation: cup-float 4s ease-in-out infinite;
}

@keyframes cup-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50%      { transform: translateY(-8px) rotate(3deg); }
}

.p-footer-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 32px;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
}

.p-footer-desc {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.p-footer-link {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--gold);
    text-decoration: none;
    padding: 8px 24px;
    border-radius: 99px;
    border: 1px solid rgba(196,154,98,0.22);
    background: rgba(196,154,98,0.04);
    transition: all 0.3s var(--out);
    cursor: none;
}

.p-footer-link:hover {
    color: var(--ink);
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 
        0 0 30px rgba(196,154,98,0.45),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 520px) {
    .nav { padding: 0 16px; }
    body { cursor: auto; }
    .c-cursor { display: none; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(232,228,220,0.08); border-radius: 2px; }
