/* ============================================
   haskeller.net — Compiling a Community
   Isometric + Swiss + Japanese-minimal
   ============================================ */

:root {
    --warm-parchment: #F5F0E8;
    --aged-linen: #EDE6D8;
    --deep-walnut: #2C2416;
    --warm-slate: #6B5E4F;
    --sage-green: #5B8C5A;
    --deep-forest: #3D6B3C;
    --pale-straw: #F0EBE0;
    --amber-glow: #D4A03C;
    --grid-line: #E0D8CC;
    --code-border: #D8D0C2;
    --iso-side: #4A7A4A;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: var(--deep-walnut);
    background: var(--warm-parchment);
    overflow-x: hidden;
}

/* --- Isometric Hex Grid Background --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50V16l28-16 28 16v34L28 66zm0-32l28-16v34L28 66 0 50V16l28 16z' fill='none' stroke='%23E0D8CC' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 56px 100px;
}

/* --- Lambda Constellation --- */
#lambda-constellation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#lambda-constellation.visible {
    opacity: 0.08;
}

/* --- Navigation --- */
#pattern-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 48px;
    background: rgba(245, 240, 232, 0.95);
    border-bottom: 1px solid var(--grid-line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.nav-item {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--deep-walnut);
    text-decoration: none;
    padding: 0 16px;
    position: relative;
    transition: color 0.2s ease;
}

.nav-item:hover {
    color: var(--sage-green);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 16px;
    width: 0;
    height: 2px;
    background: var(--sage-green);
    transition: width 0.3s ease-out;
}

.nav-item:hover::after,
.nav-item.active::after {
    width: calc(100% - 32px);
}

.pipe {
    font-family: 'Fira Code', monospace;
    color: var(--sage-green);
    font-size: 14px;
}

/* --- Page Sections --- */
.page-section {
    position: relative;
    z-index: 1;
    padding: 100px 120px 80px;
    min-height: 100vh;
}

.section-alt {
    background: var(--aged-linen);
}

/* --- Proof Tree Divider --- */
.proof-divider {
    text-align: center;
    margin-bottom: 60px;
}

.proof-rule {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 11px;
    color: var(--warm-slate);
    display: block;
    margin-bottom: 8px;
    font-feature-settings: "liga" 1, "calt" 1;
}

.proof-line {
    width: 200px;
    height: 1px;
    background: var(--code-border);
    margin: 0 auto;
}

/* ===========================
   HERO (LEXING)
   =========================== */
#hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.hero-type-sig {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(28px, 5vw, 56px);
    color: var(--deep-walnut);
    letter-spacing: -0.01em;
    line-height: 1.3;
    min-height: 1.3em;
}

.hero-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1.15rem;
    color: var(--warm-slate);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 1s ease;
}

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

/* ===========================
   MODULE GRID (PARSING)
   =========================== */
.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    max-width: 900px;
    margin: 0 auto;
}

.module-card {
    background: var(--warm-parchment);
    padding: 32px;
    border-top: 3px solid var(--sage-green);
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.06);
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.module-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.module-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 1.5rem;
    color: var(--deep-walnut);
    margin-bottom: 8px;
}

.module-card p {
    font-size: 0.95rem;
    color: var(--warm-slate);
    line-height: 1.65;
}

/* Geometric Markers */
.module-marker {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 8px;
    height: 8px;
}

.module-marker.circle {
    border-radius: 50%;
    background: var(--sage-green);
}

.module-marker.triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid var(--amber-glow);
    background: none;
}

.module-marker.square {
    background: var(--amber-glow);
}

/* ===========================
   TYPE CHECKING
   =========================== */
.type-check-layout {
    display: flex;
    gap: 60px;
    max-width: 1000px;
    margin: 0 auto;
    align-items: flex-start;
}

.code-panel {
    flex: 1;
}

.code-block {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    background: var(--pale-straw);
    border: 1px solid var(--code-border);
    padding: 24px;
    overflow-x: auto;
    font-feature-settings: "liga" 1, "calt" 1;
}

.line {
    display: block;
    min-height: 1.7em;
    transition: background 0.3s ease;
    padding: 0 4px;
}

.line.highlight {
    background: rgba(91, 140, 90, 0.1);
}

.kw { color: var(--sage-green); }
.ty { color: var(--amber-glow); }
.fn { color: var(--deep-walnut); }
.op { color: var(--warm-slate); }
.str { color: var(--warm-slate); font-style: italic; }

.type-diagram {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 20px;
}

.iso-block {
    text-align: center;
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.iso-block.active {
    opacity: 1;
    transform: scale(1.05);
}

.iso-block svg {
    width: 120px;
    height: 60px;
}

.block-label {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: 12px;
    color: var(--warm-slate);
    display: block;
    margin-top: 4px;
}

/* ===========================
   RESOURCES (COMPILATION)
   =========================== */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 900px;
    margin: 0 auto;
}

.resource-card {
    background: var(--warm-parchment);
    border-top: 3px solid var(--sage-green);
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.06);
    padding: 28px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.resource-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.resource-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--deep-walnut);
    margin-bottom: 8px;
}

.resource-card p {
    font-size: 0.9rem;
    color: var(--warm-slate);
    line-height: 1.6;
}

/* ===========================
   FOOTER (WHERE CLAUSE)
   =========================== */
#footer {
    background: var(--aged-linen);
    padding: 80px 120px 60px;
    position: relative;
    z-index: 1;
}

.where-clause {
    max-width: 600px;
    margin: 0 auto 40px;
}

.where-keyword {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 15px;
    color: var(--sage-green);
    display: block;
    margin-bottom: 12px;
    font-feature-settings: "liga" 1, "calt" 1;
}

.where-body {
    padding-left: 24px;
}

.where-def {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 14px;
    color: var(--deep-walnut);
    display: block;
    margin-bottom: 6px;
    font-feature-settings: "liga" 1, "calt" 1;
}

.colophon {
    text-align: center;
    padding-top: 40px;
}

.colophon-lambda {
    font-family: 'Cormorant Garamond', serif;
    font-size: 32px;
    color: var(--sage-green);
    display: block;
    margin-bottom: 8px;
}

.colophon-text {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: var(--warm-slate);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .module-card,
    .resource-card {
        opacity: 1;
        transform: none;
    }

    .hero-subtitle {
        opacity: 1;
    }

    #lambda-constellation {
        opacity: 0.08;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .page-section {
        padding: 80px 24px 60px;
    }

    #footer {
        padding: 60px 24px;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .type-check-layout {
        flex-direction: column;
    }

    .type-diagram {
        flex-direction: row;
        justify-content: center;
    }

    .nav-item {
        font-size: 12px;
        padding: 0 8px;
    }
}
