:root {
    --bg-primary: #12101F;
    --bg-card: #1E1B2E;
    --bg-elevated: #2A2640;
    --border-subtle: #4A4458;
    --text-primary: #E8E4F0;
    --text-body: #C9C3D5;
    --text-muted: #8E879E;
    --accent-green: #7EDCA0;
    --accent-gold: #D4A76A;
    --accent-rose: #E88B9C;
    --accent-violet: #6C5CE7;
    --code-bg: #16132A;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-body);
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.7;
    overflow-x: hidden;
}

/* Bubbles */
.bubbles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(232, 139, 156, 0.12), rgba(108, 92, 231, 0.06));
}

@keyframes floatBubble {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(10px, -20px) scale(1.03); }
    50% { transform: translate(-5px, -10px) scale(1.05); }
    75% { transform: translate(8px, -18px) scale(1.02); }
}

/* Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(18, 16, 31, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-brand {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    background-image: linear-gradient(var(--accent-green), var(--accent-green));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease, color 0.3s ease;
}

.nav-link:hover {
    color: var(--accent-green);
    background-size: 100% 2px;
}

/* Hero */
.hero {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 40%, #2A2640 0%, #12101F 70%);
    padding: 80px 24px;
    position: relative;
    z-index: 1;
}

.hero-heading {
    font-family: 'Commissioner', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 7vw, 6rem);
    color: var(--text-primary);
    letter-spacing: 0.06em;
    line-height: 1.15;
    text-align: center;
    text-shadow: 0 0 60px rgba(126, 220, 160, 0.15);
}

.typewriter-container {
    margin-top: 32px;
}

.typewriter-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: var(--accent-green);
    background: var(--code-bg);
    padding: 12px 24px;
    border-radius: 6px;
    display: inline-block;
}

.cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent-green);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Section Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 40px 32px;
    position: relative;
    z-index: 1;
}

.divider-line {
    flex: 1;
    height: 1px;
    background-color: var(--border-subtle);
}

.divider-lambda {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--accent-gold);
    background: var(--bg-primary);
    padding: 0 12px;
}

/* Collection */
.collection {
    position: relative;
    z-index: 1;
    padding: 40px 32px 80px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-heading {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 48px;
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    transform: rotate(calc(var(--card-index) * 0.3deg - 0.6deg));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    opacity: 0;
    position: relative;
}

.card.revealed {
    opacity: 1;
}

.card:hover {
    transform: translateY(-4px) rotate(0deg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.card-badge {
    display: inline-block;
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.2em 0.8em;
    border-radius: 100px;
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent-violet);
    border: 1px solid rgba(108, 92, 231, 0.3);
    margin-bottom: 16px;
}

.card-icon {
    margin-bottom: 12px;
    display: block;
}

.card-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    letter-spacing: 0.02em;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-desc {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.7;
    color: var(--text-body);
    margin-bottom: 16px;
}

.card-link {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--accent-green);
    text-decoration: none;
    background-image: linear-gradient(var(--accent-green), var(--accent-green));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}

.card-link:hover {
    background-size: 100% 2px;
}

.arrow-icon {
    font-family: 'JetBrains Mono', monospace;
    margin-right: 4px;
}

/* Specimen */
.specimen {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 32px;
}

.specimen-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    line-height: 1.6;
    max-width: 700px;
    width: 100%;
}

.specimen-code .kw { color: var(--accent-violet); }
.specimen-code .str { color: var(--accent-rose); }
.specimen-code .typ { color: var(--accent-gold); }
.specimen-code .fn { color: var(--accent-green); }
.specimen-code .cm { color: var(--text-muted); }

.code-line {
    opacity: 0;
    transition: opacity 300ms ease;
}

.code-line.visible {
    opacity: 1;
}

/* Footer */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 24px;
    border-top: 1px solid var(--border-subtle);
}

.footer-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* Responsive */
@media (max-width: 768px) {
    .top-nav {
        padding: 12px 16px;
    }

    .nav-links {
        gap: 16px;
    }

    .collection {
        padding: 40px 16px 60px;
    }

    .card-grid {
        gap: 1.5rem;
    }

    .card {
        transform: rotate(0deg);
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bubble {
        animation: none;
    }

    .cursor {
        animation: none;
        opacity: 1;
    }

    .card {
        opacity: 1;
        transition: box-shadow 0.3s ease;
    }

    .code-line {
        opacity: 1;
        transition: none;
    }
}
