/* =========================================
   haskeller.net — Dark Academia + HUD Overlay
   ========================================= */

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

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

body {
    background: #1A1612;
    color: #EDE4D4;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    overflow-x: hidden;
    /* neutral black fallback: #1A1A1A */
    position: relative;
}

/* --- Film Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: overlay;
    opacity: 0.04;
    filter: url(#grain-filter);
    background: rgba(255, 255, 255, 0.5);
    transition: opacity 200ms ease;
}

/* --- HUD Navigation Spine --- */
#hud-spine {
    position: fixed;
    left: 24px;
    top: 0;
    height: 100vh;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.spine-line {
    position: absolute;
    top: 15%;
    bottom: 15%;
    width: 0;
    border-left: 1px dashed #8B7355;
}

.spine-diamond {
    width: 12px;
    height: 12px;
    background: #2B2219;
    border: 1px solid #8B7355;
    transform: rotate(45deg);
    margin: 24px 0;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: all 300ms ease;
}

.spine-diamond:hover {
    border-color: #E8A84C;
    background: #2B2219;
    box-shadow: 0 0 12px rgba(232, 168, 76, 0.4);
}

.spine-diamond.active {
    background: #E8A84C;
    border-color: #E8A84C;
    box-shadow: 0 0 16px rgba(232, 168, 76, 0.5);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 8px rgba(232, 168, 76, 0.3); }
    50% { box-shadow: 0 0 20px rgba(232, 168, 76, 0.6); }
}

/* --- Viewport Sections --- */
.viewport-section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    padding: 80px 80px 80px 64px;
}

/* --- Cityscape CSS Backgrounds --- */
.cityscape {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.cityscape::before,
.cityscape::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 100%;
}

.cityscape-1::before {
    height: 60%;
    background:
        linear-gradient(to top, #2B2219 0%, transparent 100%),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 40px,
            #2B2219 40px, #2B2219 46px,
            transparent 46px, transparent 120px
        ),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 200px,
            #2B2219 200px, #2B2219 205px,
            transparent 205px, transparent 350px
        );
}

.cityscape-1::after {
    height: 45%;
    background:
        radial-gradient(1px 1px at 15% 30%, rgba(196, 149, 106, 0.15) 50%, transparent 50%),
        radial-gradient(1px 1px at 25% 50%, rgba(196, 149, 106, 0.12) 50%, transparent 50%),
        radial-gradient(1px 1px at 45% 25%, rgba(196, 149, 106, 0.15) 50%, transparent 50%),
        radial-gradient(1px 1px at 55% 60%, rgba(196, 149, 106, 0.1) 50%, transparent 50%),
        radial-gradient(1px 1px at 70% 35%, rgba(196, 149, 106, 0.15) 50%, transparent 50%),
        radial-gradient(1px 1px at 85% 45%, rgba(196, 149, 106, 0.12) 50%, transparent 50%),
        radial-gradient(1px 1px at 35% 70%, rgba(232, 168, 76, 0.1) 50%, transparent 50%),
        radial-gradient(1px 1px at 90% 20%, rgba(196, 149, 106, 0.15) 50%, transparent 50%);
}

.cityscape-2::before {
    height: 70%;
    background:
        linear-gradient(to top, #2B2219 0%, transparent 100%),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 30px,
            #2B2219 30px, #2B2219 35px,
            transparent 35px, transparent 80px
        ),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 150px,
            #2B2219 150px, #2B2219 157px,
            transparent 157px, transparent 250px
        );
}

.cityscape-2::after {
    height: 55%;
    background:
        radial-gradient(1px 1px at 10% 20%, rgba(196, 149, 106, 0.18) 50%, transparent 50%),
        radial-gradient(1px 1px at 20% 40%, rgba(196, 149, 106, 0.15) 50%, transparent 50%),
        radial-gradient(1px 1px at 30% 15%, rgba(196, 149, 106, 0.18) 50%, transparent 50%),
        radial-gradient(1px 1px at 50% 55%, rgba(196, 149, 106, 0.12) 50%, transparent 50%),
        radial-gradient(1px 1px at 60% 30%, rgba(196, 149, 106, 0.18) 50%, transparent 50%),
        radial-gradient(1px 1px at 75% 50%, rgba(196, 149, 106, 0.15) 50%, transparent 50%),
        radial-gradient(1px 1px at 40% 65%, rgba(232, 168, 76, 0.12) 50%, transparent 50%),
        radial-gradient(1px 1px at 88% 25%, rgba(196, 149, 106, 0.18) 50%, transparent 50%),
        radial-gradient(1px 1px at 95% 42%, rgba(196, 149, 106, 0.15) 50%, transparent 50%);
}

.cityscape-3::before {
    height: 50%;
    background:
        linear-gradient(to top, #2B2219 0%, transparent 100%),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 60px,
            #2B2219 60px, #2B2219 64px,
            transparent 64px, transparent 180px
        );
}

.cityscape-3::after {
    height: 40%;
    background:
        radial-gradient(1px 1px at 20% 30%, rgba(196, 149, 106, 0.12) 50%, transparent 50%),
        radial-gradient(1px 1px at 50% 50%, rgba(196, 149, 106, 0.1) 50%, transparent 50%),
        radial-gradient(1px 1px at 80% 40%, rgba(196, 149, 106, 0.12) 50%, transparent 50%);
}

.cityscape-4::before {
    height: 30%;
    background: linear-gradient(to top, #2B2219 0%, transparent 100%);
}

.cityscape-5::before {
    height: 55%;
    background:
        linear-gradient(to top, #2B2219 0%, transparent 100%),
        repeating-linear-gradient(90deg,
            transparent 0px, transparent 50px,
            #2B2219 50px, #2B2219 54px,
            transparent 54px, transparent 140px
        );
}

.cityscape-5::after {
    height: 45%;
    background:
        radial-gradient(1px 1px at 15% 35%, rgba(196, 149, 106, 0.15) 50%, transparent 50%),
        radial-gradient(1px 1px at 40% 20%, rgba(196, 149, 106, 0.12) 50%, transparent 50%),
        radial-gradient(1px 1px at 65% 55%, rgba(232, 168, 76, 0.1) 50%, transparent 50%),
        radial-gradient(1px 1px at 85% 30%, rgba(196, 149, 106, 0.15) 50%, transparent 50%);
}

/* --- Lambda Watermarks --- */
.lambda-watermark {
    position: absolute;
    font-family: 'Cormorant Garamond', serif;
    font-size: 500px;
    font-weight: 400;
    color: #C4956A;
    opacity: 0.03;
    z-index: 0;
    pointer-events: none;
    line-height: 1;
    user-select: none;
}

.lambda-wm-1 {
    bottom: -50px;
    right: 5%;
    transform: rotate(-15deg);
}

.lambda-wm-2 {
    top: 10%;
    right: -5%;
    transform: rotate(8deg);
    font-size: 450px;
}

.lambda-wm-3 {
    bottom: 5%;
    left: 5%;
    transform: rotate(-5deg);
    font-size: 400px;
}

.lambda-wm-4 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(12deg);
    font-size: 600px;
    opacity: 0.025;
}

.lambda-wm-5 {
    bottom: -30px;
    left: 15%;
    transform: rotate(-8deg);
    font-size: 350px;
}

/* --- HUD Panels --- */
.hud-panel {
    background: rgba(26, 22, 18, 0.85);
    border: 1px solid #C4956A;
    border-radius: 4px;
    padding: 32px 40px;
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hud-panel[data-animate="slide-right"] {
    transform: translateX(-60px);
}

.hud-panel[data-animate="slide-left"] {
    transform: translateX(60px);
}

.hud-panel[data-animate="fade-in"] {
    transform: translateY(20px);
}

.hud-panel.visible {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* --- Section 1: THE PROOF --- */
#the-proof {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 15vh;
    padding-left: 80px;
}

.panel-proof {
    max-width: 600px;
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 6vw;
    letter-spacing: -0.02em;
    color: #C4956A;
    line-height: 1.05;
    margin-bottom: 16px;
}

.entry-point {
    margin-bottom: 12px;
}

.code-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 15px;
    color: #E8A84C;
}

.subtitle-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 18px;
    color: #A89880;
    font-style: italic;
    margin-top: 8px;
}

/* --- Lambda Gutter Ticker --- */
.lambda-gutter {
    height: 80px;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    background: #151210;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
    position: relative;
    z-index: 2;
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: ticker 40s linear infinite;
}

.ticker-reverse {
    animation: ticker-rtl 35s linear infinite;
}

.ticker-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    color: #8B7355;
    padding-right: 0;
    flex-shrink: 0;
}

@keyframes ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes ticker-rtl {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

/* --- Section 2: THE TYPES --- */
#the-types {
    flex-direction: row;
    align-items: center;
    gap: 40px;
    padding-left: 80px;
    padding-right: 60px;
}

.panel-types-manifesto {
    max-width: 520px;
    flex-shrink: 0;
}

.panel-types-code {
    max-width: 520px;
    margin-left: auto;
    align-self: center;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 48px;
    letter-spacing: -0.02em;
    color: #C4956A;
    margin-bottom: 24px;
    line-height: 1.1;
}

.body-prose {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: #EDE4D4;
    margin-bottom: 16px;
}

.body-prose:last-child {
    margin-bottom: 0;
}

.body-prose em {
    color: #C4956A;
    font-style: italic;
}

/* --- Code Block --- */
.code-block {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #151210;
    padding: 24px;
    border-radius: 4px;
    overflow-x: auto;
    color: #EDE4D4;
}

.code-comment { color: #8B7355; }
.code-keyword { color: #D4713B; }
.code-type { color: #E8A84C; }
.code-fn { color: #C4956A; }

/* --- Section 3: THE COMPOSITION --- */
#the-composition {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding-left: 80px;
}

.composition-heading {
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.composition-heading.visible {
    opacity: 1;
    transform: translateX(0);
}

.composition-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    z-index: 2;
}

.hover-card {
    cursor: default;
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(196, 149, 106, 0.15);
}

.card-1 {
    max-width: 440px;
    margin-left: 0;
}

.card-2 {
    max-width: 440px;
    margin-left: 120px;
}

.card-3 {
    max-width: 440px;
    margin-left: 240px;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 32px;
    color: #C4956A;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.card-subtitle {
    margin-bottom: 12px;
    color: #A89880;
}

/* --- Section 4: THE LAMBDA --- */
#the-lambda {
    align-items: center;
    justify-content: center;
}

.panel-lambda-center {
    max-width: 800px;
    text-align: center;
    margin: 0 auto;
    background: rgba(26, 22, 18, 0.9);
}

.lambda-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(28px, 4vw, 56px);
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: #EDE4D4;
    margin-bottom: 24px;
}

.quote-attribution {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 16px;
    color: #A89880;
    letter-spacing: 0.05em;
}

/* --- Section 5: THE FUNCTION --- */
#the-function {
    align-items: flex-end;
    justify-content: flex-end;
    padding-bottom: 120px;
    flex-direction: column;
}

.function-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: flex-end;
    margin-right: 0;
    position: relative;
    z-index: 2;
}

.link-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    padding: 20px 32px;
    min-width: 280px;
}

.link-card:hover {
    border-color: #D4713B;
}

.link-label {
    font-size: 11px;
    color: #8B7355;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.link-name {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 28px;
    color: #C4956A;
    letter-spacing: -0.02em;
    transition: color 200ms ease;
}

.link-card:hover .link-name {
    color: #D4713B;
}

.link-sig {
    color: #A89880;
    font-size: 13px;
}

.function-return {
    position: absolute;
    bottom: 40px;
    left: 80px;
    z-index: 2;
}

.function-return .code-text {
    font-size: 14px;
    color: #8B7355;
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .viewport-section {
        padding: 60px 24px 60px 48px;
    }
    
    #the-proof {
        padding-left: 48px;
        padding-top: 10vh;
    }
    
    .site-title {
        font-size: 10vw;
    }
    
    #the-types {
        flex-direction: column;
        padding-left: 48px;
        padding-right: 24px;
    }
    
    .panel-types-manifesto,
    .panel-types-code {
        max-width: 100%;
        margin-left: 0;
    }
    
    #the-composition {
        padding-left: 48px;
    }
    
    .card-1, .card-2, .card-3 {
        margin-left: 0;
        max-width: 100%;
    }
    
    .card-2 { margin-left: 32px; }
    .card-3 { margin-left: 64px; }
    
    #hud-spine {
        left: 12px;
    }
    
    .function-links {
        align-self: flex-end;
    }
    
    .function-return {
        left: 48px;
    }
}

@media (max-width: 600px) {
    .viewport-section {
        padding: 40px 16px 40px 40px;
    }
    
    #the-proof {
        padding-left: 40px;
    }
    
    .site-title {
        font-size: 12vw;
    }
    
    .section-heading {
        font-size: 36px;
    }
    
    .card-2, .card-3 {
        margin-left: 0;
    }
    
    .lambda-quote {
        font-size: 24px;
    }
    
    .link-card {
        min-width: auto;
    }
}
