/* ============================================
   nlbd.dev - No Leader, But Distributed
   Neomorphic terracotta design system
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --cream: #f0ddd0;
    --terracotta: #cd8560;
    --dark-brown: #5c3d2e;
    --clay: #a06848;
    --kiln-dark: #3d2316;
    --warm-gold: #ffedc3;
    --muted-sand: #dbb8a0;
    --ember: #e8a070;
    --light-sand: #e5cbb8;
    --deepest: #2a1810;
    --warm-brown: #8b5a3f;

    --neo-bg: #f0ddd0;
    --neo-light: #ffedc3;
    --neo-shadow: #c9a78e;
    --neo-shadow-dark: #a0846e;

    --font-display: 'Jost', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-ui: 'Work Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--kiln-dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

.bokeh-disc {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, rgba(232, 160, 112, 0.35) 0%, rgba(160, 104, 72, 0.1) 60%, transparent 100%);
    filter: blur(1px);
    will-change: transform;
    animation: bokehFloat var(--duration) var(--delay) infinite ease-in-out alternate;
}

@keyframes bokehFloat {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: var(--opacity);
    }
    100% {
        transform: translate(var(--drift-x), var(--drift-y)) scale(var(--scale-end));
        opacity: calc(var(--opacity) * 0.7);
    }
}

/* --- Grain Overlay --- */
.depth-plane-0 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.grain-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noise)"/></svg>');
    background-size: 256px 256px;
}

/* --- Neomorphism Utilities --- */
.neo-convex {
    background: linear-gradient(145deg, #f7e8db, #e4cdb9);
    box-shadow:
        8px 8px 20px var(--neo-shadow),
        -8px -8px 20px var(--neo-light);
    border: 1px solid rgba(255, 237, 195, 0.3);
}

.neo-concave {
    background: linear-gradient(145deg, #e4cdb9, #f7e8db);
    box-shadow:
        inset 8px 8px 20px var(--neo-shadow),
        inset -8px -8px 20px var(--neo-light);
    border: 1px solid rgba(201, 167, 142, 0.2);
}

/* --- Section Base --- */
.section {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
}

.section-inner {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(36px, 8vw, 80px);
    letter-spacing: -0.03em;
    line-height: 1.0;
    color: var(--kiln-dark);
    margin-bottom: 16px;
}

.section-subheading {
    font-family: var(--font-body);
    font-size: clamp(16px, 2.5vw, 22px);
    font-weight: 400;
    color: var(--clay);
    margin-bottom: 60px;
    line-height: 1.5;
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    flex-direction: column;
    text-align: center;
    padding-top: 0;
    padding-bottom: 0;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.hero-letters {
    display: flex;
    gap: clamp(16px, 4vw, 48px);
    justify-content: center;
}

.hero-letter {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(48px, 12vw, 180px);
    letter-spacing: -0.03em;
    line-height: 1.0;
    color: var(--kiln-dark);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.hero-letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.subtitle-word {
    font-family: var(--font-ui);
    font-size: clamp(14px, 2.5vw, 24px);
    font-weight: 500;
    color: var(--clay);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.subtitle-word.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-tagline {
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s var(--ease-out-expo) 1.5s, transform 1s var(--ease-out-expo) 1.5s;
}

.hero-tagline.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-tagline p {
    font-family: var(--font-body);
    font-size: clamp(14px, 2vw, 18px);
    color: var(--dark-brown);
    line-height: 1.7;
    font-weight: 400;
}

.scroll-indicator {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeInUp 1s var(--ease-out-expo) 2.5s forwards;
}

.scroll-line {
    width: 1px;
    height: 50px;
    background: linear-gradient(to bottom, transparent, var(--clay));
    animation: scrollPulse 2s infinite ease-in-out;
}

.scroll-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--clay);
    opacity: 0.7;
}

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Consensus / Membrane Section --- */
.consensus-section {
    background: linear-gradient(180deg, transparent 0%, rgba(219, 184, 160, 0.15) 50%, transparent 100%);
}

.node-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.node-card {
    border-radius: 24px;
    padding: 40px 32px;
    position: relative;
    overflow: hidden;
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo), box-shadow 0.4s ease;
}

.node-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.node-card:hover {
    transform: translateY(-4px);
}

.node-card.neo-convex:hover {
    box-shadow:
        12px 12px 30px var(--neo-shadow),
        -12px -12px 30px var(--neo-light);
}

.node-card.neo-concave:hover {
    box-shadow:
        inset 12px 12px 30px var(--neo-shadow),
        inset -12px -12px 30px var(--neo-light);
}

.node-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ember);
    margin-bottom: 20px;
    position: relative;
}

.node-indicator::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(232, 160, 112, 0.3);
    animation: indicatorPulse 2s infinite ease-in-out;
}

@keyframes indicatorPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.4; }
}

.node-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 28px;
    color: var(--kiln-dark);
    margin-bottom: 12px;
}

.node-desc {
    /* uses warm-brown from palette */
    font-family: var(--font-body);
    font-size: 15px;
    color: #8b5a3f;
    line-height: 1.6;
    margin-bottom: 20px;
}

.node-code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--clay);
    background: rgba(42, 24, 16, 0.06);
    padding: 10px 16px;
    border-radius: 8px;
    display: inline-block;
}

/* --- Topology Section --- */
.nodes-section {
    background: linear-gradient(180deg, transparent 0%, rgba(205, 133, 96, 0.08) 50%, transparent 100%);
}

.topology-canvas {
    position: relative;
    width: 100%;
    height: 500px;
    border-radius: 32px;
    overflow: hidden;
    background: linear-gradient(145deg, #f7e8db, #e4cdb9);
    box-shadow:
        inset 6px 6px 16px var(--neo-shadow),
        inset -6px -6px 16px var(--neo-light);
}

.topology-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.topology-lines line {
    stroke: var(--clay);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.topology-lines line.active {
    opacity: 1;
    stroke: var(--ember);
    stroke-width: 2;
    stroke-dasharray: none;
}

.topo-node {
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.3s var(--ease-out-expo);
}

.topo-node:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.topo-node-inner {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.topo-node-inner.neo-convex {
    background: linear-gradient(145deg, #f7e8db, #e4cdb9);
    box-shadow:
        6px 6px 14px var(--neo-shadow),
        -6px -6px 14px var(--neo-light);
}

.topo-node-inner.neo-concave {
    background: linear-gradient(145deg, #e4cdb9, #f7e8db);
    box-shadow:
        inset 6px 6px 14px var(--neo-shadow),
        inset -6px -6px 14px var(--neo-light);
}

.topo-node.pulsing .topo-node-inner {
    animation: nodePulse 0.6s ease-in-out;
}

@keyframes nodePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.topo-node-id {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--kiln-dark);
}

/* --- Strata Section --- */
.strata-section {
    background: linear-gradient(180deg, transparent 0%, rgba(229, 203, 184, 0.2) 50%, transparent 100%);
}

.strata-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    perspective: 800px;
}

.stratum {
    opacity: 0;
    transform: translateY(30px) rotateX(5deg);
    transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}

.stratum.visible {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.stratum-surface {
    border-radius: 20px;
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    transition: transform 0.3s var(--ease-out-expo);
}

.stratum-surface:hover {
    transform: translateX(8px);
}

.stratum-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(22px, 3vw, 32px);
    color: var(--kiln-dark);
    white-space: nowrap;
}

.stratum-detail {
    font-family: var(--font-body);
    font-size: clamp(13px, 1.8vw, 16px);
    color: var(--dark-brown);
    line-height: 1.5;
    text-align: right;
}

/* --- Components Section --- */
.components-section {
    background: linear-gradient(180deg, transparent 0%, rgba(160, 104, 72, 0.06) 50%, transparent 100%);
}

.component-showcase {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.showcase-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

/* --- Buttons --- */
.btn {
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
    padding: 16px 32px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    letter-spacing: 0.02em;
}

.btn-primary {
    color: var(--kiln-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        12px 12px 28px var(--neo-shadow),
        -12px -12px 28px var(--neo-light);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow:
        inset 6px 6px 14px var(--neo-shadow),
        inset -6px -6px 14px var(--neo-light);
}

.btn-secondary {
    color: var(--dark-brown);
}

.btn-secondary:hover {
    box-shadow:
        inset 12px 12px 28px var(--neo-shadow),
        inset -12px -12px 28px var(--neo-light);
}

.btn-ghost {
    background: transparent;
    color: var(--clay);
    border: 2px solid var(--muted-sand);
    box-shadow: none;
}

.btn-ghost:hover {
    border-color: var(--terracotta);
    color: var(--kiln-dark);
    background: rgba(205, 133, 96, 0.08);
}

/* --- Cards --- */
.showcase-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
}

.showcase-card {
    border-radius: 24px;
    padding: 28px;
    transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s ease;
}

.showcase-card:hover {
    transform: translateY(-4px);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.card-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-active {
    background: #6dbd6d;
    box-shadow: 0 0 8px rgba(109, 189, 109, 0.5);
}

.status-syncing {
    background: var(--ember);
    box-shadow: 0 0 8px rgba(232, 160, 112, 0.5);
    animation: statusBlink 1.5s infinite ease-in-out;
}

.status-idle {
    background: var(--muted-sand);
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.card-title {
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 16px;
    color: var(--kiln-dark);
}

.card-body {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
}

.card-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 28px;
    color: var(--kiln-dark);
    letter-spacing: -0.02em;
}

.metric-label {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--clay);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(160, 104, 72, 0.15);
}

.card-epoch {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--clay);
}

/* --- Terminal Section --- */
.terminal-section {
    background: linear-gradient(180deg, transparent 0%, rgba(42, 24, 16, 0.04) 50%, transparent 100%);
}

.terminal {
    border-radius: 20px;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 24px;
    background: rgba(42, 24, 16, 0.06);
    border-bottom: 1px solid rgba(160, 104, 72, 0.1);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red { background: #e06050; }
.dot-yellow { background: #e0b050; }
.dot-green { background: #60b060; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--clay);
    margin-left: 12px;
}

.terminal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.terminal-line {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
    color: var(--dark-brown);
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
}

.terminal-line.visible {
    opacity: 1;
    transform: translateX(0);
}

.t-prompt {
    color: var(--terracotta);
    font-weight: 700;
}

.t-cmd {
    color: var(--kiln-dark);
    font-weight: 700;
}

.t-output {
    color: var(--clay);
}

.t-success {
    color: #6dbd6d;
}

.t-cursor {
    color: var(--terracotta);
    animation: cursorBlink 1s infinite step-end;
}

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

/* --- Footer Section --- */
.footer-section {
    min-height: auto;
    padding: 80px 40px;
    background: linear-gradient(180deg, transparent, rgba(42, 24, 16, 0.05));
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 48px;
    color: var(--kiln-dark);
    letter-spacing: -0.03em;
}

.footer-tagline {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    color: var(--clay);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--dark-brown);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 12px;
    transition: all 0.3s var(--ease-out-expo);
}

.footer-link:hover {
    transform: translateY(-2px);
    color: var(--kiln-dark);
}

.footer-copy {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--clay);
}

/* --- Scroll-triggered reveal base --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s var(--ease-out-expo), transform 0.7s var(--ease-out-expo);
}

.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section {
        padding: 60px 20px;
    }

    .hero-letters {
        gap: 12px;
    }

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

    .topology-canvas {
        height: 350px;
    }

    .stratum-surface {
        flex-direction: column;
        text-align: center;
    }

    .stratum-detail {
        text-align: center;
    }

    .showcase-cards {
        grid-template-columns: 1fr;
    }

    .card-body {
        flex-direction: column;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .hero-letter {
        font-size: clamp(36px, 15vw, 80px);
    }

    .section-heading {
        font-size: clamp(28px, 8vw, 48px);
    }

    .topo-node-inner {
        width: 40px;
        height: 40px;
    }
}
