/* ============================================
   The Curious Labs — Design System
   Single viewport, no scroll, mobile-first
   ============================================ */

:root {
    --bg: #f5f3ef;
    --text-primary: #1a1a1c;
    --text-secondary: #4a4a50;
    --text-tertiary: #6e6e75;
    --accent: #3d4f7c;
    --accent-light: #5a6fa0;
    --accent-warm: #b56a3a;

    --glass-bg: rgba(255, 255, 255, 0.5);
    --glass-bg-hover: rgba(255, 255, 255, 0.68);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-border-hover: rgba(0, 0, 0, 0.14);
    --glass-shadow: rgba(0, 0, 0, 0.06);
    --glass-shadow-hover: rgba(0, 0, 0, 0.12);

    --aurora-1: rgba(180, 160, 220, 0.4);
    --aurora-2: rgba(140, 190, 210, 0.35);
    --aurora-3: rgba(220, 185, 155, 0.3);

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --radius-lg: 20px;
    --radius-md: 12px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-primary);
    height: 100dvh;
    overflow: hidden;
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

em {
    font-style: italic;
}

/* ---- Grain Overlay ---- */
.grain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.018;
    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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 200px;
}

/* ---- Aurora Background ---- */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.aurora-band {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    will-change: transform, opacity;
}

.aurora-band-1 {
    width: 60vw;
    height: 50vh;
    top: -10%;
    right: -10%;
    background: var(--aurora-1);
    animation: auroraFloat1 20s ease-in-out infinite;
}

.aurora-band-2 {
    width: 50vw;
    height: 45vh;
    bottom: -5%;
    left: -10%;
    background: var(--aurora-2);
    animation: auroraFloat2 25s ease-in-out infinite;
}

.aurora-band-3 {
    width: 40vw;
    height: 35vh;
    top: 30%;
    left: 30%;
    background: var(--aurora-3);
    animation: auroraFloat3 22s ease-in-out infinite;
}

@keyframes auroraFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.4; }
    50% { transform: translate(-5%, 8%) scale(1.08); opacity: 0.55; }
}

@keyframes auroraFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.35; }
    50% { transform: translate(8%, -5%) scale(1.1); opacity: 0.5; }
}

@keyframes auroraFloat3 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.3; }
    50% { transform: translate(-6%, -8%) scale(1.05); opacity: 0.45; }
}

/* ---- Page Layout — locked to viewport ---- */
.page {
    position: relative;
    z-index: 1;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 2.5rem;
    max-width: 960px;
    margin: 0 auto;
}

/* ---- Navigation ---- */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 0 0;
    animation: fadeDown 0.6s var(--ease-out) both;
}

.nav-wordmark {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    transition: color 0.3s var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.nav-wordmark:hover {
    color: var(--accent);
}

.nav-tag {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

/* ---- Hero ---- */
.hero {
    text-align: center;
    padding: 0;
    animation: fadeUp 0.7s var(--ease-out) 0.2s both;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.hero-line {
    display: block;
}

.hero-line-1 {
    font-size: clamp(1.8rem, 4.5vw, 3.5rem);
    color: var(--text-primary);
}

.hero-line-2 {
    font-size: clamp(2rem, 5.5vw, 4.2rem);
    color: var(--accent);
}

.hero-line-2 em {
    font-style: italic;
    font-weight: 700;
}

/* ---- Projects Grid ---- */
.projects {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    animation: fadeUp 0.8s var(--ease-out) 0.5s both;
}

/* ---- Project Card ---- */
.project-card {
    position: relative;
    display: block;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.4rem;
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    box-shadow:
        0 1px 3px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transition: all 0.4s var(--ease-smooth);
    overflow: hidden;
}

.project-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow:
        0 8px 32px var(--glass-shadow-hover),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transform: translateY(-4px);
}

/* Card glow — colored top edge */
.card-glow {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 3px;
    border-radius: 0 0 4px 4px;
    opacity: 0.7;
    transition: opacity 0.4s var(--ease-smooth), width 0.4s var(--ease-smooth);
}

.project-card:hover .card-glow {
    opacity: 1;
    width: 80%;
}

[data-accent="blue"] .card-glow {
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

[data-accent="amber"] .card-glow {
    background: linear-gradient(90deg, var(--accent-warm), #d4956a);
}

/* Card content */
.card-content {
    position: relative;
    z-index: 1;
}

.card-label {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    display: block;
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    transition: color 0.3s var(--ease-smooth);
}

.project-card:hover .card-title {
    color: var(--accent);
}

[data-accent="amber"]:hover .card-title {
    color: var(--accent-warm);
}

.card-desc {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 0.75rem;
}

.card-cta {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.3s var(--ease-smooth);
}

[data-accent="amber"] .card-cta {
    color: var(--accent-warm);
}

.project-card:hover .card-cta {
    color: var(--text-primary);
}

.link-arrow {
    display: inline-block;
    transition: transform 0.3s var(--ease-out);
}

.project-card:hover .link-arrow {
    transform: translateX(4px);
}

/* Ghost card */
.project-card--ghost {
    background: rgba(255, 255, 255, 0.25);
    border: 1px dashed rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.project-card--ghost .card-label {
    color: var(--text-tertiary);
}

.project-card--ghost .card-title {
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
}

.project-card--ghost .card-desc {
    color: var(--text-tertiary);
    margin-bottom: 0;
}

.project-card--ghost:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.35);
}

/* ---- Footer ---- */
.foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 1.5rem;
    animation: fadeUp 0.6s var(--ease-out) 0.8s both;
}

.foot-manifesto {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-secondary);
}

.foot-manifesto em {
    font-family: var(--font-display);
    color: var(--accent);
}

.foot-copy {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

/* ---- Keyframes ---- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Responsive — mobile-first priority
   ============================================ */

/* Tablet & small desktop */
@media (max-width: 820px) {
    .page {
        padding: 0 1.5rem;
    }

    .projects {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .project-card--ghost {
        grid-column: 1 / -1;
    }

    .card-title {
        font-size: 1.2rem;
    }
}

/* Mobile */
@media (max-width: 560px) {
    .page {
        padding: 0 1.15rem;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .nav {
        padding-top: 1rem;
    }

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

    .hero-eyebrow {
        font-size: 0.6rem;
        margin-bottom: 0.6rem;
    }

    .hero-line-1 {
        font-size: 1.6rem;
    }

    .hero-line-2 {
        font-size: 1.85rem;
    }

    .projects {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .project-card {
        padding: 1rem 1.1rem;
    }

    .card-label {
        font-size: 0.52rem;
        margin-bottom: 0.25rem;
    }

    .card-title {
        font-size: 1.1rem;
        margin-bottom: 0.2rem;
    }

    .card-desc {
        font-size: 0.75rem;
        line-height: 1.45;
        margin-bottom: 0.4rem;
    }

    .card-cta {
        font-size: 0.58rem;
    }

    .project-card--ghost .card-desc {
        margin-bottom: 0;
    }

    .foot {
        flex-direction: column;
        gap: 0.35rem;
        text-align: center;
        padding-bottom: 1rem;
    }

    .foot-manifesto {
        font-size: 0.72rem;
    }

    .foot-copy {
        font-size: 0.55rem;
    }

    /* Aurora softer on mobile */
    .aurora-band-1 { width: 80vw; height: 40vh; }
    .aurora-band-2 { width: 70vw; height: 35vh; }
    .aurora-band-3 { width: 60vw; height: 30vh; }
}

/* Very small phones (SE, etc.) */
@media (max-width: 380px) {
    .hero-line-1 {
        font-size: 1.4rem;
    }

    .hero-line-2 {
        font-size: 1.6rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-desc {
        font-size: 0.7rem;
    }
}

/* Short screens — landscape phones, small laptops */
@media (max-height: 650px) {
    .hero-eyebrow {
        margin-bottom: 0.5rem;
    }

    .hero-line-1 {
        font-size: clamp(1.4rem, 3.5vw, 2.5rem);
    }

    .hero-line-2 {
        font-size: clamp(1.6rem, 4vw, 3rem);
    }

    .project-card {
        padding: 1rem 1.2rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-desc {
        font-size: 0.75rem;
        margin-bottom: 0.4rem;
    }
}
