/* =====================================================================
   nonri.org -- The Logic Foundation
   Dark academia, editorial-flow, scholarly journal layout.
   ===================================================================== */

:root {
    --library-dark: #1c1410;
    --vellum-cream: #f4efe4;
    --mahogany: #3b2f2f;
    --gold-foil: #8b7355;
    --aged-paper: #c4a882;
    --parchment: #d4c9b5;
    --leather-brown: #6b4c3b;
    --sealing-wax: #9b4a2c;

    --font-display: 'Playfair Display', 'Lora', Georgia, serif;
    --font-body: 'Lora', Georgia, 'Times New Roman', serif;
    --font-margin: 'Alegreya Sans', 'Inter', sans-serif;

    --measure: 64ch;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--vellum-cream);
    color: var(--mahogany);
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.85;
    font-feature-settings: "liga" 1, "onum" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection {
    background: var(--gold-foil);
    color: var(--vellum-cream);
}

/* ---------- Vignette overlay (page-wide warm lamplight effect) ---------- */
.vignette {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    background: radial-gradient(
        ellipse at center,
        transparent 40%,
        rgba(28, 20, 16, 0.18) 100%
    );
    mix-blend-mode: multiply;
    opacity: 0.5;
}

/* =====================================================================
   HERO -- Library Portal
   ===================================================================== */

.hero {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background:
        radial-gradient(ellipse at center, rgba(139, 115, 85, 0.06) 0%, transparent 70%),
        var(--library-dark);
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 1.5rem 4rem;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0,
            transparent 6px,
            rgba(139, 115, 85, 0.025) 6px,
            rgba(139, 115, 85, 0.025) 7px
        );
    pointer-events: none;
}

.hero-frame {
    position: relative;
    background: var(--vellum-cream);
    width: 100%;
    max-width: 720px;
    padding: clamp(2.5rem, 6vw, 5rem) clamp(1.75rem, 5vw, 3.5rem);
    box-shadow:
        0 0 60px rgba(244, 239, 228, 0.08),
        0 30px 80px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px var(--parchment);
    text-align: center;
}

.hero-frame::before,
.hero-frame::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    height: 1px;
    background: var(--parchment);
}

.hero-frame::before { top: 12px; }
.hero-frame::after  { bottom: 12px; }

.hero-corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 1px solid var(--gold-foil);
}
.hero-corner-tl { top: 6px;    left: 6px;    border-right: 0; border-bottom: 0; }
.hero-corner-tr { top: 6px;    right: 6px;   border-left: 0;  border-bottom: 0; }
.hero-corner-bl { bottom: 6px; left: 6px;    border-right: 0; border-top: 0;    }
.hero-corner-br { bottom: 6px; right: 6px;   border-left: 0;  border-top: 0;    }

.hero-eyebrow {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-bottom: 1.75rem;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 6.5vw, 4.4rem);
    line-height: 1;
    color: var(--mahogany);
    letter-spacing: -0.01em;
    font-style: italic;
}

.hero-korean {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    color: var(--leather-brown);
    margin-top: 0.6rem;
    letter-spacing: 0.4em;
    font-weight: 400;
}

.hero-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.6rem 0 1.4rem;
}

.hero-rule span {
    flex: 0 0 70px;
    height: 1px;
    background: var(--gold-foil);
    opacity: 0.6;
}

.hero-rule em {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--gold-foil);
    font-style: normal;
    transform: translateY(-2px);
}

.hero-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.15rem;
    color: var(--leather-brown);
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-description {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--mahogany);
    max-width: 48ch;
    margin: 1.6rem auto 1.4rem;
    font-style: italic;
}

.hero-meta {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    color: var(--gold-foil);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

.hero-imprint {
    font-family: var(--font-margin);
    font-size: 0.72rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--aged-paper);
    opacity: 0.55;
    margin-top: 3rem;
    text-align: center;
}

/* =====================================================================
   MASTHEAD
   ===================================================================== */

.masthead {
    background: var(--vellum-cream);
    padding: 5rem 0 2.5rem;
    border-bottom: 1px solid var(--parchment);
}

.masthead-grid {
    display: grid;
    grid-template-columns: 1fr 280px 80px 200px 1fr;
    width: 100%;
}

.masthead-main {
    grid-column: 2 / 3;
    text-align: left;
    border-top: 4px double var(--leather-brown);
    border-bottom: 1px solid var(--parchment);
    padding: 1.4rem 0 1.6rem;
}

.masthead-line {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-bottom: 0.7rem;
}

.masthead-headline {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    color: var(--mahogany);
    line-height: 1.2;
    letter-spacing: -0.005em;
}

.masthead-tagline {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--leather-brown);
    margin-top: 0.7rem;
    font-style: italic;
    line-height: 1.6;
}

/* =====================================================================
   ARTICLES -- Two-column journal layout
   Grid: [margin][main 280][gutter 80][marginalia 200][margin]
   ===================================================================== */

.article {
    background: var(--vellum-cream);
    padding: 4.5rem 0 1rem;
    position: relative;
}

.article-alt {
    background:
        linear-gradient(var(--vellum-cream), var(--vellum-cream)) padding-box,
        var(--vellum-cream);
}

.article-alt::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 60% 40% at 50% 0%,
            rgba(196, 168, 130, 0.08),
            transparent 70%
        );
}

.article-grid {
    display: grid;
    grid-template-columns: 1fr 280px 80px 200px 1fr;
    width: 100%;
    align-items: start;
    position: relative;
}

.article-main {
    grid-column: 2 / 3;
    position: relative;
}

.article-gutter {
    grid-column: 3 / 4;
    border-left: 1px dotted var(--parchment);
    margin-left: 39px;
    align-self: stretch;
    min-height: 100%;
    opacity: 0.7;
}

.article-marginalia {
    grid-column: 4 / 5;
    font-family: var(--font-margin);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--leather-brown);
    padding-top: 4.2rem;
}

.article-folio {
    font-family: var(--font-margin);
    font-size: 0.74rem;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-bottom: 0.9rem;
}

.article-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.7rem, 3vw, 2.6rem);
    line-height: 1.18;
    color: var(--mahogany);
    letter-spacing: -0.005em;
    margin-bottom: 0.5rem;
}

.article-byline {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--leather-brown);
    margin-bottom: 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--parchment);
}

.article-body {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--mahogany);
    margin-bottom: 1.4rem;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.article-body em,
.article-body i {
    color: var(--leather-brown);
    font-style: italic;
}

.article-body q {
    quotes: "\201C" "\201D" "\2018" "\2019";
    color: var(--leather-brown);
    font-style: italic;
}

.article-lead::first-letter {
    float: left;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: 4.2em;
    line-height: 0.85;
    margin: 0.04em 0.12em 0 0;
    color: var(--gold-foil);
    text-shadow: 0 1px 0 rgba(139, 115, 85, 0.18);
}

/* Marginalia notes */
.margin-folio {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--gold-foil);
    margin-top: 1.4rem;
    margin-bottom: 0.25rem;
    letter-spacing: 0.04em;
}

.margin-folio:first-child {
    margin-top: 0;
}

.margin-note {
    font-family: var(--font-margin);
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--leather-brown);
    margin-bottom: 0.4rem;
}

.margin-note em,
.margin-note i {
    color: var(--mahogany);
    font-style: italic;
}

.margin-note q {
    color: var(--mahogany);
    font-style: italic;
}

/* Section divider -- the THEREFORE symbol */
.divider {
    display: block;
    text-align: center;
    margin: 3rem 0 1rem;
    height: 28px;
    position: relative;
}

.divider::before,
.divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--parchment);
}

.divider::before { left: 0; }
.divider::after  { right: 0; }

.divider-final::before,
.divider-final::after {
    width: 30%;
}

.divider > .therefore,
.divider .mark {
    display: inline-block;
}

/* The actual ∴ glyph rendered with three positioned dots */
.divider {
    /* container size */
}

.divider::after {
    /* keeps the right side rule */
}

/* We use a real glyph too, layered for visual clarity */
.article-main .divider {
    background-image:
        radial-gradient(circle 2.5px at 50% 4px, var(--gold-foil) 100%, transparent 100%),
        radial-gradient(circle 2.5px at calc(50% - 8px) 18px, var(--gold-foil) 100%, transparent 100%),
        radial-gradient(circle 2.5px at calc(50% + 8px) 18px, var(--gold-foil) 100%, transparent 100%);
    background-repeat: no-repeat;
    background-size: 100% 28px;
    background-position: center;
}

/* Quote block */
.quote-block {
    margin: 2.2rem 0 2rem;
    padding: 1.3rem 1.6rem 1.3rem 1.8rem;
    border-left: 3px double var(--gold-foil);
    background: rgba(196, 168, 130, 0.12);
    position: relative;
}

.quote-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.18rem;
    line-height: 1.55;
    color: var(--mahogany);
}

.quote-text q {
    quotes: "\201C" "\201D";
}

.quote-attrib {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-top: 0.7rem;
}

/* Inline formula */
.formula {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    color: var(--sealing-wax);
    padding: 0 0.08em;
}

/* Formal lexicon list */
.formal-list {
    list-style: none;
    margin: 1.6rem 0 2rem;
    padding: 1.4rem 1.4rem;
    border-top: 1px solid var(--parchment);
    border-bottom: 1px solid var(--parchment);
    background: rgba(212, 201, 181, 0.18);
    columns: 1;
}

.formal-list li {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    padding: 0.32rem 0;
    border-bottom: 1px dotted var(--parchment);
}

.formal-list li:last-child {
    border-bottom: 0;
}

.formal-symbol {
    font-family: var(--font-display);
    font-size: 1.55rem;
    color: var(--sealing-wax);
    flex: 0 0 40px;
    text-align: center;
    line-height: 1;
}

.formal-gloss {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--mahogany);
}

.formal-gloss em {
    color: var(--leather-brown);
}

/* Signature block at end of article IV */
.signature-block {
    margin-top: 2.4rem;
    text-align: right;
    padding-right: 0.5rem;
}

.signature-line {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--mahogany);
}

.signature-place {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-top: 0.3rem;
}

/* =====================================================================
   INDEX OF DEFINITIONS
   ===================================================================== */

.index-section {
    background: var(--vellum-cream);
    padding: 4rem 0 4rem;
}

.index-grid {
    display: grid;
    grid-template-columns: 1fr 280px 80px 200px 1fr;
    align-items: start;
}

.index-main {
    grid-column: 2 / 3;
}

.index-eyebrow {
    font-family: var(--font-margin);
    font-size: 0.74rem;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-bottom: 0.9rem;
}

.index-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.5rem, 2.3vw, 2.1rem);
    color: var(--mahogany);
    margin-bottom: 0.8rem;
}

.index-intro {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--leather-brown);
    margin-bottom: 2rem;
    font-style: italic;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--parchment);
}

.index-list {
    display: flex;
    flex-direction: column;
}

.index-row {
    display: grid;
    grid-template-columns: minmax(120px, 25%) 1fr;
    gap: 1.4rem;
    padding: 1rem 0;
    border-bottom: 1px dotted var(--parchment);
    align-items: baseline;
}

.index-term {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--sealing-wax);
}

.index-def {
    font-family: var(--font-body);
    font-size: 0.97rem;
    line-height: 1.65;
    color: var(--mahogany);
}

.index-page {
    display: inline-block;
    margin-left: 0.4rem;
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-foil);
    white-space: nowrap;
}

/* =====================================================================
   COLOPHON / FOOTER
   ===================================================================== */

.colophon {
    background: var(--library-dark);
    color: var(--vellum-cream);
    padding: 5.5rem 1.5rem 3.5rem;
    position: relative;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5);
}

.colophon-rule {
    position: relative;
    height: 6px;
    max-width: 720px;
    margin: 0 auto 2.4rem;
    border-top: 1px solid var(--gold-foil);
    border-bottom: 1px solid var(--gold-foil);
}

.colophon-rule-bottom {
    margin: 2.4rem auto 0;
}

.colophon-inner {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.colophon-mark {
    margin-bottom: 0.8rem;
}

.therefore-mark {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--gold-foil);
    line-height: 1;
}

.colophon-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    color: var(--vellum-cream);
    margin-bottom: 1.2rem;
    letter-spacing: 0.02em;
}

.colophon-lead {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.85;
    color: var(--parchment);
    max-width: 56ch;
    margin: 0 auto 3rem;
    opacity: 0.92;
}

.colophon-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.2rem;
    text-align: left;
    margin-bottom: 3rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(212, 201, 181, 0.22);
    border-bottom: 1px solid rgba(212, 201, 181, 0.22);
}

.colophon-section {
    padding: 0 0.5rem;
}

.colophon-heading {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--gold-foil);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dotted rgba(139, 115, 85, 0.5);
}

.colophon-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.colophon-list li {
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--parchment);
    padding: 0.32rem 0;
    border-bottom: 1px dotted rgba(139, 115, 85, 0.18);
    opacity: 0.88;
}

.colophon-list li:last-child {
    border-bottom: 0;
}

.colophon-imprint {
    font-family: var(--font-margin);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--aged-paper);
    opacity: 0.7;
    margin-bottom: 0.6rem;
}

.colophon-tail {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1rem;
    color: var(--gold-foil);
    letter-spacing: 0.1em;
}

.colophon-tail span[lang="ko"] {
    font-style: normal;
    margin-left: 0.2rem;
    color: var(--aged-paper);
}

/* =====================================================================
   RESPONSIVE -- Collapse to single column
   ===================================================================== */

@media (max-width: 1100px) {
    .masthead-grid,
    .article-grid,
    .index-grid {
        grid-template-columns: minmax(0, 1fr);
        padding: 0 1.5rem;
    }

    .masthead-main,
    .article-main,
    .index-main,
    .article-marginalia {
        grid-column: 1 / -1;
        max-width: 720px;
        width: 100%;
        margin: 0 auto;
    }

    .article-gutter {
        display: none;
    }

    .article-marginalia {
        padding-top: 1rem;
        margin-top: 1rem;
        border-top: 1px dotted var(--parchment);
        background: rgba(196, 168, 130, 0.08);
        padding: 1.6rem;
        max-width: 720px;
    }

    .article-marginalia .margin-folio:first-child {
        margin-top: 0;
    }
}

@media (max-width: 700px) {
    body {
        font-size: 1rem;
    }

    .hero {
        padding: 4rem 1rem 3rem;
    }

    .hero-frame {
        padding: 2.2rem 1.4rem;
    }

    .hero-rule span {
        flex-basis: 50px;
    }

    .article {
        padding: 3rem 0 0.5rem;
    }

    .article-body {
        text-align: left;
        hyphens: none;
    }

    .article-lead::first-letter {
        font-size: 3.4em;
    }

    .colophon {
        padding: 4rem 1rem 3rem;
    }

    .colophon-grid {
        grid-template-columns: 1fr;
        gap: 1.6rem;
    }

    .index-row {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .formal-list {
        padding: 1rem 0.8rem;
    }

    .formal-symbol {
        flex-basis: 32px;
        font-size: 1.3rem;
    }
}
