/* ============================================================
   diplomatic.wiki — Chancery Archive Stylesheet
   Palette: gold-black-luxury (Sealing Wax Black + Burnished Gold +
   Diplomatic Crimson + Aged Vellum + Walnut Cabinet + Geneva Slate +
   Tarnished Brass)
   ============================================================ */

:root {
    --c-sealing-wax-black: #0E0B07;
    --c-walnut-cabinet:    #1A1410;
    --c-aged-vellum:       #F5EBD6;
    --c-burnished-gold:    #C9A24B;
    --c-diplomatic-crimson:#8A1A2C;
    --c-geneva-slate:      #3A4A5C;
    --c-tarnished-brass:   #7A6A4E;

    --font-display: "Cinzel Decorative", "Cinzel", "Playfair Display", serif;
    --font-body:    "Cormorant Garamond", "Cormorant", Georgia, serif;
    --font-sc:      "Cormorant SC", "Cormorant Garamond", Georgia, serif;
    --font-mono:    "Cutive Mono", "Courier New", monospace;
    /* Inter substitution available where modern sans demanded */
    --font-inter:   "Inter", system-ui, sans-serif;

    --frame-thickness: 24px;
    --column-main:  640px;
    --column-rail:  280px;
    --gutter:       64px;
    --baseline:     28px;

    --ease-ceremony: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-reveal: 900ms;
    --dur-draw:   1800ms;
}

/* ============================================================
   Resets
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

html {
    background: var(--c-sealing-wax-black);
    scroll-behavior: smooth;
}

body {
    background: var(--c-sealing-wax-black);
    color: var(--c-aged-vellum);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.65;
    font-weight: 400;
    overflow-x: hidden;
    min-height: 100vh;
    cursor: none; /* hidden — replaced with quill */
    position: relative;
}

img, svg { display: block; max-width: 100%; }

/* Hidden defs container */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ============================================================
   Paper grain overlay
   ============================================================ */
.paper-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    mix-blend-mode: screen;
}
.paper-grain svg {
    width: 100%;
    height: 100%;
}

/* ============================================================
   Decorative outer frame (always visible, fixed)
   ============================================================ */
.frame {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}
.frame-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.frame .corner {
    position: absolute;
    width: 80px;
    height: 80px;
}
.frame .corner-tl { top: 0;    left: 0; }
.frame .corner-tr { top: 0;    right: 0; }
.frame .corner-bl { bottom: 0; left: 0; }
.frame .corner-br { bottom: 0; right: 0; }

/* ============================================================
   Quill cursor
   ============================================================ */
.quill-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 9999;
    transform: translate3d(-100px, -100px, 0);
    transition: opacity 300ms var(--ease-ceremony);
}
.quill-cursor svg {
    transform: translate(-3px, -21px);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}
.quill-cursor.active svg {
    transform: translate(-3px, -21px) rotate(-12deg);
    transition: transform 400ms var(--ease-ceremony);
}
.ink-trail {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
}
.ink-trail .ink-dot {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--c-burnished-gold);
    opacity: 0.3;
    transition: opacity 600ms var(--ease-ceremony), transform 600ms var(--ease-ceremony);
    will-change: opacity, transform;
}

/* ============================================================
   Roman numeral scroll-progress rail
   ============================================================ */
.scroll-rail {
    position: fixed;
    top: 50%;
    right: calc(var(--frame-thickness) + 18px);
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: none;
}
.scroll-rail-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    background: var(--c-tarnished-brass);
    opacity: 0.6;
}
.scroll-rail-ticks {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
}
.scroll-rail-ticks li {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    position: relative;
}
.scroll-rail-ticks li::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--c-tarnished-brass);
    border-radius: 50%;
    background: var(--c-sealing-wax-black);
    transition: border-color 600ms var(--ease-ceremony), background 600ms var(--ease-ceremony);
}
.scroll-rail-ticks .numeral {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--c-tarnished-brass);
    position: relative;
    z-index: 1;
    transition: color 600ms var(--ease-ceremony);
}
.scroll-rail-ticks li.active::before {
    border-color: var(--c-burnished-gold);
    background: var(--c-burnished-gold);
}
.scroll-rail-ticks li.active .numeral {
    color: var(--c-sealing-wax-black);
}
.scroll-rail-ticks li.passed::before {
    border-color: var(--c-burnished-gold);
}
.scroll-rail-ticks li.passed .numeral {
    color: var(--c-burnished-gold);
}

/* ============================================================
   Page container
   ============================================================ */
.page {
    position: relative;
    z-index: 3;
    max-width: 1080px;
    margin: 0 auto;
    padding: calc(var(--frame-thickness) + 56px) 88px calc(var(--frame-thickness) + 56px) 88px;
}

/* ============================================================
   Masthead — asymmetric ceremonial header
   ============================================================ */
.masthead {
    margin-bottom: 96px;
}
.masthead-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 48px;
    padding-top: 24px;
}
.masthead-title {
    margin: 0;
    flex: 1;
    line-height: 1;
}
.masthead-double {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(40px, 6vw, 84px);
    letter-spacing: 0.18em;
    color: var(--c-aged-vellum);
    position: relative;
    display: inline-block;
}
/* Double-strike effect — shadow text in burnished gold offset by 1px */
.masthead-double::before {
    content: attr(data-text);
    position: absolute;
    top: 1px;
    left: 1px;
    color: var(--c-burnished-gold);
    z-index: -1;
    text-shadow: 0 0 0.4px var(--c-burnished-gold);
}

/* Medallion (header) */
.masthead-medallion {
    flex: 0 0 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.medallion-svg {
    width: 120px;
    height: 120px;
    animation: medallion-breathe 14s linear infinite;
    filter: drop-shadow(0 0 12px rgba(201, 162, 75, 0.18));
}
@keyframes medallion-breathe {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.medallion-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}
.medallion-date {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--c-burnished-gold);
}
.medallion-rev {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--c-tarnished-brass);
    letter-spacing: 0.05em;
}

/* Thin double rule with diamond ornament */
.masthead-rule {
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.rule-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--c-burnished-gold) 12%, var(--c-burnished-gold) 88%, transparent);
    position: relative;
}
.rule-line::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 4px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--c-tarnished-brass) 18%, var(--c-tarnished-brass) 82%, transparent);
}
.rule-diamond {
    width: 32px;
    height: 16px;
    flex-shrink: 0;
}

.masthead-tagline {
    margin: 28px 0 0;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 17px;
    line-height: 1.6;
    color: var(--c-aged-vellum);
    opacity: 0.8;
    text-align: center;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   Editor's Preface
   ============================================================ */
.preface {
    margin: 0 auto 96px;
    max-width: var(--column-main);
    padding-left: 48px;
    border-left: 1px solid var(--c-geneva-slate);
}
.preface-label {
    font-family: var(--font-sc);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.22em;
    color: var(--c-burnished-gold);
    text-transform: uppercase;
    margin: 0 0 20px;
}
.preface-body p {
    font-style: italic;
    font-size: 19px;
    line-height: 1.7;
    margin: 0 0 18px;
    text-indent: 1.6em;
    color: var(--c-aged-vellum);
}
.preface-body p:first-child {
    text-indent: 0;
}
.preface-body p:first-child::first-letter {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.8em;
    line-height: 1;
    color: var(--c-burnished-gold);
    float: left;
    margin: 4px 8px 0 0;
    font-style: normal;
}
.preface-sign {
    text-align: right;
    font-style: italic;
    color: var(--c-tarnished-brass) !important;
    text-indent: 0 !important;
    font-size: 16px !important;
    margin-top: 24px !important;
}

/* ============================================================
   Filigree dividers
   ============================================================ */
.filigree {
    margin: 88px auto;
    max-width: 800px;
    text-align: center;
    opacity: 1;
}
.filigree svg {
    width: 100%;
    height: auto;
    max-height: 100px;
}
.filigree-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset var(--dur-draw) var(--ease-ceremony);
}
.filigree.in-view .filigree-path {
    stroke-dashoffset: 0;
}
.filigree-final {
    margin-top: 96px;
    margin-bottom: 32px;
}

/* ============================================================
   Article sections
   ============================================================ */
.article {
    position: relative;
    margin: 0 auto;
    max-width: calc(var(--column-main) + var(--column-rail) + var(--gutter));
    padding: 24px 0;
}
.article-header {
    position: relative;
    text-align: left;
    margin-bottom: 48px;
    padding-left: 0;
    max-width: var(--column-main);
}
.article-medallion {
    position: absolute;
    top: -12px;
    right: -180px;
    width: 120px;
    height: 120px;
}
.article-medallion-svg {
    width: 120px;
    height: 120px;
    animation: medallion-breathe-slow 22s linear infinite;
    opacity: 0.92;
}
@keyframes medallion-breathe-slow {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}
.article-numeral {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.32em;
    color: var(--c-burnished-gold);
    text-transform: uppercase;
}
.article-title {
    margin: 0 0 12px;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(28px, 3.4vw, 42px);
    line-height: 1.15;
    color: var(--c-aged-vellum);
    letter-spacing: 0.005em;
}
.article-subtitle {
    margin: 0 0 20px;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 18px;
    color: var(--c-tarnished-brass);
    line-height: 1.5;
}
.article-underline {
    display: block;
    width: 0;
    height: 2px;
    background: var(--c-burnished-gold);
    transition: width 600ms var(--ease-ceremony) 300ms;
}
.article.in-view .article-underline {
    width: 220px;
}

.article-body {
    display: grid;
    grid-template-columns: var(--column-main) var(--column-rail);
    gap: var(--gutter);
    align-items: start;
}
.article-prose {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms var(--ease-ceremony) 500ms, transform 800ms var(--ease-ceremony) 500ms;
}
.article.in-view .article-prose {
    opacity: 1;
    transform: translateY(0);
}
.article-prose p {
    margin: 0 0 22px;
    font-size: 18px;
    line-height: 1.65;
    color: var(--c-aged-vellum);
    text-align: justify;
    hyphens: auto;
}
.article-prose p + p {
    text-indent: 1.6em;
}
.article-prose em {
    color: var(--c-aged-vellum);
    font-style: italic;
}

/* Drop cap — Cinzel Decorative, 6em, with thin gold underline */
.dropcap {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 5.6em;
    line-height: 0.85;
    color: var(--c-aged-vellum);
    float: left;
    margin: 0.04em 0.08em -0.05em 0;
    padding: 0 0.1em 0 0;
    letter-spacing: 0;
    position: relative;
    text-shadow: 1px 1px 0 var(--c-burnished-gold);
}
.dropcap::after {
    content: "";
    position: absolute;
    left: 0;
    right: 8px;
    bottom: 4px;
    height: 1px;
    background: var(--c-burnished-gold);
    opacity: 0.7;
}

/* ============================================================
   Marginalia
   ============================================================ */
.marginalia {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 0 0 0 24px;
    border-left: 1px solid var(--c-geneva-slate);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms var(--ease-ceremony) 700ms, transform 800ms var(--ease-ceremony) 700ms;
}
.article.in-view .marginalia {
    opacity: 1;
    transform: translateY(0);
}
.marginalia-item {
    background: transparent;
}
.marginalia-label {
    margin: 0 0 6px;
    font-family: var(--font-sc);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--c-burnished-gold);
    text-transform: uppercase;
}
.marginalia-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: var(--c-aged-vellum);
    font-style: italic;
    opacity: 0.92;
}
.marginalia-spot {
    width: 80px;
    height: 80px;
    align-self: center;
    opacity: 0.85;
}
.marginalia-spot svg {
    width: 100%;
    height: 100%;
}

/* Pull-quote with wax seal */
.pull-quote {
    position: relative;
    margin: 0;
    padding: 18px 16px 18px 20px;
    background: var(--c-walnut-cabinet);
    border-left: 2px solid var(--c-burnished-gold);
}
.pull-quote p {
    margin: 0;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 15px;
    line-height: 1.55;
    color: var(--c-aged-vellum);
}
.pull-quote .cite {
    display: block;
    margin-top: 8px;
    font-family: var(--font-sc);
    font-style: normal;
    font-size: 11px;
    letter-spacing: 0.15em;
    color: var(--c-tarnished-brass);
    text-transform: uppercase;
}
.wax-seal {
    position: absolute;
    top: -22px;
    right: -22px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 500ms var(--ease-ceremony), filter 500ms var(--ease-ceremony);
    filter: drop-shadow(0 1px 0 rgba(0,0,0,0.5));
}
.wax-seal:hover {
    transform: translateY(-2px) rotate(-3deg);
    filter: drop-shadow(0 5px 6px rgba(0,0,0,0.6));
}
.wax-seal svg {
    width: 100%;
    height: 100%;
}
.wax-seal.cracked .seal-crack {
    stroke-width: 1.2;
    stroke-dasharray: 50;
    stroke-dashoffset: 0;
    transition: stroke-width 200ms ease-out, stroke-dashoffset 600ms var(--ease-ceremony);
}
.seal-crack {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    transition: stroke-dashoffset 600ms var(--ease-ceremony);
}
.wax-seal-citation {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--c-sealing-wax-black);
    border: 1px solid var(--c-tarnished-brass);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    color: var(--c-aged-vellum);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 700ms var(--ease-ceremony), opacity 700ms var(--ease-ceremony), margin-top 700ms var(--ease-ceremony);
}
.wax-seal-citation.open {
    max-height: 200px;
    opacity: 1;
}

/* Telex / telegram block */
.telex-block {
    background: var(--c-sealing-wax-black);
    border: 1px dashed var(--c-tarnished-brass);
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
    color: var(--c-aged-vellum);
}
.telex-block .telex-line {
    margin: 0;
    letter-spacing: 0.04em;
}
.telex-block .telex-line:first-child {
    color: var(--c-diplomatic-crimson);
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
}

/* Map cartouche */
.map-cartouche {
    background: var(--c-walnut-cabinet);
    padding: 12px;
    border: 1px solid var(--c-tarnished-brass);
}
.map-cartouche svg {
    width: 100%;
    height: auto;
    background: var(--c-sealing-wax-black);
}
.cartouche-caption {
    margin: 8px 0 0;
    font-family: var(--font-sc);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--c-tarnished-brass);
    font-style: italic;
    text-align: center;
}

/* ============================================================
   Convene the Archive button
   ============================================================ */
.convene-wrap {
    margin: 64px auto 96px;
    text-align: center;
}
.convene-btn {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    padding: 18px 48px;
    background: transparent;
    border: 1px solid var(--c-burnished-gold);
    color: var(--c-burnished-gold);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    text-decoration: none;
    position: relative;
    transition: color 600ms var(--ease-ceremony), background 600ms var(--ease-ceremony), letter-spacing 600ms var(--ease-ceremony);
}
.convene-btn::before,
.convene-btn::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid var(--c-burnished-gold);
}
.convene-btn::before {
    top: -6px;
    left: -6px;
    border-right: none;
    border-bottom: none;
}
.convene-btn::after {
    bottom: -6px;
    right: -6px;
    border-left: none;
    border-top: none;
}
.convene-btn:hover {
    background: var(--c-burnished-gold);
    color: var(--c-sealing-wax-black);
    letter-spacing: 0.36em;
}
.convene-btn:hover .convene-ornament {
    color: var(--c-sealing-wax-black);
}
.convene-ornament {
    width: 40px;
    height: 24px;
    color: var(--c-burnished-gold);
    transition: color 600ms var(--ease-ceremony);
}

/* ============================================================
   Colophon footer
   ============================================================ */
.colophon {
    margin-top: 64px;
    padding-bottom: 24px;
    text-align: right;
}
.colophon-rule {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}
.colophon-text {
    margin: 0 0 12px;
    font-family: var(--font-sc);
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--c-aged-vellum);
    font-style: italic;
}
.colophon-font {
    color: var(--c-burnished-gold);
}
.colophon-meta {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--c-tarnished-brass);
    letter-spacing: 0.08em;
}
.colophon-divider {
    margin: 0 12px;
    color: var(--c-burnished-gold);
}

/* ============================================================
   Selection
   ============================================================ */
::selection {
    background: var(--c-burnished-gold);
    color: var(--c-sealing-wax-black);
}

/* ============================================================
   Hover-active elements (cursor swap signal)
   ============================================================ */
a, button, .convene-btn, .wax-seal, .scroll-rail-ticks li {
    cursor: none;
}

/* ============================================================
   Responsive — collapse marginalia rail on narrow screens
   ============================================================ */
@media (max-width: 980px) {
    .page {
        padding: calc(var(--frame-thickness) + 40px) 56px calc(var(--frame-thickness) + 40px) 56px;
    }
    .article-medallion {
        position: static;
        margin: 0 0 24px;
    }
    .article-body {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .marginalia {
        border-left: none;
        border-top: 1px solid var(--c-geneva-slate);
        padding: 24px 0 0;
    }
    .scroll-rail {
        display: none;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 16px;
        cursor: auto;
    }
    .quill-cursor, .ink-trail {
        display: none;
    }
    a, button, .convene-btn, .wax-seal {
        cursor: pointer;
    }
    .page {
        padding: calc(var(--frame-thickness) + 24px) 28px calc(var(--frame-thickness) + 24px) 28px;
    }
    .masthead-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .masthead-medallion {
        align-self: center;
    }
    .preface {
        padding-left: 24px;
    }
    .article-prose p {
        font-size: 16px;
    }
    .convene-btn {
        flex-direction: column;
        gap: 12px;
        padding: 18px 28px;
    }
}
