/* ============================================================
   reasoner.dev — Inference Engine
   Cyberpunk · Jewel-tones · Variable-fluid · Border-animate
   ============================================================ */

:root {
    --void-dark: #0A0A14;
    --obsidian: #1A1A28;
    --sapphire: #2563EB;
    --emerald: #10B981;
    --amethyst: #8B5CF6;
    --ruby: #EF4444;
    --silver: #C8D0D8;
    --silver-dim: rgba(200, 208, 216, 0.55);
    --silver-faint: rgba(200, 208, 216, 0.18);
    --silver-trace: rgba(200, 208, 216, 0.08);

    --font-headline: "Outfit", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Menlo", monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-dark);
    color: var(--silver);
    font-family: var(--font-body);
    font-size: clamp(15px, 1.4vw, 17px);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================================
   Subtle ambient grid (under everything)
   ============================================================ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--silver-trace) 1px, transparent 1px),
        linear-gradient(90deg, var(--silver-trace) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 80%);
}

/* ============================================================
   1. INFERENCE ENGINE OPENING
   ============================================================ */
.opening {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background: var(--void-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
}

.circuit-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.circuit-path {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    opacity: 0;
}

.circuit-sapphire {
    filter: drop-shadow(0 0 6px rgba(37, 99, 235, 0.55));
}

.circuit-emerald {
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.45));
}

.circuit-amethyst {
    filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.55));
}

.opening.is-on .circuit-path {
    animation: circuitDraw 2.4s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.opening.is-on .circuit-path:nth-child(2) { animation-delay: 0.15s; }
.opening.is-on .circuit-path:nth-child(3) { animation-delay: 0.30s; }
.opening.is-on .circuit-path:nth-child(4) { animation-delay: 0.45s; }
.opening.is-on .circuit-path:nth-child(5) { animation-delay: 0.60s; }
.opening.is-on .circuit-path:nth-child(6) { animation-delay: 0.75s; }

@keyframes circuitDraw {
    0%   { stroke-dashoffset: 4000; opacity: 0; }
    20%  { opacity: 0.85; }
    100% { stroke-dashoffset: 0; opacity: 0.85; }
}

.circuit-nodes circle {
    opacity: 0;
    transform-origin: center;
}

.opening.is-on .circuit-nodes circle {
    animation: nodePop 0.6s ease-out forwards;
}

.opening.is-on .circuit-nodes circle:nth-child(1)  { animation-delay: 1.0s; }
.opening.is-on .circuit-nodes circle:nth-child(2)  { animation-delay: 1.1s; }
.opening.is-on .circuit-nodes circle:nth-child(3)  { animation-delay: 1.2s; }
.opening.is-on .circuit-nodes circle:nth-child(4)  { animation-delay: 1.3s; }
.opening.is-on .circuit-nodes circle:nth-child(5)  { animation-delay: 1.4s; }
.opening.is-on .circuit-nodes circle:nth-child(6)  { animation-delay: 1.5s; }
.opening.is-on .circuit-nodes circle:nth-child(7)  { animation-delay: 1.6s; }
.opening.is-on .circuit-nodes circle:nth-child(8)  { animation-delay: 1.7s; }
.opening.is-on .circuit-nodes circle:nth-child(9)  { animation-delay: 1.8s; }
.opening.is-on .circuit-nodes circle:nth-child(10) { animation-delay: 1.9s; }
.opening.is-on .circuit-nodes circle:nth-child(11) { animation-delay: 2.0s; }
.opening.is-on .circuit-nodes circle:nth-child(12) { animation-delay: 2.1s; }

@keyframes nodePop {
    0%   { opacity: 0; transform: scale(0.2); }
    60%  { opacity: 1; transform: scale(1.6); }
    100% { opacity: 1; transform: scale(1); }
}

.wordmark-shell {
    position: relative;
    z-index: 2;
    padding: 48px 32px;
    text-align: center;
    max-width: 920px;
}

.meta-line {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--silver-dim);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 1s ease, transform 1s ease;
    transition-delay: 1.2s;
}

.opening.is-on .meta-line {
    opacity: 1;
    transform: translateY(0);
}

.meta-top { margin-bottom: 28px; }
.meta-bottom { margin-top: 36px; transition-delay: 1.6s; }

.meta-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dot-sapphire { background: var(--sapphire); box-shadow: 0 0 8px var(--sapphire); }
.dot-emerald  { background: var(--emerald);  box-shadow: 0 0 8px var(--emerald); }
.dot-amethyst { background: var(--amethyst); box-shadow: 0 0 8px var(--amethyst); }

.meta-divider {
    width: 24px;
    height: 1px;
    background: var(--silver-faint);
}

.wordmark {
    font-family: var(--font-headline);
    font-size: clamp(56px, 11vw, 168px);
    font-weight: 300;
    font-variation-settings: "wght" 300;
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--silver);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease, font-variation-settings 2s ease;
    transition-delay: 0.8s;
}

.opening.is-on .wordmark {
    opacity: 1;
    transform: translateY(0);
    font-variation-settings: "wght" 600;
}

.wordmark-domain {
    background: linear-gradient(90deg, var(--silver) 0%, var(--silver) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.wordmark-tld {
    color: var(--sapphire);
    font-weight: 400;
}

.opening.is-on .wordmark-tld {
    text-shadow: 0 0 24px rgba(37, 99, 235, 0.4);
}

.wordmark-sub {
    margin-top: 32px;
    font-size: clamp(15px, 1.4vw, 17px);
    color: var(--silver-dim);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease, transform 1s ease;
    transition-delay: 1.4s;
}

.opening.is-on .wordmark-sub {
    opacity: 1;
    transform: translateY(0);
}

.scroll-indicator {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--silver-dim);
    opacity: 0;
    transition: opacity 1s ease;
    transition-delay: 2.2s;
    z-index: 2;
}

.opening.is-on .scroll-indicator {
    opacity: 1;
}

.scroll-bar {
    display: block;
    width: 1px;
    height: 36px;
    background: linear-gradient(to bottom, var(--sapphire), transparent);
    animation: scrollPulse 2.4s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { transform: scaleY(1); opacity: 0.7; }
    50%      { transform: scaleY(1.4); opacity: 1; }
}

/* ============================================================
   Section header (shared)
   ============================================================ */
.section-header {
    max-width: 760px;
    margin: 0 auto 80px;
    padding: 0 32px;
}

.section-eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    color: var(--silver-dim);
    text-transform: uppercase;
    margin-bottom: 18px;
    padding-left: 18px;
    border-left: 2px solid var(--sapphire);
}

.section-title {
    font-family: var(--font-headline);
    font-size: clamp(28px, 4vw, 56px);
    font-weight: 400;
    font-variation-settings: "wght" 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--silver);
    transition: font-variation-settings 1.6s ease;
}

.section-title.is-on {
    font-variation-settings: "wght" 600;
}

/* ============================================================
   2. LOGIC CHAIN STREAM
   ============================================================ */
.logic-chain {
    position: relative;
    padding: 160px 32px 160px;
    background: var(--void-dark);
    z-index: 2;
}

.chain {
    list-style: none;
    max-width: 680px;
    margin: 0 auto;
    counter-reset: step;
}

.step {
    position: relative;
    padding: 28px 0 28px 32px;
    margin-bottom: 28px;
    border-left: 3px solid transparent;
    opacity: 0.55;
    transition: opacity 0.6s ease;
}

.step::before {
    content: "";
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: currentColor;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1);
}

.step.is-on {
    opacity: 1;
}

.step.is-on::before {
    transform: scaleY(1);
}

.step-sapphire { color: var(--sapphire); }
.step-emerald  { color: var(--emerald); }
.step-amethyst { color: var(--amethyst); }

.step-marker {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--silver-dim);
}

.step-number {
    color: currentColor;
    font-weight: 600;
}

.step-tag {
    padding: 3px 10px;
    border: 1px solid currentColor;
    color: currentColor;
    border-radius: 2px;
    font-size: 10px;
}

.step-title {
    font-family: var(--font-headline);
    font-size: clamp(20px, 2.3vw, 30px);
    font-weight: 400;
    font-variation-settings: "wght" 400;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--silver);
    margin-bottom: 14px;
    transition: font-variation-settings 1.4s ease;
}

.step.is-on .step-title {
    font-variation-settings: "wght" 600;
}

.step-body {
    color: var(--silver-dim);
    font-size: clamp(15px, 1.3vw, 16px);
    line-height: 1.8;
    margin-bottom: 18px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: 0.2s;
}

.step.is-on .step-body {
    opacity: 1;
    transform: translateY(0);
}

.step-code {
    display: block;
    font-family: var(--font-mono);
    font-size: 13px;
    color: currentColor;
    background: rgba(26, 26, 40, 0.6);
    border: 1px solid var(--silver-faint);
    border-left: 2px solid currentColor;
    padding: 12px 16px;
    border-radius: 2px;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    transition-delay: 0.4s;
    word-break: break-all;
}

.step.is-on .step-code {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================
   3. ARCHITECTURE DIAGRAM
   ============================================================ */
.architecture {
    position: relative;
    padding: 160px 32px 160px;
    background: var(--void-dark);
    z-index: 2;
}

.diagram-frame {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    background: rgba(10, 10, 20, 0.6);
    border: 1px solid var(--silver-faint);
    padding: 48px 32px 64px;
}

.diagram-corners .corner,
.footer-corners .corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--sapphire);
}

.corner-tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner-tr { top: -1px; right: -1px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -1px; left: -1px; border-right: none; border-top: none; }
.corner-br { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.diagram-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--silver-dim);
    text-transform: uppercase;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--silver-faint);
}

.diagram-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.edge {
    stroke: var(--silver-faint);
    stroke-width: 1;
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 1.4s cubic-bezier(0.65, 0, 0.35, 1), stroke 0.6s ease;
}

.architecture.is-on .edge {
    stroke-dashoffset: 0;
    stroke: rgba(200, 208, 216, 0.32);
}

.architecture.is-on .edge { transition-delay: 1.2s; }

.d-node {
    cursor: default;
}

.node-ring {
    fill: none;
    stroke-width: 1.2;
    transform-origin: center;
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.node-fill {
    transform-origin: center;
    transform: scale(0);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.architecture.is-on .node-ring,
.architecture.is-on .node-fill {
    transform: scale(1);
}

/* Stagger node entrance */
.architecture.is-on .d-node:nth-child(1) .node-ring,
.architecture.is-on .d-node:nth-child(1) .node-fill { transition-delay: 0.05s; }
.architecture.is-on .d-node:nth-child(2) .node-ring,
.architecture.is-on .d-node:nth-child(2) .node-fill { transition-delay: 0.15s; }
.architecture.is-on .d-node:nth-child(3) .node-ring,
.architecture.is-on .d-node:nth-child(3) .node-fill { transition-delay: 0.25s; }
.architecture.is-on .d-node:nth-child(4) .node-ring,
.architecture.is-on .d-node:nth-child(4) .node-fill { transition-delay: 0.35s; }
.architecture.is-on .d-node:nth-child(5) .node-ring,
.architecture.is-on .d-node:nth-child(5) .node-fill { transition-delay: 0.45s; }
.architecture.is-on .d-node:nth-child(6) .node-ring,
.architecture.is-on .d-node:nth-child(6) .node-fill { transition-delay: 0.55s; }
.architecture.is-on .d-node:nth-child(7) .node-ring,
.architecture.is-on .d-node:nth-child(7) .node-fill { transition-delay: 0.65s; }
.architecture.is-on .d-node:nth-child(8) .node-ring,
.architecture.is-on .d-node:nth-child(8) .node-fill { transition-delay: 0.75s; }
.architecture.is-on .d-node:nth-child(9) .node-ring,
.architecture.is-on .d-node:nth-child(9) .node-fill { transition-delay: 0.85s; }
.architecture.is-on .d-node:nth-child(10) .node-ring,
.architecture.is-on .d-node:nth-child(10) .node-fill { transition-delay: 0.95s; }
.architecture.is-on .d-node:nth-child(11) .node-ring,
.architecture.is-on .d-node:nth-child(11) .node-fill { transition-delay: 1.05s; }
.architecture.is-on .d-node:nth-child(12) .node-ring,
.architecture.is-on .d-node:nth-child(12) .node-fill { transition-delay: 1.15s; }
.architecture.is-on .d-node:nth-child(13) .node-ring,
.architecture.is-on .d-node:nth-child(13) .node-fill { transition-delay: 1.25s; }

.d-node-sapphire .node-ring { stroke: var(--sapphire); }
.d-node-sapphire .node-fill { fill: var(--sapphire); filter: drop-shadow(0 0 6px var(--sapphire)); }
.d-node-emerald .node-ring  { stroke: var(--emerald); }
.d-node-emerald .node-fill  { fill: var(--emerald);  filter: drop-shadow(0 0 6px var(--emerald)); }
.d-node-amethyst .node-ring { stroke: var(--amethyst); }
.d-node-amethyst .node-fill { fill: var(--amethyst); filter: drop-shadow(0 0 6px var(--amethyst)); }

.diagram-labels {
    opacity: 0;
    transition: opacity 0.8s ease;
    transition-delay: 1.4s;
}

.architecture.is-on .diagram-labels {
    opacity: 1;
}

.leader {
    stroke: var(--silver-faint);
    stroke-width: 0.8;
}

.lbl-num {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    fill: var(--silver-dim);
    font-weight: 600;
}

.lbl-text {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.18em;
    fill: var(--silver);
    text-transform: uppercase;
}

.diagram-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    justify-content: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px dashed var(--silver-faint);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--silver-dim);
    text-transform: uppercase;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.swatch-sapphire { background: var(--sapphire); box-shadow: 0 0 10px var(--sapphire); }
.swatch-emerald  { background: var(--emerald);  box-shadow: 0 0 10px var(--emerald); }
.swatch-amethyst { background: var(--amethyst); box-shadow: 0 0 10px var(--amethyst); }

/* ============================================================
   4. TERMINAL FOOTER
   ============================================================ */
.terminal-footer {
    position: relative;
    padding: 96px 32px 64px;
    background: var(--void-dark);
    z-index: 2;
}

.footer-frame {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
    background: rgba(26, 26, 40, 0.7);
    border: 1px solid var(--silver-faint);
    padding: 44px 36px 32px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.footer-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--emerald);
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--silver-faint);
}

.prompt-mark {
    color: var(--sapphire);
    font-weight: 600;
}

.prompt-text {
    color: var(--silver);
    flex: 1;
    white-space: pre;
}

.prompt-caret {
    width: 8px;
    height: 14px;
    background: var(--emerald);
    animation: caretBlink 1.1s steps(2) infinite;
    box-shadow: 0 0 6px var(--emerald);
}

@keyframes caretBlink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.footer-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 36px;
}

.footer-row {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    align-items: center;
    color: var(--silver-dim);
}

.row-key {
    color: var(--amethyst);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
}

.row-val {
    color: var(--silver);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-emerald {
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.3); }
}

.footer-baseline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 18px;
    border-top: 1px dashed var(--silver-faint);
    font-size: 10px;
    letter-spacing: 0.25em;
    color: var(--silver-dim);
    text-transform: uppercase;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        transition-duration: 0.001s !important;
    }

    .circuit-path {
        stroke-dashoffset: 0;
        opacity: 0.85;
    }

    .circuit-nodes circle { opacity: 1; }
    .step::before { transform: scaleY(1); }
    .step { opacity: 1; }
    .node-ring, .node-fill { transform: scale(1); }
    .edge { stroke-dashoffset: 0; }
    .diagram-labels { opacity: 1; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
    .wordmark { font-size: clamp(48px, 18vw, 96px); }
    .section-header { margin-bottom: 56px; }
    .logic-chain { padding: 100px 24px; }
    .architecture { padding: 100px 16px; }
    .diagram-frame { padding: 32px 16px 48px; }
    .terminal-footer { padding: 72px 16px 48px; }
    .footer-frame { padding: 32px 22px 24px; }
    .footer-row { grid-template-columns: 80px 1fr; gap: 12px; }
    .lbl-text { font-size: 8px; }
    .lbl-num { font-size: 9px; }
    .meta-line { gap: 10px; flex-wrap: wrap; justify-content: center; }
}
