/* ============================================
   voting.wiki - Surrealist Democratic Dreamscape
   ============================================ */

/* -- CSS Custom Properties -- */
:root {
    --primary-dream: #2A1F4E;
    --liquid-ballot: #7C5AA8;
    --consensus-pool: #F2E5D8;
    --dissent-shadow: #3D3D4D;
    --echo-glow: #E8C5FF;
    --void-accent: #1A1A2E;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-secondary: 'Lora', Georgia, serif;
    --font-body: 'Inter', 'Helvetica Neue', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --col-shift: 0;
    --scroll-progress: 0;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--consensus-pool);
    background-color: var(--primary-dream);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -- Gradient Drift Background -- */
#gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-dream) 0%, var(--void-accent) 100%);
    z-index: -10;
    animation: gradientDrift 12s ease-in-out infinite alternate;
}

@keyframes gradientDrift {
    0% {
        background: linear-gradient(180deg, var(--primary-dream) 0%, var(--void-accent) 100%);
    }
    50% {
        background: linear-gradient(185deg, #2A1F4E 0%, #1A1A2E 60%, #2A1F4E 100%);
    }
    100% {
        background: linear-gradient(175deg, var(--void-accent) 0%, var(--primary-dream) 100%);
    }
}

/* -- Liquid Overlays -- */
#liquid-overlays {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -5;
}

.liquid-overlay {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.liquid-overlay-1 {
    width: 60vw;
    height: 60vw;
    top: -10%;
    left: -15%;
    background: var(--liquid-ballot);
    opacity: 0.06;
    animation: liquidFloat1 20s ease-in-out infinite;
}

.liquid-overlay-2 {
    width: 45vw;
    height: 45vw;
    top: 40%;
    right: -10%;
    background: var(--echo-glow);
    opacity: 0.08;
    animation: liquidFloat2 25s ease-in-out infinite;
}

.liquid-overlay-3 {
    width: 35vw;
    height: 35vw;
    bottom: -5%;
    left: 30%;
    background: var(--liquid-ballot);
    opacity: 0.06;
    animation: liquidFloat3 18s ease-in-out infinite;
}

@keyframes liquidFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5vw, 8vh) scale(1.1); }
}
@keyframes liquidFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-4vw, -6vh) scale(1.05); }
}
@keyframes liquidFloat3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(3vw, -5vh) scale(1.08); }
}

/* -- Concentric Circles -- */
#concentric-circles {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vmin;
    height: 80vmin;
    pointer-events: none;
    z-index: -4;
    opacity: 0.15;
}

#concentric-circles svg {
    width: 100%;
    height: 100%;
}

.ripple {
    fill: none;
    stroke: var(--liquid-ballot);
    stroke-width: 0.5;
}

.ripple-1 { animation: rippleRotate 30s linear infinite; }
.ripple-2 { animation: rippleRotate 45s linear infinite reverse; }
.ripple-3 { animation: rippleRotate 60s linear infinite; }
.ripple-4 { animation: rippleRotate 40s linear infinite reverse; }
.ripple-5 { animation: rippleRotate 55s linear infinite; }

@keyframes rippleRotate {
    from { transform-origin: center; transform: rotate(0deg); }
    to { transform-origin: center; transform: rotate(360deg); }
}

/* ============================================
   HERO SECTION
   ============================================ */
#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
}

/* Morphing Ballot */
#ballot-morph {
    width: clamp(100px, 15vw, 180px);
    height: clamp(100px, 15vw, 180px);
    margin: 0 auto 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

#ballot-morph.visible {
    opacity: 1;
    transform: translateY(0);
}

#ballot-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 30px rgba(124, 90, 168, 0.3));
}

/* Hero Typography */
.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 8vw, 5rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    color: var(--consensus-pool);
    margin-bottom: 1.5rem;
}

.title-line {
    display: block;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.title-line.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-line-1 { transition-delay: 0.3s; }
.title-line-2 { transition-delay: 0.5s; }
.title-line-3 {
    transition-delay: 0.7s;
    color: var(--echo-glow);
}

.hero-subtitle {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.3rem);
    color: var(--consensus-pool);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1) 0.9s, transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.9s;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-subtitle.visible {
    opacity: 0.8;
    transform: translateY(0);
}

.hero-underline {
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--liquid-ballot), transparent);
    margin: 0 auto;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1) 1.1s;
}

.hero-underline.visible {
    width: 200px;
}

/* Melting Architecture Shapes */
.melting-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.melt-shape {
    position: absolute;
    height: 100%;
}

.melt-1 {
    left: 5%;
    width: 8%;
    opacity: 0.08;
}

.melt-2 {
    left: 35%;
    width: 10%;
    opacity: 0.06;
}

.melt-3 {
    right: 8%;
    width: 7%;
    opacity: 0.1;
}

/* ============================================
   VOTING EXPLORATION - Timeline
   ============================================ */
#voting-exploration {
    position: relative;
    padding: 10vh 2rem 15vh;
    max-width: 1000px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 8vh;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.4rem, 2.5vw, 2.4rem);
    letter-spacing: 0.08em;
    color: var(--consensus-pool);
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.section-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-desc {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.3rem);
    color: var(--consensus-pool);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

.section-desc.visible {
    opacity: 0.6;
    transform: translateY(0);
}

/* Timeline */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--liquid-ballot) 20%, var(--liquid-ballot) 80%, transparent);
    opacity: 0.3;
    transform: translateX(-50%);
}

.timeline-node {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 6vh;
    padding-left: calc(50% + 40px);
    opacity: 0;
    transform: translateY(40px) translateX(0);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-node.node-right {
    padding-left: 0;
    padding-right: calc(50% + 40px);
    flex-direction: row-reverse;
    text-align: right;
}

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

.node-marker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.node-content {
    max-width: 380px;
}

.node-label {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--liquid-ballot);
    display: block;
    margin-bottom: 0.5rem;
}

.node-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    letter-spacing: 0.05em;
    color: var(--consensus-pool);
    margin-bottom: 0.75rem;
}

.node-text {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.75;
    color: var(--consensus-pool);
    opacity: 0.7;
}

/* ============================================
   CONSENSUS CHAMBER
   ============================================ */
#consensus-chamber {
    position: relative;
    padding: 10vh 2rem 15vh;
    max-width: 1200px;
    margin: 0 auto;
}

.consensus-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 8vh;
}

.consensus-card {
    position: relative;
    background: rgba(42, 31, 78, 0.5);
    border: 1px solid rgba(124, 90, 168, 0.15);
    border-radius: 12px;
    padding: 2rem 1.8rem;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.consensus-card.snapped {
    opacity: 1;
    transform: translate(0, 0) !important;
}

.card-accent {
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--liquid-ballot), var(--echo-glow));
    border-radius: 2px;
    margin-bottom: 1.2rem;
}

.card-label {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--liquid-ballot);
    display: block;
    margin-bottom: 0.8rem;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    letter-spacing: 0.04em;
    color: var(--consensus-pool);
    margin-bottom: 0.75rem;
}

.card-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.7;
    color: var(--consensus-pool);
    opacity: 0.65;
}

.consensus-card:hover {
    border-color: rgba(124, 90, 168, 0.35);
    box-shadow: 0 0 40px rgba(124, 90, 168, 0.08);
}

.consensus-card:hover .card-title {
    letter-spacing: 0.06em;
    transition: letter-spacing 0.3s ease;
}

/* Constellation Map */
#constellation-map {
    position: relative;
    width: 100%;
    height: 300px;
    margin-top: 4vh;
}

#constellation-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   CALL TO PARTICIPATE
   ============================================ */
#participate {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 2rem;
    overflow: hidden;
}

.participate-content {
    text-align: center;
    max-width: 700px;
    position: relative;
    z-index: 2;
}

.participate-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4rem);
    letter-spacing: 0.08em;
    line-height: 1.2;
    color: var(--consensus-pool);
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.participate-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.participate-line {
    display: block;
}

.participate-accent {
    color: var(--echo-glow);
    font-style: italic;
}

.participate-text {
    font-family: var(--font-secondary);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.2rem);
    line-height: 1.8;
    color: var(--consensus-pool);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s;
    margin-bottom: 3rem;
}

.participate-text.visible {
    opacity: 0.7;
    transform: translateY(0);
}

/* Pulse Ring SVG */
.participate-pulse {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1) 0.5s;
}

.participate-pulse.visible {
    opacity: 1;
}

.pulse-ring {
    fill: none;
    stroke: var(--liquid-ballot);
    stroke-width: 0.5;
}

.pulse-ring-1 {
    animation: pulseExpand 3s ease-in-out infinite;
    opacity: 0.6;
}
.pulse-ring-2 {
    animation: pulseExpand 3s ease-in-out 0.8s infinite;
    opacity: 0.4;
}
.pulse-ring-3 {
    animation: pulseExpand 3s ease-in-out 1.6s infinite;
    opacity: 0.2;
}

.pulse-core {
    fill: var(--echo-glow);
    opacity: 0.6;
    animation: corePulse 3s ease-in-out infinite;
}

@keyframes pulseExpand {
    0%, 100% { transform-origin: center; transform: scale(1); opacity: 0.6; }
    50% { transform-origin: center; transform: scale(1.3); opacity: 0.1; }
}

@keyframes corePulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.9; }
}

/* Participate section skew on scroll */
.participate-content.skewed {
    transform: skewY(-0.5deg);
    transition: transform 0.5s ease;
}

/* ============================================
   FOOTER
   ============================================ */
#site-footer {
    padding: 4rem 2rem;
    text-align: center;
}

.footer-domain {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: lowercase;
    color: var(--liquid-ballot);
    opacity: 0.4;
}

/* ============================================
   MAGNETIC CURSOR EFFECT (applied via JS)
   ============================================ */
.magnetic-hover {
    transition: font-weight 0.3s ease, letter-spacing 0.3s ease;
}

.magnetic-hover.attracted {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .consensus-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .timeline-node {
        padding-left: 60px;
    }

    .timeline-node.node-right {
        padding-left: 60px;
        padding-right: 0;
        flex-direction: row;
        text-align: left;
    }

    .timeline-line {
        left: 20px;
    }

    .node-marker {
        left: 0;
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .consensus-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .hero-title {
        letter-spacing: 0.04em;
    }

    #concentric-circles {
        width: 120vmin;
        height: 120vmin;
    }
}
