/* ============================================
   causality.club — Styles
   Botanical-meets-neon debate observatory
   ============================================ */

/* CSS Custom Properties */
:root {
    --bg-primary: #0d0a1a;
    --bg-sidebar: #110e24;
    --accent-magenta: #ff2af3;
    --accent-chartreuse: #c8ff00;
    --accent-cyan: #00e5ff;
    --text-primary: #e8e4f0;
    --text-muted: #9b94b0;
    --card-surface: #1a1630;
    --bubble-amber: #ffb830;
    --collision-coral: #ff4466;
    --text-dark: #1a1625;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.75;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================
   Bubble Canvas (background)
   ============================================ */
#bubble-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* ============================================
   Collision Canvas (foreground particles)
   ============================================ */
#collision-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* ============================================
   Sidebar
   ============================================ */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-sidebar);
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 42, 243, 0.1);
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 42, 243, 0.08);
}

.sidebar-logo {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.5rem;
    letter-spacing: 0.08em;
    color: var(--text-primary);
    text-transform: uppercase;
}

.logo-dot {
    color: var(--accent-magenta);
}

#vine-svg {
    flex: 1;
    width: 100%;
    padding: 1rem 0;
}

/* Vine stem animation */
#vine-stem {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawVine 2s ease-out forwards;
    animation-delay: 0.2s;
}

@keyframes drawVine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Vine leaves */
.vine-leaf {
    opacity: 0;
    animation: leafBloom 0.6s ease-out forwards;
}

.vine-leaf:nth-child(3) { animation-delay: 0.8s; }
.vine-leaf:nth-child(4) { animation-delay: 1.2s; }
.vine-leaf:nth-child(5) { animation-delay: 1.6s; }
.vine-leaf:nth-child(6) { animation-delay: 2.0s; }
.vine-leaf:nth-child(7) { animation-delay: 2.4s; }

@keyframes leafBloom {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Vine nodes */
.vine-node circle:first-child {
    transition: fill 0.4s ease, r 0.3s ease;
}

.vine-node.active circle:first-child {
    fill: var(--accent-magenta);
    animation: nodePulse 2s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% {
        filter: url(#nodeGlow);
        opacity: 1;
    }
    50% {
        filter: url(#nodeGlow);
        opacity: 0.6;
    }
}

.node-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    fill: var(--text-muted);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.vine-node:hover .node-label,
.vine-node.active .node-label {
    opacity: 1;
}

/* Vine nodes initial state — appear after vine draws */
.vine-node {
    opacity: 0;
    animation: nodeAppear 0.5s ease-out forwards;
    cursor: pointer;
}

.vine-node[data-section="0"] { animation-delay: 0.6s; }
.vine-node[data-section="1"] { animation-delay: 1.0s; }
.vine-node[data-section="2"] { animation-delay: 1.4s; }
.vine-node[data-section="3"] { animation-delay: 1.8s; }
.vine-node[data-section="4"] { animation-delay: 2.2s; }

@keyframes nodeAppear {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   Main Content Area
   ============================================ */
#main-content {
    margin-left: 280px;
    padding: clamp(2rem, 6vw, 8rem);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============================================
   Debate Blocks
   ============================================ */
.debate-block {
    min-height: 60vh;
    padding: 4rem 0;
    position: relative;
}

/* ============================================
   Kinetic Headings
   ============================================ */
.kinetic-heading {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 7rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.05;
    margin-bottom: 2.5rem;
    background: linear-gradient(90deg, var(--accent-magenta), var(--accent-chartreuse));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    overflow: hidden;
}

/* Character animation states */
.kinetic-heading .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) rotate(-5deg);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.kinetic-heading .char.space {
    width: 0.3em;
}

.kinetic-heading.animated .char {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

/* ============================================
   Argument Cards (Tilt-3D)
   ============================================ */
.argument-card {
    background: var(--card-surface);
    border: 1px solid rgba(255, 42, 243, 0.12);
    border-radius: 12px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    transition: box-shadow 0.3s ease;
    will-change: transform;
    margin-bottom: 2rem;
}

.argument-card:hover {
    box-shadow: 0 8px 40px rgba(255, 42, 243, 0.15);
}

.card-spotlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 42, 243, 0.05), transparent 60%);
    pointer-events: none;
    transition: background 0.1s ease;
}

.card-leaf {
    position: absolute;
    width: 60px;
    height: 60px;
    opacity: 0.4;
    pointer-events: none;
}

.card-leaf-tl {
    top: -5px;
    left: -5px;
}

.card-leaf-br {
    bottom: -5px;
    right: -5px;
    transform: rotate(180deg);
}

.card-body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-primary);
    position: relative;
    z-index: 2;
}

/* ============================================
   Evidence Cards
   ============================================ */
.evidence-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.evidence-card {
    background: rgba(26, 22, 48, 0.7);
    border: 1px solid rgba(155, 148, 176, 0.15);
    border-radius: 8px;
    padding: 1.5rem;
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
    will-change: transform;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 0.3s ease;
}

.evidence-card.visible {
    opacity: 1;
    transform: translateY(0) perspective(1000px) rotateX(0deg) rotateY(0deg);
}

.evidence-card:hover {
    box-shadow: 0 4px 24px rgba(0, 229, 255, 0.1);
}

.evidence-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--accent-cyan);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 0.75rem;
    padding: 0.2em 0.5em;
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 3px;
}

.evidence-card p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-muted);
}

/* ============================================
   Collision Zones
   ============================================ */
.collision-zone {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 2rem 0;
}

.collision-label {
    text-align: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.collision-zone.triggered .collision-label {
    opacity: 1;
    transform: scale(1);
}

.collision-vs {
    display: block;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.2em;
    color: var(--collision-coral);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.collision-text {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ============================================
   Closing Ambient Section
   ============================================ */
.closing-ambient {
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
}

.closing-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.closing-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Loading / Opening Darkness
   ============================================ */
body {
    opacity: 0;
    animation: bodyFadeIn 0.3s ease-out forwards;
    animation-delay: 0.2s;
}

@keyframes bodyFadeIn {
    to {
        opacity: 1;
    }
}

/* ============================================
   Responsive: Collapse sidebar on small screens
   ============================================ */
@media (max-width: 768px) {
    #sidebar {
        width: 60px;
    }

    .sidebar-header {
        padding: 1rem 0.5rem;
        text-align: center;
    }

    .sidebar-logo {
        font-size: 0;
    }

    .logo-dot {
        font-size: 1.2rem;
    }

    .node-label {
        display: none;
    }

    #main-content {
        margin-left: 60px;
        padding: clamp(1rem, 4vw, 3rem);
    }

    .kinetic-heading {
        font-size: clamp(2rem, 6vw, 4rem);
    }

    .evidence-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Scrollbar styling
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 42, 243, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 42, 243, 0.5);
}
