/* =============================================================
   oning.stream — reasoning in real time
   Cinematic, generative, three-channel reasoning visualization
   ============================================================= */

/* Palette
   #0a1628  Deep Stream      (background)
   #4ecdc4  Teal Channel
   #ff6b6b  Coral Channel
   #ffd93d  Gold Channel
   #e0e0e0  Stream Light     (text)
   #1e3a5e  Deep Current     (lines, borders)
   #ffffff  Clarity White    (emphasis)
   #2d5470  Mid Stream       (secondary bg)
*/

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0a1628;
    color: #e0e0e0;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    font-weight: 400;
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background grain — subtle drift suggesting deep current */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(78,205,196,0.04), transparent 60%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(255,217,61,0.03), transparent 60%),
        radial-gradient(ellipse 50% 30% at 0% 50%, rgba(255,107,107,0.025), transparent 70%);
    z-index: 0;
}

.stream {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* =============================================================
   THE SOURCE — Hero
   ============================================================= */

.source {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 16px;
}

.source-point {
    position: relative;
    width: 320px;
    height: 320px;
    margin-bottom: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center,
        #ffffff 0%,
        #4ecdc4 5%,
        rgba(78,205,196,0.4) 12%,
        rgba(45,84,112,0.3) 22%,
        #0a1628 40%);
    border-radius: 50%;
    animation: source-breathe 4s ease-in-out infinite;
}

@keyframes source-breathe {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.04);
        filter: brightness(1.15);
    }
}

/* Eight rays radiating outward at 45-degree intervals */
.ray {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    background: linear-gradient(to top,
        rgba(78,205,196,0.6) 0%,
        rgba(78,205,196,0.0) 100%);
    transform-origin: 0 0;
    animation: radiate 5s ease-out infinite;
    height: 0;
    opacity: 0;
}

.ray-1 { transform: rotate(0deg);   animation-delay: 0.0s; }
.ray-2 { transform: rotate(45deg);  animation-delay: 0.3s; }
.ray-3 { transform: rotate(90deg);  animation-delay: 0.6s; }
.ray-4 { transform: rotate(135deg); animation-delay: 0.9s; }
.ray-5 { transform: rotate(180deg); animation-delay: 1.2s; }
.ray-6 { transform: rotate(225deg); animation-delay: 1.5s; }
.ray-7 { transform: rotate(270deg); animation-delay: 1.8s; }
.ray-8 { transform: rotate(315deg); animation-delay: 2.1s; }

@keyframes radiate {
    0% {
        height: 0;
        opacity: 0;
    }
    30% {
        opacity: 0.4;
    }
    100% {
        height: 220px;
        opacity: 0;
    }
}

/* Domain title — typewriter */
.domain-title {
    font-family: "Outfit", "Inter", sans-serif;
    font-size: clamp(1.8rem, 5vw, 3.4rem);
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: baseline;
    margin-bottom: 18px;
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    display: inline-block;
}

.caret {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #4ecdc4;
    margin-left: 2px;
    transform: translateY(0.12em);
    animation: caret-blink 0.9s steps(2) infinite;
}

@keyframes caret-blink {
    50% { opacity: 0; }
}

.subtitle {
    font-family: "Source Code Pro", monospace;
    font-size: 0.95rem;
    color: #4ecdc4;
    letter-spacing: 0.08em;
    margin-bottom: 32px;
    opacity: 0;
    animation: fade-up 1s ease 1.6s forwards;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.meta-line {
    font-family: "Source Code Pro", monospace;
    font-size: 0.78rem;
    color: rgba(224,224,224,0.5);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    opacity: 0;
    animation: fade-up 1s ease 1.9s forwards;
}

.meta-token {
    color: rgba(224,224,224,0.55);
    letter-spacing: 0.04em;
}

.meta-pulse {
    color: #ffd93d;
    font-weight: 500;
    min-width: 4ch;
    text-align: center;
}

.scroll-hint {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fade-up 1s ease 2.4s forwards;
}

.scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, transparent, #4ecdc4, transparent);
    animation: scroll-drip 2.4s ease-in-out infinite;
}

@keyframes scroll-drip {
    0% { transform: translateY(-12px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(12px); opacity: 0; }
}

.scroll-label {
    font-family: "Source Code Pro", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: rgba(224,224,224,0.45);
    text-transform: lowercase;
}

/* =============================================================
   STREAM CHANNELS — three columns
   ============================================================= */

.channels,
.merge,
.confluence,
.afterflow {
    position: relative;
    padding: 96px 0;
}

.channels-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    margin-bottom: 48px;
    padding: 0 4px;
}

.frame-tag {
    font-family: "Source Code Pro", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: rgba(224,224,224,0.45);
    padding: 4px 10px;
    border: 1px solid rgba(30,58,94,0.6);
    border-radius: 2px;
    background: rgba(30,58,94,0.15);
}

.frame-tag.right {
    color: #4ecdc4;
    border-color: rgba(78,205,196,0.3);
    background: rgba(78,205,196,0.05);
}

.channels-title {
    font-family: "Outfit", sans-serif;
    font-size: clamp(1.1rem, 2.4vw, 1.8rem);
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.01em;
    text-align: center;
}

.grid {
    display: grid;
    gap: 24px;
}

.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.two-col-grid {
    grid-template-columns: 2fr 1fr;
}

/* Channel column */
.channel {
    position: relative;
    padding: 24px 20px 48px;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Vertical guide line down each channel */
.channel::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(30,58,94,0.45);
    z-index: 0;
}

.channel-head {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    background: rgba(10,22,40,0.9);
    border: 1px solid rgba(30,58,94,0.6);
    border-radius: 3px;
    margin-bottom: 6px;
}

.channel-id {
    font-family: "Source Code Pro", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: lowercase;
    color: rgba(224,224,224,0.55);
}

.channel-name {
    font-family: "Outfit", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
}

/* Channel color tints */
.channel-teal .channel-head { border-color: rgba(78,205,196,0.35); }
.channel-teal .channel-name { color: #4ecdc4; }
.channel-teal::before { background: rgba(78,205,196,0.18); }

.channel-coral .channel-head { border-color: rgba(255,107,107,0.35); }
.channel-coral .channel-name { color: #ff6b6b; }
.channel-coral::before { background: rgba(255,107,107,0.18); }

.channel-gold .channel-head { border-color: rgba(255,217,61,0.35); }
.channel-gold .channel-name { color: #ffd93d; }
.channel-gold::before { background: rgba(255,217,61,0.18); }

/* Nodes */
.node {
    position: relative;
    z-index: 2;
    padding: 14px 16px 16px;
    background: rgba(30,58,94,0.22);
    backdrop-filter: blur(2px);
    border-left: 3px solid #2d5470;
    border-radius: 0 3px 3px 0;
    opacity: 0;
    transform: translateY(14px);
    animation: node-appear 0.7s ease forwards, node-pulse 3s ease-in-out infinite;
    animation-delay: 0s, 1.2s;
}

.node p {
    font-family: "Inter", sans-serif;
    font-size: 0.92rem;
    line-height: 1.65;
    color: #e0e0e0;
}

.node-step {
    display: block;
    font-family: "Source Code Pro", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: lowercase;
    color: rgba(224,224,224,0.55);
    margin-bottom: 6px;
}

.channel-teal .node { border-left-color: #4ecdc4; }
.channel-teal .node-step { color: rgba(78,205,196,0.85); }

.channel-coral .node { border-left-color: #ff6b6b; }
.channel-coral .node-step { color: rgba(255,107,107,0.85); }

.channel-gold .node { border-left-color: #ffd93d; }
.channel-gold .node-step { color: rgba(255,217,61,0.85); }

/* Stagger node entrances */
.channel .node-1 { animation-delay: 0.10s, 1.20s; }
.channel .node-2 { animation-delay: 0.30s, 1.55s; }
.channel .node-3 { animation-delay: 0.50s, 1.85s; }
.channel .node-4 { animation-delay: 0.70s, 2.20s; }

@keyframes node-appear {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes node-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* When node is "active" (scroll-revealed), bump glow briefly */
.node.active {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 4px 24px rgba(0,0,0,0.3);
}

/* Particles flowing down each channel */
.particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    left: 50%;
    top: 0;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.channel-teal .particle  { background: #4ecdc4; box-shadow: 0 0 6px rgba(78,205,196,0.6); }
.channel-coral .particle { background: #ff6b6b; box-shadow: 0 0 6px rgba(255,107,107,0.6); }
.channel-gold .particle  { background: #ffd93d; box-shadow: 0 0 6px rgba(255,217,61,0.6); }

.particle.p1 { animation: drift 8s linear infinite;   animation-delay: 0s; }
.particle.p2 { animation: drift 11s linear infinite;  animation-delay: 2.4s; }
.particle.p3 { animation: drift 13s linear infinite;  animation-delay: 5.0s; }
.particle.p4 { animation: drift 15s linear infinite;  animation-delay: 7.5s; }

@keyframes drift {
    0% {
        top: -2%;
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        top: 102%;
        opacity: 0;
    }
}

/* SVG Connectors over channels */
.connectors {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 36px;
    width: 100%;
    height: 200px;
    pointer-events: none;
    opacity: 0.7;
    z-index: 0;
}

.connector {
    stroke-dasharray: 6 8;
    animation: dash-flow 6s linear infinite;
}

.connector.c2 { animation-duration: 7s; animation-delay: 1s; }
.connector.c3 { animation-duration: 8s; animation-delay: 2s; }

@keyframes dash-flow {
    to { stroke-dashoffset: -200; }
}

/* =============================================================
   MERGE — two-column convergence
   ============================================================= */

.merge {
    border-top: 1px solid rgba(30,58,94,0.4);
    border-bottom: 1px solid rgba(30,58,94,0.4);
}

.merged-channel {
    position: relative;
    padding: 24px 20px;
    min-height: 280px;
}

.merged-channel:first-child .channel-head {
    border-color: rgba(255,107,107,0.35);
    background: linear-gradient(90deg,
        rgba(78,205,196,0.08) 0%,
        rgba(255,107,107,0.08) 100%);
}

.merged-channel:first-child .channel-name {
    background: linear-gradient(90deg, #4ecdc4 0%, #ff6b6b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.merged-channel:first-child::before {
    background: linear-gradient(to bottom,
        rgba(78,205,196,0.18),
        rgba(255,107,107,0.18));
}

.merged-channel:first-child .node {
    border-left: 3px solid;
    border-image: linear-gradient(to bottom, #4ecdc4, #ff6b6b) 1;
}

.merged-channel:last-child .channel-head {
    border-color: rgba(255,217,61,0.35);
}
.merged-channel:last-child .channel-name {
    color: #ffd93d;
}
.merged-channel:last-child::before {
    background: rgba(255,217,61,0.18);
}
.merged-channel:last-child .node {
    border-left-color: #ffd93d;
    background: rgba(30,58,94,0.18);
}

.node.wide p {
    font-size: 0.95rem;
}

/* =============================================================
   CONFLUENCE — single centered conclusion
   ============================================================= */

.confluence {
    text-align: center;
}

.conclusion-block {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 40px 44px;
    background:
        linear-gradient(180deg,
            rgba(30,58,94,0.5) 0%,
            rgba(45,84,112,0.35) 100%);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px;
    text-align: left;
    overflow: hidden;
    box-shadow:
        0 0 30px rgba(78,205,196,0.15),
        0 0 30px rgba(255,107,107,0.15),
        0 0 30px rgba(255,217,61,0.15),
        inset 0 0 60px rgba(78,205,196,0.04);
    animation: confluence-glow 5s ease-in-out infinite;
}

@keyframes confluence-glow {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(78,205,196,0.15),
            0 0 30px rgba(255,107,107,0.15),
            0 0 30px rgba(255,217,61,0.15),
            inset 0 0 60px rgba(78,205,196,0.04);
    }
    33% {
        box-shadow:
            0 0 40px rgba(78,205,196,0.22),
            0 0 30px rgba(255,107,107,0.12),
            0 0 30px rgba(255,217,61,0.12),
            inset 0 0 60px rgba(78,205,196,0.06);
    }
    66% {
        box-shadow:
            0 0 30px rgba(78,205,196,0.12),
            0 0 40px rgba(255,107,107,0.22),
            0 0 30px rgba(255,217,61,0.12),
            inset 0 0 60px rgba(255,107,107,0.06);
    }
}

.conclusion-glow {
    position: absolute;
    inset: -2px;
    border-radius: 4px;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(78,205,196,0.10), transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(255,107,107,0.10), transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(255,217,61,0.10), transparent 50%);
}

.conclusion-tag {
    display: inline-block;
    font-family: "Source Code Pro", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: lowercase;
    color: #4ecdc4;
    margin-bottom: 14px;
}

.conclusion-title {
    font-family: "Outfit", sans-serif;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 20px;
    letter-spacing: 0.005em;
}

.conclusion-body {
    font-family: "Inter", sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    color: #e0e0e0;
    margin-bottom: 16px;
    max-width: 640px;
}

.conclusion-body.subtle {
    color: rgba(224,224,224,0.7);
    font-size: 0.92rem;
}

.conclusion-meta {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-family: "Source Code Pro", monospace;
    font-size: 0.75rem;
    color: rgba(224,224,224,0.55);
    letter-spacing: 0.06em;
}

/* =============================================================
   AFTERFLOW — fade out
   ============================================================= */

.afterflow {
    text-align: center;
    padding: 80px 0 120px;
}

.afterflow-line {
    font-family: "Source Code Pro", monospace;
    font-size: 0.85rem;
    color: rgba(224,224,224,0.5);
    letter-spacing: 0.14em;
    margin-bottom: 18px;
}

.dots span {
    display: inline-block;
    animation: dot-pulse 1.4s ease-in-out infinite;
}
.dots span:nth-child(1) { animation-delay: 0.0s; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; color: #4ecdc4; }
}

.afterflow-domain {
    font-family: "Outfit", sans-serif;
    font-size: 1.4rem;
    font-weight: 500;
    background: linear-gradient(90deg, #4ecdc4 0%, #ff6b6b 50%, #ffd93d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 0.04em;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */

@media (max-width: 860px) {
    .three-col,
    .two-col-grid {
        grid-template-columns: 1fr;
    }

    .channel {
        min-height: auto;
    }

    .source-point {
        width: 240px;
        height: 240px;
        margin-bottom: 36px;
    }

    .channels,
    .merge,
    .confluence,
    .afterflow {
        padding: 64px 0;
    }

    .conclusion-block {
        padding: 36px 24px 32px;
    }

    .channels-header {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 12px;
    }

    .frame-tag,
    .frame-tag.right {
        justify-self: center;
    }

    .connectors {
        display: none;
    }
}

@media (max-width: 480px) {
    .stream {
        padding: 0 16px;
    }

    .source-point {
        width: 200px;
        height: 200px;
    }

    .channel-head {
        padding: 8px 12px;
    }

    .node {
        padding: 12px 14px;
    }
}
