/* ============================================================
   nlbd.dev -- No Leader, But Distributed
   Anti-design + Bauhaus. Radical equality. No hierarchy.
   ============================================================ */

:root {
    --consensus-dark: #1a1a1a;   /* primary background */
    --grid-line:      #3d3d3d;   /* borders, structural */
    --node-light:     #f0f0f0;   /* text, light elements */
    --signal-yellow:  #ffcc00;   /* the one accent */
    --peer-gray:      #666666;   /* secondary text */
    --block-dark:     #2a2a2a;   /* cell backgrounds */
    --consensus-white:#ffffff;   /* emphasis text */
    --glow-yellow:    rgba(255, 204, 0, 0.15);

    --cell-size: 300px;
    --cell-pad: 20px;
    --grid-gap: 1px;
}

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

::selection {
    background: var(--signal-yellow);
    color: var(--consensus-dark);
}
::-moz-selection {
    background: var(--signal-yellow);
    color: var(--consensus-dark);
}

html, body {
    background: var(--consensus-dark);
    color: var(--node-light);
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    font-weight: 400;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
    position: relative;
}

/* Thin yellow scrollbar on dark */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--signal-yellow) var(--consensus-dark);
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    background: var(--consensus-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--signal-yellow);
    border-radius: 0;
}
::-webkit-scrollbar-track {
    background: var(--consensus-dark);
}

/* ------------------------------------------------------------
   Wire mesh background. 1px lines every 40px, #3d3d3d at 20%.
   Edge-to-edge, fixed, behind everything.
   ------------------------------------------------------------ */
.wire-mesh {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(to right, rgba(61, 61, 61, 0.20) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(61, 61, 61, 0.20) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: 0 0, 0 0;
}

/* ------------------------------------------------------------
   Consensus grid -- non-hierarchical, equal cells.
   The 1px gap is filled by the dark background showing through.
   ------------------------------------------------------------ */
.consensus-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--cell-size), 1fr));
    gap: var(--grid-gap);
    background: var(--consensus-dark);
    padding: var(--grid-gap);
    width: 100%;
    min-height: 100vh;
}

/* ------------------------------------------------------------
   Cell -- every cell is the same size, the same weight.
   ------------------------------------------------------------ */
.cell {
    position: relative;
    background: var(--block-dark);
    border: 1px solid var(--grid-line);
    aspect-ratio: 1 / 1;
    transition: background 0.3s ease;
    overflow: hidden;
}

.cell:hover {
    background: rgba(255, 204, 0, 0.05);
}

.cell-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    padding: var(--cell-pad);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.6rem;
}

/* Uniform typography. No element shouts louder than another. */
.cell-label {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--peer-gray);
    letter-spacing: 0.02em;
}

.cell-title {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--node-light);
    letter-spacing: 0.01em;
}

.cell-body {
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--node-light);
}

.cell-meta {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--peer-gray);
    margin-top: auto;
}

/* ------------------------------------------------------------
   Domain cell -- same size, same weight.
   Distinguished only by rotating border animation.
   ------------------------------------------------------------ */
.cell-domain {
    border: 1px solid var(--grid-line);
}

.cell-domain .domain-name {
    font-family: 'Work Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--consensus-white);
    letter-spacing: 0.02em;
}

.domain-border {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    border: 2px solid transparent;
    animation: borderRotate 4s linear infinite;
}

@keyframes borderRotate {
    0%   { border-top-color: var(--signal-yellow); border-right-color: transparent; border-bottom-color: transparent; border-left-color: transparent; }
    24%  { border-top-color: var(--signal-yellow); border-right-color: transparent; border-bottom-color: transparent; border-left-color: transparent; }
    25%  { border-top-color: transparent; border-right-color: var(--signal-yellow); border-bottom-color: transparent; border-left-color: transparent; }
    49%  { border-top-color: transparent; border-right-color: var(--signal-yellow); border-bottom-color: transparent; border-left-color: transparent; }
    50%  { border-top-color: transparent; border-right-color: transparent; border-bottom-color: var(--signal-yellow); border-left-color: transparent; }
    74%  { border-top-color: transparent; border-right-color: transparent; border-bottom-color: var(--signal-yellow); border-left-color: transparent; }
    75%  { border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; border-left-color: var(--signal-yellow); }
    99%  { border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; border-left-color: var(--signal-yellow); }
    100% { border-top-color: var(--signal-yellow); border-right-color: transparent; border-bottom-color: transparent; border-left-color: transparent; }
}

/* ------------------------------------------------------------
   Consensus ring -- equal segments, fill in sequence.
   4-second cycle, each segment fills over 0.5s.
   ------------------------------------------------------------ */
.consensus-ring {
    width: 96px;
    height: 96px;
    align-self: center;
    margin: 0.25rem 0;
}

.ring-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.ring-svg .ring-base {
    fill: none;
    stroke: var(--grid-line);
    stroke-width: 1.5;
}

.ring-svg .ring-seg {
    fill: none;
    stroke: var(--signal-yellow);
    stroke-width: 2;
    opacity: 0;
    transition: opacity 0.5s linear;
}

/* ------------------------------------------------------------
   Node mesh -- a small flat mesh of equal nodes inside one cell.
   ------------------------------------------------------------ */
.node-mesh {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mesh-svg {
    width: 100%;
    height: 100%;
    max-width: 220px;
    max-height: 220px;
}

.mesh-svg .mesh-edge {
    stroke: var(--grid-line);
    stroke-width: 1;
    opacity: 0.6;
}

.mesh-svg .mesh-node {
    fill: var(--signal-yellow);
}

/* ------------------------------------------------------------
   Quote / vote / data cells
   ------------------------------------------------------------ */
.quote-text {
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--node-light);
}

.vote-text {
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--node-light);
}

.vote-dots {
    display: flex;
    gap: 8px;
    margin-top: 0.25rem;
}

.vote-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--signal-yellow);
    background: transparent;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.vote-dot.filled {
    background: var(--signal-yellow);
    box-shadow: 0 0 6px var(--glow-yellow);
}

/* Pulsing dot used as navigation hint substitute */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal-yellow);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.35; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.15); }
}

/* Data list (protocol.fields, network.status) */
.data-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-family: 'Overpass Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--node-light);
}

.data-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 1px solid var(--grid-line);
    padding-bottom: 3px;
}

.data-list .data-key {
    color: var(--peer-gray);
}

.data-list .data-val {
    color: var(--node-light);
}

/* ------------------------------------------------------------
   Equal-circles motif. Small 8px yellow circles at corners
   of every cell, brightening on cell hover (peer consensus).
   ------------------------------------------------------------ */
.cell::before,
.cell::after {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--signal-yellow);
    opacity: 0.45;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    z-index: 3;
    pointer-events: none;
}

.cell::before {
    top: -4px;
    left: -4px;
}

.cell::after {
    bottom: -4px;
    right: -4px;
}

.cell:hover::before,
.cell:hover::after,
.cell.peer-active::before,
.cell.peer-active::after {
    opacity: 1;
    box-shadow: 0 0 8px var(--glow-yellow);
}

/* Domain cell circles slightly more present, but same size --
   visual weight remains equal */
.cell-domain::before,
.cell-domain::after {
    opacity: 0.7;
}

/* ------------------------------------------------------------
   Responsive. Cells stay equal at all sizes.
   ------------------------------------------------------------ */
@media (max-width: 640px) {
    :root {
        --cell-size: 220px;
        --cell-pad: 16px;
    }

    .cell-label,
    .cell-meta,
    .data-list {
        font-size: 0.78rem;
    }

    .cell-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 360px) {
    :root {
        --cell-size: 180px;
        --cell-pad: 14px;
    }
}
