
:root {
    --color-void: #0B0606; /* Tinted to a very dark, smoky red/ash */
    --color-ember: #691F1A; /* Deep crimson extracted from reference */
    --color-text-main: #FDF4E5; /* Slightly warmer ivory */
    --color-text-muted: #D1A39C; /* Ash-rose to match the dark crimson */
    --color-text-subtle: #796664;
    --color-spine: #160D0D;
    --color-border: #351C1B;

    --font-serif: "Cormorant Garamond", serif;
    --font-sans: "JetBrains Mono", monospace;

    /* AAA Contrast scale */
    --size-step-0: clamp(1.125rem, 1.08rem + 0.22vw, 1.25rem); /* approx 18px-20px */
    --size-step-1: clamp(1.5rem, 1.39rem + 0.54vw, 1.8rem);
    --size-step-2: clamp(2rem, 1.76rem + 1.2vw, 2.66rem);
    --size-step-3: clamp(2.66rem, 2.19rem + 2.37vw, 3.99rem);
    --size-step-4: clamp(3.55rem, 2.68rem + 4.38vw, 5.99rem);

    --grid-size: 1px;
    --grid-color: rgba(255, 255, 255, 0.02);
}

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

::selection {
    background: var(--color-ember);
    color: var(--color-text-main);
    text-shadow: none;
}

::-moz-selection {
    background: var(--color-ember);
    color: var(--color-text-main);
    text-shadow: none;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
::-webkit-scrollbar {
    display: none;
}

body {
    background-color: var(--color-void);
    color: var(--color-text-main);
    font-family: var(--font-serif);
    line-height: 1.65;
    font-size: var(--size-step-0);
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Base Overlays for YC / Neocities brutalism */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04; /* Subdued for optimal long-form reading */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.15) 50%,
        rgba(0,0,0,0.15)
    );
    background-size: 100% 4px;
    opacity: 0.12; /* Reduced to protect typographic contrast */
}

/* Faint background grid to hint at "Architecture / Blueprint" */
.layout-container::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background: 
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.6;
}

/* Accessibility: Hidden Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}
.skip-link:focus {
    top: 0;
}

/* Base Layout Structure */
#scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 3px;
    background: transparent;
    z-index: 100;
    pointer-events: none;
}

#scroll-progress-bar {
    width: 0%;
    height: 100%;
    background: var(--color-ember);
    transform-origin: left;
    will-change: width;
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.8);
}

.layout-container {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    container-type: inline-size;
    width: 100vw;
    min-height: 100vh;
    position: relative;
}

/* Faint full-skin veil to avoid hard cutoffs and blend animated layers. */
.layout-container::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background:
        radial-gradient(circle at 50% 42%, rgba(50, 19, 16, 0.08) 0%, rgba(19, 8, 8, 0.0) 58%),
        linear-gradient(90deg, rgba(19, 8, 8, 0.02) 0%, rgba(19, 8, 8, 0.12) 100%);
}

/* GL Container - Starts fullscreen, transitions on scroll */
.gl-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none; /* Let clicks pass to the essay if overlaid */
    transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1), opacity 1s ease;
    will-change: transform, opacity;
    overflow: hidden;
}

.gl-container.scrolled {
    transform: translateX(-28vw); /* Push it further left to avoid text bleed */
    opacity: 0.65; 
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.2) 70%, rgba(0, 0, 0, 0.0) 90%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 40%, rgba(0, 0, 0, 0.2) 70%, rgba(0, 0, 0, 0.0) 90%);
}

.gl-container canvas {
    display: block;
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
}

.gl-container.scrolled canvas {
    transform: translateX(0vw); /* Keep internal shift neutral so flame remains centralized on the left */
}

/* Scroll Prompt area for initial hero view */
.intro-spacer {
    height: 100vh;
    width: 100%;
    grid-column: 1 / -1;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end; /* Push to the right, aligning with essay */
    padding-bottom: 25vh;
    padding-right: 8vw;
    pointer-events: none;
}

.scroll-prompt {
    font-family: var(--font-sans);
    color: var(--color-ember);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    border: 1px solid var(--color-ember);
    padding: 0.5rem 1rem;
    background: rgba(19, 8, 8, 0.4);
    box-shadow: inset 0 0 10px rgba(220, 20, 60, 0.1);
}

.typewriter-text {
    margin-right: 2px;
}

.blinking-cursor {
    animation: blink 1s step-start infinite;
    color: var(--color-text-main);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Essay Container - Starts further down or overlaying */
.essay-container {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    grid-column: 1 / -1;
}

.essay-wrapper {
    width: 100%;
    grid-column: 10 / -1; /* spans across the right side of the 24 col grid */
    max-width: 75ch; /* intrinsic constraint */
    padding: 10vh 4ch 20vh 6ch;
    background: transparent;
    border-left: 1px dotted rgba(255,255,255,0.1);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
}

.essay-wrapper::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -5vw; right: 0; /* Smooth the text shield blending */
    background: linear-gradient(90deg, rgba(19, 8, 8, 0.0) 0%, rgba(19, 8, 8, 0.85) 18%, rgba(19, 8, 8, 1) 100%); /* Gentler shield slope */
    z-index: -1;
}

.layout-container.is-scrolled .essay-wrapper {
    opacity: 1;
    transform: translateY(0);
}

/* Document Meta-data / Neocities header */
.doc-meta {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--color-ember);
    letter-spacing: 0.1em;
    display: flex;
    gap: 2rem;
    margin-bottom: 4rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 1rem;
}

/* Typographic Strictness for Essay */
article h1.manifesto-title {
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: clamp(3rem, 6vw, 6rem); /* Responsive Units: utilize VW */
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5em;
    color: var(--color-text-main);
    text-transform: capitalize;
}

article h1 {
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: clamp(2.5rem, 5vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5em;
    color: var(--color-text-main);
}

article h2 {
    font-family: var(--font-sans);
    font-size: clamp(0.9rem, 1.5vw, 1.25rem); /* Responsive Units */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-ember);
    margin-top: 4em;
    margin-bottom: 1em;
    border-top: 1px dashed var(--color-border);
    border-bottom: 1px dashed var(--color-border);
    padding: 0.75em 0;
    position: relative;
    display: inline-block;
}

article p {
    font-size: clamp(1.125rem, 1rem + 0.4vw, 1.5rem); /* Flexible units */
    line-height: 1.65; /* Comfortable line height */
    letter-spacing: 0.01em; /* Restored tracking: Wide tracking destroys saccadic eye-movement for reading */
    max-width: 65ch; /* Long lines are difficult: Ideal length 45-75 chars */
    margin-bottom: 1.2em; /* Adjusted paragraph spacing */
    color: var(--color-text-main);
    font-weight: 400;
}

article blockquote {
    position: relative;
    font-family: var(--font-sans);
    font-size: clamp(0.9rem, 0.7rem + 0.5vw + 0.5vh, 1.2rem);
    line-height: 1.6;
    color: var(--color-text-muted);
    border-left: 2px dashed var(--color-text-subtle);
    padding: 1.5rem 0 1.5rem 2.5rem;
    margin: clamp(3rem, 5vh, 5rem) 0;
    max-width: 55ch;
    background: transparent;
    box-shadow: none;
}

/* Ensure conclusion stands out gently */
.quote-author {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-ember);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 1rem;
    font-style: normal;
}
.handoff-note {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.3) !important;
    margin-top: 6rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 2rem;
}

/* Media Queries for mobile responsiveness */
@media (max-width: 1024px) {
    .gl-container.scrolled {
        width: 100vw;
        opacity: 0.3; /* Sink to background on smaller screens */
    }
    
    .essay-wrapper {
        max-width: 100vw;
        grid-column: 1 / -1;
        padding: 5vh 5vw 15vh 5vw;
        background: rgba(3,3,3,0.85); /* Darken everything to maintain contrast */
    }

    .manifesto-site-bar {
        padding-left: 3vw;
        padding-right: 3vw;
    }
}

/* Top home bar + leave dialog (manifesto) */
.manifesto-site-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.6rem 1.1rem 0.85rem;
    background: linear-gradient(180deg, rgba(11, 6, 6, 0.94) 0%, rgba(11, 6, 6, 0.55) 82%, transparent 100%);
    pointer-events: auto;
}

.manifesto-brand-btn {
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: rgba(19, 8, 8, 0.45);
    border: 1px solid rgba(105, 31, 26, 0.45);
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.manifesto-brand-btn:hover,
.manifesto-brand-btn:focus-visible {
    color: var(--color-text-main);
    border-color: var(--color-ember);
    outline: none;
}

.manifesto-site-dialog {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: var(--color-spine);
    color: var(--color-text-muted);
    width: min(92vw, 26rem);
    max-height: min(86vh, 22rem);
}

.manifesto-site-dialog::backdrop {
    background: rgba(6, 3, 3, 0.82);
    backdrop-filter: blur(4px);
}

.manifesto-site-dialog__inner {
    position: relative;
    padding: 1.4rem 1.2rem 1.2rem;
}

.manifesto-site-dialog__title {
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 3vw, 1.45rem);
    font-weight: 400;
    color: var(--color-text-main);
    margin-bottom: 0.65rem;
    padding-right: 2rem;
}

.manifesto-site-dialog__body {
    font-size: var(--size-step-0);
    line-height: 1.55;
    margin-bottom: 0.5rem;
}

.manifesto-site-dialog__close {
    position: absolute;
    top: 0.45rem;
    right: 0.4rem;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    background: transparent;
    color: var(--color-text-subtle);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.manifesto-site-dialog__close:hover,
.manifesto-site-dialog__close:focus-visible {
    color: var(--color-text-main);
    outline: none;
}

.manifesto-site-dialog__actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1rem;
}

@media (min-width: 480px) {
    .manifesto-site-dialog__actions {
        flex-direction: row;
        justify-content: flex-end;
    }

    .manifesto-btn {
        min-width: 7.5rem;
    }
}

.manifesto-btn {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.6rem 0.95rem;
    cursor: pointer;
    border-radius: 0;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.manifesto-btn--ghost {
    background: transparent;
    border: 1px solid rgba(121, 102, 100, 0.45);
    color: var(--color-text-subtle);
}

.manifesto-btn--accent {
    background: rgba(105, 31, 26, 0.35);
    border: 1px solid rgba(212, 90, 80, 0.45);
    color: var(--color-text-main);
}

.manifesto-btn--ghost:hover,
.manifesto-btn--ghost:focus-visible,
.manifesto-btn--accent:hover,
.manifesto-btn--accent:focus-visible {
    border-color: var(--color-ember);
    outline: none;
}
