/* ========================================
   20241204.com - Whimsical Editorial Chronicle
   A single day told in illustrated moments
   ======================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --burnt-orange: #C8572A;
    --deep-charcoal: #2B2118;
    --cream-canvas: #F5EDE3;
    --dusty-rose: #D4917A;
    --sage-whisper: #8FA68E;
    --amber-glow: #E8A54B;
    --deep-teal: #2D5F5D;
    --papyrus-tan: #C9B99A;
    --papyrus-dark: #F0E6D8;
    --shadow-warm: rgba(43, 33, 24, 0.12);
    --shadow-deeper: rgba(43, 33, 24, 0.2);
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', Arial, sans-serif;
    font-size: 18px;
    line-height: 1.65;
    color: var(--deep-charcoal);
    background-color: var(--papyrus-dark);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Paper Texture Background ---------- */
#paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(245, 237, 227, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201, 185, 154, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(245, 237, 227, 0.3) 0%, transparent 45%),
        radial-gradient(circle at 30% 30%, rgba(200, 87, 42, 0.03) 0%, transparent 30%),
        radial-gradient(circle at 70% 70%, rgba(143, 166, 142, 0.05) 0%, transparent 30%);
}

/* ---------- Scroll Container ---------- */
#scroll-container {
    position: relative;
    width: 100%;
    z-index: 1;
}

/* ---------- Scenes ---------- */
.scene {
    scroll-snap-align: start;
}

/* ---------- HERO SECTION ---------- */
.hero-scene {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, rgba(232, 165, 75, 0.1) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 70%, rgba(200, 87, 42, 0.06) 0%, transparent 50%);
    z-index: 0;
}

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

.hero-date {
    font-family: 'Baloo 2', Georgia, serif;
    font-size: clamp(60px, 12vw, 120px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--deep-charcoal);
    line-height: 1;
    position: relative;
    display: inline-block;
}

.date-dot {
    color: var(--burnt-orange);
    display: inline-block;
    margin: 0 0.05em;
}

.date-month,
.date-day,
.date-year {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-subtitle {
    font-family: 'Caveat', cursive;
    font-size: clamp(20px, 3vw, 28px);
    color: var(--burnt-orange);
    margin-top: 16px;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

/* ---------- Floating Accents ---------- */
.floating-accent {
    position: absolute;
    pointer-events: none;
    z-index: 3;
}

.teacup {
    top: 15%;
    right: 10%;
    animation: floatDrift 5s ease-in-out infinite;
}

.paper-plane {
    top: 25%;
    left: 8%;
    animation: floatDrift 6s ease-in-out infinite 0.5s;
}

.leaves {
    bottom: 20%;
    right: 15%;
    animation: floatDrift 4.5s ease-in-out infinite 1s;
}

@keyframes floatDrift {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-8px) rotate(3deg);
    }
}

/* ---------- Dot Constellations ---------- */
.dot-constellation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.dot {
    position: absolute;
    width: var(--size, 4px);
    height: var(--size, 4px);
    background-color: var(--color, #C8572A);
    border-radius: 50%;
    animation: dotPulse 3s ease-in-out infinite var(--delay, 0s);
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.3);
    }
}

/* ---------- TIMELINE SVG ---------- */
#timeline-svg {
    position: absolute;
    top: 100vh;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: calc(100% - 200vh);
    z-index: 5;
    pointer-events: none;
    overflow: visible;
}

#timeline-path {
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: url(#none);
    opacity: 0.85;
}

/* ---------- TIMELINE NODES ---------- */
.timeline-node {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    padding: 80px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.node-left {
    flex-direction: row;
    justify-content: flex-start;
}

.node-right {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Node connector stems */
.node-connector {
    position: absolute;
    top: 50%;
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, var(--burnt-orange), transparent);
    opacity: 0.5;
    z-index: 4;
}

.node-left .node-connector {
    right: calc(50% - 100px);
    background: linear-gradient(to left, var(--burnt-orange), transparent);
}

.node-right .node-connector {
    left: calc(50% - 100px);
    background: linear-gradient(to right, var(--burnt-orange), transparent);
}

/* Stamp / Seal */
.node-stamp {
    position: absolute;
    top: 50%;
    z-index: 10;
    margin-top: -25px;
}

.node-left .node-stamp {
    right: calc(50% - 125px);
}

.node-right .node-stamp {
    left: calc(50% - 125px);
}

/* Node Card */
.node-card {
    position: relative;
    max-width: 480px;
    background: var(--cream-canvas);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 4px 6px 20px var(--shadow-warm);
    border: 1px solid rgba(201, 185, 154, 0.4);
    z-index: 6;
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.card-bg-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 30% 30%, rgba(232, 165, 75, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.card-illustration {
    position: relative;
    z-index: 1;
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--papyrus-tan);
    background: var(--papyrus-dark);
}

.card-illustration svg {
    display: block;
    width: 100%;
    height: auto;
}

.card-text {
    position: relative;
    z-index: 1;
}

.node-title {
    font-family: 'Baloo 2', Georgia, serif;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--deep-charcoal);
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    line-height: 1.2;
}

.node-body {
    font-family: 'Nunito', Arial, sans-serif;
    font-size: 18px;
    line-height: 1.65;
    color: var(--deep-charcoal);
    margin-bottom: 16px;
    opacity: 0.9;
}

.node-caption {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    color: var(--burnt-orange);
    opacity: 0.8;
    display: block;
}

/* Card foreground accents */
.card-foreground-accents {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.accent-squiggle {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 20px;
    border-bottom: 2px solid var(--dusty-rose);
    border-radius: 0 0 20px 0;
    opacity: 0.3;
}

/* Node floating accents */
.node-accent {
    position: absolute;
    z-index: 3;
    animation: nodeFloat var(--drift-duration, 5s) ease-in-out infinite;
}

.node-left .node-accent {
    right: 20%;
    top: 20%;
}

.node-right .node-accent {
    left: 20%;
    top: 25%;
}

@keyframes nodeFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(calc(-1 * var(--drift-y, 8px))) rotate(var(--drift-rotate, 3deg));
    }
}

/* ---------- TORN PAPER DIVIDERS ---------- */
.torn-paper-divider {
    position: relative;
    z-index: 7;
    margin: -40px 0;
    pointer-events: none;
    line-height: 0;
}

.torn-paper-divider svg {
    display: block;
    width: 100%;
    filter: drop-shadow(0 4px 8px rgba(43, 33, 24, 0.08));
}

.torn-paper-divider.flip svg {
    transform: scaleY(-1);
}

/* ---------- INTERSTITIALS ---------- */
.interstitial {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    position: relative;
    z-index: 6;
}

.interstitial-icon {
    opacity: 0.5;
    transition: opacity 0.5s ease;
}

.interstitial:hover .interstitial-icon {
    opacity: 0.8;
}

/* Spinning compass animation */
.spinning-compass .compass-needle {
    transform-origin: 40px 40px;
    animation: compassSpin 8s linear infinite;
}

@keyframes compassSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Candle flame flicker */
.flickering-candle .candle-flame {
    animation: flameFlicker 2s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

@keyframes flameFlicker {
    0% { transform: scaleX(1) scaleY(1); opacity: 0.9; }
    25% { transform: scaleX(0.85) scaleY(1.05); opacity: 1; }
    50% { transform: scaleX(1.1) scaleY(0.95); opacity: 0.85; }
    75% { transform: scaleX(0.9) scaleY(1.08); opacity: 1; }
    100% { transform: scaleX(1.05) scaleY(0.98); opacity: 0.9; }
}

/* Ticking clock */
.ticking-clock .clock-second-hand {
    transform-origin: 45px 45px;
    animation: secondTick 60s steps(60) infinite;
}

.ticking-clock .clock-minute-hand {
    transform-origin: 45px 45px;
    animation: minuteTick 3600s linear infinite;
}

@keyframes secondTick {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes minuteTick {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Steam animation */
.steam-path {
    animation: steamFloat 3s ease-in-out infinite alternate;
    transform-origin: center bottom;
}

@keyframes steamFloat {
    0% { opacity: 0.3; transform: translateY(0); }
    100% { opacity: 0.7; transform: translateY(-5px); }
}

/* ---------- CLOSING SCENE ---------- */
.closing-scene {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.closing-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, rgba(45, 95, 93, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 30%, rgba(43, 33, 24, 0.06) 0%, transparent 50%);
    z-index: 0;
}

.closing-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.closing-window {
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.closing-window svg {
    width: 100%;
    max-width: 400px;
    height: auto;
    filter: drop-shadow(4px 6px 20px rgba(43, 33, 24, 0.12));
}

.closing-text {
    font-family: 'Nunito', Arial, sans-serif;
    font-size: 20px;
    line-height: 1.7;
    color: var(--deep-charcoal);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
    margin-bottom: 32px;
}

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

.closing-date {
    font-family: 'Baloo 2', Georgia, serif;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--burnt-orange);
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1s ease 0.6s, transform 1s ease 0.6s;
}

.closing-date.visible {
    opacity: 0.6;
    transform: translateY(0);
}

/* ---------- COMPASS NAVIGATION ---------- */
#compass-nav {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.compass-icon {
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(2px 3px 8px rgba(43, 33, 24, 0.2));
}

.compass-icon:hover {
    transform: scale(1.1);
}

.compass-icon svg {
    display: block;
}

.compass-waypoints {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-bottom: 0;
}

#compass-nav:hover .compass-waypoints,
#compass-nav.open .compass-waypoints {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 12px;
}

.waypoint {
    font-family: 'Caveat', cursive;
    font-size: 16px;
    color: var(--burnt-orange);
    text-decoration: none;
    padding: 4px 12px;
    background: var(--cream-canvas);
    border-radius: 12px;
    border: 1px solid var(--papyrus-tan);
    transition: background 0.2s, color 0.2s, transform 0.2s;
    white-space: nowrap;
}

.waypoint:hover {
    background: var(--burnt-orange);
    color: var(--cream-canvas);
    transform: translateX(-4px);
}

/* ---------- MAGNETIC ELEMENT TRANSITION ---------- */
.magnetic-element {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .timeline-node {
        flex-direction: column !important;
        padding: 60px 20px;
        align-items: center;
    }

    .node-card {
        max-width: 100%;
    }

    .node-connector {
        display: none;
    }

    .node-stamp {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin-bottom: 16px;
    }

    .node-left .node-stamp,
    .node-right .node-stamp {
        left: auto;
        right: auto;
    }

    #timeline-svg {
        display: none;
    }

    .hero-date {
        font-size: clamp(48px, 10vw, 80px);
    }

    .floating-accent.teacup,
    .floating-accent.paper-plane,
    .floating-accent.leaves {
        display: none;
    }

    #compass-nav {
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 600px) {
    .node-card {
        padding: 20px;
    }

    .node-body {
        font-size: 16px;
    }

    .closing-text {
        font-size: 17px;
    }

    .hero-date {
        font-size: clamp(40px, 12vw, 60px);
    }
}

/* ---------- SELECTION ---------- */
::selection {
    background: rgba(200, 87, 42, 0.2);
    color: var(--deep-charcoal);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--papyrus-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--papyrus-tan);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--burnt-orange);
}
