/* ===== RETRO-FUTURISTIC DATA ARCHIVE (ESSAYS) ===== */
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

/* ===== VARIABLES ===== */
:root {
    --bg-color: #F5F5DC;
    --text-color: #000000;
    --accent-orange: #FF4500;
    --border-thick: 3px solid #000000;
    --border-thin: 1px solid #000000;
    --font-head: 'VT323', monospace;
    --font-code: 'Share Tech Mono', monospace;
}

/* ===== BASE LAYOUT ===== */
.essay-archive-body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-code);
    overflow-x: hidden;
    min-height: 100vh;
}

#essay-particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    opacity: 0.15;
}

.essay-archive-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== HEADER SECTION ===== */
.essay-header {
    padding-top: 2rem;
    margin-bottom: 2rem;
}

.essay-header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Back Button */
.back-link-keypad {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: #000;
    color: var(--bg-color);
    text-decoration: none;
    border: 2px solid #000;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    margin: 0;
    /* Ensure no margin */
}

.back-link-keypad:hover {
    background-color: var(--accent-orange);
    color: #000;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.3);
}

.keypad-icon {
    font-size: 1.5rem;
    font-family: var(--font-head);
    line-height: 1;
}

/* Title Block */
.header-title-block {
    flex: 1;
}

.archive-main-title {
    font-family: var(--font-head);
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 1;
    /* Reset to 1 */
    margin: 0;
    /* Ensure 0 margin */
    text-transform: uppercase;
    color: #000;
}

.header-sub-meta {
    font-family: var(--font-code);
    font-size: 0.9rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.8;
}

.status-online {
    color: var(--accent-orange);
    font-weight: bold;
    animation: blink 2s infinite;
}

.header-heavy-border {
    height: 4px;
    background-color: #000;
    width: 100%;
    margin-top: 0.5rem;
}

/* ===== MAIN CONTENT ===== */
.essay-main {
    padding-top: 20px;
    margin-top: 2rem;
    flex: 1;
}

/* ===== LIST VIEW: THE STACK ===== */
/* ===== LIST VIEW: THE STACK ===== */
.essay-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 3px solid #000;
    /* Use simpler border */
    border-radius: 0;
    /* Remove rounding for industrial look */
    overflow: hidden;
    background-color: #000;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.1);
}

.essay-card {
    background-color: var(--bg-color);
    border-bottom: 2px solid #000;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically if needed, or just let it flow */
    min-height: auto;
    /* Let content dictate height */
    position: relative;
    text-decoration: none;
}

.essay-card:last-child {
    border-bottom: none;
}

/* Hover State */
.essay-card:hover {
    background-color: #000;
}

.essay-card:hover .card-title {
    color: var(--accent-orange);
}

.essay-card:hover .card-footer {
    border-top-color: var(--accent-orange);
}


/* Card Title - MASSIVE */
.card-title {
    font-family: 'VT323', monospace;
    font-size: clamp(3rem, 5vw, 5rem);
    text-transform: uppercase;
    line-height: 0.9;
    margin: 1rem 0;
    color: #000;
    transition: color 0.2s ease;
    text-align: left;
    /* Explicitly align left */
}

/* Card Footer - Minimal & Orange */
.card-footer {
    display: flex;
    justify-content: space-between;
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    /* Slightly larger */
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 2px solid #000;
    /* Thick divider */
    color: var(--accent-orange);
    font-weight: bold;
}

.bold-orange {
    color: var(--accent-orange);
    font-weight: bold;
}


/* ===== READER VIEW: THE READOUT CONSOLE ===== */
.essay-reader-view {
    border: 4px solid #000;
    padding: 0;
    background: #F5F5DC;
    margin-top: 2rem;
}

.reader-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2rem 2rem 0 2rem;
    margin-bottom: 2rem;
    /* Removed border from container */
}

.reader-back-keysquare {
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: #000;
    color: var(--bg-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-bottom: 1rem;
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    text-transform: uppercase;
}

.reader-back-keysquare:hover {
    background: var(--accent-orange);
    color: #000;
}

.reader-title-wrapper {
    width: 100%;
}

.reader-title {
    font-family: 'VT323', monospace;
    font-size: clamp(2rem, 4vw, 3.5rem);
    /* Tighter max size */
    line-height: 1.1;
    text-transform: uppercase;
    border-bottom: 4px solid #000;
    padding-bottom: 1rem;
    margin: 1.5rem 0 1rem 0;
    letter-spacing: -2px;
    /* Tight, dense look */
}

/* Metadata (Injected) */
.doc-meta {
    font-family: 'Share Tech Mono', monospace;
    color: #FF4500;
    font-weight: bold;
    display: flex;
    justify-content: flex-start;
    gap: 2rem;
    margin-bottom: 3rem;
    margin: 0 auto 3rem auto;
    /* Match content alignment */
    padding: 0 2rem;
    font-size: 1rem;
    flex-wrap: wrap;
    max-width: 900px;
    /* Match content max-width */
    width: 100%;
}

/* Progress Widget - Minimal LEFT SIDE */
.reading-progress-container {
    position: fixed;
    top: 50%;
    /* Calculated: Center (50%) - Half Content Width (450px) - Gap (70px) */
    left: calc(50% - 520px);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    height: 50vh;
    z-index: 1000;
}

.progress-bar-wrapper {
    width: 8px;
    height: 100%;
    background: transparent;
    border: 2px solid #000;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.progress-bar {
    width: 100%;
    height: 0%;
    background: #FF4500;
    transition: height 0.1s linear;
}

.progress-meta {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    color: #000;
}

.progress-label {
    letter-spacing: 2px;
}

.progress-percent {
    display: none;
    /* Hide percentage if minimal look desired, or style it */
}


/* Content - Widened */
.essay-content {
    margin: 0 auto 4rem auto;
    padding: 0 2rem;
    font-size: 1.2rem;
    line-height: 1.6;
    text-align: justify;
    max-width: 900px;
    width: 100%;
    font-family: 'Share Tech Mono', monospace;
}

.essay-paragraph {
    margin-bottom: 1.5rem;
}

.essay-end-marker {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 4rem 2rem;
    opacity: 0.5;
    font-family: 'Share Tech Mono', monospace;
}

.end-block {
    flex: 1;
    height: 2px;
    background: #000;
}

/* Footer */
.essay-footer {
    margin-top: auto;
    border-top: 3px solid #000;
    padding: 2rem;
    text-align: center;
    font-family: var(--font-code);
    font-size: 0.9rem;
    opacity: 0.7;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .essay-card {
        padding: 1.5rem;
    }

    .card-title {
        font-size: 2rem;
    }

    .essay-content {
        margin: 0 1rem 3rem 1rem;
        font-size: 1.1rem;
    }

    /* Hide sticky widget on very small screens if needed, or adjust */
    .reading-progress-container {
        display: none;
        /* Often better to hide on mobile if it blocks content */
    }
}

/* ===== CRT HEAVY DATA TRANSITIONS ===== */

/* SHARED SETTINGS */
.anim-slide-up-out,
.anim-slide-up-in,
.anim-slide-down-out,
.anim-slide-down-in {
    /* "Expo Out" easing for a mechanical snap effect */
    animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
    animation-duration: 0.6s;
    animation-fill-mode: forwards;
    will-change: transform, opacity, filter;
}

/* 1. LOAD CARTRIDGE (List -> Reader) */
.anim-slide-up-out {
    animation-name: crt-power-out-up;
}

.anim-slide-up-in {
    animation-name: crt-power-in-up;
}

/* 2. EJECT CARTRIDGE (Reader -> List) */
.anim-slide-down-out {
    animation-name: crt-power-out-down;
}

.anim-slide-down-in {
    animation-name: crt-power-in-down;
}

/* KEYFRAMES */

/* Exit Up: Signal gets bright, blurs, and snaps away */
@keyframes crt-power-out-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: brightness(1) blur(0);
    }

    40% {
        filter: brightness(2) blur(2px);
    }

    /* Bloom */
    100% {
        opacity: 0;
        transform: translateY(-20px) scaleY(0.1);
        /* Compress vertically like a scanline */
        filter: brightness(3) blur(10px);
    }
}

/* 1. LOAD CARTRIDGE - NOW "SKYFALL" */
@keyframes crt-power-in-up {
    0% {
        opacity: 1;
        transform: translateY(-100vh) scale(1);
        /* Start from WAY UP (Skyfall) */
        filter: blur(5px);
    }

    70% {
        transform: translateY(20px) scale(1.02);
        /* Heavy Impact Bounce */
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* Exit Down: Drops away and dims */
@keyframes crt-power-out-down {
    0% {
        opacity: 1;
        transform: translateY(0);
        filter: brightness(1) blur(0);
    }

    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: brightness(0.5) blur(5px);
    }
}

/* Enter Down: Snaps back in */
@keyframes crt-power-in-down {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(1.05);
        filter: brightness(2) blur(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: brightness(1) blur(0);
    }
}