/* ========================================
   whitepapers.xyz - styles.css
   Palette:
     Library Dark:    #1C1610
     Parchment Cream: #F5F0E6
     Warm Brass:      #8B7355
     Ink Black:       #2A2520
     Annotation Red:  #9B3B2A
     Deep Forest:     #3A5C3A
     Academic Blue:   #3A4F7A
     Amber Gold:      #B8923A
   Fonts: Playfair Display 700, Source Serif 4 400, DM Sans 500
======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    color: #2A2520;
    background: #F5F0E6;
    line-height: 1.75;
    font-size: 1.05rem;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
}

/* ---- UTILITY ---- */

.brass-rule {
    border: none;
    height: 1px;
    background: rgba(139, 115, 85, 0.4);
    width: 100%;
    max-width: 600px;
    margin: 1rem auto;
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ---- METADATA / LABELS ---- */

.paper-author,
.paper-date,
.row-label,
.featured-label,
.footer-copy,
.category-item {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

/* ---- FOYER SECTION ---- */

.foyer {
    min-height: 100vh;
    background: #1C1610;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.foyer::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#grain);
    opacity: 0.03;
    pointer-events: none;
}

.foyer-content {
    text-align: center;
    padding: 2rem;
}

.foyer-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: #F5F0E6;
    letter-spacing: 0.02em;
    margin: 1.5rem 0;
}

.foyer-subtitle {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: 1.1rem;
    color: #8B7355;
    text-transform: none;
    letter-spacing: 0.06em;
    margin-top: 0.5rem;
}

.foyer .brass-rule {
    max-width: 400px;
}

/* ---- CLASSIFICATION INDEX ---- */

.classification {
    background: #F5F0E6;
    padding: clamp(3rem, 6vw, 6rem) 2rem;
    min-height: 80vh;
    position: relative;
}

.classification::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#grain);
    opacity: 0.02;
    pointer-events: none;
}

.classification-layout {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 3rem;
}

.category-nav {
    flex: 0 0 25%;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
}

.section-heading {
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #2A2520;
    margin-bottom: 2rem;
    line-height: 1.2;
}

.category-list {
    list-style: none;
}

.category-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(139, 115, 85, 0.2);
    color: #8B7355;
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.category-item:hover {
    color: #9B3B2A;
}

.category-cards-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.card-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.row-label {
    color: #8B7355;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}

.card-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 16px;
    padding-bottom: 0.5rem;
}

.card-scroll::-webkit-scrollbar {
    height: 4px;
}

.card-scroll::-webkit-scrollbar-track {
    background: rgba(139, 115, 85, 0.1);
}

.card-scroll::-webkit-scrollbar-thumb {
    background: #8B7355;
    border-radius: 2px;
}

.paper-card {
    flex: 0 0 280px;
    background: #F5F0E6;
    border-radius: 4px;
    padding: 1.5rem;
    scroll-snap-align: start;
    box-shadow: 0 1px 3px rgba(28, 22, 16, 0.12), 0 1px 2px rgba(28, 22, 16, 0.08);
    border-left: 4px solid transparent;
    transition: box-shadow 0.3s ease;
}

.paper-card:hover {
    box-shadow: 0 4px 12px rgba(28, 22, 16, 0.15), 0 2px 4px rgba(28, 22, 16, 0.1);
}

.border-science { border-left-color: #3A5C3A; }
.border-tech { border-left-color: #3A4F7A; }
.border-policy { border-left-color: #9B3B2A; }
.border-econ { border-left-color: #B8923A; }

.paper-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1rem;
    color: #2A2520;
    margin-bottom: 0.5rem;
    line-height: 1.35;
}

.paper-author {
    color: #8B7355;
    font-style: italic;
    margin-bottom: 0.5rem;
    display: block;
}

.paper-excerpt {
    font-size: 0.9rem;
    color: #2A2520;
    line-height: 1.6;
}

.paper-date {
    display: block;
    margin-top: 0.75rem;
    color: #8B7355;
    font-size: 0.75rem;
}

/* ---- FEATURED READING ---- */

.featured {
    background: #F5F0E6;
    padding: clamp(4rem, 8vw, 8rem) 2rem;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.featured::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#grain);
    opacity: 0.02;
    pointer-events: none;
}

.featured-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.featured-header {
    text-align: center;
    margin-bottom: 3rem;
}

.featured-label {
    color: #9B3B2A;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.5rem;
}

.featured-body {
    position: relative;
}

.featured-title {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    color: #2A2520;
    margin-bottom: 1rem;
    line-height: 1.25;
}

.featured-author {
    font-size: 1rem;
    margin-bottom: 2rem;
}

.featured-abstract p {
    margin-bottom: 2rem;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #2A2520;
}

/* ---- MARGIN ANNOTATIONS ---- */

.margin-annotation {
    position: absolute;
    width: 200px;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 0.9rem;
    color: #9B3B2A;
    line-height: 1.4;
}

.annotation-1 {
    right: -220px;
    top: 120px;
    transform: rotate(-2deg);
}

.annotation-2 {
    left: -220px;
    top: 350px;
    transform: rotate(-1.5deg);
}

.annotation-connector {
    display: block;
    width: 40px;
    height: 1px;
    background: #9B3B2A;
    margin-top: 0.5rem;
}

.annotation-1 .annotation-connector {
    margin-left: 0;
}

.annotation-2 .annotation-connector {
    margin-left: auto;
}

/* ---- THE STACKS ---- */

.stacks {
    background: #1C1610;
    padding: clamp(4rem, 6vw, 6rem) 2rem;
    min-height: 80vh;
    position: relative;
}

.stacks::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url(#grain);
    opacity: 0.03;
    pointer-events: none;
}

.stacks-heading {
    color: #F5F0E6;
    text-align: center;
    margin-bottom: 3rem;
}

.masonry-grid {
    max-width: 1100px;
    margin: 0 auto;
    columns: 3;
    column-gap: 20px;
}

.stack-card {
    break-inside: avoid;
    background: #F5F0E6;
    padding: 1.5rem;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid transparent;
    box-shadow: 0 1px 3px rgba(28, 22, 16, 0.12), 0 1px 2px rgba(28, 22, 16, 0.08);
}

/* ---- BOOK SPINES ---- */

.book-spines {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    padding: 2rem 0;
    background: #1C1610;
}

.spine {
    border-radius: 1px;
    opacity: 0.8;
}

/* ---- LAMP FOOTER ---- */

.lamp-footer {
    background: #1C1610;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: clamp(4rem, 6vw, 6rem) 2rem;
}

.lamp-glow {
    position: absolute;
    width: 500px;
    height: 500px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(139, 115, 85, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.footer-content {
    text-align: center;
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.footer-title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: #F5F0E6;
    margin-bottom: 1.5rem;
}

.footer-text {
    color: rgba(245, 240, 230, 0.8);
    font-size: 1rem;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.footer-email {
    color: #B8923A;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
}

.footer-rule {
    margin: 2rem auto;
    max-width: 200px;
}

.footer-copy {
    color: rgba(139, 115, 85, 0.6);
    font-size: 0.75rem;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 1100px) {
    .margin-annotation {
        position: relative;
        right: auto;
        left: auto;
        top: auto;
        width: 100%;
        transform: none;
        padding: 1rem;
        border-left: 3px solid #9B3B2A;
        margin: 1.5rem 0;
    }

    .annotation-connector {
        display: none;
    }
}

@media (max-width: 900px) {
    .classification-layout {
        flex-direction: column;
    }

    .category-nav {
        position: static;
        flex: none;
    }

    .masonry-grid {
        columns: 2;
    }
}

@media (max-width: 600px) {
    .masonry-grid {
        columns: 1;
    }

    .paper-card {
        flex: 0 0 240px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
