/* ===================================================
   haskell.day - Swiss Typography Clean
   A typographic cathedral to functional programming
   =================================================== */

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

:root {
    --void: #1A1A2E;
    --parchment: #FAFAF5;
    --graphite: #2C2C2C;
    --lambda-gold: #E8D44D;
    --type-blue: #5C6BC0;
    --comment-gray: #9E9E9E;
    --pure-white: #FFFFFF;
    --error-red: #C62828;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--parchment);
    color: var(--graphite);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Grid Watermark --- */
.grid-watermark {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(to right, rgba(44, 44, 44, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(44, 44, 44, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
}

/* --- Section Base --- */
.section {
    position: relative;
    z-index: 1;
}

/* --- Section Markers --- */
.section-marker {
    position: absolute;
    right: calc(50% - 380px);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    opacity: 0.5;
}

.section-marker--hero {
    bottom: 40px;
    color: var(--comment-gray);
}

.section-marker--dark {
    bottom: 40px;
    color: var(--comment-gray);
}

.section-marker--light {
    bottom: 40px;
    color: var(--comment-gray);
}

@media (max-width: 800px) {
    .section-marker {
        right: 20px;
    }
}

/* ===================================================
   Section 1: Hero / Title Block
   =================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--parchment);
    padding: 0 24px;
}

.hero-content {
    text-align: center;
    padding-top: 23.6vh; /* Pushes content to ~61.8% from top visually */
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: 0.08em;
    color: var(--graphite);
    opacity: 0;
    transition: opacity 600ms ease;
}

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

.hero-rule {
    width: 0;
    height: 1px;
    background-color: var(--graphite);
    margin: 28px auto;
    transition: width 800ms ease-out;
}

.hero-rule.visible {
    width: 200px;
}

.hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    letter-spacing: 0.04em;
    color: var(--comment-gray);
    opacity: 0;
    transition: opacity 600ms ease;
}

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

/* ===================================================
   Section 2: Lambda Section
   =================================================== */
.lambda-section {
    position: relative;
    background-color: var(--void);
    padding: 200px 24px;
    overflow: hidden;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lambda-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Noto Serif Display', serif;
    font-weight: 300;
    font-size: 40vw;
    color: var(--lambda-gold);
    opacity: 0;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    animation: lambdaRotate 120s linear infinite;
    transition: opacity 1s ease;
}

.lambda-bg.visible {
    opacity: 0.12;
}

@keyframes lambdaRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.lambda-content {
    position: relative;
    z-index: 2;
    max-width: 680px;
    margin: 0 auto;
}

.lambda-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--pure-white);
    margin-bottom: 2.4em;
    opacity: 0;
    transition: opacity 800ms ease-in-out;
}

.lambda-text.visible {
    opacity: 1;
}

.lambda-text:last-child {
    margin-bottom: 0;
}

/* ===================================================
   Section 3: Type Signature Gallery
   =================================================== */
.type-gallery {
    background-color: var(--parchment);
    padding: 200px 24px;
}

.gallery-inner {
    max-width: 680px;
    margin: 0 auto;
}

.type-panel {
    margin-bottom: 120px;
    opacity: 0;
    transition: opacity 800ms ease-in-out;
}

.type-panel.visible {
    opacity: 1;
}

.type-panel:last-child {
    margin-bottom: 0;
}

.type-signature-wrapper {
    position: relative;
    margin-bottom: 32px;
}

.type-signature {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.5vw, 0.95rem);
    letter-spacing: 0;
    color: var(--type-blue);
    background-color: var(--void);
    padding: 24px 28px;
    border-radius: 2px;
    overflow-x: auto;
    white-space: pre;
}

.type-signature code {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
}

.annotation-lines {
    width: 100%;
    height: 60px;
    display: block;
}

.annotation-line {
    stroke: var(--comment-gray);
    stroke-width: 0.5;
    stroke-dasharray: 4 4;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 500ms ease;
}

.type-panel.visible .annotation-line {
    stroke-dashoffset: 0;
}

.annotation-labels {
    position: relative;
    height: 24px;
}

.annotation-label {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--comment-gray);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 300ms ease;
    transition-delay: 500ms;
}

.type-panel.visible .annotation-label {
    opacity: 1;
}

.type-explanation {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--graphite);
    margin-top: 24px;
    opacity: 0;
    transition: opacity 300ms ease;
    transition-delay: 800ms;
}

.type-panel.visible .type-explanation {
    opacity: 1;
}

.type-explanation code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: var(--type-blue);
    background-color: rgba(92, 107, 192, 0.08);
    padding: 2px 6px;
    border-radius: 2px;
}

.type-explanation em {
    font-style: italic;
    color: var(--type-blue);
}

/* ===================================================
   Section 4: Timeline
   =================================================== */
.timeline-section {
    background-color: var(--parchment);
    padding: 200px 24px;
}

.timeline-inner {
    max-width: 680px;
    margin: 0 auto;
}

.timeline-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    letter-spacing: 0.04em;
    color: var(--graphite);
    text-align: center;
    margin-bottom: 80px;
    opacity: 0;
    transition: opacity 800ms ease-in-out;
}

.timeline-heading.visible {
    opacity: 1;
}

.timeline-container {
    position: relative;
    padding: 0 0 40px 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 0;
    background-color: var(--graphite);
    transform: translateX(-50%);
    transition: height 0.1s linear;
}

.timeline-event {
    position: relative;
    width: 45%;
    margin-bottom: 60px;
    opacity: 0;
    transition: opacity 800ms ease-in-out;
}

.timeline-event.visible {
    opacity: 1;
}

.timeline-event--left {
    margin-right: auto;
    text-align: right;
    padding-right: 40px;
}

.timeline-event--right {
    margin-left: auto;
    text-align: left;
    padding-left: 40px;
}

.timeline-date {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    color: var(--graphite);
    margin-bottom: 8px;
}

.timeline-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--comment-gray);
}

/* Timeline dot markers */
.timeline-event::after {
    content: '';
    position: absolute;
    top: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--lambda-gold);
}

.timeline-event--left::after {
    right: -4px;
}

.timeline-event--right::after {
    left: -3px;
}

/* ===================================================
   Footer
   =================================================== */
.footer {
    background-color: var(--parchment);
    padding: 160px 24px 80px;
    text-align: center;
}

.footer-proof {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--comment-gray);
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 800ms ease-in-out;
}

.footer-proof.visible {
    opacity: 1;
}

/* ===================================================
   Typewriter Effect
   =================================================== */
.type-signature code .char {
    opacity: 0;
    transition: opacity 50ms ease;
}

.type-signature code .char.typed {
    opacity: 1;
}

/* ===================================================
   Responsive
   =================================================== */
@media (max-width: 768px) {
    .hero-content {
        padding-top: 15vh;
    }

    .lambda-section {
        padding: 120px 24px;
    }

    .type-gallery {
        padding: 120px 24px;
    }

    .timeline-section {
        padding: 120px 24px;
    }

    .type-panel {
        margin-bottom: 80px;
    }

    .timeline-event {
        width: 80%;
        margin-bottom: 40px;
    }

    .timeline-event--left {
        text-align: left;
        padding-right: 0;
        padding-left: 40px;
        margin-left: 10%;
    }

    .timeline-event--right {
        padding-left: 40px;
        margin-left: 10%;
    }

    .timeline-line {
        left: 10%;
    }

    .timeline-event--left::after {
        right: auto;
        left: -3px;
    }

    .timeline-event--right::after {
        left: -3px;
    }

    .annotation-lines {
        display: none;
    }

    .annotation-labels {
        display: none;
    }

    .footer {
        padding: 80px 24px 60px;
    }
}

@media (max-width: 480px) {
    .type-signature {
        font-size: 0.75rem;
        padding: 16px 18px;
    }

    .lambda-bg {
        font-size: 60vw;
    }
}
