/* ============================================================
   HASKELL.QUEST STYLES - Holographic Timeline
   A functional programming odyssey rendered as geological strata
   ============================================================ */

/* Reset and Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Source Serif 4', serif;
    background-color: #0B0D14;
    color: #D8D3CA;
    font-size: 18px;
    line-height: 1.75;
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================================
   TYPOGRAPHY HIERARCHY
   ============================================================ */

h1, h2, h3 {
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 56px;
}

h2 {
    font-family: 'Lora', serif;
    font-size: 32px;
    color: #F0EDE6;
    font-weight: 600;
}

h3 {
    font-family: 'Lora', serif;
    font-size: 24px;
    color: #F0EDE6;
}

p {
    color: #D8D3CA;
    max-width: 36em;
    margin-bottom: 1.5rem;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    line-height: 1.6;
    color: #A8E6CF;
}

/* ============================================================
   PROGRESS BAR (Right edge)
   ============================================================ */

.progress-bar {
    position: fixed;
    right: 0;
    top: 0;
    width: 3px;
    height: 0%;
    background: linear-gradient(180deg, #7B5EA7 0%, #5B8FBF 20%, #3D9B8F 40%, #6AB87A 60%, #C49A3C 80%, #B86A6A 95%, #7B5EA7 100%);
    background-size: 100% 200%;
    background-position: 0% 0%;
    z-index: 1000;
    transition: height 0.1s linear;
}

/* ============================================================
   TIMELINE CONTAINER & STRATA
   ============================================================ */

.timeline-container {
    position: relative;
    width: 100%;
}

.stratum {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background-color: #0B0D14;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
}

.stratum-1 {
    background-color: #0B0D14;
}

.stratum-2 {
    background-color: #0B0D14;
    --stratum-hue: #7B5EA7;
}

.stratum-3 {
    background-color: #0B0D14;
    --stratum-hue: #3D9B8F;
}

.stratum-4 {
    background-color: #0B0D14;
    --stratum-hue: #C49A3C;
}

.stratum-5 {
    background-color: #0B0D14;
    --stratum-hue: #7B5EA7;
}

.stratum-6 {
    background-color: #0B0D14;
    --stratum-hue: #3D9B8F;
}

.stratum-7 {
    background-color: #0B0D14;
    --stratum-hue: #C49A3C;
}

.stratum-8 {
    background-color: #0B0D14;
    --stratum-hue: #7B5EA7;
}

.stratum-9.deep-stratum {
    background-color: #06080C;
}

.stratum-content {
    position: relative;
    width: 100%;
    max-width: 1000px;
    z-index: 10;
}

/* ============================================================
   OPENING SECTION
   ============================================================ */

.opening-header {
    text-align: center;
    margin-bottom: 80px;
}

.title-main {
    font-size: 120px;
    background: linear-gradient(135deg, #7B5EA7 0%, #5B8FBF 20%, #3D9B8F 40%, #6AB87A 60%, #C49A3C 80%, #B86A6A 95%, #7B5EA7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    line-height: 1.1;
}

.opening-subtitle {
    font-size: 18px;
    color: #8A8578;
    font-family: 'Source Serif 4', serif;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.timeline-spine-container {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, #0B0D14, #8A8578, #0B0D14);
    transform: translateX(-50%);
    opacity: 0.4;
    box-shadow: 0 0 10px rgba(139, 134, 120, 0.2);
}

.prismatic-beam {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: drift-beam 60s linear infinite;
}

@keyframes drift-beam {
    0% { transform: translateX(0); }
    100% { transform: translateX(100px); }
}

/* ============================================================
   HOLOGRAPHIC SEAMS (Dividers)
   ============================================================ */

.holographic-seam {
    position: relative;
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, #7B5EA7 0%, #5B8FBF 20%, #3D9B8F 40%, #6AB87A 60%, #C49A3C 80%, #B86A6A 95%, #7B5EA7 100%);
    background-size: 200% 100%;
    animation: seam-shimmer 8s linear infinite;
    z-index: 20;
    opacity: 0.8;
}

@keyframes seam-shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

.seam-1, .seam-5 { --seam-hue: #7B5EA7; }
.seam-2, .seam-6 { --seam-hue: #3D9B8F; }
.seam-3, .seam-7 { --seam-hue: #C49A3C; }
.seam-4, .seam-8 { --seam-hue: #7B5EA7; }

/* ============================================================
   TIMELINE NODES (Left/Right alternation)
   ============================================================ */

.timeline-node {
    position: relative;
    margin-bottom: 80px;
    display: flex;
    align-items: flex-start;
    gap: 40px;
}

.timeline-node.left {
    flex-direction: row;
    margin-right: auto;
    width: 50%;
    padding-right: 60px;
}

.timeline-node.right {
    flex-direction: row-reverse;
    margin-left: auto;
    width: 50%;
    padding-left: 60px;
}

.timeline-node.centered {
    width: 100%;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

.timeline-diamond {
    position: relative;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #7B5EA7 0%, #3D9B8F 50%, #C49A3C 100%);
    transform: rotate(45deg) scale(0);
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 8px;
    box-shadow: 0 0 15px rgba(123, 94, 167, 0.5);
    animation: diamond-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes diamond-pop {
    from {
        transform: rotate(45deg) scale(0);
        opacity: 0;
    }
    to {
        transform: rotate(45deg) scale(1);
        opacity: 1;
    }
}

.timeline-diamond-final {
    position: relative;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #7B5EA7 0%, #3D9B8F 50%, #C49A3C 100%);
    transform: rotate(45deg);
    border-radius: 3px;
    margin-bottom: 40px;
    box-shadow: 0 0 25px rgba(123, 94, 167, 0.6);
    animation: diamond-pulse 2s ease-in-out infinite;
}

@keyframes diamond-pulse {
    0%, 100% { box-shadow: 0 0 25px rgba(123, 94, 167, 0.6); }
    50% { box-shadow: 0 0 40px rgba(123, 94, 167, 0.9); }
}

.connector-line {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, #3D9B8F, transparent);
    top: 10px;
    z-index: 5;
    animation: line-draw 0.4s ease-out 0.2s both;
}

.timeline-node.left .connector-line {
    width: 40px;
    right: -40px;
    transform-origin: left;
}

.timeline-node.right .connector-line {
    width: 40px;
    left: -40px;
    transform-origin: right;
}

@keyframes line-draw {
    from {
        transform: scaleX(0);
        opacity: 0;
    }
    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

.node-content {
    flex: 1;
}

.node-title {
    margin-top: 0;
}

.node-text {
    color: #D8D3CA;
}

.final-message {
    text-align: center;
}

.closing-quote {
    font-size: 20px;
    color: #8A8578;
}

/* ============================================================
   CODE BLOCKS
   ============================================================ */

.code-block {
    background-color: #0D0F12;
    border: 1px solid;
    border-image: linear-gradient(135deg, #7B5EA7 0%, #5B8FBF 20%, #3D9B8F 40%, #6AB87A 60%, #C49A3C 80%, #B86A6A 95%, #7B5EA7 100%) 1;
    padding: 24px;
    border-radius: 4px;
    margin: 24px 0;
    overflow-x: auto;
    transition: all 0.3s ease;
    animation: code-entry 0.5s ease-out;
}

.code-block:hover {
    border-image: linear-gradient(135deg, #C49A3C 0%, #B86A6A 20%, #7B5EA7 40%, #3D9B8F 60%, #5B8FBF 80%, #C49A3C 95%, #C49A3C 100%) 1;
    box-shadow: 0 0 20px rgba(196, 154, 60, 0.3);
}

@keyframes code-entry {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

code {
    display: block;
    white-space: pre;
    font-size: 14px;
}

/* ============================================================
   SHAKE ANIMATION (Type errors)
   ============================================================ */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.code-error {
    animation: shake 0.3s ease-in-out;
}

/* ============================================================
   NATURE ELEMENTS (SVG Decorations)
   ============================================================ */

.nature-element {
    position: absolute;
    opacity: 0.08;
    z-index: 1;
}

.tree-diagram {
    width: 300px;
    height: 300px;
    top: 50%;
    right: -100px;
    transform: translateY(-50%);
}

.ripple-pattern {
    width: 250px;
    height: 250px;
    top: 50%;
    left: -80px;
    transform: translateY(-50%);
    animation: ripple-expand 3s ease-out infinite;
}

@keyframes ripple-expand {
    0% {
        opacity: 0.12;
        transform: translateY(-50%) scale(0.8);
    }
    50% {
        opacity: 0.12;
        transform: translateY(-50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) scale(1.3);
    }
}

.crystal-formation {
    width: 300px;
    height: 300px;
    top: 50%;
    right: -120px;
    transform: translateY(-50%) rotate(15deg);
    animation: rotate-crystal 20s linear infinite;
}

@keyframes rotate-crystal {
    0% { transform: translateY(-50%) rotate(15deg); }
    100% { transform: translateY(-50%) rotate(375deg); }
}

.leaf-venation {
    width: 400px;
    height: 300px;
    top: 50%;
    left: -150px;
    transform: translateY(-50%);
}

/* ============================================================
   LAMBDA WATERMARK (Background fossils)
   ============================================================ */

.lambda-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 300px;
    font-family: 'Playfair Display', serif;
    color: #151822;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    line-height: 1;
}

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

@media (max-width: 1024px) {
    .timeline-node.left,
    .timeline-node.right {
        width: 100%;
        padding-left: 0;
        padding-right: 0;
        flex-direction: column;
        gap: 20px;
    }

    .timeline-node.right {
        flex-direction: column;
    }

    .connector-line {
        display: none;
    }

    .timeline-diamond {
        margin-left: 0;
    }

    .nature-element {
        display: none;
    }

    h1 {
        font-size: 48px;
    }

    h2 {
        font-size: 28px;
    }

    .stratum {
        padding: 40px 20px;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 36px;
    }

    h2 {
        font-size: 24px;
    }

    p {
        font-size: 16px;
    }

    code {
        font-size: 13px;
    }

    .code-block {
        padding: 16px;
    }

    .stratum {
        padding: 30px 16px;
        min-height: auto;
    }

    .progress-bar {
        width: 2px;
    }

    .title-main {
        font-size: 56px;
    }

    .opening-subtitle {
        font-size: 16px;
    }
}

/* ============================================================
   ACCESSIBILITY & DEFAULTS
   ============================================================ */

a {
    color: #3D9B8F;
    text-decoration: none;
    border-bottom: 1px solid #3D9B8F;
}

a:hover {
    color: #7B5EA7;
    border-bottom-color: #7B5EA7;
}

button {
    cursor: pointer;
}

/* Ensure smooth scrolling on all elements */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0B0D14;
}

::-webkit-scrollbar-thumb {
    background: #3D9B8F;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #7B5EA7;
}
