:root {
    --bg: #0a0a0a;
    --emerald: #10b981;
    --amber: #f59e0b;
    --text-muted: #9ca3af;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    background: var(--bg);
    overflow-x: hidden;
}

body.is-loading {
    overflow: hidden;
}

/* Film grain overlay */
.grain {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Preloader */
.preloader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.preloader__mark {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 500;
    letter-spacing: 0.3em;
    color: var(--emerald);
}

/* Header */
.site-header {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-header.is-scrolled {
    background: rgba(10, 10, 10, 0.85);
    border-color: rgba(16, 185, 129, 0.15);
}

/* Hero */
.hero__line {
    display: block;
    overflow: hidden;
}

.hero__word {
    display: inline-block;
    transform: translateY(110%);
}

.hero__scroll {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, var(--emerald), transparent);
}

/* Web horizontal section */
.web-section {
    min-height: 100vh;
}

.web-track {
    display: flex;
    width: max-content;
    height: 100vh;
}

.web-card {
    flex: 0 0 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.web-card__media {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.web-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
}

.web-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 10, 10, 0.95) 0%, rgba(10, 10, 10, 0.4) 40%, rgba(10, 10, 10, 0.2) 100%);
}

.web-card__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: clamp(1.5rem, 5vw, 4rem);
    z-index: 2;
}

.web-card__tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--emerald);
    border-radius: 2px;
}

/* Mobile web stack */
@media (max-width: 767px) {
    .web-section {
        min-height: auto;
    }

    .web-track {
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .web-card {
        flex: none;
        width: 100%;
        height: 70vh;
        min-height: 400px;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

/* Production cards */
.prod-card {
    opacity: 0;
    transform: translateY(60px);
}

.prod-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.prod-card__image-wrap {
    overflow: hidden;
    border-radius: 2px;
    aspect-ratio: 16 / 10;
}

.prod-card__image-wrap img,
.prod-card__image-wrap video {
    width: 100%;
    height: 120%;
    object-fit: cover;
    will-change: transform;
}

.prod-card__image-wrap--media {
    position: relative;
}

.prod-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    pointer-events: none;
    background: rgba(10, 10, 10, 0.25);
}

.prod-card__role {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--amber);
}

.prod-card__description {
    text-wrap: pretty;
}

/* Skills marquee */
.skills-track {
    display: flex;
    gap: 2rem;
    width: max-content;
}

.skill-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border-radius: 2px;
    transition: border-color 0.3s, color 0.3s;
}

.skill-pill:hover {
    border-color: rgba(16, 185, 129, 0.5);
    color: var(--emerald);
}

/* Lightbox */
.lightbox[hidden] {
    display: none !important;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox__content {
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox__content img,
.lightbox__content video {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 2px;
}

.lightbox__embed {
    width: min(90vw, 960px);
    aspect-ratio: 16 / 9;
}

.lightbox__embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 2px;
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    background: rgba(10, 10, 10, 0.6);
    transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.lightbox__nav--prev {
    left: 1.5rem;
}

.lightbox__nav--next {
    right: 1.5rem;
}

.lightbox__nav:hover,
.lightbox__nav:focus-visible {
    border-color: var(--amber);
    color: var(--amber);
    background: rgba(10, 10, 10, 0.85);
    outline: none;
}

.lightbox__counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    letter-spacing: 0.1em;
}

.lightbox__close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    background: transparent;
    transition: border-color 0.2s, color 0.2s;
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
    border-color: var(--amber);
    color: var(--amber);
    outline: none;
}

/* Focus states */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--emerald);
    outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero__word,
    .prod-card,
    .preloader {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
    }

    .grain {
        display: none;
    }
}
