/* ============================================
   luminant.dev - Controlled Luminous Decay
   Glitch aesthetic / Timeline-vertical / Candle-atmospheric
   ============================================ */

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

:root {
    --charred-obsidian: #0D0B0F;
    --molten-amber: #B8621B;
    --candle-gold: #E8A832;
    --deep-teal: #1B7A7A;
    --phosphor-mint: #7EC8A0;
    --ash-parchment: #E8E4D9;
    --signal-magenta: #C43B6E;
    --smoke-gray: #3A3540;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--charred-obsidian);
    color: var(--ash-parchment);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* --- Scanline Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 1px,
        rgba(13, 11, 15, 0.03) 1px,
        rgba(13, 11, 15, 0.03) 2px
    );
    pointer-events: none;
    z-index: 1000;
}

/* --- Noise Texture Overlay --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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");
    pointer-events: none;
    z-index: 999;
}

/* --- Bokeh Background Layers --- */
.bokeh-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.bokeh-layer-1 {
    background:
        radial-gradient(circle 120px at 15% 20%, rgba(184, 98, 27, 0.06) 0%, transparent 70%),
        radial-gradient(circle 80px at 75% 35%, rgba(232, 168, 50, 0.04) 0%, transparent 70%),
        radial-gradient(circle 160px at 50% 70%, rgba(184, 98, 27, 0.05) 0%, transparent 70%),
        radial-gradient(circle 60px at 85% 80%, rgba(27, 122, 122, 0.04) 0%, transparent 70%),
        radial-gradient(circle 100px at 25% 90%, rgba(232, 168, 50, 0.03) 0%, transparent 70%);
    animation: drift1 45s ease-in-out infinite alternate;
}

.bokeh-layer-2 {
    background:
        radial-gradient(circle 200px at 60% 15%, rgba(184, 98, 27, 0.04) 0%, transparent 70%),
        radial-gradient(circle 90px at 30% 50%, rgba(232, 168, 50, 0.05) 0%, transparent 70%),
        radial-gradient(circle 140px at 80% 60%, rgba(27, 122, 122, 0.03) 0%, transparent 70%),
        radial-gradient(circle 70px at 10% 75%, rgba(184, 98, 27, 0.06) 0%, transparent 70%),
        radial-gradient(circle 110px at 45% 40%, rgba(196, 59, 110, 0.03) 0%, transparent 70%);
    animation: drift2 55s ease-in-out infinite alternate;
}

.bokeh-layer-3 {
    background:
        radial-gradient(circle 50px at 40% 10%, rgba(232, 168, 50, 0.08) 0%, transparent 70%),
        radial-gradient(circle 180px at 70% 45%, rgba(184, 98, 27, 0.03) 0%, transparent 70%),
        radial-gradient(circle 40px at 20% 60%, rgba(126, 200, 160, 0.05) 0%, transparent 70%),
        radial-gradient(circle 130px at 90% 25%, rgba(232, 168, 50, 0.04) 0%, transparent 70%),
        radial-gradient(circle 75px at 55% 85%, rgba(27, 122, 122, 0.06) 0%, transparent 70%);
    animation: drift3 35s ease-in-out infinite alternate;
}

@keyframes drift1 {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(-30px) translateX(15px); }
}

@keyframes drift2 {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(-20px) translateX(-10px); }
}

@keyframes drift3 {
    from { transform: translateY(0) translateX(0); }
    to { transform: translateY(-25px) translateX(12px); }
}

/* --- Floating Nav Glyph --- */
.nav-glyph {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row-reverse;
}

.nav-flame-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(58, 53, 64, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 300ms ease, box-shadow 300ms ease;
    border: 1px solid rgba(184, 98, 27, 0.3);
}

.nav-flame-icon:hover {
    background: rgba(58, 53, 64, 0.9);
    box-shadow: 0 0 20px rgba(184, 98, 27, 0.4);
}

.nav-flame-icon svg {
    animation: flicker 2.5s ease-in-out infinite;
}

.nav-links {
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateX(20px);
    pointer-events: none;
    transition: opacity 300ms ease, transform 300ms ease;
}

.nav-glyph:hover .nav-links,
.nav-glyph.active .nav-links {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.nav-links a {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ash-parchment);
    text-decoration: none;
    padding: 8px 14px;
    background: rgba(58, 53, 64, 0.7);
    border-radius: 20px;
    border: 1px solid rgba(184, 98, 27, 0.2);
    transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
    white-space: nowrap;
}

.nav-links a:hover {
    background: rgba(184, 98, 27, 0.3);
    color: var(--candle-gold);
    border-color: var(--molten-amber);
}

/* --- Hero Section --- */
.hero {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.hero-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(ellipse at center, rgba(184, 98, 27, 0.15) 0%, rgba(184, 98, 27, 0.05) 40%, transparent 70%);
    filter: blur(40px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ember-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.ember {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--candle-gold);
    opacity: 0;
    animation: ember-rise linear infinite;
}

@keyframes ember-rise {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.15;
    }
    90% {
        opacity: 0.05;
    }
    100% {
        opacity: 0;
        transform: translateY(-300px) translateX(30px);
    }
}

.hero-title {
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: hero-fade-in 1.5s ease-out 1.5s forwards;
}

@keyframes hero-fade-in {
    0% {
        opacity: 0;
        filter: blur(4px);
    }
    50% {
        opacity: 0.7;
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
    }
}

.glitch-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(2.2rem, 6vw, 4rem);
    letter-spacing: 0.03em;
    color: var(--ash-parchment);
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: var(--signal-magenta);
    animation: glitch-r 4s ease-in-out infinite;
}

.glitch-text::after {
    color: var(--deep-teal);
    animation: glitch-b 4s ease-in-out infinite;
}

@keyframes glitch-r {
    0%, 90%, 100% { opacity: 0; transform: translateX(0); }
    92% { opacity: 0.8; transform: translateX(-2px) translateY(1px); }
    94% { opacity: 0; transform: translateX(0); }
    96% { opacity: 0.6; transform: translateX(-3px) translateY(-1px); }
    98% { opacity: 0; }
}

@keyframes glitch-b {
    0%, 90%, 100% { opacity: 0; transform: translateX(0); }
    93% { opacity: 0.8; transform: translateX(2px) translateY(-1px); }
    95% { opacity: 0; transform: translateX(0); }
    97% { opacity: 0.6; transform: translateX(3px) translateY(1px); }
    99% { opacity: 0; }
}

.hero-flame {
    margin-top: 32px;
    z-index: 2;
    opacity: 0;
    animation: hero-fade-in 1s ease-out 2.5s forwards;
}

.hero-flame .candle-flame {
    animation: flicker 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(184, 98, 27, 0.5));
}

.scroll-streak {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 60vh;
    background: linear-gradient(to bottom, transparent 0%, rgba(184, 98, 27, 0.15) 50%, rgba(184, 98, 27, 0.3) 100%);
    opacity: 0;
    animation: streak-fade 2s ease-out 3s forwards;
    pointer-events: none;
}

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

/* --- Candle Flicker Keyframes --- */
@keyframes flicker {
    0% { opacity: 0.8; transform: scaleY(1); }
    25% { opacity: 1; transform: scaleY(1.04); }
    50% { opacity: 0.85; transform: scaleY(0.98); }
    75% { opacity: 0.95; transform: scaleY(1.02); }
    100% { opacity: 0.8; transform: scaleY(1); }
}

/* --- Timeline --- */
.timeline {
    position: relative;
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 24px 120px;
    z-index: 1;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: linear-gradient(
        to bottom,
        var(--molten-amber) 0%,
        var(--candle-gold) 30%,
        var(--molten-amber) 60%,
        var(--ash-parchment) 100%
    );
    transition: height 0.1s linear;
    box-shadow: 0 0 8px rgba(184, 98, 27, 0.3), 0 0 20px rgba(184, 98, 27, 0.1);
}

/* Glitch breaks on the timeline */
.timeline-line::before,
.timeline-line::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 8px;
    background: var(--molten-amber);
    left: 0;
}

.timeline-line::before {
    top: 30%;
    transform: translateX(4px);
    box-shadow: 0 0 6px rgba(184, 98, 27, 0.5);
}

.timeline-line::after {
    top: 65%;
    transform: translateX(-5px);
    box-shadow: 0 0 6px rgba(184, 98, 27, 0.5);
}

/* --- Timeline Sections --- */
.timeline-section {
    position: relative;
    padding: 40px 0;
}

/* --- Timeline Nodes --- */
.timeline-node {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 120px;
    opacity: 0;
    transition: opacity 600ms ease, transform 600ms ease;
}

.timeline-node.visible {
    opacity: 1;
}

.node-left {
    flex-direction: row-reverse;
    transform: translateX(-40px);
    padding-right: calc(50% + 60px);
}

.node-left.visible {
    transform: translateX(0);
}

.node-right {
    transform: translateX(40px);
    padding-left: calc(50% + 60px);
}

.node-right.visible {
    transform: translateX(0);
}

/* Node pulse on timeline */
.node-pulse {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--candle-gold);
    box-shadow: 0 0 12px rgba(232, 168, 50, 0.6), 0 0 30px rgba(232, 168, 50, 0.2);
    z-index: 2;
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(232, 168, 50, 0.6), 0 0 30px rgba(232, 168, 50, 0.2); transform: translateX(-50%) scale(1); }
    50% { box-shadow: 0 0 20px rgba(232, 168, 50, 0.8), 0 0 40px rgba(232, 168, 50, 0.3); transform: translateX(-50%) scale(1.15); }
}

/* Node flame */
.node-flame {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.candle-flame-small {
    animation: flicker var(--flicker-duration, 2.5s) ease-in-out infinite;
    filter: drop-shadow(0 0 6px rgba(184, 98, 27, 0.4));
}

/* Node content */
.node-content {
    max-width: 480px;
    padding: 32px;
    background: rgba(58, 53, 64, 0.15);
    border-radius: 4px;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 300ms ease;
}

.node-left .node-content {
    border-right: 3px solid var(--molten-amber);
    box-shadow: 4px 0 20px rgba(184, 98, 27, 0.1);
    text-align: right;
    margin-left: auto;
}

.node-right .node-content {
    border-left: 3px solid var(--molten-amber);
    box-shadow: -4px 0 20px rgba(184, 98, 27, 0.1);
}

.node-content:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(184, 98, 27, 0.15);
}

.node-content:hover h2 {
    text-shadow: -2px 0 var(--signal-magenta), 2px 0 var(--deep-teal);
}

.node-content h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.03em;
    color: var(--ash-parchment);
    margin-bottom: 16px;
    transition: text-shadow 200ms ease;
    text-shadow: 0 0 transparent;
}

.node-content p {
    color: rgba(232, 228, 217, 0.85);
    margin-bottom: 16px;
}

.node-label {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--deep-teal);
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid rgba(27, 122, 122, 0.3);
    border-radius: 12px;
}

/* --- Code Blocks --- */
.code-block {
    background: rgba(13, 11, 15, 0.6);
    border: 1px solid rgba(27, 122, 122, 0.3);
    border-radius: 4px;
    padding: 20px;
    margin: 16px 0;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Source Code Pro', monospace;
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--phosphor-mint);
    line-height: 1.6;
    white-space: pre;
    display: block;
    text-align: left;
}

/* --- Tech Specs --- */
.tech-specs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Varela Round', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    color: var(--phosphor-mint);
}

.spec-item svg {
    flex-shrink: 0;
}

/* --- Glitch Divider --- */
.glitch-divider {
    width: 100%;
    height: 8px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transition: opacity 400ms ease;
}

.glitch-divider.visible {
    opacity: 1;
}

.glitch-divider::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(196, 59, 110, 0.1) 20%,
        rgba(27, 122, 122, 0.15) 40%,
        rgba(184, 98, 27, 0.1) 60%,
        rgba(232, 168, 50, 0.08) 80%,
        transparent 100%
    );
    transform: translateX(-50%);
    animation: burn-line 1.5s ease-out forwards;
    animation-play-state: paused;
}

.glitch-divider.visible::before {
    animation-play-state: running;
}

@keyframes burn-line {
    from { width: 0; }
    to { width: 100%; }
}

/* --- Culmination Section --- */
.timeline-terminus {
    display: flex;
    justify-content: center;
    padding: 60px 0 40px;
}

.terminus-pulse {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--candle-gold) 0%, rgba(232, 168, 50, 0.4) 50%, transparent 70%);
    animation: terminus-glow 2s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(232, 168, 50, 0.4), 0 0 60px rgba(232, 168, 50, 0.15);
}

@keyframes terminus-glow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(232, 168, 50, 0.4), 0 0 60px rgba(232, 168, 50, 0.15); }
    50% { transform: scale(1.3); box-shadow: 0 0 40px rgba(232, 168, 50, 0.6), 0 0 80px rgba(232, 168, 50, 0.25); }
}

.culmination-text {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    opacity: 0;
    transition: opacity 800ms ease;
}

.culmination-text.visible {
    opacity: 1;
}

.culmination-text h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.03em;
    color: var(--ash-parchment);
    margin-bottom: 24px;
}

.culmination-text p {
    color: rgba(232, 228, 217, 0.8);
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.culmination-cta {
    margin-top: 32px;
}

.highlight {
    color: var(--candle-gold);
    font-weight: 800;
    position: relative;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--molten-amber);
    box-shadow: 0 0 8px rgba(184, 98, 27, 0.5);
}

/* --- Data Corruption Blocks --- */
.corruption-block {
    position: fixed;
    width: 80px;
    height: 12px;
    background: var(--signal-magenta);
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    animation: corruption-flash 300ms ease-out forwards;
}

@keyframes corruption-flash {
    0% { opacity: 0.5; transform: scaleX(0); }
    30% { opacity: 0.4; transform: scaleX(1); }
    100% { opacity: 0; transform: scaleX(1.2); }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .timeline-line {
        left: 16px;
        transform: none;
    }

    .node-pulse {
        left: 16px;
        transform: translateX(-50%);
    }

    .node-flame {
        left: 16px;
        transform: translateX(-50%);
    }

    .timeline-node {
        margin-bottom: 80px;
    }

    .node-left,
    .node-right {
        padding-left: 48px;
        padding-right: 16px;
        flex-direction: row;
    }

    .node-left {
        transform: translateX(-20px);
    }

    .node-right {
        transform: translateX(20px);
    }

    .node-left .node-content,
    .node-right .node-content {
        text-align: left;
        border-left: 3px solid var(--molten-amber);
        border-right: none;
        box-shadow: -4px 0 20px rgba(184, 98, 27, 0.1);
        margin-left: 0;
    }

    .nav-links {
        flex-direction: column;
        position: absolute;
        top: 56px;
        right: 0;
    }

    .hero-glow {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 480px) {
    .glitch-text {
        font-size: clamp(1.6rem, 8vw, 2.4rem);
    }

    .node-content {
        padding: 20px;
    }

    .node-content h2 {
        font-size: clamp(1.2rem, 4vw, 1.6rem);
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .bokeh-layer-1,
    .bokeh-layer-2,
    .bokeh-layer-3 {
        animation: none;
    }

    .candle-flame,
    .candle-flame-small,
    .nav-flame-icon svg {
        animation: none;
    }

    .ember {
        animation: none;
        display: none;
    }

    .node-pulse {
        animation: none;
    }

    .terminus-pulse {
        animation: none;
    }

    .glitch-text::before,
    .glitch-text::after {
        animation: none;
        display: none;
    }

    .hero-title {
        animation: none;
        opacity: 1;
    }

    .hero-flame {
        animation: none;
        opacity: 1;
    }

    .scroll-streak {
        animation: none;
        opacity: 1;
    }

    .timeline-node {
        opacity: 1;
        transform: none;
    }

    .node-content:hover h2 {
        text-shadow: none;
    }
}
