/* ============================================
   recycle.games — Scholarly Neon Arcade
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-void: #0a0f14;
    --charcoal-slate: #141d26;
    --phosphor-green: #39ff85;
    --hot-coral: #ff3965;
    --sage-mist: #b8d4b0;
    --faded-lavender: #8e7ca8;
    --frosted-mint: #1a3a2a;
    --electric-magenta: #e040a0;
    --soft-coral: #e8637a;
    --white: #e8e8e8;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-void);
    color: var(--sage-mist);
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- CRT Scanline Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.06) 2px,
        rgba(0, 0, 0, 0.06) 3px
    );
}

/* --- Pixel Grid Texture --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: radial-gradient(circle, #39ff8514 1px, transparent 1px);
    background-size: 8px 8px;
}

/* --- Scroll Progress Bar --- */
#progress-bar {
    position: fixed;
    top: 0;
    right: 0;
    width: 4px;
    height: 100vh;
    background: rgba(57, 255, 133, 0.1);
    z-index: 1000;
}

#progress-fill {
    width: 100%;
    height: 0%;
    background: var(--phosphor-green);
    box-shadow: 0 0 8px var(--phosphor-green), 0 0 20px rgba(57, 255, 133, 0.4);
    transition: height 0.1s linear;
}

#progress-icon {
    position: absolute;
    top: 8px;
    left: -8px;
}

/* --- Exhibit (Section) Base --- */
.exhibit {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.exhibit-content {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    position: relative;
}

/* --- Section Headers --- */
.section-header {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.4rem, 3.5vw, 2.4rem);
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
    margin-bottom: 3rem;
    text-shadow: 0 0 10px var(--phosphor-green), 0 0 30px rgba(57, 255, 133, 0.3);
}

/* ==========================================
   SECTION 1: The Respawn Thesis
   ========================================== */
#respawn-thesis {
    flex-direction: column;
}

#respawn-thesis .exhibit-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.mobius-hero {
    position: relative;
    width: clamp(300px, 60vw, 600px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobius-svg {
    width: 100%;
    height: auto;
    animation: mobiusRotate 20s linear infinite;
    filter: drop-shadow(0 0 10px #39ff85) drop-shadow(0 0 30px rgba(57, 255, 133, 0.4)) drop-shadow(0 0 60px rgba(57, 255, 133, 0.13));
}

@keyframes mobiusRotate {
    0% { transform: perspective(800px) rotateY(0deg); }
    100% { transform: perspective(800px) rotateY(360deg); }
}

.hero-title {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 5rem);
    color: var(--white);
    letter-spacing: 0.06em;
    z-index: 3;
    text-shadow: 0 0 20px rgba(57, 255, 133, 0.5);
}

.thesis-statement {
    margin-top: 3rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    color: var(--sage-mist);
    font-variant: small-caps;
    max-width: 38ch;
    text-align: center;
    line-height: 1.72;
}

/* ==========================================
   SECTION 2: The Taxonomy of Loops
   ========================================== */
.diagram-container {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.flowchart-svg {
    width: 70%;
    max-width: 800px;
    height: auto;
}

.flow-node {
    fill: var(--frosted-mint);
    stroke: var(--phosphor-green);
    stroke-width: 1;
    filter: drop-shadow(0 0 6px rgba(57, 255, 133, 0.4));
    /* pixel grid via pattern would go here, using fill color instead */
}

.flow-label {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    fill: var(--white);
    text-anchor: middle;
    dominant-baseline: middle;
}

.flow-arrow {
    fill: none;
    stroke: var(--phosphor-green);
    stroke-width: 2;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease-out;
}

.flow-arrow.animate {
    stroke-dashoffset: 0;
}

/* Annotations */
.annotation {
    position: absolute;
    max-width: 220px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.annotation.visible {
    opacity: 1;
    transform: translateY(0);
}

.annotation-text {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: var(--soft-coral);
    display: block;
    border-left: 1px dashed var(--soft-coral);
    padding-left: 8px;
}

/* ==========================================
   SECTION 3: The Archive
   ========================================== */
#archive .exhibit-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cabinet {
    perspective: 1200px;
    width: 100%;
    max-width: 700px;
}

.cabinet-interior {
    transform: rotateX(-8deg);
    transform-origin: top center;
    background: var(--charcoal-slate);
    border: 1px solid rgba(57, 255, 133, 0.15);
    border-radius: 4px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background-image: radial-gradient(circle, #39ff8514 1px, transparent 1px);
    background-size: 8px 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(0, 0, 0, 0.3);
}

.folder {
    background: var(--deep-void);
    border: 1px solid rgba(255, 57, 101, 0.2);
    border-radius: 2px;
    padding: 0.8rem 1.2rem;
    position: relative;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    overflow: hidden;
}

.folder::after {
    content: attr(data-preview);
    position: absolute;
    top: 0;
    right: 0;
    width: 55%;
    height: 100%;
    padding: 0.8rem 1rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.78rem;
    color: var(--sage-mist);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, transparent, var(--deep-void) 20%);
}

.folder:hover {
    transform: scale(1.08);
    box-shadow: 0 0 10px var(--hot-coral), 0 0 30px rgba(255, 57, 101, 0.3), 0 0 60px rgba(255, 57, 101, 0.1);
    z-index: 5;
}

.folder:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.folder-tab {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: clamp(0.75rem, 1.3vw, 0.9rem);
    color: var(--soft-coral);
    opacity: 0.7;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.folder:hover .folder-tab {
    opacity: 1;
    text-shadow: 0 0 8px var(--hot-coral);
}

/* ==========================================
   SECTION 4: The Closed Loop
   ========================================== */
#closed-loop .exhibit-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.text-loop-container {
    width: clamp(300px, 60vw, 500px);
    margin-bottom: 3rem;
}

.text-loop-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(57, 255, 133, 0.3));
}

.loop-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
}

/* Colophon */
.colophon {
    max-width: 600px;
    width: 100%;
}

.colophon-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--faded-lavender);
    padding-bottom: 0.5rem;
}

.references {
    list-style: none;
    padding: 0;
}

.references li {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: var(--faded-lavender);
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.references em {
    font-style: italic;
    color: var(--sage-mist);
}

.loop-status {
    margin-top: 2rem;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--phosphor-green);
    text-align: center;
    text-shadow: 0 0 10px var(--phosphor-green);
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .mobius-svg {
        animation: none;
    }
    .flow-arrow {
        stroke-dashoffset: 0;
        transition: none;
    }
    .annotation {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .folder {
        transition: none;
    }
    .folder::after {
        transition: none;
    }
}
