/* ============================================ */
/* recycle.wiki - Neubrutalist Recycling Wiki   */
/* ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Bitter', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.8;
    color: #5C4A38;
    background-color: #F5ECD8;
    overflow-x: hidden;
    position: relative;
}

/* ---------- SVG Filters (hidden) ---------- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Paper Texture Overlay ---------- */
.paper-texture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    filter: url(#paper-texture);
    background: #F5ECD8;
    mix-blend-mode: multiply;
}

/* ---------- Page Border (Neubrutalist) ---------- */
.page-border {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid #5C4A38;
    pointer-events: none;
    z-index: 9998;
}

/* ============================================ */
/* ENCYCLOPEDIA COVER                           */
/* ============================================ */
#encyclopedia-cover {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #F5ECD8;
    overflow: hidden;
}

/* ---------- Bubble Clusters ---------- */
.bubble-cluster {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.bubble-cluster.visible {
    opacity: 1;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0.2;
}

/* Bubble color classes - Bubble Blue: #6BA8C8, Bubble Pink: #D88B8B */
.bubble-blue {
    background-color: #6BA8C8;
}

.bubble-pink {
    background-color: #D88B8B;
}

.bubble-cluster-1 .bubble,
.bubble-cluster-2 .bubble,
.bubble-cluster-3 .bubble,
.bubble-cluster-footer .bubble {
    animation: bubbleFloat 6s ease-in-out infinite;
}

.bubble-cluster-1 .bubble:nth-child(2) { animation-delay: 1s; }
.bubble-cluster-1 .bubble:nth-child(3) { animation-delay: 2s; }
.bubble-cluster-1 .bubble:nth-child(4) { animation-delay: 0.5s; }
.bubble-cluster-2 .bubble:nth-child(2) { animation-delay: 1.5s; }
.bubble-cluster-2 .bubble:nth-child(3) { animation-delay: 0.8s; }
.bubble-cluster-2 .bubble:nth-child(4) { animation-delay: 2.2s; }
.bubble-cluster-3 .bubble:nth-child(2) { animation-delay: 0.7s; }
.bubble-cluster-3 .bubble:nth-child(3) { animation-delay: 1.4s; }

@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.05); }
}

/* ---------- Cover Content ---------- */
.cover-content {
    text-align: center;
    z-index: 10;
}

.wordmark {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 5vw, 64px);
    color: #3C2A1A;
    letter-spacing: 0.02em;
    display: inline-block;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px);
}

.letter.animate-in {
    animation: letterBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.letter-dot {
    color: #D4A855;
}

@keyframes letterBounce {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.cover-tagline {
    font-family: 'Bitter', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    color: #5C4A38;
    font-size: clamp(14px, 2vw, 20px);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.8s ease 1.4s;
}

.cover-tagline.visible {
    opacity: 1;
}

/* ---------- Scroll Hint ---------- */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.6s ease 2s;
}

.scroll-hint.visible {
    opacity: 1;
}

.scroll-hint-text {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: #5C4A38;
    text-transform: lowercase;
}

.scroll-hint-arrow {
    font-size: 20px;
    color: #5C4A38;
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ============================================ */
/* ARTICLE STREAM                               */
/* ============================================ */
#article-stream {
    max-width: 700px;
    margin: 0 auto;
    padding: 80px 24px;
}

/* ---------- Wiki Article ---------- */
.wiki-article {
    position: relative;
    margin-bottom: 80px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.wiki-article.visible {
    opacity: 1;
    transform: translateY(0);
}

.article-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(24px, 4vw, 40px);
    color: #3C2A1A;
    margin-bottom: 20px;
    border-bottom: 3px solid #5C4A38;
    padding-bottom: 8px;
    display: inline-block;
}

.article-body {
    color: #5C4A38;
    margin-bottom: 20px;
}

/* ---------- Key Terms (Pulse Attention) ---------- */
.key-term {
    background: rgba(212, 168, 85, 0.2);
    padding: 1px 4px;
    border-radius: 2px;
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { background: rgba(212, 168, 85, 0.2); }
    50% { background: rgba(212, 168, 85, 0.4); }
}

/* ---------- Pull Quotes (Neubrutalist) ---------- */
.pull-quote {
    border: 3px solid #5C4A38;
    box-shadow: 4px 4px 0 #5C4A38;
    padding: 20px;
    margin: 32px 0;
    background: #F5ECD8;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.pull-quote:hover {
    box-shadow: 6px 6px 0 #5C4A38;
    transform: translate(-2px, -2px);
}

.pull-quote p {
    font-family: 'Bitter', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: clamp(16px, 2vw, 20px);
    color: #3C2A1A;
    line-height: 1.6;
}

.pull-quote cite {
    display: block;
    margin-top: 12px;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-style: normal;
    color: #5C4A38;
}

/* ---------- Callout Boxes (Neubrutalist) ---------- */
.callout-box {
    border: 3px solid #5C4A38;
    box-shadow: 4px 4px 0 #5C4A38;
    padding: 24px;
    margin: 32px 0;
    background: #E8DCC8;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.callout-box:hover {
    box-shadow: 6px 6px 0 #5C4A38;
    transform: translate(-2px, -2px);
}

.callout-title {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(18px, 2.5vw, 24px);
    color: #3C2A1A;
    margin-bottom: 16px;
}

.callout-subtitle {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: #3C2A1A;
    margin-bottom: 8px;
}

.callout-list {
    padding-left: 20px;
    color: #5C4A38;
    margin-bottom: 12px;
}

.callout-list li {
    margin-bottom: 6px;
}

.callout-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* ---------- Material Grid ---------- */
.material-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 32px 0;
}

.material-card {
    border: 3px solid #5C4A38;
    box-shadow: 4px 4px 0 #5C4A38;
    padding: 20px;
    background: #F5ECD8;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.material-card:hover {
    box-shadow: 6px 6px 0 #5C4A38;
    transform: translate(-2px, -2px);
}

.material-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
    color: #D4A855;
}

.material-name {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 16px;
    color: #3C2A1A;
    margin-bottom: 8px;
}

.material-detail {
    font-size: 14px;
    color: #5C4A38;
    line-height: 1.6;
}

/* ---------- Inline Bubble Clusters ---------- */
.bubble-cluster-inline {
    position: absolute;
    width: 60px;
    height: 60px;
    top: 0;
    left: -50px;
    opacity: 0.8;
}

.bubble-cluster-inline.bubble-cluster-right {
    left: auto;
    right: -50px;
}

/* ============================================ */
/* INDEX SECTION                                */
/* ============================================ */
#index-section {
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    border-top: 3px solid #5C4A38;
}

.index-heading {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(28px, 4vw, 48px);
    color: #3C2A1A;
    margin-bottom: 40px;
    text-align: center;
}

.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.index-tab {
    border: 3px solid #5C4A38;
    box-shadow: 3px 3px 0 #5C4A38;
    padding: 16px;
    background: #E8DCC8;
    transform: rotate(-1deg);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.index-tab:nth-child(even) {
    transform: rotate(1deg);
}

.index-tab:nth-child(3n) {
    transform: rotate(-0.5deg);
}

.index-tab:hover {
    box-shadow: 5px 5px 0 #5C4A38;
    transform: rotate(0deg) translate(-2px, -2px);
}

.index-letter {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 32px;
    color: #D4A855;
    display: block;
    margin-bottom: 8px;
    line-height: 1;
}

.index-entries {
    list-style: none;
    padding: 0;
}

.index-entries li {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: #5C4A38;
    padding: 2px 0;
    border-bottom: 1px solid rgba(92, 74, 56, 0.2);
}

.index-entries li:last-child {
    border-bottom: none;
}

/* ============================================ */
/* COMPOST FOOTER                               */
/* ============================================ */
#compost-footer {
    position: relative;
    background: #E8DCC8;
    border-top: 3px solid #5C4A38;
    padding: 60px 24px 40px;
    overflow: hidden;
}

.bubble-cluster-footer {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 1;
    pointer-events: none;
}

.footer-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 10;
}

.footer-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(18px, 3vw, 28px);
    color: #3C2A1A;
    margin-bottom: 24px;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.footer-link {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    color: #5C4A38;
    text-decoration: none;
    border: 2px solid #5C4A38;
    padding: 6px 14px;
    box-shadow: 2px 2px 0 #5C4A38;
    background: #F5ECD8;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.footer-link:hover {
    box-shadow: 4px 4px 0 #5C4A38;
    transform: translate(-2px, -2px);
}

.footer-note {
    font-family: 'Bitter', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: #5C4A38;
    opacity: 0.7;
}

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

    .callout-columns {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .index-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .bubble-cluster-inline {
        display: none;
    }

    #article-stream {
        padding: 40px 16px;
    }

    .footer-nav {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
}
