/* ============================================================
   recycle.digital — Styles
   Palette:
     #0a0a0a  Dead Pixel Black (bg)
     #1a1a2e  Screen Dark (panel fill)
     #c0c0c0  CRT Gray (body text)
     #333333  Dead Zone (borders/inactive)
     #00ff41  Matrix Green (recycled/alive)
     #ff0040  Error Red (waste/broken)
     #00d4ff  Cyan Channel (RGB offset)
     #ffff00  Warning Yellow (alerts)
   Fonts: Share Tech Mono, Space Grotesk, VT323
============================================================ */

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

:root {
    --bg: #0a0a0a;
    --panel: #1a1a2e;
    --text: #c0c0c0;
    --border: #333333;
    --green: #00ff41;
    --red: #ff0040;
    --cyan: #00d4ff;
    --yellow: #ffff00;
    --white: #f0f0f0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* CRT Scan Lines overlay — always present */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* ---------- Utility classes ---------- */
.share-tech {
    font-family: 'Share Tech Mono', monospace;
}

.vt323 {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    line-height: 1.4;
}

.green  { color: var(--green); }
.red    { color: var(--red); }
.cyan   { color: var(--cyan); }
.yellow { color: var(--yellow); }
.white  { color: var(--white); }
.grey   { color: var(--border); }

.blink {
    animation: blink-cursor 1s step-end infinite;
}

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

.status-sep {
    color: var(--border);
    margin: 0 0.5rem;
}

.status-blink {
    animation: blink-cursor 1s step-end infinite;
}

/* ---------- RGB Glitch Title ---------- */
@keyframes glitch-r {
    0%   { transform: translate(0,0); opacity: 1; }
    2%   { transform: translate(-4px, 2px); opacity: 0.9; }
    4%   { transform: translate(3px, -1px); opacity: 1; }
    5%   { transform: translate(0,0); opacity: 1; }
    100% { transform: translate(0,0); opacity: 1; }
}

@keyframes glitch-g {
    0%   { transform: translate(0,0); opacity: 1; }
    2%   { transform: translate(3px, -2px); opacity: 0.9; }
    4%   { transform: translate(-2px, 1px); opacity: 1; }
    5%   { transform: translate(0,0); opacity: 1; }
    100% { transform: translate(0,0); opacity: 1; }
}

@keyframes glitch-b {
    0%   { transform: translate(0,0); opacity: 1; }
    2%   { transform: translate(2px, 3px); opacity: 0.9; }
    4%   { transform: translate(-3px, -2px); opacity: 1; }
    5%   { transform: translate(0,0); opacity: 1; }
    100% { transform: translate(0,0); opacity: 1; }
}

@keyframes glitch-main {
    0%   { transform: translate(0,0); clip-path: none; }
    1.5% { transform: translate(-2px, 0); clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%); }
    2%   { transform: translate(2px, 0); clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); }
    2.5% { transform: translate(-1px, 1px); clip-path: none; }
    3%   { transform: translate(0,0); clip-path: none; }
    100% { transform: translate(0,0); clip-path: none; }
}

@keyframes glitch-small-r {
    0%   { transform: translate(0,0); }
    5%   { transform: translate(-3px, 1px); }
    10%  { transform: translate(2px, -1px); }
    15%  { transform: translate(0,0); }
    100% { transform: translate(0,0); }
}

.glitch-title {
    position: relative;
    display: inline-block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2rem, 6vw, 5rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1;
}

.rgb-layer {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
}

.rgb-main {
    position: relative;
    color: var(--white);
    animation: glitch-main 4s infinite;
}

.rgb-r {
    color: var(--red);
    mix-blend-mode: screen;
    animation: glitch-r 4s infinite;
    animation-delay: 0.05s;
}

.rgb-g {
    color: var(--green);
    mix-blend-mode: screen;
    animation: glitch-g 4s infinite;
    animation-delay: 0.1s;
}

.rgb-b {
    color: var(--cyan);
    mix-blend-mode: screen;
    animation: glitch-b 4s infinite;
    animation-delay: 0.15s;
}

/* ---------- Hero Section ---------- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 4rem 5vw;
    position: relative;
    background:
        linear-gradient(135deg, rgba(26,26,46,0.6) 0%, transparent 60%),
        var(--bg);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.hero-inner {
    position: relative;
    z-index: 2;
    max-width: 900px;
}

.hero-title-wrapper {
    margin-bottom: 3rem;
}

.hero-subtitle {
    margin-top: 1.5rem;
    font-size: 1.1rem;
    color: var(--red);
    letter-spacing: 0.05em;
}

.hero-status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    background: rgba(26,26,46,0.8);
    font-size: 0.9rem;
}

/* Animated noise/grid in hero background */
.hero-noise {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image:
        linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    animation: grid-drift 20s linear infinite;
}

@keyframes grid-drift {
    from { background-position: 0 0; }
    to   { background-position: 40px 40px; }
}

/* ---------- Data Fragment Blocks ---------- */
.fragment {
    position: relative;
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 1.5rem;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.5s ease;
    will-change: transform, opacity;
}

.fragment.visible {
    opacity: 1;
    transform: translate(0, 0) !important;
}

.fragment-header {
    font-size: 0.9rem;
    color: var(--border);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.05em;
}

.fragment-body p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

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

.fragment-recycled {
    border-color: rgba(0, 255, 65, 0.3);
}

.fragment-recycled .fragment-header {
    border-bottom-color: rgba(0, 255, 65, 0.3);
}

.fragment-wide {
    /* slightly wider feel handled by flex container */
    align-self: stretch;
}

/* Code blocks inside fragments */
.code-block {
    background: #0d0d1a;
    border: 1px solid var(--border);
    padding: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.6;
    margin-top: 0.75rem;
    color: var(--text);
}

.green-border {
    border-color: rgba(0, 255, 65, 0.4);
}

/* Meter bars */
.waste-meter {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.meter-label {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--border);
}

.meter-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
}

.meter-fill {
    height: 100%;
    transition: width 1.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.red-fill   { background: var(--red); }
.green-fill { background: var(--green); }

/* ---------- Split Screen Section ---------- */
#split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    min-height: 100vh;
    border-bottom: 1px solid var(--border);
}

.split-divider-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.split-svg {
    width: 100%;
    height: 100%;
}

.split-half {
    padding: 3rem 3vw 3rem 3vw;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.split-left {
    border-right: none; /* divider SVG handles it */
    background: rgba(255, 0, 64, 0.02);
}

.split-right {
    background: rgba(0, 255, 65, 0.02);
}

.split-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* Section titles */
.section-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.4rem, 3vw, 2.5rem);
    font-weight: 400;
    color: var(--white);
    letter-spacing: 0.05em;
    line-height: 1.2;
}

.section-title.glitch-small {
    animation: glitch-main 6s infinite;
}

/* ---------- Process Section ---------- */
#process-section {
    padding: 5rem 5vw;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.process-header {
    margin-bottom: 3rem;
}

.process-addr {
    margin-top: 0.5rem;
    color: var(--border);
    font-size: 0.9rem;
}

.process-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.process-step {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    background: var(--panel);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.6s ease;
}

.process-step.visible {
    transform: translateY(0);
    opacity: 1;
}

.step-number {
    font-size: 2.5rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.8;
}

.step-content h3 {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    font-weight: 400;
    color: var(--white);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.step-content p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.step-stat {
    font-size: 0.85rem;
    color: var(--border);
}

/* ---------- Stats Section ---------- */
#stats-section {
    padding: 5rem 5vw;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.stats-header {
    margin-bottom: 3rem;
}

.stats-ticker {
    margin-top: 0.5rem;
    color: var(--green);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
}

.stat-block {
    text-align: left;
}

.stat-number {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 400;
    color: var(--green);
    line-height: 1;
    margin: 1rem 0 0.5rem 0;
}

.stat-unit {
    font-size: 0.6em;
    color: var(--cyan);
    margin-left: 0.2em;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--border);
    letter-spacing: 0.08em;
}

/* ---------- Terminal Section ---------- */
#terminal-section {
    padding: 5rem 5vw;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.terminal-window {
    max-width: 860px;
    margin: 0 auto;
    border: 1px solid var(--border);
    background: #050510;
    clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.term-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.red-dot    { background: var(--red); }
.yellow-dot { background: var(--yellow); }
.green-dot  { background: var(--green); }

.term-title {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
}

.terminal-body {
    padding: 1.5rem;
    min-height: 280px;
}

.term-line {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.term-out {
    color: var(--border);
}

.term-input-line {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.term-cursor {
    color: var(--green);
    animation: blink-cursor 1s step-end infinite;
}

/* ---------- Manifesto Section ---------- */
#manifesto-section {
    padding: 5rem 5vw;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.manifesto-inner {
    max-width: 1000px;
}

.manifesto-text {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.manifesto-fragment {
    /* inherit fragment styles */
}

/* ---------- Footer ---------- */
#footer {
    padding: 3rem 5vw;
    border-top: 1px solid var(--border);
    background: var(--panel);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.footer-logo {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--white);
    letter-spacing: 0.1em;
}

.footer-tagline {
    font-size: 0.9rem;
    color: var(--border);
    letter-spacing: 0.05em;
}

.footer-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.footer-link {
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--green);
}

.footer-sys {
    font-size: 0.85rem;
    color: var(--border);
}

/* ---------- Glitch flash animation for divider ---------- */
@keyframes divider-flash {
    0%   { opacity: 1; stroke: var(--yellow); stroke-width: 2; }
    30%  { stroke: var(--white); stroke-width: 4; }
    60%  { stroke: var(--yellow); stroke-width: 1; }
    100% { opacity: 1; stroke: var(--yellow); stroke-width: 2; }
}

.divider-flash {
    animation: divider-flash 0.4s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    #split-screen {
        grid-template-columns: 1fr;
    }

    .split-divider-wrap {
        display: none;
    }

    .split-left {
        border-bottom: 1px solid var(--red);
    }

    .split-right {
        border-top: 1px solid var(--green);
    }

    .manifesto-text {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .hero-status-bar {
        font-size: 0.8rem;
    }

    #hero {
        padding: 3rem 4vw;
    }

    #process-section,
    #stats-section,
    #terminal-section,
    #manifesto-section {
        padding: 3rem 4vw;
    }
}
