/* ===========================================
   recycle.wiki - Neomorphic Ocean-Deep Encyclopedia
   Colors: #0A1828, #283848, #406888, #C86858, #EEF2F8, #F4F6FA, #506880, #C8D0E0, #FFFFFF
   Fonts: JetBrains Mono (Google Fonts, 300/400/700)
   =========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: #F4F6FA;
    color: #283848;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    line-height: 1.9;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* --- City-Urban Infrastructure Background --- */
#city-infrastructure-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#city-infrastructure-bg svg {
    width: 100%;
    height: 100%;
    fill: #506880;
    stroke: #506880;
    opacity: 0.04;
}

/* --- Sea Foam Overlay --- */
#sea-foam-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 0%, rgba(244, 246, 250, 0) 0%, rgba(244, 246, 250, 0.4) 70%, rgba(244, 246, 250, 0.8) 100%);
}

/* --- Ocean Column --- */
#ocean-column {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    gap: clamp(60px, 10vh, 120px);
    padding-top: clamp(60px, 12vh, 140px);
    padding-bottom: clamp(60px, 10vh, 120px);
}

/* --- Neomorphic Card --- */
.neomorphic-card {
    background: #EEF2F8;
    box-shadow: 6px 6px 12px #C8D0E0, -6px -6px 12px #FFFFFF;
    border-radius: 16px;
    padding: clamp(28px, 4vw, 48px);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.neomorphic-card:hover {
    box-shadow: 8px 8px 16px #C8D0E0, -8px -8px 16px #FFFFFF;
    transform: translateY(-2px);
}

/* --- Glassmorphic Panel --- */
.glassmorphic-panel {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(240, 244, 250, 0.7);
    border: 1px solid rgba(80, 120, 180, 0.15);
    border-radius: 12px;
}

/* --- Typography --- */
.section-heading {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    color: #0A1828;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.wiki-tag {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    color: #406888;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 10px;
    background: rgba(64, 104, 136, 0.08);
    border-radius: 4px;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.hero-terminal-line {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #406888;
}

.terminal-prompt {
    font-weight: 700;
}

.terminal-cursor {
    display: inline-block;
    width: 10px;
    height: 1.4em;
    background: #406888;
    animation: cursorBlink 1s step-end infinite;
}

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

#site-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5rem);
    color: #0A1828;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(30px);
    animation: titleReveal 1s ease 0.3s forwards;
}

@keyframes titleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.4vw, 1.1rem);
    color: #506880;
    line-height: 1.7;
    max-width: 500px;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.8s forwards;
}

.hero-tagline {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: #C86858;
    margin-top: 16px;
    opacity: 0;
    animation: fadeIn 0.8s ease 1.2s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* --- Hero Scroll Indicator --- */
.hero-scroll-indicator {
    position: absolute;
    bottom: clamp(24px, 5vh, 48px);
    left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeIn 0.8s ease 1.8s forwards;
}

.scroll-arrow {
    display: block;
    width: 16px;
    height: 16px;
    border-right: 2px solid #406888;
    border-bottom: 2px solid #406888;
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(6px); }
}

.scroll-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    color: #506880;
    letter-spacing: 0.1em;
    text-transform: lowercase;
}

/* --- Stats Section --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-item {
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: scale(1.03);
    box-shadow: inset 2px 2px 5px rgba(200, 208, 224, 0.4), inset -2px -2px 5px rgba(255, 255, 255, 0.6);
}

.stat-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: #406888;
    display: block;
}

.stat-unit {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #506880;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.72rem;
    color: #283848;
    line-height: 1.5;
    margin-top: 4px;
}

/* --- Wiki Entry --- */
.wiki-entry-header {
    margin-bottom: 20px;
}

.wiki-entry-body p {
    margin-bottom: 16px;
    color: #283848;
}

.wiki-entry-body p:last-of-type {
    margin-bottom: 24px;
}

/* --- Wiki Data Block --- */
.wiki-data-block {
    padding: 20px 24px;
    margin-top: 8px;
    transition: box-shadow 0.3s ease;
}

.data-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(80, 120, 180, 0.08);
}

.data-row:last-child {
    border-bottom: none;
}

.data-key {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.78rem;
    color: #506880;
    white-space: nowrap;
}

.data-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.78rem;
    color: #0A1828;
}

.data-value.threat-critical {
    color: #C86858;
    animation: criticalPulse 2s ease-in-out infinite;
}

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

/* --- Infrastructure Diagram --- */
.infrastructure-diagram {
    padding: 24px;
    margin-top: 8px;
    transition: box-shadow 0.3s ease;
}

.diagram-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.72rem;
    color: #C86858;
    margin-bottom: 20px;
    letter-spacing: 0.05em;
}

.diagram-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.flow-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 60px;
}

.node-icon {
    width: 40px;
    height: 40px;
    color: #406888;
}

.node-icon svg {
    width: 100%;
    height: 100%;
}

.node-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.65rem;
    color: #0A1828;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.flow-arrow {
    font-size: 1.2rem;
    color: #C86858;
    flex-shrink: 0;
}

/* --- Recycling Rates --- */
.rates-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rate-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rate-bar-container {
    padding: 12px 16px;
    position: relative;
    overflow: hidden;
}

.rate-bar {
    height: 32px;
    background: linear-gradient(135deg, #406888, #506880);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    width: 0;
    transition: width 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-width: 48px;
}

.rate-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.82rem;
    color: #FFFFFF;
}

.rate-percent {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: #FFFFFF;
}

.rate-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.72rem;
    color: #506880;
    padding-left: 4px;
}

/* --- Circular Economy Diagram --- */
.circular-diagram {
    padding: 24px;
    margin-top: 8px;
    transition: box-shadow 0.3s ease;
}

.circle-flow {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.circle-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: rgba(64, 104, 136, 0.05);
    border-radius: 12px;
    transition: transform 0.3s ease, background 0.3s ease;
    cursor: default;
}

.circle-node:hover {
    transform: scale(1.05);
    background: rgba(64, 104, 136, 0.1);
}

.circle-icon {
    font-size: 1.4rem;
    color: #406888;
    transition: color 0.3s ease;
}

.circle-node:hover .circle-icon {
    color: #C86858;
}

.circle-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    color: #0A1828;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* --- Composition Bars (E-Waste) --- */
.composition-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comp-bar-item {
    display: grid;
    grid-template-columns: 140px 1fr 48px;
    align-items: center;
    gap: 12px;
}

.comp-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.72rem;
    color: #283848;
    text-align: right;
}

.comp-bar-track {
    height: 12px;
    background: rgba(200, 208, 224, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.comp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #406888, #C86858);
    border-radius: 6px;
    width: 0;
    transition: width 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.comp-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.72rem;
    color: #406888;
}

/* --- Hierarchy Diagram (Zero Waste) --- */
.hierarchy-diagram {
    padding: 24px;
    margin-top: 8px;
    transition: box-shadow 0.3s ease;
}

.hierarchy-levels {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hierarchy-level {
    display: grid;
    grid-template-columns: 36px 100px 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(64, 104, 136, 0.03);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.hierarchy-level:hover {
    border-left-color: #C86858;
    background: rgba(64, 104, 136, 0.07);
    transform: translateX(4px);
}

.level-marker {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.7rem;
    color: #406888;
}

.level-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0A1828;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.level-desc {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.72rem;
    color: #506880;
}

/* --- Footer --- */
#site-footer {
    padding-top: 0;
}

.footer-content {
    padding: 40px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.footer-title {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 1.2rem;
    color: #0A1828;
    letter-spacing: 0.15em;
}

.footer-terminal {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.terminal-line {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 300;
    font-size: 0.72rem;
    color: #506880;
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #406888;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(64, 104, 136, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(64, 104, 136, 0); }
}

.status-text {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.65rem;
    color: #506880;
    letter-spacing: 0.05em;
}

/* --- Scroll Reveal Animation --- */
.scroll-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .comp-bar-item {
        grid-template-columns: 100px 1fr 40px;
    }

    .hierarchy-level {
        grid-template-columns: 28px 80px 1fr;
        gap: 8px;
        padding: 10px 12px;
    }

    .circle-flow {
        grid-template-columns: repeat(2, 1fr);
    }

    .diagram-flow {
        flex-direction: column;
        align-items: center;
    }

    .flow-arrow {
        transform: rotate(90deg);
    }

    #ocean-column {
        padding: 0 16px;
    }

    .hero-scroll-indicator {
        left: 50%;
        transform: translateX(-50%);
    }

    .data-row {
        flex-direction: column;
        gap: 2px;
    }
}
