/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Helvetica, Arial, sans-serif;
    background-color: #fffaf0;
    color: #000;
}

/* Film Grain Overlay */
body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: grain 0.3s steps(6) infinite;
}

@keyframes grain {

    0%,
    100% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-3%, -3%);
    }

    40% {
        transform: translate(3%, 3%);
    }

    60% {
        transform: translate(-2%, 2%);
    }

    80% {
        transform: translate(2%, -2%);
    }
}

/* Heart Background */
.heart-bg {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    z-index: 1;
    pointer-events: none;
    display: block;
}

/* Background Video */
.bg-video {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    z-index: 2;
    pointer-events: none;
    display: block;
}

/* Controls - Center (Mark Image) */
.controls-center {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    z-index: 0;
    display: flex;
    justify-content: center;
}

.mark-image {
    width: 80vw !important;
    max-width: 80vw !important;
    height: auto !important;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    display: block;
    filter: brightness(0);
}

.mark-image:hover {
    opacity: 1;
}

/* Vertical URL Link */
.vertical-url {
    position: fixed;
    left: 30px;
    bottom: 305px;
    transform: rotate(90deg);
    transform-origin: left bottom;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 1.33rem;
    color: #0000EE;
    text-decoration: underline;
    letter-spacing: 0.02em;
    white-space: nowrap;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.vertical-url:hover {
    opacity: 0.6;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 20px 30px;
    z-index: 100;
    pointer-events: none;
}

.header>* {
    pointer-events: auto;
}

.logo {
    font-family: Helvetica, Arial, sans-serif;
    font-size: calc(3rem + 15px);
    font-weight: 700;
    color: #333631;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: opacity 0.3s ease;
    position: relative;
    left: 30px;
}

.logo:hover {
    opacity: 0.6;
}

.nav {
    display: flex;
    gap: 19px;
    position: relative;
    right: 25px;
}

.nav-link {
    font-family: Helvetica, Arial, sans-serif;
    font-size: calc(1.65rem - 2px);
    font-weight: 300;
    color: #333631;
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: opacity 0.3s ease;
}

.nav-link:hover {
    opacity: 0.6;
}

/* Click Area - Full Screen */
.click-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

/* Video Element - Spawned on Click */
.video-popup {
    position: absolute;
    z-index: 10;
    cursor: pointer;
    overflow: visible;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: transform 0.5s ease, left 0.5s ease, top 0.5s ease;
    background: transparent;
}

.video-popup:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.video-popup video {
    display: block;
    max-width: 1000px;
    max-height: 750px;
    width: auto;
    height: auto;
    background: transparent;
    filter: drop-shadow(0 5px 20px rgba(0, 0, 0, 0.15));
}

/* Pop-in Animation */
@keyframes popIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Pop-out Animation */
.video-popup.closing {
    animation: popOut 0.3s ease forwards;
}

@keyframes popOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
}

/* Glitch Shuffle Animation */
.glitching {
    animation: glitch-shuffle 0.3s steps(4) both;
    transition: none !important;
}

@keyframes glitch-shuffle {
    0% {
        transform: translate(calc(-50% + 10px), -50%) scale(var(--scale)) skew(10deg);
        filter: invert(0.2);
    }

    25% {
        transform: translate(-50%, calc(-50% - 10px)) scale(var(--scale)) skew(-10deg);
        filter: invert(0.4);
    }

    50% {
        transform: translate(calc(-50% - 5px), -50%) scale(var(--scale)) skew(5deg);
        filter: none;
    }

    75% {
        transform: translate(-50%, calc(-50% + 5px)) scale(var(--scale)) skew(-5deg);
        filter: invert(0.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(var(--scale));
        filter: none;
    }
}

/* Controls - Bottom Left */
.controls {
    position: fixed;
    bottom: 20px;
    left: 30px;
    display: flex;
    gap: 15px;
    z-index: 100;
}

/* Controls - Bottom Right */
.controls-right {
    position: fixed;
    bottom: 20px;
    right: 30px;
    display: flex;
    gap: 15px;
    z-index: 100;
}

/* Control Buttons */
.control-button {
    font-family: Helvetica, Arial, sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: #000;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-button:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #000;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .logo {
        font-size: 2.5rem;
        left: 0;
        text-align: center;
    }

    .nav {
        right: 0;
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        font-size: 1rem;
    }

    .header {
        z-index: 9999 !important;
    }

    /* Hide desktop elements on mobile */
    .vertical-url-desktop {
        display: none !important;
    }

    .heart-bg-desktop {
        display: none !important;
    }

    .bg-video-desktop {
        display: none !important;
    }

    .mark-image-desktop {
        display: none !important;
    }

    /* Show mobile elements */
    .heart-bg-mobile {
        display: block !important;
        top: calc(45% + 15px) !important;
    }

    .bg-video-mobile {
        display: block !important;
        top: calc(45% + 15px) !important;
    }

    .mark-image-mobile {
        display: block !important;
    }

    .controls-center {
        z-index: 2 !important;
    }

    .url-image-mobile {
        display: block !important;
        position: fixed !important;
        left: 10px !important;
        bottom: 30px !important;
        width: 560px !important;
        height: auto !important;
        z-index: 3 !important;
    }

    .heart-bg {
        width: auto !important;
        height: auto !important;
        max-height: 100vh !important;
        max-width: 100vw !important;
    }

    .bg-video {
        width: auto !important;
        height: auto !important;
        max-height: 100vh !important;
        max-width: 100vw !important;
    }

    .video-popup video {
        max-width: 90vw;
        max-height: 60vh;
    }

    .controls,
    .controls-right {
        bottom: 25px;
        flex-direction: column;
    }

    .controls {
        left: 20px;
        gap: 10px;
    }

    .controls-right {
        right: 20px;
        gap: 10px;
    }

    .control-button {
        padding: 10px 15px;
        font-size: 0.8rem;
        background: rgba(255, 250, 240, 0.5);
    }
}

/* Hide mobile elements on desktop (default) */
.heart-bg-mobile {
    display: none;
}

.bg-video-mobile {
    display: none;
}

.mark-image-mobile {
    display: none;
}

.url-image-mobile {
    display: none;
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 40px;
    height: auto;
    z-index: 100;
    pointer-events: auto;
}