/* ========================================
   recycle.digital - styles.css
   Brutalist anti-design / recycling plant
   Industrial salvage yard aesthetic
   ======================================== */

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

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #3D3D3D #1A1A1A;
}

/* Custom scrollbar - conveyor belt style */
::-webkit-scrollbar {
    width: 12px;
}
::-webkit-scrollbar-track {
    background: #1A1A1A;
}
::-webkit-scrollbar-thumb {
    background: repeating-linear-gradient(
        0deg,
        #3D3D3D 0px,
        #3D3D3D 8px,
        #6B6B6B 8px,
        #6B6B6B 10px
    );
    border: 1px solid #1A1A1A;
}
::-webkit-scrollbar-thumb:hover {
    background: repeating-linear-gradient(
        0deg,
        #4D4D4D 0px,
        #4D4D4D 8px,
        #6B6B6B 8px,
        #6B6B6B 10px
    );
}

body {
    background-color: #1A1A1A;
    color: #E8E8E8;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    cursor: default;
}

/* --- Background texture layer (fixed behind everything) --- */
#bg-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Conveyor belt animation strips (fixed, persistent) --- */
#conveyor-strips {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.conveyor-strip {
    position: absolute;
    left: 0;
    width: 200%;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #3D3D3D 0px,
        #3D3D3D 12px,
        transparent 12px,
        transparent 18px
    );
}

.strip-1 {
    top: 25%;
    animation: conveyor-move 12s linear infinite;
}
.strip-2 {
    top: 45%;
    animation: conveyor-move 8s linear infinite;
    opacity: 0.8;
}
.strip-3 {
    top: 65%;
    animation: conveyor-move 15s linear infinite;
}
.strip-4 {
    top: 82%;
    animation: conveyor-move 10s linear infinite;
    opacity: 0.5;
}

@keyframes conveyor-move {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}

/* --- Typography Classes --- */
.stencil-label {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    line-height: 1.0;
    font-size: clamp(1.8rem, 4vw, 4.5rem);
    text-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    display: inline-block;
}

.stencil-label.small-label {
    font-size: clamp(1rem, 2vw, 1.6rem);
    font-weight: 700;
}

.stencil-label.tiny-label {
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    font-weight: 600;
}

.mono-meta {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: #A8A8A8;
    display: block;
    margin-top: 0.5rem;
}

/* Stream accent colors - industrial safety palette */
.accent-orange { color: #FF6B35; }
.accent-cyan { color: #00B4D8; }
.accent-green { color: #8AC926; }
.accent-yellow { color: #FFD60A; }

/* --- Act / Section base --- */
.act {
    position: relative;
    z-index: 2;
}

/* ========================================
   ACT I: THE INTAKE (0-100vh)
   Nearly empty viewport, mid-stream entry
   ======================================== */
#act-intake {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Site name: tiny, top-left, nearly invisible */
.site-name {
    position: fixed;
    top: 2rem;
    left: 2rem;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: #6B6B6B;
    z-index: 100;
    transition: opacity 0.3s ease;
}

/* Central "INCOMING STREAM" label */
.intake-label {
    text-align: center;
    opacity: 0;
    animation: intake-fade-in 1.5s ease 0.5s forwards;
}

.intake-label .stencil-label {
    font-size: clamp(3rem, 6vw, 6rem);
}

/* Fragment container */
.intake-fragments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.fragment {
    position: absolute;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    color: #E8E8E8;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(100vw);
}

.fragment-1 { top: 24%; --frag-opacity: 0.3; animation: slide-fragment 6s linear 1.5s infinite; }
.fragment-2 { top: 44%; --frag-opacity: 0.5; animation: slide-fragment 5s linear 2s infinite; }
.fragment-3 { top: 64%; --frag-opacity: 0.7; animation: slide-fragment 7s linear 2.5s infinite; }
.fragment-4 { top: 81%; --frag-opacity: 0.4; animation: slide-fragment 5.5s linear 3s infinite; }
.fragment-5 { top: 35%; --frag-opacity: 0.6; animation: slide-fragment 8s linear 1s infinite; }
.fragment-6 { top: 55%; --frag-opacity: 0.35; animation: slide-fragment 6.5s linear 3.5s infinite; }
.fragment-7 { top: 15%; --frag-opacity: 0.25; animation: slide-fragment 9s linear 0.5s infinite; }
.fragment-8 { top: 74%; --frag-opacity: 0.45; animation: slide-fragment 7.5s linear 4s infinite; }

@keyframes slide-fragment {
    0% { transform: translateX(100vw); opacity: 0; }
    5% { opacity: var(--frag-opacity, 0.5); }
    90% { opacity: var(--frag-opacity, 0.5); }
    100% { transform: translateX(-120%); opacity: 0; }
}

@keyframes intake-fade-in {
    0% { opacity: 0; transform: translateY(30px) scale(1.1); }
    60% { opacity: 1; transform: translateY(-5px) scale(1.0); }
    100% { opacity: 1; transform: translateY(0) scale(1.0); }
}

/* ========================================
   ACT II: THE SORT (100vh-350vh)
   Conveyor rotates, asymmetric two-column
   ======================================== */
#act-sort {
    min-height: 280vh;
    padding: 4rem 2rem;
    position: relative;
}

/* Conveyor wrapper - perspective container for rotation */
#conveyor-wrapper {
    position: sticky;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 8px;
    z-index: 3;
    perspective: 1200px;
    pointer-events: none;
    transition: opacity 0.8s ease 0.3s;
}

#conveyor-belt {
    width: 100%;
    height: 100%;
    background: #3D3D3D;
    box-shadow: 0 0 20px rgba(61, 61, 61, 0.4);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: center center;
}

#conveyor-wrapper.rotated #conveyor-belt {
    transform: rotateZ(90deg) scaleX(3);
}

#conveyor-wrapper.rotated {
    opacity: 0;
}

/* Sort grid - deliberate asymmetric two-column layout */
.sort-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Sort blocks: collage-fragment borders with torn edges */
.sort-block {
    display: grid;
    grid-template-columns: 30% 70%;
    border-left: 4px dashed #6B6B6B;
    background: #2C2C2C;
    clip-path: polygon(0% 2%, 98% 0%, 100% 97%, 1% 100%);
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateX(-80px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    position: relative;
    cursor: grab;
}

/* Alternate blocks: different torn edges, slide from opposite side */
.sort-block:nth-child(even) {
    clip-path: polygon(1% 0%, 100% 1.5%, 99% 98%, 0% 100%);
}

.sort-block.block-right {
    transform: translateX(80px);
    margin-left: 4%;
}

.sort-block.block-left {
    margin-right: 4%;
}

/* Overlapping blocks: jut into neighbor space */
.sort-block:nth-child(3) {
    margin-top: -1.5rem;
    clip-path: polygon(0% 0%, 97% 2.5%, 100% 100%, 2% 98%);
}

.sort-block:nth-child(5) {
    margin-top: -1rem;
    clip-path: polygon(1.5% 1%, 100% 0%, 98% 97.5%, 0% 100%);
}

.sort-block.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Stamp impact animation - rubber stamp hit with screen-shake */
.sort-block.stamp-in .stencil-label {
    animation: label-stamp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.sort-block.stamp-in {
    animation: block-shake 0.15s ease-out;
}

@keyframes label-stamp {
    0% { transform: scale(1.3) rotate(-2deg); opacity: 0.5; }
    60% { transform: scale(0.98) rotate(-2deg); opacity: 1; }
    100% { transform: scale(1.0) rotate(-2deg); opacity: 1; }
}

@keyframes block-shake {
    0% { transform: translateX(3px); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

/* Label column: 30% left strip with dashed border separator */
.block-label-col {
    padding-right: 1.5rem;
    border-right: 4px dashed #6B6B6B;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.block-label-col .stencil-label {
    font-size: clamp(1rem, 2vw, 1.6rem);
}

/* Content column: 70% right side */
.block-content-col {
    padding-left: 1.5rem;
}

.block-content-col p {
    color: #E8E8E8;
    line-height: 1.65;
}

.stream-icon {
    margin-top: 0.5rem;
}

/* Contamination block: special warning styling */
.contamination-block {
    border-left-color: #FFD60A;
    border-left-style: solid;
    border-left-width: 4px;
}

.contamination-block .block-label-col {
    border-right-color: #FFD60A;
}

/* Inline compression zone (mid-sort rhythm break) */
.inline-compression-zone {
    max-width: 900px;
    margin: 1rem auto 2rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: scale(0.65);
    transform-origin: center center;
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.inline-compression-zone.visible {
    opacity: 1;
}

.compressed-inline {
    background: #2C2C2C;
    padding: 0.6rem 1rem;
    border-left: 2px solid #6B6B6B;
    clip-path: polygon(0% 1%, 99.5% 0%, 100% 99%, 0.5% 100%);
}

.compressed-inline p {
    font-size: 0.78rem;
    line-height: 1.4;
    color: #A8A8A8;
    margin-top: 0.25rem;
}

/* ========================================
   ACT III: THE COMPRESS (350vh-500vh)
   Progressive scaling, purple overlay
   ======================================== */
#act-compress {
    min-height: 180vh;
    padding: 6rem 2rem;
    position: relative;
}

/* Compactor Purple overlay */
.compress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #4A0E4E;
    opacity: 0;
    transition: opacity 1.2s ease;
    pointer-events: none;
    z-index: 0;
}

#act-compress.active .compress-overlay {
    opacity: 0.08;
}

.compress-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 1;
}

.compress-header .stencil-label {
    font-size: clamp(1.4rem, 3vw, 2.5rem);
    display: block;
    margin-bottom: 0.5rem;
}

/* Compression zones: 3 blocks stacked tight, 4px gaps */
.compression-zone {
    max-width: 900px;
    margin: 0 auto 4rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.compressed-block {
    background: #2C2C2C;
    padding: 1.2rem 1.5rem;
    clip-path: polygon(0% 1%, 99% 0%, 100% 98%, 0.5% 100%);
    transform: scale(1);
    transition: transform 0.8s ease;
    border-left: 3px solid #6B6B6B;
}

/* Alternate torn edges on compressed blocks */
.compressed-block:nth-child(2) {
    clip-path: polygon(0.5% 0%, 100% 1.5%, 99.5% 99%, 0% 98%);
}

.compressed-block:nth-child(3) {
    clip-path: polygon(0% 2%, 99.5% 0%, 100% 97%, 1% 100%);
}

/* Squished state: scaled down to 60% */
.compressed-block.squished {
    transform: scale(0.6);
    transform-origin: center center;
}

.compressed-block .stencil-label {
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    margin-bottom: 0.4rem;
}

.compressed-block p {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #A8A8A8;
}

/* Compress status: blinking caution yellow */
.compress-status {
    text-align: center;
    margin-top: 3rem;
    position: relative;
    z-index: 1;
}

.compress-status .mono-meta {
    font-size: 0.85rem;
    color: #FFD60A;
    animation: status-blink 2s ease-in-out infinite;
}

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

/* Compression gauge */
.compress-gauge {
    text-align: center;
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

.gauge-track {
    width: 300px;
    max-width: 80%;
    height: 6px;
    background: #2C2C2C;
    margin: 0 auto 0.75rem;
    border: 1px solid #6B6B6B;
    overflow: hidden;
}

.gauge-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF6B35, #FFD60A, #8AC926);
    transition: width 0.3s ease;
}

/* ========================================
   ACT IV: THE OUTPUT (500vh-600vh)
   Centered column, summary bale, chart
   ======================================== */
#act-output {
    min-height: 100vh;
    padding: 8rem 2rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    position: relative;
}

/* Output bale: pulsing gently */
.output-bale {
    max-width: 800px;
    width: 100%;
    text-align: center;
    animation: bale-pulse 3s ease-in-out infinite;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s ease, transform 1s ease;
}

.output-bale.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes bale-pulse {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.02); }
}

.bale-inner {
    background: #2C2C2C;
    padding: 3rem;
    clip-path: polygon(0.5% 1.5%, 99% 0%, 99.5% 98.5%, 1% 99.5%);
    border: 2px solid #6B6B6B;
    position: relative;
}

.bale-inner .stencil-label {
    font-size: clamp(1.4rem, 3vw, 2.5rem);
    margin-bottom: 1.5rem;
}

.bale-text {
    font-size: clamp(0.95rem, 1.3vw, 1.15rem);
    line-height: 1.65;
    color: #E8E8E8;
    margin-bottom: 1.5rem;
}

.bale-meta {
    color: #8AC926;
    margin-top: 1rem;
}

/* Material recovered bar chart */
.output-chart {
    max-width: 700px;
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.output-chart.visible {
    opacity: 1;
    transform: translateY(0);
}

.chart-title {
    font-size: clamp(1rem, 2vw, 1.4rem);
    margin-bottom: 1.5rem;
    text-align: center;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chart-label {
    width: 160px;
    text-align: right;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.chart-bar-track {
    flex: 1;
    background: rgba(44, 44, 44, 0.6);
    height: 28px;
    position: relative;
    border: 1px solid #3D3D3D;
}

.chart-bar {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
    width: 0%;
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-orange { background: #FF6B35; }
.bar-cyan { background: #00B4D8; }
.bar-green { background: #8AC926; }

.chart-value {
    color: #1A1A1A;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Final domain name with color cycling */
.output-domain {
    text-align: center;
    margin-top: 2rem;
}

#final-domain {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 4vw, 4rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    animation: color-cycle 4s linear infinite;
}

@keyframes color-cycle {
    0%, 100% { color: #FF6B35; }
    33% { color: #00B4D8; }
    66% { color: #8AC926; }
}

/* Footer with streams bar */
.output-footer {
    text-align: center;
    margin-top: 2rem;
}

.output-footer .mono-meta {
    color: #6B6B6B;
}

.output-streams-bar {
    display: flex;
    height: 4px;
    width: 300px;
    max-width: 80%;
    margin: 1.5rem auto 0;
    gap: 0;
}

.stream-segment {
    flex: 1;
    height: 100%;
}

.segment-orange { background: #FF6B35; }
.segment-cyan { background: #00B4D8; }
.segment-green { background: #8AC926; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sort-block {
        grid-template-columns: 1fr;
        border-left: 3px dashed #6B6B6B;
    }

    .sort-block.block-right,
    .sort-block.block-left {
        margin-left: 0;
        margin-right: 0;
    }

    .block-label-col {
        border-right: none;
        border-bottom: 3px dashed #6B6B6B;
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .block-content-col {
        padding-left: 0;
    }

    .chart-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .chart-label {
        text-align: left;
        width: auto;
    }

    .chart-bar-track {
        width: 100%;
    }

    .bale-inner {
        padding: 2rem 1.5rem;
    }

    .intake-label .stencil-label {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .compress-header .stencil-label {
        font-size: clamp(1.2rem, 5vw, 2rem);
    }

    .gauge-track {
        width: 200px;
    }

    .site-name {
        top: 1rem;
        left: 1rem;
    }

    .inline-compression-zone {
        transform: scale(0.75);
    }
}

@media (max-width: 480px) {
    #act-sort {
        padding: 2rem 1rem;
    }

    #act-compress {
        padding: 3rem 1rem;
    }

    .sort-block {
        padding: 1.5rem 1rem;
    }

    .compressed-block {
        padding: 0.8rem 1rem;
    }
}
