/* moral.quest - Surreal dreamscape wabi-sabi moral journey */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1C1A17;
    color: #B0A898;
    font-family: 'Crimson Text', serif;
    font-size: 17px;
    line-height: 1.8;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Noise texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1000;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* Mist gradient layers */
.mist-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.mist-layer {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #2A2621 0%, transparent 70%);
}

.mist-1 {
    width: 1200px;
    height: 1200px;
    top: -200px;
    left: -300px;
    animation: mistDrift1 30s ease-in-out infinite;
}

.mist-2 {
    width: 900px;
    height: 900px;
    top: 300px;
    right: -200px;
    animation: mistDrift2 35s ease-in-out infinite;
}

.mist-3 {
    width: 1000px;
    height: 1000px;
    bottom: -100px;
    left: 20%;
    animation: mistDrift3 28s ease-in-out infinite;
}

.mist-4 {
    width: 800px;
    height: 800px;
    top: 50%;
    right: 10%;
    animation: mistDrift4 32s ease-in-out infinite;
}

@keyframes mistDrift1 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(20px); }
}

@keyframes mistDrift2 {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-15px) translateX(10px); }
}

@keyframes mistDrift3 {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(15px); }
}

@keyframes mistDrift4 {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-20px) translateX(-10px); }
}

/* Progress bar */
.progress-bar {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 100vh;
    background-color: #2A2621;
    z-index: 100;
}

.progress-fill {
    width: 100%;
    height: 0%;
    background-color: #8B6F47;
    transition: height 0.1s linear;
}

/* Hero Section */
.hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.hero-question {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 32px;
    color: #E8E0D0;
    text-align: center;
    max-width: 700px;
    line-height: 1.4;
    opacity: 0;
    animation: fadeInHero 2s linear 0.5s forwards;
}

@keyframes fadeInHero {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Timeline Section */
.timeline {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 60px 20px 120px;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 0;
    background-color: #4A4A4A;
    transform: translateX(-50%);
    transition: height 0.05s linear;
}

/* Waypoints */
.waypoint {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 24px 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 120px;
}

.waypoint:last-child {
    margin-bottom: 0;
}

/* Waypoint marker */
.waypoint-marker {
    grid-column: 2;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #8B6F47;
    justify-self: center;
    align-self: start;
    margin-top: 20px;
    opacity: 0;
    transform: scale(0);
    position: relative;
    z-index: 2;
}

.waypoint-marker.visible {
    animation: markerAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.waypoint-amber.visible {
    animation: markerAppear 400ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards, amberGlow 1s ease-out 400ms forwards;
}

@keyframes markerAppear {
    0% { opacity: 0; transform: scale(0); }
    70% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes amberGlow {
    0% { box-shadow: 0 0 0 0 rgba(196, 163, 90, 0.1); }
    100% { box-shadow: 0 0 20px 10px rgba(196, 163, 90, 0); }
}

/* Cards */
.card {
    background-color: #2A2621;
    border: 1px solid #3A352F;
    padding: 30px;
    opacity: 0;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 128 128' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
}

.card-left {
    grid-column: 1;
    grid-row: 1;
    transform: translateX(-40px);
}

.card-right {
    grid-column: 3;
    grid-row: 1;
    transform: translateX(40px);
}

/* Counter card appears on the other side */
.waypoint-left .card-counter {
    grid-row: 2;
}

.waypoint-right .card-counter {
    grid-row: 2;
}

.card.visible {
    opacity: 1;
    transform: translateX(0);
    transition: opacity 600ms ease, transform 600ms ease;
}

.card-question {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 24px;
    color: #E8E0D0;
    margin-bottom: 16px;
    line-height: 1.3;
}

.card-body {
    font-family: 'Crimson Text', serif;
    font-size: 17px;
    line-height: 1.8;
    color: #B0A898;
    margin-bottom: 12px;
}

.card-body em {
    font-style: italic;
}

.card-annotation {
    font-family: 'Anonymous Pro', monospace;
    font-size: 12px;
    color: #6A6258;
    display: block;
    margin-top: 12px;
}

/* Pivotal amber highlight on question text */
.waypoint[data-pivotal="true"] .card-scenario .card-question {
    color: #C4A35A;
}

/* Closing */
.closing {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 20px 120px;
}

.closing-text {
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 24px;
    color: #6A6258;
    opacity: 0;
}

.closing-text.visible {
    animation: fadeInHero 2s linear forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .waypoint {
        grid-template-columns: 12px 1fr;
        gap: 12px;
    }

    .waypoint-marker {
        grid-column: 1;
        margin-top: 24px;
    }

    .card-left,
    .card-right {
        grid-column: 2;
        grid-row: auto;
        transform: translateX(20px);
    }

    .card.visible {
        transform: translateX(0);
    }

    .timeline-line {
        left: 26px;
    }

    .hero-question {
        font-size: 24px;
    }

    .card-question {
        font-size: 20px;
    }
}
