/* === Base Reset & Variables === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f0ebe3;
    --bg-secondary: #e8e0d4;
    --text-primary: #3a3632;
    --text-secondary: #7d746a;
    --timeline-start: #c9b8db;
    --timeline-end: #8ec5c0;
    --aurora-rose: #e8a0bf;
    --aurora-mint: #a0e8d0;
    --aurora-lilac: #bfa0e8;
    --kintsugi-gold: #d4b896;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.72;
    overflow-x: hidden;
    position: relative;
}

/* === Aurora Background Blobs === */
.aurora-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.aurora-blob {
    position: absolute;
    width: 600px;
    height: 300px;
    border-radius: 50%;
    filter: blur(120px);
    animation: aurora-drift 45s infinite alternate ease-in-out;
}

.aurora-blob-1 {
    top: 10%;
    right: 10%;
    background: var(--aurora-rose);
    opacity: 0.08;
}

.aurora-blob-2 {
    top: 45%;
    left: 5%;
    background: var(--aurora-mint);
    opacity: 0.06;
    animation-delay: -15s;
}

.aurora-blob-3 {
    bottom: 15%;
    left: 35%;
    background: var(--aurora-lilac);
    opacity: 0.07;
    animation-delay: -30s;
}

@keyframes aurora-drift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(80px, -40px); }
    50% { transform: translate(-40px, 40px); }
    75% { transform: translate(60px, 20px); }
    100% { transform: translate(-80px, -20px); }
}

/* === Kintsugi Crack Overlay === */
.kintsugi-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.crack {
    stroke: var(--kintsugi-gold);
    stroke-width: 0.5;
    fill: none;
    opacity: 0.15;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

/* === Timeline Line === */
.timeline-line {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
}

.timeline-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, var(--timeline-start), var(--timeline-end));
    opacity: 0.4;
}

/* === Epoch Indicator === */
.epoch-indicator {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.epoch-indicator-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--timeline-start);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
}

.epoch-indicator-name {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

/* === Epochs === */
.epoch {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.epoch-1 {
    min-height: 100vh;
}

.epoch-7 {
    min-height: 100vh;
}

/* === Epoch Nodes === */
.epoch-node {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.node-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--timeline-start);
    background: var(--bg-primary);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.epoch.active .node-circle {
    background-color: var(--aurora-rose);
    border-color: var(--aurora-rose);
}

/* === Hero Content === */
.hero-content {
    text-align: center;
    perspective: 1200px;
    z-index: 10;
}

.hero-title {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(48px, 8vw, 96px);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0;
    transform: rotateX(2deg) rotateY(-1deg);
    transition: opacity 0.8s ease-out, transform 0.3s ease-out;
}

.hero-title.visible {
    opacity: 1;
}

.hero-subtitle {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(16px, 2vw, 22px);
    color: var(--text-secondary);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.8s ease-out;
    transition-delay: 0.2s;
}

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

/* === Epoch Panels === */
.epoch-panel {
    max-width: 520px;
    padding: 40px;
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #e8a0bf22 0%, #a0e8d022 33%, #bfa0e822 66%, #e8a0bf22 100%);
    border-left: 3px solid var(--kintsugi-gold);
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel-left {
    margin-right: auto;
    margin-left: calc(50% + 48px);
    transform: translateX(40px) rotate(-3.2deg);
}

.panel-right {
    margin-left: auto;
    margin-right: calc(50% + 48px);
    transform: translateX(-40px) rotate(2.8deg);
}

.panel-left.visible {
    opacity: 1;
    transform: translateX(0) rotate(-3.2deg);
}

.panel-right.visible {
    opacity: 1;
    transform: translateX(0) rotate(2.8deg);
}

.epoch-header {
    margin-bottom: 24px;
}

.epoch-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.epoch-title {
    font-family: 'Righteous', sans-serif;
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.epoch-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    line-height: 1.72;
    color: var(--text-primary);
    margin-top: 24px;
}

/* === 3D Objects === */
.object-3d {
    margin: 32px 0;
    perspective: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease-out;
}

/* Cracked Bowl */
.cracked-bowl {
    position: relative;
    width: 200px;
    height: 120px;
}

.bowl-body {
    width: 200px;
    height: 120px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: conic-gradient(from 45deg, #e8e0d4, #d4c8b8, #f0ebe3, #e8e0d4);
    transform: perspective(800px) rotateX(25deg) rotateY(-8deg);
    box-shadow:
        0 8px 24px rgba(58, 54, 50, 0.15),
        inset 0 -4px 12px rgba(58, 54, 50, 0.1);
    position: relative;
}

.bowl-crack {
    position: absolute;
    top: 20%;
    left: 30%;
    width: 80px;
    height: 2px;
    background: var(--kintsugi-gold);
    transform: rotate(35deg) perspective(800px) rotateX(25deg);
    box-shadow: 0 0 6px var(--kintsugi-gold);
}

.bowl-shadow {
    position: absolute;
    bottom: -20px;
    left: 20%;
    width: 60%;
    height: 12px;
    background: rgba(58, 54, 50, 0.1);
    border-radius: 50%;
    filter: blur(4px);
}

/* Weathered Stone */
.weathered-stone {
    position: relative;
    width: 160px;
    height: 140px;
}

.stone-body {
    width: 160px;
    height: 140px;
    border-radius: 40% 60% 55% 45%;
    background:
        radial-gradient(circle at 30% 40%, rgba(125, 116, 106, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(125, 116, 106, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, #d4c8b8 0%, #b8a898 100%);
    transform: perspective(800px) rotateX(10deg) rotateY(5deg);
    box-shadow:
        0 4px 8px rgba(58, 54, 50, 0.1),
        0 8px 16px rgba(58, 54, 50, 0.08),
        0 16px 32px rgba(58, 54, 50, 0.06),
        0 24px 48px rgba(58, 54, 50, 0.04),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.stone-shadow {
    position: absolute;
    bottom: -16px;
    left: 15%;
    width: 70%;
    height: 10px;
    background: rgba(58, 54, 50, 0.08);
    border-radius: 50%;
    filter: blur(6px);
}

/* Torn Paper */
.torn-paper {
    position: relative;
    width: 180px;
    height: 160px;
}

.paper-layer {
    position: absolute;
    width: 160px;
    height: 100px;
    background: #f0ebe3;
    box-shadow: 1px 2px 4px rgba(58, 54, 50, 0.1);
}

.paper-layer-1 {
    top: 0;
    left: 0;
    clip-path: polygon(0% 0%, 95% 2%, 100% 15%, 97% 100%, 5% 98%, 0% 85%);
    background: #ede7dd;
    transform: rotate(-2deg);
}

.paper-layer-2 {
    top: 20px;
    left: 10px;
    clip-path: polygon(2% 0%, 100% 3%, 98% 90%, 95% 100%, 0% 97%, 3% 10%);
    background: #f2ece4;
    transform: rotate(1deg);
}

.paper-layer-3 {
    top: 40px;
    left: 5px;
    clip-path: polygon(0% 5%, 97% 0%, 100% 92%, 93% 100%, 2% 95%, 0% 12%);
    background: #f5efe7;
    transform: rotate(-0.5deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.paper-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    line-height: 1.8;
    text-transform: uppercase;
}

/* Aurora Vessel */
.aurora-vessel {
    position: relative;
    width: 120px;
    height: 180px;
}

.vessel-body {
    width: 100px;
    height: 160px;
    margin: 0 auto;
    border-radius: 45% 45% 40% 40% / 30% 30% 70% 70%;
    background: linear-gradient(to bottom, var(--aurora-rose), var(--aurora-mint), var(--aurora-lilac));
    transform: perspective(800px) rotateY(-5deg);
    box-shadow:
        0 8px 32px rgba(232, 160, 191, 0.3),
        inset 0 -8px 16px rgba(191, 160, 232, 0.2);
    animation: gentle-rotate 720s linear infinite;
}

.vessel-glow {
    position: absolute;
    top: 20%;
    left: 10%;
    width: 80%;
    height: 60%;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(160, 232, 208, 0.3), transparent);
    filter: blur(8px);
}

.vessel-shadow {
    position: absolute;
    bottom: -12px;
    left: 20%;
    width: 60%;
    height: 8px;
    background: rgba(191, 160, 232, 0.2);
    border-radius: 50%;
    filter: blur(4px);
}

@keyframes gentle-rotate {
    from { transform: perspective(800px) rotateY(-5deg); }
    to { transform: perspective(800px) rotateY(355deg); }
}

/* Dissolved Grid */
.dissolved-grid {
    display: grid;
    grid-template-columns: repeat(6, 24px);
    grid-template-rows: repeat(6, 24px);
    gap: 4px;
}

.grid-cell {
    width: 24px;
    height: 24px;
    background: var(--text-secondary);
    opacity: var(--opacity, 0.5);
    border-radius: 2px;
    transition: opacity 0.3s ease;
}

/* === Final Content (Epoch 7) === */
.final-content {
    text-align: center;
    z-index: 10;
    max-width: 600px;
    padding: 40px;
}

.final-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(20px, 3vw, 32px);
    line-height: 1.6;
    color: var(--text-primary);
}

.final-text .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    margin-right: 0.3em;
}

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

/* === Node Pulse Animation === */
@keyframes node-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.node-circle.pulse {
    animation: node-pulse 0.6s ease-in-out;
}

/* === Responsive (<=768px) === */
@media (max-width: 768px) {
    .timeline-line {
        left: 24px;
        transform: none;
    }

    .epoch-node {
        left: 24px;
        transform: translate(-50%, -50%);
    }

    .panel-left,
    .panel-right {
        margin-left: 60px;
        margin-right: 20px;
        transform: translateX(40px) rotate(0deg);
    }

    .panel-left.visible,
    .panel-right.visible {
        transform: translateX(0) rotate(0deg);
    }

    .hero-title {
        font-size: clamp(36px, 10vw, 56px);
    }

    .object-3d {
        transform: scale(0.75);
    }

    .aurora-blob-2 {
        display: none;
    }

    .epoch-indicator {
        left: 8px;
    }
}
