:root {
    --bg: #0c0c0c;
    --fg: #efefef;
    --secondary: #555;
    --border: rgba(255, 255, 255, 0.1);
    --dim: 0.22;
}

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

html, body {
    height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Film grain overlay */
body::before {
    content: '';
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    z-index: 2;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    opacity: 0.04;
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10%       { transform: translate(-5%, -10%); }
    20%       { transform: translate(-15%, 5%); }
    30%       { transform: translate(7%, -25%); }
    40%       { transform: translate(-5%, 25%); }
    50%       { transform: translate(-15%, 10%); }
    60%       { transform: translate(15%, 0%); }
    70%       { transform: translate(0%, 15%); }
    80%       { transform: translate(3%, 35%); }
    90%       { transform: translate(-10%, 10%); }
}

/* Three.js background canvas */
#bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Cursor spotlight */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background-image: radial-gradient(
        500px circle at var(--cx, -9999px) var(--cy, -9999px),
        rgba(255, 255, 255, 0.04),
        transparent 80%
    );
}

/* Page shell */
.page {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 6vw, 5rem);
}

/* ── Header strip ── */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    color: var(--secondary);
    text-transform: uppercase;
    animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 0ms;
}

/* ── Hero ── */
.hero {
    padding: clamp(3rem, 7vw, 7rem) 0 clamp(2.5rem, 5vw, 5rem);
    animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 80ms;
}

h1 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 900;
    font-size: clamp(4.5rem, 14vw, 11rem);
    line-height: 0.88;
    letter-spacing: -0.04em;
    color: var(--fg);
    margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.h-line {
    display: block;
}

.h-line.ghost {
    opacity: 0.16;
}

.bio {
    font-size: clamp(0.9375rem, 1.5vw, 1.125rem);
    font-weight: 300;
    color: var(--secondary);
    line-height: 1.6;
    max-width: 420px;
    letter-spacing: 0.01em;
}

/* ── Project rows ── */
.projects {
    list-style: none;
    animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 180ms;
}

/* CSS :has() hover — dim all siblings when any is hovered */
.projects:has(.project:hover) .project:not(:hover) {
    opacity: var(--dim);
}

.project {
    border-top: 1px solid var(--border);
    transition: opacity 0.25s ease, background-color 0.25s ease;
}

.project:hover {
    background-color: rgba(255, 255, 255, 0.025);
}

.project a {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    padding: 1.75rem 0;
    text-decoration: none;
    color: inherit;
}

.proj-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    color: var(--secondary);
    min-width: 1.75rem;
    flex-shrink: 0;
    padding-top: 0.1em; /* optical alignment with name */
}

.proj-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.proj-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--fg);
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.project:hover .proj-name {
    color: #fff;
}

.proj-desc {
    font-size: 0.8125rem;
    font-weight: 300;
    color: var(--secondary);
    letter-spacing: 0.005em;
}

.proj-arrow {
    font-size: 1rem;
    color: var(--secondary);
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.2s ease, color 0.2s ease;
    padding-right: 0.25rem;
}

.project:hover .proj-arrow {
    transform: translate(3px, -3px);
    color: var(--fg);
}

/* ── Footer ── */
.site-footer {
    margin-top: auto;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.18);
    text-transform: uppercase;
    animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-delay: 380ms;
}

/* ── Animations ── */
@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(1.25rem);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.project:nth-child(1) { animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 200ms; }
.project:nth-child(2) { animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 260ms; }
.project:nth-child(3) { animation: reveal 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 320ms; }

/* Disable all animations for prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .proj-desc {
        display: none; /* tighten on mobile */
    }

    h1 {
        letter-spacing: -0.03em;
    }
}
