/* ============================================================
   ncbd.dev :: not centralized, but distributed
   Brutalist + terminal :: dark-neon palette
   ============================================================ */

:root {
    --bg: #0a0a0a;
    --node-dark: #1a1a1a;
    --terminal: #0d2818;
    --green: #00ff41;
    --cyan: #00ccff;
    --red: #ff3333;
    --gray: #333333;
    --light-gray: #b0b0b0;
    --dark-gray: #333333;
}

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

::selection {
    background: #00ff41;
    color: #0a0a0a;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #00ff41;
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: #00ccff;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0a0a0a;
    color: #b0b0b0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Scanline overlay */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.015) 2px,
        rgba(0, 255, 65, 0.015) 3px
    );
    mix-blend-mode: screen;
}

/* Hash watermarks */
.hash-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.hash {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 5rem;
    color: #00ff41;
    opacity: 0.03;
    white-space: nowrap;
    letter-spacing: 0.05em;
    user-select: none;
}

.hash-a {
    top: 8%;
    left: -5%;
    transform: rotate(-7deg);
}

.hash-b {
    top: 38%;
    right: -10%;
    transform: rotate(6deg);
    font-size: 4rem;
}

.hash-c {
    top: 65%;
    left: -8%;
    transform: rotate(-5deg);
    font-size: 4.5rem;
}

.hash-d {
    bottom: 4%;
    right: -6%;
    transform: rotate(8deg);
    font-size: 3.5rem;
}

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #333333;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(2px);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #b0b0b0;
}

.topbar-label {
    color: #00ff41;
    font-weight: 700;
}

.topbar-sep {
    color: #333333;
}

.topbar-meta {
    color: #b0b0b0;
}

.topbar-tx {
    color: #00ccff;
    font-family: 'Share Tech Mono', monospace;
    min-width: 3.5em;
    display: inline-block;
}

.topbar-nav {
    display: flex;
    gap: 1.25rem;
}

.topbar-nav a {
    color: #b0b0b0;
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    transition: color 0.15s linear;
    position: relative;
    padding: 0.25rem 0;
}

.topbar-nav a::before {
    content: '> ';
    color: #333333;
    transition: color 0.15s linear;
}

.topbar-nav a:hover {
    color: #00ff41;
}

.topbar-nav a:hover::before {
    color: #00ff41;
}

.dot {
    width: 6px;
    height: 6px;
    display: inline-block;
}

.dot-green {
    background: #00ff41;
    box-shadow: 0 0 6px #00ff41;
    animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { box-shadow: 0 0 4px #00ff41; opacity: 1; }
    50% { box-shadow: 0 0 12px #00ff41; opacity: 0.6; }
}

/* ============================================================
   Cursor blink (shared)
   ============================================================ */
.cursor {
    display: inline-block;
    color: #00ff41;
    margin-left: 0.25em;
    animation: cursorBlink 1s steps(2) infinite;
    font-size: 0.85em;
    line-height: 1;
}

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

/* ============================================================
   Hero / Node Map
   ============================================================ */
.hero {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.node-map {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
}

.connection-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.connection-svg path {
    fill: none;
    stroke: #00ff41;
    stroke-width: 1;
    opacity: 0.55;
    stroke-dasharray: 4 4;
    animation: dashFlow 4s linear infinite;
}

.connection-svg path.conn-cyan {
    stroke: #00ccff;
    opacity: 0.4;
    animation-duration: 6s;
}

.connection-svg circle {
    fill: #00ff41;
    animation: nodePulse 2.4s ease-in-out infinite;
}

.connection-svg circle.cyan {
    fill: #00ccff;
}

@keyframes dashFlow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -32; }
}

@keyframes nodePulse {
    0%, 100% {
        r: 3;
        opacity: 1;
    }
    50% {
        r: 5;
        opacity: 0.5;
    }
}

.node {
    position: absolute;
    z-index: 2;
    padding: 0.5rem 0.85rem;
    background: rgba(10, 10, 10, 0.92);
    border: 1px solid #333333;
    transition: border-color 0.2s linear, background 0.2s linear;
}

.node-main {
    top: 40%;
    left: 30%;
    border: 1px solid #00ff41;
    border-left: 3px solid #00ff41;
    padding: 1.25rem 1.75rem;
    background: rgba(13, 40, 24, 0.5);
    cursor: default;
}

.node-main .node-tag {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: #00ccff;
    letter-spacing: 0.12em;
    margin-bottom: 0.4rem;
}

.node-main h1 {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.75rem, 5.5vw, 4rem);
    font-weight: 400;
    color: #00ff41;
    line-height: 1;
    text-shadow: 0 0 12px rgba(0, 255, 65, 0.35);
    letter-spacing: 0.02em;
}

.node-main .node-sub {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #b0b0b0;
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

.node-main:hover {
    border-color: #00ccff;
}

.node-phrase {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #b0b0b0;
    border: 1px solid #333333;
    border-left: 2px solid #00ff41;
    opacity: 0;
    transform: translateY(6px);
    animation: nodeAppear 0.6s ease forwards;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 90px;
}

.node-phrase .phrase-id {
    font-size: 0.55rem;
    color: #00ccff;
    letter-spacing: 0.12em;
}

.node-phrase .phrase-text {
    color: #00ff41;
    letter-spacing: 0.04em;
}

.node-phrase-alt {
    border-left-color: #00ccff;
}

.node-phrase-alt .phrase-text {
    color: #00ccff;
}

.node-phrase:nth-of-type(1) { animation-delay: 0.3s; }
.node-phrase:nth-of-type(2) { animation-delay: 0.55s; }
.node-phrase:nth-of-type(3) { animation-delay: 0.8s; }
.node-phrase:nth-of-type(4) { animation-delay: 1.05s; }
.node-phrase:nth-of-type(5) { animation-delay: 1.3s; }
.node-phrase:nth-of-type(6) { animation-delay: 1.55s; }
.node-phrase:nth-of-type(7) { animation-delay: 1.8s; }

@keyframes nodeAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-readout {
    position: absolute;
    bottom: 2rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 3;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    border-top: 1px solid #333333;
    padding-top: 0.75rem;
}

.readout-label {
    color: #b0b0b0;
}

.readout-value {
    color: #00ff41;
    font-family: 'Share Tech Mono', monospace;
    min-width: 4em;
    display: inline-block;
}

/* ============================================================
   Section header (shared)
   ============================================================ */
.section-header {
    position: relative;
    padding: 3.5rem 1.5rem 1.5rem;
    border-bottom: 1px solid #333333;
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 2;
}

.section-id {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #00ccff;
    letter-spacing: 0.12em;
}

.section-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 400;
    color: #00ff41;
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-shadow: 0 0 8px rgba(0, 255, 65, 0.25);
}

.section-meta {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #b0b0b0;
    letter-spacing: 0.08em;
}

/* ============================================================
   Manifesto :: broken-grid content nodes
   ============================================================ */
.manifesto {
    position: relative;
    z-index: 2;
    padding-bottom: 4rem;
}

.content-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: auto;
    gap: 1.5rem 1rem;
    padding: 0 1.5rem 1rem;
    max-width: 1280px;
    margin: 0 auto;
}

.content-node {
    position: relative;
    background: #1a1a1a;
    border-left: 3px solid #00ff41;
    padding: 1.5rem 1.5rem 1.25rem;
    font-family: 'IBM Plex Mono', monospace;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

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

.content-node::before {
    content: '';
    position: absolute;
    top: 1.4rem;
    left: -7px;
    width: 8px;
    height: 8px;
    background: #00ff41;
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.6);
}

.node-pos-1 { grid-column: 1 / span 6; grid-row: 1; }
.node-pos-2 { grid-column: 7 / span 5; grid-row: 1; margin-top: 2.5rem; }
.node-pos-3 { grid-column: 2 / span 5; grid-row: 2; }
.node-pos-4 { grid-column: 7 / span 6; grid-row: 2; margin-top: 1.75rem; }

.content-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.node-id {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: #00ccff;
    letter-spacing: 0.12em;
}

.node-status {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
}

.status-ok { color: #00ff41; }
.status-warn { color: #ff3333; }

.content-node h3 {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.15rem;
    font-weight: 400;
    color: #00ff41;
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
    text-shadow: 0 0 6px rgba(0, 255, 65, 0.2);
}

.content-node p {
    color: #b0b0b0;
    font-size: 0.85rem;
    line-height: 1.7;
}

.content-foot {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #333333;
    display: flex;
    gap: 0.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    flex-wrap: wrap;
}

.foot-key { color: #00ccff; }
.foot-val { color: #b0b0b0; }

/* ============================================================
   Topology grid
   ============================================================ */
.topology {
    position: relative;
    z-index: 2;
    padding-bottom: 4rem;
}

.topology-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    background: #333333;
    border: 1px solid #333333;
}

.topo-cell {
    background: #0a0a0a;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    position: relative;
    cursor: pointer;
    transition: background 0.2s linear, color 0.2s linear;
}

.topo-cell .cell-coord {
    color: #333333;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
}

.topo-cell .cell-glyph {
    font-size: 0.85rem;
    color: #333333;
    align-self: center;
    line-height: 1;
}

.topo-cell.topo-active {
    background: #1a1a1a;
}

.topo-cell.topo-active .cell-coord { color: #00ccff; }
.topo-cell.topo-active .cell-glyph {
    color: #00ff41;
    animation: cellPulse 2.2s ease-in-out infinite;
    text-shadow: 0 0 6px rgba(0, 255, 65, 0.7);
}

.topo-cell.topo-trace {
    background: #0d2818;
}

.topo-cell.topo-trace .cell-glyph {
    color: #00ff41;
    text-shadow: 0 0 8px #00ff41;
}

.topo-cell.topo-trace .cell-coord {
    color: #00ff41;
}

.topo-cell:hover {
    background: #0d2818;
}

.topo-cell:hover .cell-coord {
    color: #00ff41;
}

.topo-cell:hover .cell-glyph {
    color: #00ccff;
}

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

.topology-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding: 0 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #b0b0b0;
    letter-spacing: 0.08em;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-swatch {
    width: 12px;
    height: 12px;
    display: inline-block;
}

.swatch-active { background: #00ff41; box-shadow: 0 0 6px #00ff41; }
.swatch-idle { background: #333333; }
.swatch-trace { background: #0d2818; border: 1px solid #00ff41; }

/* ============================================================
   Protocol blocks
   ============================================================ */
.protocol {
    position: relative;
    z-index: 2;
    padding-bottom: 4rem;
}

.protocol-blocks {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.25rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.proto-block {
    background: #1a1a1a;
    border-left: 3px solid #00ff41;
    padding: 1.25rem 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    position: relative;
}

.proto-block::before {
    content: '';
    position: absolute;
    top: 1.25rem;
    left: -7px;
    width: 8px;
    height: 8px;
    background: #00ff41;
}

.proto-pos-1 { grid-column: 1 / span 6; }
.proto-pos-2 { grid-column: 7 / span 6; margin-top: 1.5rem; }
.proto-pos-3 { grid-column: 2 / span 6; }
.proto-pos-4 { grid-column: 8 / span 5; margin-top: 1rem; }

.proto-label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #00ccff;
    letter-spacing: 0.12em;
    margin-bottom: 0.75rem;
}

.proto-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #b0b0b0;
    white-space: pre-wrap;
    word-break: break-word;
}

.hl-green { color: #00ff41; }
.hl-cyan { color: #00ccff; }
.hl-red { color: #ff3333; }

/* ============================================================
   Packets stream
   ============================================================ */
.packets {
    position: relative;
    z-index: 2;
    padding-bottom: 4rem;
}

.packet-stream {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    background: #0a0a0a;
    border-top: 1px solid #00ff41;
    border-bottom: 1px solid #00ff41;
    height: 280px;
    overflow: hidden;
    position: relative;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
}

.packet-stream::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, #0a0a0a 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

.packet-stream::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, #0a0a0a 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

.packet {
    display: grid;
    grid-template-columns: 90px 1fr 110px 80px 70px;
    gap: 0.75rem;
    padding: 0.15rem 0;
    color: #b0b0b0;
    border-bottom: 1px dashed transparent;
    align-items: baseline;
    white-space: nowrap;
    overflow: hidden;
}

.packet.fresh {
    color: #00ff41;
    text-shadow: 0 0 4px rgba(0, 255, 65, 0.4);
}

.packet .pkt-time { color: #00ccff; }
.packet .pkt-route { color: #b0b0b0; overflow: hidden; text-overflow: ellipsis; }
.packet .pkt-route .arrow { color: #00ff41; margin: 0 0.25rem; }
.packet .pkt-hash { color: #b0b0b0; }
.packet .pkt-size { color: #b0b0b0; }
.packet .pkt-status { color: #00ff41; }
.packet.err .pkt-status { color: #ff3333; }
.packet.err .pkt-route .arrow { color: #ff3333; }

/* ============================================================
   Footer
   ============================================================ */
.footer {
    position: relative;
    z-index: 2;
    padding: 2.5rem 1.5rem 2rem;
    border-top: 1px solid #00ff41;
    background: #0a0a0a;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto 2rem;
    padding: 0 0.5rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-left: 2px solid #00ff41;
    padding-left: 1rem;
}

.foot-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #00ccff;
    letter-spacing: 0.12em;
    margin-bottom: 0.35rem;
}

.foot-line {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    color: #b0b0b0;
    letter-spacing: 0.04em;
}

.foot-line .hl-green { color: #00ff41; }
.foot-hash {
    color: #b0b0b0;
    word-break: break-all;
}

.footer-text {
    text-align: center;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: #00ff41;
    letter-spacing: 0.08em;
    margin-top: 0.5rem;
    text-shadow: 0 0 6px rgba(0, 255, 65, 0.3);
}

.footer-mantra {
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: #b0b0b0;
    letter-spacing: 0.12em;
    margin-top: 0.5rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
    .topbar-nav { display: none; }
    .protocol-blocks .proto-pos-1,
    .protocol-blocks .proto-pos-2,
    .protocol-blocks .proto-pos-3,
    .protocol-blocks .proto-pos-4 {
        grid-column: 1 / -1;
        margin-top: 0;
    }
    .content-grid .node-pos-1,
    .content-grid .node-pos-2,
    .content-grid .node-pos-3,
    .content-grid .node-pos-4 {
        grid-column: 1 / -1;
        margin-top: 0;
    }
    .topology-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    .topo-cell .cell-coord { font-size: 0.5rem; }
    .topo-cell .cell-glyph { font-size: 0.7rem; }
}

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .node-main {
        left: 50%;
        top: 38%;
        transform: translateX(-50%);
        text-align: left;
    }
    .node-phrase { font-size: 0.6rem; min-width: 70px; padding: 0.35rem 0.55rem; }
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .packet {
        grid-template-columns: 60px 1fr 60px;
        font-size: 0.7rem;
    }
    .packet .pkt-hash,
    .packet .pkt-size {
        display: none;
    }
    .hash { font-size: 2.5rem; }
    .packet-stream { height: 220px; }
}
