:root {
    --deep-ice: #1B1F3B;
    --frost-white: #E8EDF5;
    --glacier-blue: #7BA7CC;
    --amethyst-haze: #9B8EC4;
    --thaw-pink: #D4A0B9;
    --ice-mist: #F0F4FA;
    --subglacial-teal: #2E6B7F;
    --permafrost-gray: #6B7A8D;
    --cell-bg: rgba(240, 244, 250, 0.07);
    --cell-border: rgba(240, 244, 250, 0.12);
    --radius: clamp(16px, 3vw, 48px);
}

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

body {
    background: radial-gradient(ellipse at 50% 0%, #2E6B7F 0%, #1B1F3B 40%, #1B1F3B 60%, #9B8EC4 100%);
    background-attachment: fixed;
    color: var(--frost-white);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.1vw, 1.2rem);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    animation: bgShift 40s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0% { background: radial-gradient(ellipse at 50% 0%, #2E6B7F 0%, #1B1F3B 40%, #1B1F3B 60%, #9B8EC4 100%); }
    50% { background: radial-gradient(ellipse at 50% 0%, #2E5B7F 0%, #1B1F3B 40%, #1B1F3B 60%, #8B7EB4 100%); }
    100% { background: radial-gradient(ellipse at 50% 0%, #2E6B7F 0%, #1B1F3B 40%, #1B1F3B 60%, #A49ED4 100%); }
}

/* Background particles */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--glacier-blue);
    opacity: 0.3;
}

/* Decorative blobs */
.decorative-blob {
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

.blob-1 {
    top: 20%;
    left: -10%;
    width: 400px;
    height: 400px;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: rgba(123, 167, 204, 0.06);
    animation: blobMorph1 18s ease-in-out infinite alternate;
}

.blob-2 {
    bottom: 10%;
    right: -10%;
    width: 350px;
    height: 350px;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    background: rgba(155, 142, 196, 0.04);
    animation: blobMorph2 20s ease-in-out infinite alternate;
}

@keyframes blobMorph1 {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
}

@keyframes blobMorph2 {
    0% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    100% { border-radius: 40% 60% 50% 50% / 50% 60% 40% 60%; }
}

/* Bento cells */
.bento-cell {
    background: var(--cell-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--cell-border);
    border-radius: var(--radius);
    padding: clamp(24px, 4vw, 48px);
}

/* ENTRANCE */
.entrance {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    padding: 48px 24px;
}

.hero-blob {
    width: clamp(240px, 40vw, 400px);
    height: clamp(240px, 40vw, 400px);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: var(--cell-bg);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid var(--cell-border);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: heroMorph 8s ease-in-out infinite alternate;
}

@keyframes heroMorph {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    33% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    66% { border-radius: 40% 60% 50% 50% / 50% 60% 40% 60%; }
    100% { border-radius: 50% 50% 40% 60% / 40% 50% 60% 50%; }
}

.hero-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--frost-white);
    text-align: center;
}

.hero-subtitle {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--permafrost-gray);
    margin-top: 32px;
    text-align: center;
    max-width: 50ch;
}

.scroll-wave {
    margin-top: 48px;
    animation: wavePulse 2s ease-in-out infinite;
}

@keyframes wavePulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 0.8; transform: translateY(6px); }
}

/* Wave Dividers */
.wave-divider {
    position: relative;
    z-index: 1;
    height: 60px;
    width: 100%;
    overflow: hidden;
}

.wave {
    animation: waveShift 6s ease-in-out infinite;
}

.wave-2 { animation-delay: -2s; }
.wave-3 { animation-delay: -4s; }
.wave-4 { animation-duration: 4s; }
.wave-5 { animation-delay: -1.5s; animation-duration: 4s; }

@keyframes waveShift {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-20px); }
}

/* TAXONOMY */
.taxonomy {
    position: relative;
    z-index: 1;
    padding: 48px 24px;
}

.bento-grid {
    display: grid;
    gap: clamp(12px, 2vw, 24px);
    max-width: 1100px;
    margin: 0 auto;
}

.taxonomy-grid {
    grid-template-columns: repeat(3, 1fr);
}

.concept-card {
    text-align: center;
    opacity: 0;
    filter: blur(6px);
    transform: scale(0.96);
    transition: opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.concept-card.revealed {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

.lambda-creature {
    margin-bottom: 16px;
}

.card-name {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--frost-white);
    margin-bottom: 12px;
}

.card-desc {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1vw, 1rem);
    line-height: 1.7;
    color: var(--permafrost-gray);
    max-width: 30ch;
    margin: 0 auto;
}

/* SPECIMEN */
.specimen {
    position: relative;
    z-index: 1;
    padding: 48px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.code-cell {
    opacity: 0;
    filter: blur(6px);
    transform: scale(0.97);
    transition: opacity 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.code-cell.revealed {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

.code-block {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1.05rem);
    letter-spacing: 0.01em;
    line-height: 1.6;
    color: var(--frost-white);
    overflow-x: auto;
}

.code-block .keyword { color: var(--glacier-blue); }
.code-block .type-sig { color: var(--amethyst-haze); }
.code-block .string { color: var(--thaw-pink); }
.code-block .comment { color: var(--subglacial-teal); }

/* CONNECTIONS */
.connections {
    position: relative;
    z-index: 1;
    padding: 48px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.pipeline-cell {
    opacity: 0;
    filter: blur(6px);
    transform: scale(0.97);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pipeline-cell.revealed {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

.section-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.02em;
    color: var(--frost-white);
    margin-bottom: 32px;
    text-align: center;
}

.pipeline-diagram {
    margin: 24px 0;
    overflow-x: auto;
}

.pipeline-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    color: var(--permafrost-gray);
    text-align: center;
    max-width: 60ch;
    margin: 24px auto 0;
}

/* INVITATION */
.invitation {
    position: relative;
    z-index: 1;
    padding: 80px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.invitation-blob {
    width: clamp(280px, 50vw, 500px);
    height: clamp(280px, 50vw, 500px);
    border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%;
    background: var(--cell-bg);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid var(--cell-border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    animation: invitationRotate 60s linear infinite;
    margin-bottom: 60px;
}

@keyframes invitationRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.invitation-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    line-height: 1.4;
    color: var(--frost-white);
    text-align: center;
    animation: invitationRotate 60s linear infinite reverse;
}

.resource-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 700px;
    width: 100%;
}

.resource-card {
    text-align: center;
    opacity: 0;
    filter: blur(6px);
    transform: scale(0.96);
    transition: opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                filter 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.resource-card.revealed {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

.resource-link {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--glacier-blue);
    text-decoration: none;
    transition: color 200ms;
}

.resource-link:hover {
    color: var(--thaw-pink);
}

/* Responsive */
@media (max-width: 768px) {
    .taxonomy-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }
}

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    body { animation: none; }
    .hero-blob { animation: none; }
    .blob-1, .blob-2 { animation: none; }
    .scroll-wave { animation: none; opacity: 0.5; }
    .wave { animation: none; }
    .invitation-blob { animation: none; }
    .invitation-text { animation: none; }

    .concept-card,
    .code-cell,
    .pipeline-cell,
    .resource-card {
        opacity: 1;
        filter: none;
        transform: none;
        transition: none;
    }
}
