/* ============================================================
   haskeller.net - Styles
   Typography: Cormorant Garamond, Source Sans 3, JetBrains Mono
   Palette: Cool Grays (#f7f8f9, #e8eaed, #f2f3f5, #edeef0,
            #2d2d2d, #5a6370, #7a8a99, #3d4f5f, #1a1d21)
   ============================================================ */

/* --- Reset & Base --- */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #2d2d2d;
    background-color: #f7f8f9;
    overflow-x: hidden;
}

/* --- Lambda Home Link (Fixed Top-Left) --- */

.lambda-home {
    position: fixed;
    top: 2rem;
    left: 2rem;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.2rem;
    color: #3d4f5f;
    text-decoration: none;
    z-index: 100;
    transition: color 0.3s ease;
}

.lambda-home:hover {
    color: #7a8a99;
}

/* --- Main Navigation (Fixed Top-Right, hidden initially) --- */

.main-nav {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    gap: 2rem;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.main-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

.main-nav a {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #2d2d2d;
    text-decoration: none;
    background: linear-gradient(#7a8a99, #7a8a99) no-repeat bottom left;
    background-size: 0% 1px;
    padding-bottom: 2px;
    transition: background-size 0.3s ease, color 0.3s ease;
}

.main-nav a:hover {
    background-size: 100% 1px;
    color: #3d4f5f;
}

/* --- Hero Watermark Lambda --- */

.hero-watermark {
    position: fixed;
    top: 50%;
    right: -5vw;
    transform: translateY(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 30vw;
    color: #f7f8f9;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    line-height: 1;
    user-select: none;
}

/* --- Hero Section (The Fog Gate) --- */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f7f8f9;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #edeef0 0%, #e8eaed 100%);
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hero.loaded::before {
    opacity: 1;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 0 clamp(1.5rem, 5vw, 4rem);
}

.hero-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.hero-rule {
    display: block;
    width: 120px;
    height: 1px;
    background-color: #7a8a99;
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.6s ease-out;
}

.hero.loaded .hero-rule {
    transform: scaleX(1);
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2.6rem, 5.5vw, 4.8rem);
    line-height: 1.15;
    color: #2d2d2d;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.hero.loaded .hero-title {
    opacity: 1;
    transform: translateY(0);
}

.hero-description {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    line-height: 1.72;
    color: #5a6370;
    margin-top: 2rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.hero.loaded .hero-description {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll chevron */
.scroll-chevron {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border: none;
    border-right: 1px solid #7a8a99;
    border-bottom: 1px solid #7a8a99;
    transform: translateX(-50%) rotate(45deg);
    animation: chevronPulse 3s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Nav sentinel */
.nav-sentinel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 1px;
    height: 1px;
}

/* --- Reading Surface (Content Zone) --- */

.reading-surface {
    display: grid;
    grid-template-columns: 1fr minmax(0, 680px) 1fr;
    padding: 0 clamp(1.5rem, 5vw, 4rem);
}

.reading-surface > * {
    grid-column: 2;
}

/* --- Content Sections --- */

.content-section {
    padding-top: 0;
    padding-bottom: 0;
}

/* --- Section Separators --- */

.section-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 8rem;
}

.diamond {
    display: block;
    width: 12px;
    height: 12px;
    background-color: #7a8a99;
    opacity: 0.4;
    transform: rotate(45deg);
    transition: opacity 0.4s ease, transform 0.3s ease;
}

.diamond:hover {
    opacity: 0.8;
    transform: rotate(135deg);
}

.lambda-ornament {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 0.7rem;
    color: #2d2d2d;
    opacity: 0.3;
}

/* --- Fade Reveal Animation --- */

.fade-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Typography --- */

h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    line-height: 1.15;
    color: #2d2d2d;
    margin-bottom: 1.5em;
}

h3 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.2rem, 2.2vw, 1.5rem);
    line-height: 1.15;
    color: #2d2d2d;
    margin-bottom: 0.75em;
}

p {
    margin-bottom: 1.5em;
    color: #2d2d2d;
}

p:last-child {
    margin-bottom: 0;
}

/* --- Article Entries --- */

.article-entry {
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid #f2f3f5;
}

.article-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.article-meta {
    display: block;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.8125rem;
    color: #5a6370;
    margin-bottom: 1em;
}

/* --- Photography --- */

.photo-section {
    grid-column: 2;
}

.photo-container {
    position: relative;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    overflow: hidden;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background-color: #e8eaed;
    transform: translateX(0);
    transition: transform 0.4s ease-out;
    z-index: 2;
}

.photo-container.revealed .photo-overlay {
    transform: translateX(-101%);
}

.photo-placeholder {
    width: 100%;
    filter: saturate(0) brightness(1.1);
    transition: filter 0.4s ease-out 0.4s;
}

.photo-container.revealed .photo-placeholder {
    filter: saturate(0.65) brightness(1);
}

.photo-placeholder svg {
    display: block;
    width: 100%;
    height: auto;
}

.photo-placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #e8eaed20;
    mix-blend-mode: multiply;
    pointer-events: none;
}

.photo-border {
    width: 100%;
    height: 1px;
    background-color: #f2f3f5;
    margin-top: 0.5rem;
}

figcaption {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.8125rem;
    color: #5a6370;
    margin-top: 0.75rem;
}

/* --- Pull Quote --- */

.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.4rem, 2.8vw, 1.8rem);
    line-height: 1.5;
    color: #2d2d2d;
    border-left: 3px solid #7a8a99;
    padding-left: 1.5rem;
    margin: 2rem 0;
}

.pull-quote cite {
    display: block;
    margin-top: 1rem;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-style: normal;
    font-size: 0.8125rem;
    color: #5a6370;
    letter-spacing: 0.05em;
}

/* --- Code Blocks --- */

.code-block {
    position: relative;
    background: #f2f3f5;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 2px solid transparent;
    overflow-x: auto;
}

.code-border-anim {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 0;
    background-color: #7a8a99;
    transition: height 0.4s ease-out 0.2s;
}

.code-block.border-drawn .code-border-anim {
    height: 100%;
}

.code-block pre {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #2d2d2d;
    white-space: pre;
    overflow-x: auto;
}

.code-block code {
    font-family: inherit;
    font-size: inherit;
}

/* Haskell syntax highlighting (palette only) */
.hs-comment {
    color: #5a6370;
}

.hs-keyword {
    color: #3d4f5f;
    font-weight: 400;
}

.hs-type {
    color: #7a8a99;
}

.hs-default {
    color: #2d2d2d;
}

/* --- Resource Lists --- */

.resource-list {
    list-style: none;
    padding: 0;
    margin-bottom: 2rem;
}

.resource-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f2f3f5;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.resource-list li:last-child {
    border-bottom: none;
}

.resource-title {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: #2d2d2d;
}

.resource-meta {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.8125rem;
    color: #5a6370;
}

/* --- Contact Links --- */

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.5rem;
}

.contact-link {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    color: #3d4f5f;
    text-decoration: none;
    background: linear-gradient(#7a8a99, #7a8a99) no-repeat bottom left;
    background-size: 0% 1px;
    padding-bottom: 2px;
    transition: background-size 0.3s ease, color 0.3s ease;
}

.contact-link:hover {
    background-size: 100% 1px;
    color: #2d2d2d;
}

/* --- Footer --- */

.site-footer {
    background-color: #1a1d21;
    color: #e8eaed;
    margin-top: 8rem;
    padding: 4rem clamp(1.5rem, 5vw, 4rem);
}

.footer-content {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

.footer-rule {
    width: 120px;
    height: 1px;
    background-color: #3d4f5f;
    margin: 0 auto 2rem;
}

.footer-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.footer-lambda {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.5rem;
    color: #7a8a99;
}

.footer-domain {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 1.2rem;
    color: #e8eaed;
    letter-spacing: 0.1em;
}

.footer-text {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.8125rem;
    color: #5a6370;
    margin-bottom: 1rem;
}

.footer-copyright {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    color: #5a6370;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .lambda-home {
        top: 1.5rem;
        left: 1.5rem;
    }

    .main-nav {
        top: 1.5rem;
        right: 1.5rem;
        gap: 1.2rem;
    }

    .main-nav a {
        font-size: 0.75rem;
        letter-spacing: 0.15em;
    }

    .hero-rule {
        width: 60px;
    }

    .section-separator {
        height: 5rem;
    }

    .contact-links {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .main-nav {
        flex-direction: column;
        gap: 0.8rem;
        align-items: flex-end;
    }

    .hero-title-wrapper {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-rule {
        width: 60px;
    }
}

/* --- Selection styling --- */

::selection {
    background-color: #e8eaed;
    color: #2d2d2d;
}

/* --- Scrollbar styling (Webkit) --- */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f7f8f9;
}

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

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