/* concurrent.day - Styles */

/* ===== CSS Custom Properties ===== */
:root {
    --deep-void: #0b0e17;
    --stream-alpha: #4ecdc4;
    --stream-beta: #ff6b6b;
    --stream-gamma: #ffe66d;
    --convergence-white: #f0f0f5;
    --grid-line: #3a3a4a;
    --timestamp-color: #6b7a8d;
    --hover-glow: #7b68ee;
    --blend-ab: #c89c97;
    --blend-bc: #c8b86c;
    --muted-note: #8899aa;

    --col-a-width: 33.33%;
    --col-b-width: 33.33%;
    --col-c-width: 33.34%;
}

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

html {
    overflow: hidden;
    height: 100%;
}

body {
    background: var(--deep-void);
    color: var(--convergence-white);
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 400;
    line-height: 1.65;
    overflow: hidden;
    height: 100%;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="2" height="24"><rect width="2" height="24" fill="%236b7a8d"/></svg>') 1 12, default;
}

/* ===== Grain Overlay ===== */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    pointer-events: none;
    opacity: 0.02;
    background-image: url('data:image/svg+xml;utf8,<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-repeat: repeat;
    background-size: 256px 256px;
    animation: grain-shift 0.25s steps(1) infinite;
}

@keyframes grain-shift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-10px, 10px); }
    50% { transform: translate(10px, -10px); }
    75% { transform: translate(-5px, -15px); }
    100% { transform: translate(15px, 5px); }
}

/* ===== Opening Screen ===== */
#opening-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: var(--deep-void);
    transition: opacity 0.8s ease;
}

#opening-screen.fading {
    opacity: 0;
    pointer-events: none;
}

#opening-screen.hidden {
    display: none;
}

#opening-now {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(4rem, 15vw, 12rem);
    font-variation-settings: 'wdth' 100;
    letter-spacing: 0.02em;
    color: var(--convergence-white);
    animation: now-breathe 3s ease-in-out infinite;
}

@keyframes now-breathe {
    0%, 100% { font-variation-settings: 'wdth' 50; }
    50% { font-variation-settings: 'wdth' 150; }
}

/* ===== Stream Dividers (SVG) ===== */
.stream-dividers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.stream-dividers.visible {
    opacity: 1;
}

.divider-path {
    fill: none;
    stroke: var(--grid-line);
    stroke-width: 1;
    transition: stroke 0.3s ease;
}

/* ===== Stream Container ===== */
#stream-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: var(--col-a-width) var(--col-b-width) var(--col-c-width);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.8s ease;
    mix-blend-mode: normal;
}

#stream-container.visible {
    opacity: 1;
}

/* ===== Streams ===== */
.stream {
    position: relative;
    overflow: hidden;
    height: 100%;
}

.stream-inner {
    will-change: transform;
    padding: 2rem 1.5rem;
}

#stream-alpha {
    border-right: none;
}

#stream-alpha .stream-text {
    font-weight: 400;
    color: rgba(78, 205, 196, 0.9);
}

#stream-alpha .timestamp {
    color: var(--stream-alpha);
}

#stream-beta {
    border-left: none;
    border-right: none;
}

#stream-beta .stream-text {
    font-weight: 500;
    color: rgba(255, 107, 107, 0.9);
}

#stream-beta .timestamp {
    color: var(--stream-beta);
}

#stream-gamma {
    border-left: none;
}

#stream-gamma .stream-text {
    font-weight: 300;
    color: rgba(255, 230, 109, 0.9);
}

#stream-gamma .timestamp {
    color: var(--stream-gamma);
}

/* ===== Stream Events ===== */
.stream-event {
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stream-event.visible {
    opacity: 1;
    transform: translateY(0);
}

.timestamp {
    font-family: 'Azeret Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--timestamp-color);
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.timestamp.pulse {
    animation: timestamp-pulse 0.3s ease forwards;
}

@keyframes timestamp-pulse {
    0% { opacity: 0.5; }
    100% { opacity: 1.0; }
}

.stream-text {
    font-family: 'Instrument Sans', sans-serif;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    line-height: 1.65;
}

.margin-note {
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.7rem;
    font-weight: 300;
    font-style: italic;
    color: var(--muted-note);
    margin: 2rem 0;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(136, 153, 170, 0.2);
}

/* ===== Breathing Column Animations ===== */
@keyframes breathe-a {
    0%, 100% { --col-a-basis: 28%; }
    50% { --col-a-basis: 38%; }
}

@keyframes breathe-b {
    0%, 100% { --col-b-basis: 25%; }
    50% { --col-b-basis: 35%; }
}

@keyframes breathe-c {
    0%, 100% { --col-c-basis: 27%; }
    50% { --col-c-basis: 37%; }
}

/* ===== Convergence Zones ===== */
.convergence-zone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 30;
    background: var(--deep-void);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, background-color 0.4s ease;
}

.convergence-zone.active {
    opacity: 1;
    background: var(--convergence-white);
    pointer-events: auto;
}

.convergence-statement {
    font-family: 'Anybody', sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    color: var(--deep-void);
    text-align: center;
    max-width: 80vw;
    font-variation-settings: 'wdth' 50;
    transition: font-variation-settings 3s ease;
    line-height: 1.2;
}

.convergence-zone.active .convergence-statement {
    font-variation-settings: 'wdth' 150;
}

.convergence-pulse {
    width: 0;
    height: 1px;
    background: var(--deep-void);
    margin-bottom: 2rem;
    transition: width 0.5s ease, opacity 0.4s ease 0.5s;
}

.convergence-pulse-bottom {
    margin-bottom: 0;
    margin-top: 2rem;
}

.convergence-zone.active .convergence-pulse {
    width: 100vw;
    opacity: 0.3;
}

.convergence-diamond {
    font-size: 0.6rem;
    color: var(--hover-glow);
    margin-bottom: 1.5rem;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.convergence-zone.active .convergence-diamond {
    opacity: 1;
}

/* ===== Alignment Glow ===== */
.alignment-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(123, 104, 238, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.alignment-glow.flash {
    opacity: 1;
}

/* ===== Timeline Bar ===== */
#timeline-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(11, 14, 23, 0.6);
    display: flex;
    align-items: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#timeline-bar.visible {
    opacity: 1;
}

#timeline-track {
    display: flex;
    width: 100%;
    height: 4px;
    position: relative;
}

.timeline-segment {
    height: 100%;
    transition: width 0.3s ease;
}

#segment-alpha {
    background: var(--stream-alpha);
    width: 33.33%;
}

#segment-beta {
    background: var(--stream-beta);
    width: 33.33%;
}

#segment-gamma {
    background: var(--stream-gamma);
    width: 33.34%;
}

.timeline-diamond {
    position: absolute;
    bottom: 12px;
    width: 8px;
    height: 8px;
    background: var(--hover-glow);
    transform: rotate(45deg) translateX(-50%);
    z-index: 101;
}

.timeline-diamond.passed {
    background: var(--convergence-white);
    opacity: 0.5;
}

/* ===== Scroll Spacer ===== */
#scroll-spacer {
    position: relative;
    height: 600vh;
    z-index: -1;
}

/* ===== Connector Lines (timestamp sync visualization) ===== */
.connector-line {
    position: fixed;
    height: 1px;
    background: rgba(123, 104, 238, 0.15);
    z-index: 8;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #stream-container {
        grid-template-columns: 1fr 1fr;
    }

    #stream-gamma {
        display: none;
    }

    .stream-inner {
        padding: 1.5rem 1rem;
    }

    .convergence-statement {
        font-size: clamp(1.5rem, 5vw, 3rem);
    }
}

@media (max-width: 480px) {
    #stream-container {
        grid-template-columns: 1fr;
    }

    #stream-beta,
    #stream-gamma {
        display: none;
    }
}
