/* =============================================
   Manuscripts & Treatises - Parchment Card Styling
   Aged academic papers floating on dark background
   ============================================= */

/* Color Palette for Parchment Cards */
:root {
    /* Parchment (card) colors */
    --parchment-bg: #f4e8d3;
    --parchment-dark: #e8d5b7;
    --parchment-stain: #d4c4a8;
    --parchment-edge: #c9b896;

    /* Ink colors (for text on parchment) */
    --ink-brown: #3d2914;
    --ink-sepia: #5c4033;
    --ink-red: #8b3a3a;
    --ink-faded: #7a6b5a;

    /* Decorative */
    --flourish-color: #6b5344;
}

/* =============================================
   Manuscript Collection Container
   ============================================= */

.manuscript-collection {
    padding: 2rem 0;
}

.manuscript-intro {
    background: var(--bg-secondary);
    border: 2px solid var(--brass-dark);
    padding: 2rem 2.5rem;
    margin-bottom: 3rem;
    position: relative;
    box-shadow:
        inset 0 0 0 1px var(--brass),
        0 4px 8px rgba(0, 0, 0, 0.6);
}

.manuscript-intro::before,
.manuscript-intro::after {
    content: '❦';
    position: absolute;
    font-size: 1.5rem;
    color: var(--brass);
    text-shadow: var(--text-shadow-brass);
}

.manuscript-intro::before {
    top: 0.5rem;
    left: 0.5rem;
}

.manuscript-intro::after {
    bottom: 0.5rem;
    right: 0.5rem;
    transform: rotate(180deg);
}

.manuscript-intro h2 {
    color: var(--brass-light);
    font-family: 'Georgia', serif;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: var(--text-shadow-brass);
}

.manuscript-intro p {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.05rem;
}

.manuscript-intro p em {
    color: var(--text-primary);
}

/* =============================================
   Treatise Entry - Parchment Card Style
   ============================================= */

a.treatise-entry {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

.treatise-entry {
    background:
        /* Subtle paper grain texture */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 115, 85, 0.03) 2px,
            rgba(139, 115, 85, 0.03) 4px
        ),
        /* Age stains - scattered radial gradients */
        radial-gradient(ellipse at 85% 15%, rgba(180, 160, 130, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 80%, rgba(160, 140, 110, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 95% 90%, rgba(170, 150, 120, 0.12) 0%, transparent 35%),
        /* Base parchment gradient */
        linear-gradient(
            180deg,
            var(--parchment-bg) 0%,
            var(--parchment-dark) 50%,
            var(--parchment-stain) 100%
        );
    border: 1px solid var(--parchment-edge);
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    position: relative;

    /* Paper shadow and worn edge effect */
    box-shadow:
        /* Lift shadow */
        0 4px 12px rgba(0, 0, 0, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.2),
        /* Worn edge simulation - asymmetric inner shadows */
        inset 0 0 30px rgba(139, 115, 85, 0.15),
        inset 2px 0 8px rgba(0, 0, 0, 0.05),
        inset -1px 0 6px rgba(0, 0, 0, 0.03),
        inset 0 2px 8px rgba(255, 255, 255, 0.3),
        inset 0 -2px 10px rgba(139, 115, 85, 0.2);

    /* Subtle rotation for organic feel */
    transform: rotate(-0.3deg);
    transition: all 0.3s ease;
}

/* Alternate rotation for variety */
.treatise-entry:nth-child(even) {
    transform: rotate(0.2deg);
}

.treatise-entry:nth-child(3n) {
    transform: rotate(-0.15deg);
}

/* Corner flourishes */
.treatise-entry::before,
.treatise-entry::after {
    position: absolute;
    font-family: 'Georgia', serif;
    color: var(--flourish-color);
    opacity: 0.4;
    font-size: 1.5rem;
    line-height: 1;
}

.treatise-entry::before {
    content: '❧';
    top: 0.75rem;
    left: 1rem;
}

.treatise-entry::after {
    content: '❧';
    bottom: 0.75rem;
    right: 1rem;
    transform: rotate(180deg);
}

/* Hover effect - paper lifting */
.treatise-entry:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.5),
        0 6px 12px rgba(0, 0, 0, 0.3),
        inset 0 0 30px rgba(139, 115, 85, 0.15),
        inset 2px 0 8px rgba(0, 0, 0, 0.05),
        inset -1px 0 6px rgba(0, 0, 0, 0.03),
        inset 0 2px 8px rgba(255, 255, 255, 0.3),
        inset 0 -2px 10px rgba(139, 115, 85, 0.2);
}

.treatise-entry:hover::before,
.treatise-entry:hover::after {
    opacity: 0.6;
}

/* =============================================
   Treatise Typography
   ============================================= */

.treatise-title {
    font-family: 'Georgia', serif;
    font-size: 1.5rem;
    font-weight: normal;
    color: var(--ink-brown);
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
    /* Calligraphic feel */
    letter-spacing: 0.02em;
}

/* When card is a link, title changes color on hover */
a.treatise-entry:hover .treatise-title {
    color: var(--ink-red);
    text-shadow:
        1px 1px 0 rgba(255, 255, 255, 0.5),
        0 0 1px var(--ink-red);
}

.treatise-author {
    font-family: 'Georgia', serif;
    font-size: 1rem;
    color: var(--ink-sepia);
    margin: 0 0 1rem 0;
    font-style: italic;
    padding-left: 1.5rem;
    position: relative;
}

.treatise-author::before {
    content: '—';
    position: absolute;
    left: 0;
}

.author-name {
    font-style: normal;
    font-weight: bold;
    color: var(--ink-brown);
}

.author-title {
    font-size: 0.9rem;
    color: var(--ink-faded);
}

.treatise-abstract {
    font-family: 'Georgia', serif;
    font-size: 1rem;
    color: var(--ink-sepia);
    line-height: 1.7;
    margin: 0 0 1rem 0;
    text-align: justify;
    hyphens: auto;
}

.treatise-date {
    display: block;
    font-family: 'Georgia', serif;
    font-size: 0.85rem;
    color: var(--ink-faded);
    font-style: italic;
    text-align: right;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(107, 83, 68, 0.2);
}

/* =============================================
   Treatise Status Indicators
   ============================================= */

.treatise-status {
    display: inline-block;
    font-family: 'Georgia', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid;
}

.treatise-status.available {
    color: #2d5016;
    background: rgba(77, 120, 77, 0.15);
    border-color: #4d784d;
}

.treatise-status.forthcoming {
    color: var(--ink-faded);
    background: rgba(139, 115, 85, 0.15);
    border-color: var(--parchment-edge);
}

.treatise-status.restricted {
    color: var(--ink-red);
    background: rgba(139, 58, 58, 0.1);
    border-color: var(--ink-red);
}

/* =============================================
   Section Dividers
   ============================================= */

.manuscript-divider {
    text-align: center;
    margin: 3rem 0;
    color: var(--brass);
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    opacity: 0.6;
}

/* =============================================
   Archive Notice / Disclaimer
   ============================================= */

.archive-notice {
    background: var(--bg-tertiary);
    border: 1px solid var(--brass-dark);
    border-left: 4px solid var(--brass);
    padding: 1.5rem 2rem;
    margin-top: 3rem;
    font-style: italic;
    color: var(--text-secondary);
}

.archive-notice p {
    margin: 0;
    line-height: 1.7;
}

.archive-notice strong {
    color: var(--brass-light);
    font-style: normal;
}

/* =============================================
   Responsive Adjustments
   ============================================= */

@media (max-width: 768px) {
    .treatise-entry {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        /* Reset rotation on mobile for cleaner stacking */
        transform: none;
    }

    .treatise-entry:hover {
        transform: translateY(-2px);
    }

    .treatise-entry:nth-child(even),
    .treatise-entry:nth-child(3n) {
        transform: none;
    }

    .treatise-title {
        font-size: 1.25rem;
    }

    .treatise-entry::before,
    .treatise-entry::after {
        font-size: 1.2rem;
    }

    .manuscript-intro {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .treatise-entry {
        padding: 1.25rem;
    }

    .treatise-entry::before,
    .treatise-entry::after {
        display: none;
    }

    .treatise-title {
        font-size: 1.1rem;
    }

    .treatise-author {
        font-size: 0.9rem;
        padding-left: 1rem;
    }

    .treatise-abstract {
        font-size: 0.95rem;
        text-align: left;
    }
}
