/* The Unlearning Archive - Global Design System (Refined) */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;700&family=Indie+Flower&family=Reenie+Beanie&family=Shadows+Into+Light&family=Special+Elite&family=Inter:wght@300;400&display=swap');

:root {
    --paper-white: #fcfcfc;
    /* Cleaner off-white */
    --paper-texture: #f8f8f5;
    --ink-black: #111111;
    --pencil-grey: #444444;
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    /* Softer, more diffuse shadow */

    /* Fonts */
    --font-hand: 'Caveat', cursive;
    /* Default */
    --font-type: 'Special Elite', monospace;
    --font-ui: 'Courier Prime', 'Special Elite', monospace;

    --max-width: 1100px;
}

/* --- DYNAMIC VARIATIONS --- */
/* Fonts */
.font-hand-1 {
    font-family: 'Caveat', cursive;
}

.font-hand-4 {
    font-family: 'Indie Flower', cursive;
}

.font-hand-5 {
    font-family: 'Shadows Into Light', cursive;
}

/* Paper Colors */
.paper-color-1 {
    background-color: #fdfdfd;
}

/* Pure White */
.paper-color-2 {
    background-color: #fcfbf7;
}

/* Warm Cream */
.paper-color-3 {
    background-color: #f7f9fc;
}

/* Cool White */
.paper-color-4 {
    background-color: #fcfcfc;
}

/* Off White */
.paper-color-5 {
    background-color: #fdfaf6;
}

/* Linen */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--paper-texture);
    color: var(--ink-black);
    font-family: var(--font-type);
    line-height: 1.6;
    overflow-x: hidden;
    /* Subtle paper noise */
    background-image:
        repeating-linear-gradient(transparent, transparent 2px, #fdfdfd 3px),
        repeating-linear-gradient(90deg, transparent, transparent 2px, #fdfdfd 3px);
    background-size: 100% 100%;

}

/* Texture overlay */
body::before {
    content: "";
    position: fixed;
    /* Stick to screen */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* --- HEADER MATCHING SCREENSHOT --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    /* Compressed spacing */
    margin-bottom: 1rem;
    border-bottom: none;
}

.site-title-box {
    border: 2px solid var(--ink-black);
    padding: 0.8rem 1.2rem;
    display: inline-block;
    transform: rotate(-0.5deg);
    /* Tiny Imperfection */
}

.site-title {
    font-family: var(--font-type);
    font-size: 1.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--ink-black);
    font-weight: 400;
}

nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--ink-black);
    font-family: var(--font-type);
    font-size: 1rem;
    position: relative;
    padding-bottom: 2px;
}

/* Specific nav item styling from screenshot */
nav a.nav-link-active {
    border-bottom: 2px solid var(--ink-black);
}

nav a.nav-btn-highlight {
    font-weight: 700;
    /* Bold 'Submit' */
}

/* --- HERO SECTION --- */
.hero-section {
    text-align: center;
    max-width: 900px;
    margin: 0 auto 3rem auto;
}

.hero-title {
    font-family: var(--font-type);
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: var(--ink-black);
    font-weight: 400;
}

.hero-subtitle {
    font-family: var(--font-type);
    /* Typewriter for subtitle too */
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--pencil-grey);
    margin-bottom: 2rem;
}

/* Black Button Style */
.btn-primary {
    display: inline-block;
    background: var(--ink-black);
    color: #fff;
    padding: 1rem 2rem;
    font-family: var(--font-type);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* --- ARCHIVE GRID --- */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 Columns based on screenshot width hint */
    gap: 2rem;
    /* Wide gap */
    max-width: 1000px;
    margin: 0 auto;
}

.paper-scrap {
    background: #fff;
    padding: 2.5rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0, 0, 0, 0.03);
    /* Extremely subtle border */
    min-height: 200px;
    display: flex;
    align-items: flex-start;
    /* Top align text */
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Clean rect edges, no clip-path */
    position: relative;
    /* For tape */
    transform: rotate(var(--rotate, 0deg));
}

.paper-scrap::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    width: 30%;
    height: 15px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Tape look */
}

.paper-scrap:hover {
    transform: translateY(-8px) rotate(var(--rotate, 0deg));
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.paper-scrap p {
    font-family: var(--font-hand);
    font-size: 1.6rem;
    line-height: 1.5;
    color: var(--ink-black);
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(250, 250, 248, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #fff;
    padding: 4rem;
    max-width: 700px;
    width: 90%;
    /* Ensure long content scrolls */
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
    border: 2px solid var(--ink-black);
}

.close-modal {
    position: absolute;
    top: 2rem;
    right: 3rem;
    background: none;
    border: none;
    font-size: 3rem;
    cursor: pointer;
    font-family: var(--font-hand);
    color: var(--ink-black);
}

/* --- SUBMISSIONS PAGE --- */
.notebook-area {
    width: 100%;
    height: 600px;
    padding: 2.5rem 3rem;
    font-family: var(--font-hand);
    font-size: 1.8rem;
    line-height: 2.5rem;
    border: 1px solid #eee;
    background-color: #fff;
    background-image: repeating-linear-gradient(white 0, white 2.4rem, #f0f0f0 2.4rem, #f0f0f0 2.5rem);
    background-attachment: local;
    resize: none;
    outline: none;
    color: var(--ink-black);
    box-shadow: var(--shadow-soft);
}

/* Responsiveness */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 2rem;
    }

    .archive-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

/* --- INFINITE SCROLL LOADING --- */
.loading-indicator {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--pencil-grey);
    font-family: var(--font-type);
    opacity: 0;
    transition: opacity 0.3s;
}

.loading-indicator.visible {
    opacity: 1;
}

/* --- RESOURCES PAGE REDESIGN --- */
.resource-split-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    min-height: 60vh;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 0;
}

@media (max-width: 768px) {
    .resource-split-layout {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
}

.resource-left {
    flex: 1;
    display: flex;
    justify-content: center;
}

.resource-right {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

/* Simulated Book Cover */
.cover-placeholder {
    width: 280px;
    height: 400px;
    background-color: #dcd9d4;
    /* Darker paper color for contrast */
    border: 2px solid var(--ink-black);
    box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    position: relative;
    transform: rotate(-2deg);
    transition: transform 0.3s ease;
}

.cover-placeholder:hover {
    transform: rotate(0deg) scale(1.02);
}

/* Spine detail */
.cover-placeholder::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(0, 0, 0, 0.1);
}

.cover-title-display {
    font-family: var(--font-type);
    font-size: 1.6rem;
    margin-bottom: 1rem;
    line-height: 1.3;
    font-weight: 700;
}

.cover-author-display {
    font-family: var(--font-hand);
    font-size: 1.2rem;
    color: var(--pencil-grey);
}

/* Shuffle Button */
.shuffle-btn {
    margin-top: 2rem;
    background: transparent;
    border: 1px solid var(--ink-black);
    padding: 0.8rem 2rem;
    font-family: var(--font-type);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.shuffle-btn:hover {
    background: var(--ink-black);
    color: #fff;
}

/* External Link Button */
.view-btn {
    margin-top: 1rem;
    margin-right: 1rem;
    background: var(--ink-black);
    color: #fff;
    border: 1px solid var(--ink-black);
    padding: 0.8rem 2rem;
    font-family: var(--font-type);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    text-decoration: none;
}


/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {

    /* 1. Global Navigation */
    header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        margin-bottom: 2rem;
    }

    nav ul {
        flex-direction: row;
        justify-content: center;
        gap: 0.8rem;
        flex-wrap: nowrap;
    }

    nav a {
        font-size: 0.85rem;
    }

    .site-title {
        font-size: 1.4rem;
    }

    /* 2. Typography */
    .hero-title {
        font-size: 2rem;
        /* Scale down from 3rem */
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        padding: 0 1rem;
    }

    /* 3. Index Page */
    .archive-grid {
        grid-template-columns: 1fr;
        /* Stack cards */
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .paper-scrap {
        min-height: auto;
        padding: 2rem;
    }

    /* Modals */
    .modal-content {
        padding: 2rem;
        width: 95%;
        margin: 1rem;
    }

    .close-modal {
        top: 1rem;
        right: 1.5rem;
        font-size: 2.5rem;
    }

    /* 4. Resources Page */
    .resource-split-layout {
        flex-direction: column;
        gap: 2rem;
        padding: 0 1rem 2rem 1rem;
    }

    .resource-left,
    .resource-right {
        width: 100%;
        flex: none;
        align-items: center;
        text-align: center;
    }

    .resource-right {
        align-items: center;
        /* Center align all text on mobile */
    }

    #resource-cover-img {
        max-height: 50vh;
        /* Don't take up whole screen */
    }

    .cover-placeholder {
        transform: rotate(0deg);
        /* Remove rotation on mobile for cleaner stack */
        width: 100%;
        max-width: 280px;
    }

    #resource-title {
        font-size: 2rem !important;
        /* Override inline style */
        text-align: center;
    }

    /* 5. About Page */
    .notebook-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }

    .pinned-note {
        transform: rotate(0deg) !important;
        /* Remove rotation for clean stack */
        padding: 2rem;
    }

    .about-header-section h1 {
        font-size: 2.5rem !important;
        /* Ensure it fits */
    }

    /* 6. Submissions Page */
    .notebook-area {
        padding: 1.5rem;
        font-size: 1.4rem;
        line-height: 2rem;
    }
}