/* ============================================
   ncbd.dev - Not Centralized, But Distributed
   Scandinavian editorial design system
   ============================================ */

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

:root {
    --clean-white: #FAFAFA;
    --ink-dark: #1A1A20;
    --neon-electric: #00B8FF;
    --neon-green: #00E870;
    --botanical-sage: #5A8A60;
    --code-gray: #F0F0F4;
    --border-light: #E0E0E8;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1vw, 16px);
    line-height: 1.8;
    color: var(--ink-dark);
    background-color: var(--clean-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
}

code, pre {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-weight: 400;
    font-size: 14px;
}

/* --- Manifesto Header --- */
.manifesto-header {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--clean-white);
    position: relative;
    padding: 40px 20px;
}

.manifesto-content {
    text-align: center;
    position: relative;
    padding: 40px 0;
}

.domain-title {
    font-size: clamp(40px, 6vw, 80px);
    color: var(--ink-dark);
    opacity: 0;
    transform: translateY(10px);
    letter-spacing: -0.02em;
}

.domain-title.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 600ms ease, transform 600ms ease;
}

.manifesto-line {
    font-family: 'Inter', sans-serif;
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 500;
    color: var(--ink-dark);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 16px;
    min-height: 1.5em;
    opacity: 0.9;
}

.manifesto-line .cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--neon-electric);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 800ms step-end infinite;
}

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

/* Accent lines */
.accent-lines {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.accent-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 2px;
    background-color: var(--neon-electric);
    width: 0;
    transition: width 600ms ease;
}

.accent-line-top {
    top: 0;
}

.accent-line-bottom {
    bottom: 0;
}

.accent-lines.visible .accent-line {
    width: 120px;
}

/* Network Diagram in Header */
.network-diagram {
    width: min(600px, 80vw);
    margin-top: 48px;
}

#header-network-svg {
    width: 100%;
    height: auto;
}

.net-line {
    stroke: var(--neon-electric);
    stroke-width: 1;
    opacity: 0;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: opacity 300ms;
}

.net-line.drawn {
    opacity: 1;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 400ms ease-in-out, opacity 200ms;
}

.net-node {
    fill: var(--neon-electric);
    transform: scale(0);
    transform-origin: center;
    transform-box: fill-box;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.net-node.visible {
    transform: scale(1);
}

.net-node:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 6px var(--neon-electric));
}

.data-packet {
    fill: var(--neon-green);
    opacity: 0;
}

.data-packet.active {
    opacity: 1;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 600ms ease;
}

.scroll-hint.visible {
    opacity: 0.6;
}

.scroll-hint-text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-dark);
}

.scroll-arrow {
    animation: bobDown 2s ease-in-out infinite;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* --- Spreads --- */
.spread {
    padding: 80px 0;
    transition: filter 400ms ease, opacity 400ms ease;
}

.spread.blurred {
    filter: blur(1.5px);
    opacity: 0.7;
}

.spread.focused {
    filter: blur(0);
    opacity: 1;
}

.spread-inner {
    width: 85%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 32px;
    align-items: start;
}

.spread-inner-reversed {
    grid-template-columns: 45% 55%;
}

.spread-label {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--neon-electric);
    margin-bottom: 16px;
}

.spread-heading {
    font-size: clamp(28px, 3.5vw, 52px);
    color: var(--ink-dark);
    margin-bottom: 24px;
    line-height: 1.2;
}

.spread-text p {
    margin-bottom: 20px;
    color: var(--ink-dark);
}

.spread-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.topology-svg {
    width: 100%;
    max-width: 360px;
    height: auto;
}

/* Topology diagram styles */
.topo-line {
    stroke: var(--neon-electric);
    stroke-width: 1;
    opacity: 0.6;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 600ms ease, opacity 300ms;
}

.topo-line.drawn {
    stroke-dashoffset: 0;
    opacity: 0.6;
}

.topo-line-broken {
    stroke-dasharray: 6 4;
    opacity: 0.3;
}

.topo-line-broken.drawn {
    stroke-dashoffset: 0;
    opacity: 0.3;
}

.topo-line-bus {
    stroke-width: 2;
    opacity: 0.8;
}

.topo-line-bus.drawn {
    opacity: 0.8;
}

.topo-node {
    fill: var(--neon-electric);
    transform: scale(0);
    transform-origin: center;
    transform-box: fill-box;
    transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.topo-node.visible {
    transform: scale(1);
}

.topo-node:hover {
    transform: scale(1.3);
    filter: drop-shadow(0 0 6px var(--neon-electric));
    cursor: pointer;
}

.topo-leader {
    fill: var(--neon-green);
}

.topo-publisher {
    fill: var(--neon-green);
}

.topo-node-failed {
    fill: #FF4444;
}

.topo-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    fill: var(--ink-dark);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Code blocks */
.code-block {
    background-color: var(--code-gray);
    border-radius: 4px;
    padding: 20px 24px;
    overflow-x: auto;
    border-left: 2px solid transparent;
    transition: border-color 300ms ease;
    margin-top: 8px;
}

.spread.focused .code-block {
    border-left-color: var(--neon-electric);
}

.code-block:hover {
    border-left-width: 4px;
    border-left-color: var(--neon-electric);
}

.code-block pre {
    margin: 0;
    white-space: pre;
}

.code-block code {
    color: var(--ink-dark);
    line-height: 1.6;
}

/* Syntax highlighting */
.code-block .kw {
    color: var(--neon-electric);
}

.code-block .str {
    color: var(--neon-green);
}

.code-block .fn {
    color: var(--ink-dark);
    font-weight: 500;
}

.code-block .num {
    color: var(--botanical-sage);
}

/* --- Botanical Sections --- */
.botanical-section {
    background-color: #F4F7F4;
    padding: 100px 0;
    position: relative;
    overflow: hidden;
    transition: filter 400ms ease, opacity 400ms ease;
}

.botanical-section.blurred {
    filter: blur(1.5px);
    opacity: 0.7;
}

.botanical-section.focused {
    filter: blur(0);
    opacity: 1;
}

.botanical-inner {
    width: 85%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.botanical-heading {
    font-size: clamp(28px, 3.5vw, 48px);
    color: var(--botanical-sage);
    margin-bottom: 24px;
}

.botanical-text {
    max-width: 700px;
    margin: 0 auto 48px;
    color: var(--ink-dark);
    line-height: 1.8;
}

.rhizome-svg,
.mycelium-svg {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.rhizome-path,
.mycelium-path {
    stroke: var(--botanical-sage);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1200ms ease;
}

.rhizome-path.drawn,
.mycelium-path.drawn {
    stroke-dashoffset: 0;
}

.rhizome-node,
.mycelium-node {
    fill: var(--botanical-sage);
    opacity: 0;
    transition: opacity 400ms ease;
}

.rhizome-node.visible,
.mycelium-node.visible {
    opacity: 1;
}

.mycelium-tree {
    fill: var(--botanical-sage);
    opacity: 0;
    transition: opacity 600ms ease;
}

.mycelium-tree.visible {
    opacity: 0.8;
}

.botanical-label {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    fill: var(--botanical-sage);
    opacity: 0.6;
}

/* Hover effects on botanical SVGs */
.botanical-section svg:hover .rhizome-node,
.botanical-section svg:hover .mycelium-node,
.botanical-section svg:hover .mycelium-tree {
    filter: drop-shadow(0 0 4px var(--botanical-sage));
}

/* --- Spread column hover effects --- */
.spread-text:hover ~ .spread-visual {
    filter: blur(0.5px);
    transition: filter 300ms ease;
}

.spread-visual:hover ~ .spread-text {
    filter: blur(0.5px);
    transition: filter 300ms ease;
}

.spread-text,
.spread-visual {
    transition: filter 300ms ease;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--ink-dark);
    padding: 60px 20px;
}

.footer-inner {
    width: 85%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-domain {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--clean-white);
}

.footer-tagline {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--neon-electric);
}

.footer-network svg {
    width: 120px;
    height: 40px;
    margin-top: 12px;
}

.footer-node {
    fill: var(--neon-electric);
    opacity: 0.6;
}

.footer-line {
    stroke: var(--neon-electric);
    stroke-width: 1;
    opacity: 0.3;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .spread-inner,
    .spread-inner-reversed {
        grid-template-columns: 1fr;
    }

    .spread-inner-reversed .spread-visual {
        order: -1;
    }

    .spread-visual {
        max-height: 300px;
    }

    .spread {
        padding: 60px 0;
    }

    .botanical-section {
        padding: 60px 0;
    }

    .manifesto-content {
        padding: 20px 0;
    }

    .network-diagram {
        margin-top: 32px;
    }
}

@media (max-width: 480px) {
    .spread-inner,
    .spread-inner-reversed {
        width: 92%;
    }

    .botanical-inner {
        width: 92%;
    }

    .code-block {
        padding: 16px;
    }

    .code-block code {
        font-size: 12px;
    }
}
