/* ============================================
   nlbd.dev - No Leader, But Distributed
   Dark-academia split-screen design
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'IBM Plex Mono', monospace;
    background: #1A1818;
    color: #F5EDE0;
    overflow-x: hidden;
}

/* --- Color Variables --- */
:root {
    --terracotta: #B87858;
    --academia-dark: #1A1818;
    --cream: #F5EDE0;
    --dark-text: #2A1810;
    --tropical-blue: #3898C8;
    --tropical-orange: #E88840;
    --paper-aged: #D8C8A8;
    --consensus-gold: #C8A040;
}

/* --- Connecting Pulse Line --- */
#pulse-line {
    position: fixed;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100vh;
    background: var(--consensus-gold);
    z-index: 100;
    transform: translateX(-50%);
    animation: pulseLine 2s ease-in-out infinite, lineGrow 800ms ease-out forwards;
    pointer-events: none;
    transition: width 0.3s ease, opacity 0.3s ease;
}

#pulse-line:hover {
    width: 2px;
    opacity: 1 !important;
}

@keyframes pulseLine {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes lineGrow {
    from { height: 0; }
    to { height: 100vh; }
}

/* --- Tropical Fish --- */
#fish-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 90;
    overflow: hidden;
}

.fish {
    position: absolute;
    width: 28px;
    height: 18px;
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.fish:hover {
    animation-direction: reverse !important;
}

.fish-1 {
    animation: swimPath1 18s linear infinite;
    animation-delay: 1.2s;
    opacity: 0;
}

.fish-2 {
    animation: swimPath2 22s linear infinite;
    animation-delay: 3s;
    opacity: 0;
}

.fish-3 {
    animation: swimPath3 15s linear infinite;
    animation-delay: 5s;
    opacity: 0;
}

.fish-4 {
    animation: swimPath4 25s linear infinite;
    animation-delay: 7s;
    opacity: 0;
}

.fish-5 {
    animation: swimPath5 20s linear infinite;
    animation-delay: 2s;
    opacity: 0;
}

@keyframes swimPath1 {
    0%   { left: 20%; top: 25%; opacity: 0; transform: scaleX(1); }
    5%   { opacity: 0.8; }
    45%  { left: 55%; top: 20%; }
    55%  { left: 65%; top: 30%; }
    90%  { left: 80%; top: 22%; opacity: 0.8; }
    100% { left: 85%; top: 22%; opacity: 0; }
}

@keyframes swimPath2 {
    0%   { left: 75%; top: 45%; opacity: 0; transform: scaleX(-1); }
    5%   { opacity: 0.8; }
    40%  { left: 50%; top: 50%; }
    60%  { left: 35%; top: 40%; }
    90%  { left: 15%; top: 48%; opacity: 0.8; }
    100% { left: 10%; top: 48%; opacity: 0; }
}

@keyframes swimPath3 {
    0%   { left: 10%; top: 60%; opacity: 0; transform: scaleX(1); }
    5%   { opacity: 0.7; }
    50%  { left: 52%; top: 55%; }
    90%  { left: 88%; top: 62%; opacity: 0.7; }
    100% { left: 92%; top: 62%; opacity: 0; }
}

@keyframes swimPath4 {
    0%   { left: 85%; top: 75%; opacity: 0; transform: scaleX(-1); }
    5%   { opacity: 0.8; }
    35%  { left: 60%; top: 70%; }
    65%  { left: 40%; top: 78%; }
    90%  { left: 12%; top: 72%; opacity: 0.8; }
    100% { left: 8%; top: 72%; opacity: 0; }
}

@keyframes swimPath5 {
    0%   { left: 30%; top: 35%; opacity: 0; transform: scaleX(1); }
    5%   { opacity: 0.7; }
    30%  { left: 48%; top: 38%; }
    70%  { left: 68%; top: 32%; }
    90%  { left: 78%; top: 36%; opacity: 0.7; }
    100% { left: 82%; top: 36%; opacity: 0; }
}

/* --- Dual Origin Hero --- */
#dual-origin {
    width: 100%;
    height: 100vh;
    position: relative;
}

.split-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 100%;
}

.panel {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.panel-inner {
    text-align: center;
    z-index: 2;
}

/* Left panel - terracotta warm */
.panel-left {
    background: var(--terracotta);
    color: var(--dark-text);
}

/* Paper-aged manuscript texture via noise overlay */
.panel-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, transparent 50%, rgba(42, 24, 16, 0.25) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(42, 24, 16, 0.03) 2px,
            rgba(42, 24, 16, 0.03) 4px
        );
    pointer-events: none;
    z-index: 1;
}

/* Right panel - dark academia */
.panel-right {
    background: var(--academia-dark);
    color: var(--cream);
}

/* Vignetting on right panel */
.panel-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Domain text */
.domain-text {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(48px, 8vw, 120px);
    letter-spacing: -0.02em;
    opacity: 0;
    animation: fadeInDomain 600ms ease-out forwards;
}

.domain-left {
    color: var(--dark-text);
}

.domain-right {
    color: var(--cream);
}

.subtitle-left,
.subtitle-right {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(12px, 1.2vw, 16px);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    margin-top: 16px;
    opacity: 0;
    animation: fadeInDomain 600ms ease-out 300ms forwards;
}

.subtitle-left {
    color: var(--dark-text);
    opacity: 0;
}

.subtitle-right {
    color: var(--cream);
    opacity: 0;
}

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

/* --- Dialogue Section --- */
#dialogue {
    position: relative;
}

/* Dialogue Row (split pair) */
.dialogue-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 80vh;
}

.dialogue-panel {
    padding: 64px 16px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.dialogue-content {
    max-width: 520px;
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Left dialogue panels - warm/serif */
.dialogue-left {
    background: var(--terracotta);
    color: var(--dark-text);
}

.dialogue-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, transparent 50%, rgba(42, 24, 16, 0.2) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(42, 24, 16, 0.02) 3px,
            rgba(42, 24, 16, 0.02) 6px
        );
    pointer-events: none;
}

.dialogue-left .dialogue-content {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(15px, 1vw, 17px);
    line-height: 1.85;
}

.dialogue-left .dialogue-heading {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 36px);
    line-height: 1.3;
    margin-bottom: 28px;
    color: var(--dark-text);
}

.dialogue-left p {
    margin-bottom: 20px;
}

.dialogue-left a {
    color: var(--tropical-orange);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.dialogue-left a:hover {
    border-bottom-color: var(--tropical-orange);
}

/* Hover underline on left panel elements */
.dialogue-left .dialogue-content:hover .dialogue-heading {
    text-decoration: underline;
    text-decoration-color: var(--dark-text);
    text-underline-offset: 4px;
}

/* Right dialogue panels - dark/mono */
.dialogue-right {
    background: var(--academia-dark);
    color: var(--cream);
}

.dialogue-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
}

.dialogue-right .dialogue-content {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(14px, 0.9vw, 15px);
    line-height: 1.7;
}

.dialogue-right .dialogue-heading {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 36px);
    line-height: 1.3;
    margin-bottom: 28px;
    color: var(--cream);
}

.dialogue-right a {
    color: var(--tropical-blue);
    text-decoration: none;
    transition: text-shadow 0.2s ease;
}

.dialogue-right a:hover {
    text-shadow: 0 0 8px rgba(56, 152, 200, 0.5);
}

/* Hover glow on right panel elements */
.dialogue-right .dialogue-content:hover .dialogue-heading {
    text-shadow: 0 0 12px rgba(56, 152, 200, 0.3);
}

/* --- Terminal Code Blocks --- */
.terminal-block {
    background: #0D0D0D;
    border: 1px solid rgba(245, 237, 224, 0.12);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 8px;
}

.terminal-header {
    background: #1E1E1E;
    padding: 10px 14px;
    display: flex;
    gap: 7px;
    align-items: center;
}

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

.terminal-dot.red { background: #FF5F56; }
.terminal-dot.yellow { background: #FFBD2E; }
.terminal-dot.green { background: #27C93F; }

.terminal-code {
    padding: 20px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(12px, 0.85vw, 14px);
    line-height: 1.7;
    color: var(--cream);
    overflow-x: auto;
    white-space: pre;
}

/* Syntax highlighting */
.code-keyword { color: #C8A040; }
.code-type { color: #3898C8; }
.code-func { color: #E88840; }
.code-field { color: #F5EDE0; }
.code-comment { color: #6A6A5A; font-style: italic; }
.code-string { color: #B87858; }

/* --- Consensus Merge Rows --- */
.consensus-row {
    width: 100%;
    overflow: hidden;
}

.consensus-panel {
    background: var(--paper-aged);
    color: var(--dark-text);
    text-align: center;
    padding: 64px 32px;
    position: relative;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.consensus-panel.merged {
    transform: scaleX(1);
}

.consensus-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--consensus-gold);
}

.consensus-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--consensus-gold);
}

.consensus-text {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 44px);
    line-height: 1.5;
    max-width: 900px;
    margin: 0 auto;
    color: var(--dark-text);
}

.consensus-attribution {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(12px, 1vw, 14px);
    color: var(--consensus-gold);
    margin-top: 20px;
    letter-spacing: 0.1em;
}

/* Final consensus - larger, more prominent */
.consensus-final .consensus-panel {
    padding: 96px 32px;
    background: linear-gradient(
        180deg,
        var(--paper-aged) 0%,
        #C8B888 100%
    );
}

/* --- Footer --- */
#site-footer {
    width: 100%;
    border-top: 1px solid var(--consensus-gold);
}

.footer-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 120px;
}

.footer-left {
    background: var(--terracotta);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.footer-right {
    background: var(--academia-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
}

.footer-left .footer-domain {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(18px, 2vw, 28px);
    color: var(--dark-text);
}

.footer-right .footer-domain {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: clamp(18px, 2vw, 28px);
    color: var(--cream);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .split-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    #dual-origin {
        height: auto;
        min-height: 100vh;
    }

    .panel {
        min-height: 50vh;
    }

    .dialogue-row {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .dialogue-panel {
        padding: 48px 16px;
    }

    .dialogue-content {
        max-width: 100%;
    }

    #pulse-line {
        display: none;
    }

    .footer-split {
        grid-template-columns: 1fr;
    }

    .footer-left,
    .footer-right {
        min-height: 60px;
    }

    .fish {
        width: 20px;
        height: 13px;
    }
}
