/* ============================
   haskell.day - Pop Art Pastoral
   ============================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    background: #fdf6e3;
    color: #1d1d1b;
    overflow-x: hidden;
    line-height: 1.6;
}

code, pre {
    font-family: 'Fira Code', monospace;
}

/* ============================
   Zone Base Styles
   ============================ */

.zone {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

.zone-divider {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 10;
    display: block;
}

.zone-content {
    position: relative;
    z-index: 5;
    padding: 4rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.zone-title {
    font-family: 'Bangers', cursive;
    font-size: clamp(36px, 6vw, 84px);
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.1;
    color: #1d1d1b;
}

/* ============================
   Speech Bubbles
   ============================ */

.speech-bubble {
    position: relative;
    display: inline-block;
    background: #fdf6e3;
    border: 3px solid #1d1d1b;
    border-radius: 20px;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.speech-bubble.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.speech-bubble-tail {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 20px solid #1d1d1b;
}

.speech-bubble-tail::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: -12px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 17px solid #fdf6e3;
}

.tail-left {
    left: 20%;
}

.tail-right {
    left: 80%;
}

.tail-center {
    left: 50%;
}

.speech-bubble-hero {
    background: #f4d35e;
    border-width: 4px;
    padding: 1.5rem 3rem;
}

.speech-bubble-hero .speech-bubble-tail::after {
    border-top-color: #f4d35e;
}

.speech-bubble-wide {
    display: block;
    max-width: 700px;
    margin: 2rem auto;
    background: #fdf6e3;
}

.speech-bubble-wide p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.7;
    color: #1d1d1b;
}

.speech-bubble-left {
    margin-left: 0;
}

.speech-bubble-right {
    margin-left: auto;
    display: block;
    text-align: right;
    width: fit-content;
}

.speech-bubble-center {
    display: block;
    text-align: center;
    width: fit-content;
    margin: 0 auto 2rem;
}

.speech-bubble-final {
    display: block;
    text-align: center;
    width: fit-content;
    margin: 0 auto 2rem;
    background: #f4d35e;
    border-width: 4px;
}

.speech-bubble-final .speech-bubble-tail::after {
    border-top-color: #f4d35e;
}

/* ============================
   ZONE 1: THE MEADOW
   ============================ */

.zone-meadow {
    background: linear-gradient(180deg, #fdf6e3 0%, #f4d35e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 110vh;
    padding-bottom: 80px;
}

.meadow-sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    z-index: 1;
}

.meadow-dots {
    width: 100%;
    height: 100%;
}

.meadow-content {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 6rem 2rem 2rem;
}

.hero-title {
    font-family: 'Bangers', cursive;
    font-size: clamp(48px, 10vw, 120px);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1;
    color: #1d1d1b;
    text-shadow: 4px 4px 0 #e76f51;
}

.hero-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(18px, 3vw, 28px);
    font-style: italic;
    color: #6b2d5b;
    margin-top: 1rem;
    margin-bottom: 3rem;
}

/* Lambda wildflowers */
.lambda-field {
    position: relative;
    width: 100%;
    height: 120px;
    margin-top: 2rem;
}

.lambda-flower {
    position: absolute;
    left: var(--x);
    bottom: 0;
    font-family: 'Bangers', cursive;
    font-size: clamp(28px, 4vw, 48px);
    color: #e76f51;
    text-shadow: 2px 2px 0 #1d1d1b;
    animation: sway 3s ease-in-out infinite;
    animation-delay: var(--delay);
    transform-origin: bottom center;
}

@keyframes sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* Type signatures floating in sky */
.type-sig-sky {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.type-sig {
    font-family: 'Fira Code', monospace;
    font-size: clamp(12px, 1.5vw, 16px);
    color: #457b9d;
    background: rgba(253, 246, 227, 0.8);
    border: 2px solid #457b9d;
    border-radius: 4px;
    padding: 0.3rem 0.8rem;
}

.floating {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(var(--drift)) translateX(10px); }
    50% { transform: translateY(0) translateX(-5px); }
    75% { transform: translateY(calc(var(--drift) * -0.5)) translateX(8px); }
}

/* Meadow ground */
.meadow-ground {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 3;
}

.ground-hills {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================
   ZONE 2: THE FOREST OF TYPES
   ============================ */

.zone-forest {
    background: #457b9d;
    padding-bottom: 80px;
}

.forest-canopy {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 1;
    opacity: 0.5;
}

.forest-dots {
    width: 100%;
    height: 100%;
}

.zone-forest .zone-title {
    color: #fdf6e3;
}

.forest-trees {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    margin: 3rem 0;
}

.tree-type {
    text-align: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.tree-type.revealed {
    opacity: 1;
    transform: translateY(0);
}

.tree-crown {
    width: 120px;
    height: 100px;
    margin: 0 auto;
}

.tree-crown svg {
    width: 100%;
    height: 100%;
}

.tree-label {
    margin-top: 0.5rem;
}

.tree-label code {
    font-family: 'Fira Code', monospace;
    font-size: clamp(11px, 1.2vw, 14px);
    color: #fdf6e3;
    background: rgba(29, 29, 27, 0.6);
    border: 2px solid #1d1d1b;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    display: inline-block;
}

.zone-forest .speech-bubble-wide {
    background: rgba(253, 246, 227, 0.95);
}

.zone-forest .forest-prose {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.zone-forest .forest-prose.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   ZONE 3: THE RIVER OF FUNCTIONS
   ============================ */

.zone-river {
    background: #e76f51;
    padding-bottom: 80px;
}

.river-dots-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 1;
}

.river-dots {
    width: 100%;
    height: 100%;
}

.zone-river .zone-title {
    color: #fdf6e3;
}

.river-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin: 3rem 0;
}

.function-stone {
    position: relative;
    text-align: center;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.function-stone.revealed {
    opacity: 1;
    transform: translateX(0);
}

.function-stone:nth-child(2) {
    transform: translateX(30px);
}

.function-stone:nth-child(2).revealed {
    transform: translateX(0);
}

.stone-body {
    position: relative;
    z-index: 2;
    padding: 1rem 2rem;
}

.stone-code {
    font-family: 'Fira Code', monospace;
    font-size: clamp(14px, 1.8vw, 18px);
    color: #fdf6e3;
    font-weight: 600;
}

.stone-outline {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 80px;
    z-index: 1;
}

.river-wave-container {
    position: relative;
    width: 100%;
    height: 120px;
    margin: 2rem 0;
}

.river-waves {
    width: 100%;
    height: 100%;
}

.wave {
    animation: waveMotion 4s ease-in-out infinite;
}

.wave-2 {
    animation-delay: 0.5s;
}

.wave-3 {
    animation-delay: 1s;
}

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

.zone-river .speech-bubble-wide {
    background: rgba(253, 246, 227, 0.95);
}

.zone-river .river-prose {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.zone-river .river-prose.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   ZONE 4: THE MOUNTAIN OF MONADS
   ============================ */

.zone-mountain {
    background: #6b2d5b;
    padding-bottom: 80px;
}

.mountain-dots-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    z-index: 1;
}

.mountain-dots {
    width: 100%;
    height: 100%;
}

.zone-mountain .zone-title {
    color: #f4d35e;
}

.zone-mountain .speech-bubble-center {
    background: #f4d35e;
    border-color: #1d1d1b;
}

.zone-mountain .speech-bubble-center .speech-bubble-tail::after {
    border-top-color: #f4d35e;
}

.monad-peaks {
    width: 100%;
    max-width: 1000px;
    margin: 2rem auto;
}

.mountain-svg {
    width: 100%;
    height: auto;
}

.monad-code-blocks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
    position: relative;
    z-index: 5;
}

.code-panel {
    background: #1d1d1b;
    border: 3px solid #f4d35e;
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.code-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

.code-panel-header {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    background: #2a2a28;
}

.code-panel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-panel pre {
    padding: 1rem 1.2rem;
    overflow-x: auto;
}

.code-panel code {
    font-family: 'Fira Code', monospace;
    font-size: clamp(13px, 1.4vw, 15px);
    color: #fdf6e3;
    line-height: 1.6;
}

.zone-mountain .speech-bubble-wide {
    background: rgba(253, 246, 227, 0.95);
}

.zone-mountain .mountain-prose {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.zone-mountain .mountain-prose.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   ZONE 5: THE HORIZON
   ============================ */

.zone-horizon {
    background: linear-gradient(180deg, #fdf6e3 0%, #f4d35e 50%, #e76f51 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 2rem;
}

.horizon-dots-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    z-index: 1;
}

.horizon-dots {
    width: 100%;
    height: 100%;
}

.horizon-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.zone-horizon .zone-title {
    color: #1d1d1b;
}

.horizon-message {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.horizon-message.revealed {
    opacity: 1;
    transform: translateY(0);
}

.horizon-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(20px, 3vw, 36px);
    font-style: italic;
    line-height: 1.6;
    color: #6b2d5b;
    text-shadow: 1px 1px 0 rgba(253, 246, 227, 0.5);
}

.horizon-lambda {
    margin: 3rem 0;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 1s ease, transform 1s ease;
}

.horizon-lambda.revealed {
    opacity: 1;
    transform: scale(1);
}

.giant-lambda {
    font-family: 'Bangers', cursive;
    font-size: clamp(80px, 15vw, 200px);
    color: #e63946;
    text-shadow: 6px 6px 0 #1d1d1b;
    display: block;
    line-height: 1;
}

.horizon-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.horizon-links.revealed {
    opacity: 1;
    transform: translateY(0);
}

.pop-link {
    font-family: 'Bangers', cursive;
    font-size: clamp(18px, 2.5vw, 28px);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #1d1d1b;
    background: #f4d35e;
    border: 3px solid #1d1d1b;
    border-radius: 12px;
    padding: 0.6rem 1.5rem;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 4px 4px 0 #1d1d1b;
}

.pop-link:hover {
    background: #e76f51;
    color: #fdf6e3;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #1d1d1b;
}

.pop-link:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #1d1d1b;
}

.horizon-sun {
    position: absolute;
    top: 10%;
    right: 5%;
    width: clamp(100px, 15vw, 200px);
    height: clamp(100px, 15vw, 200px);
    z-index: 2;
    animation: sunPulse 4s ease-in-out infinite;
}

.sun-svg {
    width: 100%;
    height: 100%;
}

@keyframes sunPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Footer note */
.footer-note {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 2rem;
}

.footer-note p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 14px;
    color: #fdf6e3;
    opacity: 0.8;
}

/* ============================
   Reveal Animation Helpers
   ============================ */

[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   Parallax Depth
   ============================ */

.parallax-layer {
    will-change: transform;
}

/* ============================
   Responsive Adjustments
   ============================ */

@media (max-width: 768px) {
    .zone-content {
        padding: 3rem 1rem;
    }
    
    .forest-trees {
        gap: 1.5rem;
    }
    
    .monad-code-blocks {
        grid-template-columns: 1fr;
    }
    
    .speech-bubble {
        padding: 0.8rem 1.2rem;
    }
    
    .speech-bubble-hero {
        padding: 1rem 1.5rem;
    }
    
    .pop-link {
        padding: 0.5rem 1rem;
    }
    
    .horizon-sun {
        top: 5%;
        right: 2%;
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .lambda-field {
        height: 80px;
    }
    
    .tree-crown {
        width: 80px;
        height: 70px;
    }
    
    .function-stone .stone-body {
        padding: 0.5rem 1rem;
    }
}

/* Ben-Day pink highlight */
.lambda-flower:hover {
    color: #f7a1b5;
}
