/* ================================================
   voting.wiki — Y2K Pastoral Futurism
   ================================================ */

:root {
    /* Creamy Pastel Palette */
    --parchment-ground: #FFF8F0;
    --meadow-mist: #B8C9A3;
    --honey-bisque: #E8C9A0;
    --ballot-ink: #3D2B1F;
    --rose-quartz: #D4A0A0;
    --pastoral-blue: #A0B4D4;
    --cream-frost: #FAF3EB;
    --dusk-lavender: #B8A0C8;
    --foliage-light: #D4DFC4;
    --milestone-border: #D4A878;
    --cool-parchment: #F5F0EB;
    --axis-top: #F5E6D0;
    --axis-bottom: #D4B896;

    /* Animation */
    --bounce-ease: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Typography scale */
    --heading-size: clamp(2.5rem, 5vw, 4.5rem);
    --body-size: clamp(1rem, 1.8vw, 1.25rem);
    --label-size: 0.8rem;
}

/* ================================================
   Base
   ================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: var(--body-size);
    line-height: 1.7;
    color: var(--ballot-ink);
    background-color: var(--parchment-ground);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ================================================
   Scroll Progress Indicator
   ================================================ */

.scroll-progress {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 120px;
    background: rgba(232, 201, 160, 0.3);
    border-radius: 2px;
    z-index: 100;
}

.scroll-progress-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, var(--honey-bisque), var(--milestone-border));
    border-radius: 2px;
    transition: height 0.15s ease-out;
}

/* ================================================
   Hero Section
   ================================================ */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
    background-color: var(--parchment-ground);
}

.hero-landscape {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1200ms ease-out;
    z-index: 1;
}

.hero-landscape.visible {
    opacity: 0.35;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: 20vh;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: 0.02em;
    color: var(--ballot-ink);
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 600ms var(--bounce-ease), transform 600ms var(--bounce-ease);
}

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

.hero-subtitle {
    font-family: 'Lora', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--ballot-ink);
    opacity: 0;
    margin-top: 1rem;
    transition: opacity 800ms ease-out;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.hero-subtitle.visible {
    opacity: 0.7;
}

/* Ballot Box */
.ballot-box-container {
    position: absolute;
    top: 60vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 80px;
    height: 90px;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.ballot-box-container.visible {
    opacity: 1;
}

.ballot-box-svg {
    width: 100%;
    height: 100%;
}

/* ================================================
   Timeline Section
   ================================================ */

.timeline-section {
    position: relative;
    padding: 80px 0 0;
    min-height: 100vh;
}

/* Central Timeline Axis */
.timeline-axis {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#timelinePath {
    stroke-dasharray: 0;
    stroke-dashoffset: 0;
}

/* Sine Wave Dividers */
.sine-divider {
    width: 100%;
    height: 40px;
    margin: 40px 0;
    position: relative;
    z-index: 2;
}

.sine-divider svg {
    width: 100%;
    height: 100%;
}

/* ================================================
   Timeline Nodes
   ================================================ */

.timeline-node {
    position: relative;
    z-index: 3;
    margin: 60px 0;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: none;
}

/* Node sizing hierarchy */
.epoch-node .node-panel {
    width: 55vw;
    max-width: 680px;
}

.event-node .node-panel {
    width: 40vw;
    max-width: 520px;
}

.detail-node .node-panel {
    width: 30vw;
    max-width: 400px;
}

/* Left nodes */
.node-left {
    justify-content: flex-start;
    padding-left: calc(50% - 55vw / 2 - 60px);
    transform: translateX(-40px) scale(0.88);
}

/* Right nodes */
.node-right {
    justify-content: flex-end;
    padding-right: calc(50% - 55vw / 2 - 60px);
    flex-direction: row-reverse;
    transform: translateX(40px) scale(0.88);
}

.node-right .event-node .node-panel,
.event-node.node-right {
    padding-right: calc(50% - 40vw / 2 - 60px);
}

/* Animate in */
.timeline-node.animate-in {
    opacity: 1;
    transform: translateX(0) scale(1);
    transition: opacity 550ms var(--bounce-ease), transform 550ms var(--bounce-ease);
}

/* ================================================
   Node Panels (Y2K Frosted Glass)
   ================================================ */

.node-panel {
    position: relative;
    padding: 2.5rem 2rem;
    border-radius: 20px;
    border: 1px solid rgba(212, 184, 150, 0.4);
    background: rgba(255, 248, 240, 0.72);
    box-shadow: 0 8px 32px rgba(61, 43, 31, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

@supports (backdrop-filter: blur(1px)) {
    .node-panel {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
}

@supports not (backdrop-filter: blur(1px)) {
    .node-panel {
        background: var(--cream-frost);
    }
}

/* ================================================
   Node Content
   ================================================ */

.node-date {
    display: inline-block;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: var(--label-size);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pastoral-blue);
    margin-bottom: 0.75rem;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.node-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: var(--heading-size);
    letter-spacing: 0.02em;
    color: var(--ballot-ink);
    margin-bottom: 1rem;
    line-height: 1.15;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.event-node .node-heading,
.detail-node .node-heading {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.node-body {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: var(--body-size);
    line-height: 1.7;
    color: var(--ballot-ink);
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.node-icon {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

/* Content stagger animation */
.timeline-node.animate-in .node-date {
    opacity: 1;
    transition-delay: 150ms;
}

.timeline-node.animate-in .node-heading {
    opacity: 1;
    transition-delay: 300ms;
}

.timeline-node.animate-in .node-body {
    opacity: 1;
    transition-delay: 450ms;
}

.timeline-node.animate-in .node-icon {
    opacity: 0.6;
    transition-delay: 600ms;
}

/* ================================================
   Node Connectors
   ================================================ */

.node-connector-container {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100px;
    height: 60px;
    z-index: 2;
}

.node-left .node-connector-container {
    right: -50px;
}

.node-right .node-connector-container {
    left: -50px;
}

.node-connector {
    width: 100%;
    height: 100%;
}

.connector-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 500ms ease-out;
}

.timeline-node.animate-in .connector-path {
    stroke-dashoffset: 0;
}

/* ================================================
   Scrollwork Ornaments
   ================================================ */

.scrollwork-ornament {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 5;
}

.scrollwork-ornament.top-left {
    top: -8px;
    left: -8px;
}

.scrollwork-ornament.top-right {
    top: -8px;
    right: -8px;
}

.ornament-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 800ms ease-out;
}

.timeline-node.animate-in .ornament-path {
    stroke-dashoffset: 0;
    transition-delay: 750ms;
}

/* ================================================
   Milestone Markers
   ================================================ */

.milestone-marker {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 20px auto;
    z-index: 5;
    background: var(--honey-bisque);
    border: 2px solid var(--milestone-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: scale(0);
    transition: transform 350ms var(--bounce-ease);
}

.milestone-marker.pop-in {
    transform: scale(1);
}

.milestone-marker svg {
    width: 32px;
    height: 32px;
}

/* Tooltip on hover */
.milestone-marker::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ballot-ink);
    background: rgba(255, 248, 240, 0.9);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(212, 184, 150, 0.3);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease-out, transform 250ms var(--bounce-ease);
}

.milestone-marker:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.milestone-marker:hover {
    transform: scale(1.15);
    transition: transform 200ms var(--bounce-ease);
}

/* ================================================
   Final Node (center, opens into landscape)
   ================================================ */

.node-center {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    transform: scale(0.88);
}

.node-center .node-panel {
    margin: 0 auto;
    text-align: center;
}

.final-panel {
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding-bottom: 4rem;
}

.final-landscape {
    position: relative;
    width: 100%;
    height: 400px;
    margin-top: -40px;
    z-index: 2;
    overflow: hidden;
}

.final-landscape-svg {
    width: 100%;
    height: 100%;
}

/* ================================================
   Background Color Shifts (scroll-driven)
   ================================================ */

body.section-warm {
    background-color: var(--parchment-ground);
}

body.section-neutral {
    background-color: var(--cream-frost);
    transition: background-color 1.5s ease;
}

body.section-cool {
    background-color: var(--cool-parchment);
    transition: background-color 1.5s ease;
}

/* ================================================
   Responsive: Mobile (< 768px)
   ================================================ */

@media (max-width: 768px) {
    .timeline-axis {
        left: 10vw;
        transform: none;
    }

    .timeline-node {
        margin: 40px 0;
    }

    .node-left,
    .node-right {
        justify-content: flex-end;
        padding-left: calc(10vw + 40px);
        padding-right: 1rem;
        flex-direction: row;
    }

    .node-left {
        transform: translateX(40px) scale(0.88);
    }

    .node-left .node-connector-container {
        right: auto;
        left: -50px;
    }

    .epoch-node .node-panel,
    .event-node .node-panel,
    .detail-node .node-panel {
        width: calc(100vw - 10vw - 80px);
        max-width: none;
    }

    .hero-content {
        padding-top: 15vh;
    }

    .hero-title {
        font-size: clamp(2.2rem, 10vw, 3.5rem);
    }

    .node-heading {
        font-size: clamp(1.8rem, 5vw, 2.5rem);
    }

    .event-node .node-heading,
    .detail-node .node-heading {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }

    .node-panel {
        padding: 1.5rem 1.25rem;
    }

    .scroll-progress {
        right: 8px;
    }

    .milestone-marker::after {
        left: calc(100% + 8px);
    }

    .node-center {
        padding-left: calc(10vw + 40px);
        justify-content: flex-end;
    }
}

/* ================================================
   Responsive: Large screens
   ================================================ */

@media (min-width: 1400px) {
    .node-left {
        padding-left: calc(50% - 340px - 80px);
    }

    .node-right {
        padding-right: calc(50% - 340px - 80px);
    }
}

/* ================================================
   Selection / Links
   ================================================ */

::selection {
    background: var(--rose-quartz);
    color: var(--parchment-ground);
}

a {
    color: var(--ballot-ink);
    text-decoration-color: var(--rose-quartz);
    text-underline-offset: 3px;
    transition: text-decoration-color 200ms ease;
}

a:hover {
    text-decoration-color: var(--dusk-lavender);
}
