/* ============================================================
   riron.net — Scholarly Dark-Academia Editorial
   Palette: Parchment #f4efe6, Mahogany #2b1810, Ink #1a1412,
            Gilt #c4953a, Marginalia Red #8b3a3a, Chalk #d4cdc0
   Fonts: Playfair Display, Crimson Pro, Alegreya Sans
   ============================================================ */

/* --- Google Fonts are linked in HTML head --- */

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

html {
    font-size: 17px;
    scroll-behavior: smooth;
}

body {
    background-color: #2b1810;
    color: #1a1412;
    font-family: 'Crimson Pro', Georgia, serif;
    font-weight: 400;
    line-height: 1.8;
    min-height: 100vh;
    /* Subtle noise texture via SVG data URI overlay */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ============================================================
   Typography Scale
   ============================================================ */
h1, h2, h3, h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    line-height: 1.2;
    color: #1a1412;
}

em {
    font-style: italic;
    color: #1a1412;
}

/* ============================================================
   Site Header
   ============================================================ */
.site-header {
    background-color: #2b1810;
    color: #d4cdc0;
    padding: 5rem 2rem 4rem;
    text-align: center;
    border-bottom: 3px solid #c4953a;
    position: relative;
}

.site-header::before {
    content: '';
    display: block;
    width: 60px;
    height: 1px;
    background: #c4953a;
    margin: 0 auto 1.5rem;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
}

.header-kicker {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: #c4953a;
    letter-spacing: 0.15em;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.85;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.25rem, 5.5vw, 3.75rem);
    font-weight: 700;
    color: #f4efe6;
    letter-spacing: 0.04em;
    margin-bottom: 0.6rem;
}

.site-subtitle {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 1rem;
    color: #d4cdc0;
    opacity: 0.7;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 400;
}

/* ============================================================
   Main Surface — Parchment "Page" Lifted from Background
   ============================================================ */
.site-main {
    background-color: #f4efe6;
    max-width: 1040px;
    margin: 0 auto;
    /* Page shadow: asymmetric right-edge shadow */
    box-shadow:
        6px 0 40px rgba(0,0,0,0.45),
        -2px 0 16px rgba(0,0,0,0.12),
        0 6px 30px rgba(0,0,0,0.3);
    position: relative;
}

/* Paper texture overlay */
.site-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   Editorial Section Container
   ============================================================ */
.editorial-section {
    padding: 4.5rem 3rem 4rem;
    position: relative;
    z-index: 2;
    /* Fade-in animation state */
    opacity: 0;
    transition: opacity 0.7s ease;
}

.editorial-section.is-visible {
    opacity: 1;
}

/* ============================================================
   Section Ornament (Number + Rule + Asterism)
   ============================================================ */
.section-ornament {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.section-number {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #c4953a;
    letter-spacing: 0.08em;
    white-space: nowrap;
    text-transform: uppercase;
}

.ornament-rule {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0;
}

.ornament-rule::before,
.ornament-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #c4953a;
    opacity: 0.5;
}

.asterism {
    font-size: 0.9rem;
    color: #c4953a;
    padding: 0 0.75rem;
    line-height: 1;
}

/* ============================================================
   Two-Column Editorial Grid
   ============================================================ */
.editorial-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2.5rem;
    align-items: start;
}

/* ============================================================
   Text Column
   ============================================================ */
.text-column {
    min-width: 0;
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    color: #1a1412;
    margin-bottom: 1.5rem;
    line-height: 1.15;
}

/* Drop Cap — First paragraph of each section */
.drop-cap-paragraph {
    position: relative;
}

.drop-cap-paragraph::first-letter {
    font-family: 'Playfair Display', serif;
    font-size: 4.5em;
    font-weight: 700;
    float: left;
    line-height: 0.78;
    margin-right: 0.1em;
    margin-top: 0.05em;
    color: #c4953a;
    /* Thin gilt frame border */
    border: 1.5px solid #c4953a;
    padding: 0.08em 0.12em;
    /* Subtle inner shadow for gilt-frame depth */
    box-shadow: inset 0 0 0 2px rgba(196,149,58,0.15);
}

/* Drop cap animated frame (the outline that "draws in") */
.drop-cap-paragraph.frame-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3.2em;
    height: 3.6em;
    border: 1.5px solid #c4953a;
    transform: scale(1.06);
    pointer-events: none;
    animation: frameDrawIn 0.6s ease forwards;
    transform-origin: top left;
}

@keyframes frameDrawIn {
    from { clip-path: inset(0 100% 100% 0); }
    to   { clip-path: inset(0 0 0 0); }
}

/* Body paragraphs */
.text-column p {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 1.0625rem;
    line-height: 1.8;
    color: #1a1412;
    margin-bottom: 1.2em;
    hyphens: auto;
}

.text-column p:last-child {
    margin-bottom: 0;
}

/* Pull Quote */
.pull-quote {
    border-left: 3px solid #c4953a;
    padding: 1rem 1.25rem;
    margin: 1.75rem 0;
    background: rgba(196,149,58,0.05);
}

.pull-quote p {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-style: italic;
    font-weight: 400;
    color: #2b1810;
    margin-bottom: 0 !important;
    line-height: 1.65;
}

/* ============================================================
   Margin Column & Annotations
   ============================================================ */
.margin-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 3.75rem; /* align roughly with body text start */
}

.margin-annotation {
    background: #faf7f2;
    border-left: 2px solid #8b3a3a;
    padding: 1rem 0.9rem 0.9rem;
    border-radius: 0 2px 2px 0;
    position: relative;
    box-shadow: 2px 2px 8px rgba(27,20,18,0.1), 0 0 0 0.5px rgba(139,58,58,0.1);
    /* Slide-reveal from right */
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.margin-annotation.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Brass tack pin */
.pin {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: #c4953a;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.2);
}

.annotation-meta {
    font-family: 'Alegreya Sans', sans-serif !important;
    font-size: 0.7rem !important;
    font-weight: 500 !important;
    color: #8b3a3a !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.4em !important;
    line-height: 1.4 !important;
}

.margin-annotation p {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #2b1810;
    margin-bottom: 0;
}

.margin-annotation em {
    color: #2b1810;
    font-style: italic;
}

/* ============================================================
   Chalkboard Interludes
   ============================================================ */
.chalkboard-interlude {
    background-color: #2b1810;
    color: #d4cdc0;
    padding: 4rem 3rem;
    text-align: center;
    position: relative;
    z-index: 2;
    /* Fade in on scroll */
    opacity: 0;
    transition: opacity 0.8s ease;
}

.chalkboard-interlude.is-visible {
    opacity: 1;
}

/* Subtle chalk-dust texture */
.chalkboard-interlude::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23c)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
}

.interlude-inner {
    max-width: 680px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.theorem-label {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #c4953a;
    margin-bottom: 1rem;
}

.theorem-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.7rem);
    line-height: 1.55;
    color: #d4cdc0;
    margin-bottom: 1rem;
}

.theorem-attribution {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 0.8rem;
    color: #c4953a;
    opacity: 0.8;
    letter-spacing: 0.06em;
}

/* ============================================================
   Footer — Bibliography
   ============================================================ */
.site-footer {
    background-color: #2b1810;
    color: #d4cdc0;
    padding: 4rem 3rem;
    position: relative;
    z-index: 2;
    border-top: 3px solid #c4953a;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
}

.footer-ornament {
    text-align: center;
    margin-bottom: 2.5rem;
}

.footer-ornament .ornament-rule {
    margin-bottom: 1.5rem;
}

.footer-ornament .ornament-rule::before,
.footer-ornament .ornament-rule::after {
    background: #c4953a;
    opacity: 0.4;
}

.bibliography-heading {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #f4efe6;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.bibliography {
    max-width: 700px;
    margin: 0 auto;
}

.bibliography-list {
    list-style: decimal;
    padding-left: 1.5rem;
}

.bibliography-list li {
    font-family: 'Crimson Pro', serif;
    font-size: 0.9375rem;
    color: #d4cdc0;
    line-height: 1.6;
    margin-bottom: 0.8em;
    padding-left: 0.5rem;
    opacity: 0.9;
}

.bibliography-list li em {
    color: #f4efe6;
    font-style: italic;
}

.footer-colophon {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(196,149,58,0.25);
}

.footer-colophon p {
    font-family: 'Alegreya Sans', sans-serif;
    font-size: 0.8rem;
    color: #c4953a;
    letter-spacing: 0.15em;
    opacity: 0.75;
}

.colophon-year {
    letter-spacing: 0.2em;
}

/* ============================================================
   Horizontal Rules (used inside ornament-rule elements)
   ============================================================ */
hr {
    border: none;
    height: 1px;
    background: #c4953a;
    opacity: 0.3;
    margin: 2rem 0;
}

/* ============================================================
   Responsive — Mobile (< 768px)
   ============================================================ */
@media (max-width: 768px) {
    .editorial-section {
        padding: 3rem 1.5rem 2.5rem;
    }

    .editorial-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .margin-column {
        padding-top: 0;
        border-top: 1px solid rgba(139,58,58,0.2);
        padding-top: 1.5rem;
    }

    .margin-annotation {
        transform: translateX(0);
    }

    .chalkboard-interlude {
        padding: 3rem 1.5rem;
    }

    .site-header {
        padding: 3.5rem 1.5rem 3rem;
    }

    .site-footer {
        padding: 3rem 1.5rem;
    }

    .drop-cap-paragraph::first-letter {
        font-size: 3.5em;
    }
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .editorial-section,
    .chalkboard-interlude,
    .margin-annotation {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .drop-cap-paragraph.frame-animated::before {
        animation: none;
        clip-path: none;
    }
}
