:root {
    --bg: #0A0A12;
    --text: #E8E8F0;
    --text-secondary: #9898B0;
    --accent-blue: #4A9EE8;
    --accent-violet: #8B6CC1;
    --accent-pink: #E86A9E;
    --accent-green: #4AE8A0;
    --panel-bg: rgba(255,255,255,0.05);
    --panel-border: rgba(255,255,255,0.08);
    --code-bg: rgba(15,15,25,0.8);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* Fixed refraction lines */
.refraction-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Caustic filter SVG hidden */
.caustic-filter-svg {
    position: absolute;
    width: 0;
    height: 0;
}

/* Sections */
.section {
    position: relative;
    z-index: 2;
}

/* Prism Header */
.section-header {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 50%, rgba(74,158,232,0.04) 0%, transparent 70%);
}

.header-content {
    text-align: center;
    opacity: 0;
    animation: header-fade 1.5s ease 0.8s forwards;
}

@keyframes header-fade {
    to { opacity: 1; }
}

.prism-hero {
    width: 280px;
    height: 210px;
    margin: 0 auto 30px;
}

/* Prism animation */
.prism-shape {
    animation: prism-rotate 60s linear infinite;
    transform-origin: 160px 160px;
}

.beam-in {
    stroke-dasharray: 160;
    stroke-dashoffset: 160;
    animation: draw-beam 1s ease 1.5s forwards;
}

.beam-out {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.beam-out-1 { animation: draw-beam-out 0.8s ease 2.5s forwards; }
.beam-out-2 { animation: draw-beam-out 0.8s ease 2.7s forwards; }
.beam-out-3 { animation: draw-beam-out 0.8s ease 2.9s forwards; }
.beam-out-4 { animation: draw-beam-out 0.8s ease 3.1s forwards; }

@keyframes draw-beam {
    to { stroke-dashoffset: 0; }
}

@keyframes draw-beam-out {
    to { stroke-dashoffset: 0; }
}

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

.site-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: 20px;
    color: var(--text);
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.site-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Light beam connectors */
.beam-connector {
    position: relative;
    z-index: 2;
    height: 60px;
}

.connector-svg {
    width: 100%;
    height: 60px;
    display: block;
}

/* Bento Grid */
.bento-grid {
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 40px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

/* Glass Cards */
.glass-card {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 32px;
    transition: border-color 2s ease;
}

.glass-card:hover {
    border-color: rgba(74,158,232,0.2);
}

.section-violet .glass-card:hover {
    border-color: rgba(139,108,193,0.2);
}

.section-pink .glass-card:hover {
    border-color: rgba(232,106,158,0.2);
}

.card-span-4 {
    grid-column: span 4;
}

.card-span-6 {
    grid-column: span 6;
}

.card-deep {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(255,255,255,0.03);
}

.card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}

.section-blue .card-title { color: var(--accent-blue); }
.section-violet .card-title { color: var(--accent-violet); }
.section-pink .card-title { color: var(--accent-pink); }

.card-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Code blocks */
.code-block {
    background: var(--code-bg);
    border-radius: 6px;
    overflow: hidden;
}

.code-header {
    padding: 10px 14px;
    display: flex;
    gap: 6px;
}

.code-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 0.7;
}

.code-content {
    padding: 0 18px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    overflow-x: auto;
}

.code-content code {
    white-space: pre;
}

.kw { color: var(--accent-blue); }
.fn { color: var(--accent-green); }
.param { color: var(--accent-pink); }

/* Fade-in elements */
[data-fade] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-fade].visible {
    opacity: 1;
    transform: translateY(0);
}

/* Blue section */
.section-blue {
    min-height: 180vh;
    padding-top: 40px;
}

/* Violet section */
.section-violet {
    min-height: 160vh;
    padding-top: 40px;
    position: relative;
}

.caustic-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 50%, rgba(139,108,193,0.04) 0%, transparent 60%);
    filter: url(#caustic-filter);
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

.section-violet .bento-grid {
    position: relative;
    z-index: 1;
}

/* Pink section */
.section-pink {
    min-height: 140vh;
    padding-top: 40px;
}

/* Full Spectrum */
.section-spectrum {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spectrum-content {
    text-align: center;
}

.prism-final {
    width: 320px;
    height: 240px;
    margin: 0 auto 30px;
}

.final-prism {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.final-prism.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 2s ease;
}

.final-beam-in {
    stroke-dasharray: 180;
    stroke-dashoffset: 180;
}

.final-beam-in.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s ease;
}

.final-beam {
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
}

.final-beam.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s ease;
}

.spectrum-message {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: var(--text);
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.spectrum-link {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    padding: 10px 28px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: var(--panel-bg);
    background-clip: padding-box;
    position: relative;
    transition: box-shadow 0.4s ease;
}

.spectrum-link::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet), var(--accent-pink));
    z-index: -1;
    opacity: 0.5;
}

.spectrum-link:hover {
    box-shadow: 0 0 20px rgba(74,158,232,0.2), 0 0 40px rgba(139,108,193,0.1);
}

/* Mobile */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        padding: 40px 20px;
    }

    .card-span-4,
    .card-span-6 {
        grid-column: span 1;
    }

    .glass-card {
        padding: 24px;
    }

    .prism-hero {
        width: 200px;
        height: 150px;
    }

    .prism-final {
        width: 240px;
        height: 180px;
    }
}
