/* ============================================
   diplomacy.day — Editorial Broadsheet Styles
   ============================================ */

/* === CSS Custom Properties === */
:root {
    /* Palette */
    --ink: #0f0f14;
    --ivory: #f4efe6;
    --parchment: #e8e0d0;
    --carbon: #1a1a1f;
    --crimson: #8b1a1a;
    --gold: #b8953e;
    --fog: #9a9590;
    --smoke: rgba(15, 15, 20, 0.65);

    /* Typography */
    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
    --font-utility: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;

    /* Spacing */
    --gutter: 4%;
    --primary-width: 58%;
    --secondary-width: 38%;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--parchment);
    background-color: var(--ink);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Navigation Bar === */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 3vw;
    background: rgba(15, 15, 20, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(154, 149, 144, 0.15);
}

.nav-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--parchment);
    letter-spacing: -0.01em;
}

.nav-pipe {
    margin: 0 1.2em;
    color: var(--fog);
    font-size: 0.8rem;
    opacity: 0.5;
}

.nav-links {
    display: flex;
    gap: 2em;
}

.nav-links a {
    font-family: var(--font-utility);
    font-weight: 500;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    color: var(--fog);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    transition: color 400ms ease;
}

.nav-links a:hover {
    color: var(--parchment);
}

/* === Masthead / Hero === */
.masthead {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ink);
    position: relative;
    z-index: 2;
}

.masthead-inner {
    text-align: center;
    padding: 0 5vw;
}

/* Double Rule */
.double-rule {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 auto;
    width: 60%;
}

.double-rule .rule-line {
    display: block;
    width: 100%;
    height: 1px;
    background-color: var(--parchment);
    transform: scaleX(0);
    transform-origin: center;
}

.double-rule.animate .rule-line {
    transform: scaleX(1);
    transition: transform 900ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.double-rule-below {
    margin-top: 2rem;
}

.double-rule-below .rule-line {
    background-color: rgba(232, 224, 208, 0.4);
}

/* Masthead Title */
.masthead-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3.5rem, 10vw, 8rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--parchment);
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(15px);
}

.masthead-title.animate {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 800ms cubic-bezier(0.33, 0, 0.2, 1),
                transform 800ms cubic-bezier(0.33, 0, 0.2, 1);
}

/* Masthead Dateline */
.masthead-dateline {
    font-family: var(--font-utility);
    font-weight: 500;
    font-size: clamp(0.7rem, 1.2vw, 0.85rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin-top: 1rem;
    opacity: 0;
}

.masthead-dateline.animate {
    opacity: 1;
    transition: opacity 600ms cubic-bezier(0.33, 0, 0.2, 1);
}

/* Masthead Tagline */
.masthead-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.4rem);
    line-height: 1.5;
    color: var(--fog);
    margin-top: 0.8rem;
    opacity: 0;
}

.masthead-tagline.animate {
    opacity: 1;
    transition: opacity 600ms cubic-bezier(0.33, 0, 0.2, 1);
}

/* === Spread System === */
.spread {
    width: 100%;
    min-height: 100vh;
    position: relative;
    z-index: 2;
    padding: 8vh 5vw;
    display: flex;
    align-items: center;
}

.spread-dark {
    background-color: var(--ink);
    color: var(--parchment);
}

.spread-light {
    background-color: var(--ivory);
    color: var(--carbon);
}

.spread-grid {
    display: grid;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 0;
    align-items: start;
}

.spread-grid.primary-left {
    grid-template-columns: var(--primary-width) var(--gutter) var(--secondary-width);
}

.spread-grid.primary-right {
    grid-template-columns: var(--secondary-width) var(--gutter) var(--primary-width);
}

/* Gutter */
.spread-gutter {
    position: relative;
    align-self: stretch;
}

.spread-gutter::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    border-left: 1px dotted rgba(154, 149, 144, 0.4);
}

/* === Section Headings === */
.section-heading-block {
    margin-bottom: 2em;
}

.heading-rule-above {
    border: none;
    height: 1px;
    background-color: var(--fog);
    margin-bottom: 1em;
    opacity: 0.6;
}

.spread-light .heading-rule-above {
    background-color: var(--carbon);
    opacity: 0.2;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.spread-dark .section-heading {
    color: var(--parchment);
}

.spread-light .section-heading {
    color: var(--carbon);
}

.heading-double-rule {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0.8em;
    width: 100%;
}

.heading-double-rule .rule-line {
    display: block;
    width: 100%;
    height: 1px;
    background-color: var(--fog);
    opacity: 0.5;
}

.spread-light .heading-double-rule .rule-line {
    background-color: var(--carbon);
    opacity: 0.2;
}

/* === Body Text === */
.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    margin-bottom: 1.4em;
}

.spread-dark .body-text {
    color: var(--parchment);
}

.spread-light .body-text {
    color: var(--carbon);
}

/* Scroll reveal */
.reveal-text {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms cubic-bezier(0.33, 0, 0.2, 1),
                transform 500ms cubic-bezier(0.33, 0, 0.2, 1);
}

.reveal-text.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* === Treaty Line === */
.treaty-line {
    height: 1px;
    background-color: var(--gold);
    margin: 2em 0;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1200ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.treaty-line.drawn {
    transform: scaleX(1);
}

/* === Pull Quotes === */
.pull-quote {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.5em;
    padding: 1.5em 0;
    margin: 1.5em 0;
}

.pull-quote blockquote {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-align: center;
    flex: 1;
}

.spread-dark .pull-quote blockquote {
    color: var(--parchment);
}

.spread-light .pull-quote blockquote {
    color: var(--carbon);
}

.pull-quote-rule-left,
.pull-quote-rule-right {
    width: 3px;
    min-height: 40px;
    align-self: stretch;
    background-color: var(--crimson);
    flex-shrink: 0;
}

/* Pull quote word-by-word reveal */
.pq-word {
    display: inline-block;
    opacity: 0;
    transition: opacity 300ms cubic-bezier(0.33, 0, 0.2, 1);
}

.pull-quote.revealed .pq-word {
    opacity: 1;
}

/* === Secondary Column === */
.spread-secondary {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.secondary-image {
    width: 100%;
    aspect-ratio: 4/3;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) contrast(1.1) brightness(0.95);
}

.caption {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--fog);
    font-style: italic;
}

/* === Footnote Rail === */
.footnote-rail {
    max-width: 200px;
    position: sticky;
    top: 20vh;
    display: flex;
    flex-direction: column;
    gap: 1.5em;
    margin-top: 2em;
}

.footnote {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--fog);
    border-left: 2px solid var(--gold);
    padding-left: 12px;
}

.footnote-date {
    display: block;
    font-family: var(--font-utility);
    font-weight: 500;
    font-style: normal;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--gold);
    margin-bottom: 0.3em;
}

/* === Parallax Interludes === */
.parallax-interlude {
    width: 100%;
    height: 80vh;
    position: relative;
    z-index: 1;
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.interlude-1 {
    background-color: #1a1a25;
    background-image:
        radial-gradient(ellipse at 30% 50%, rgba(139, 26, 26, 0.08) 0%, transparent 60%),
        linear-gradient(175deg, rgba(15, 15, 20, 0.8) 0%, rgba(30, 28, 35, 0.9) 40%, rgba(15, 15, 20, 0.95) 100%);
    background-attachment: fixed;
}

.interlude-2 {
    background-color: #18181f;
    background-image:
        radial-gradient(ellipse at 70% 40%, rgba(184, 149, 62, 0.06) 0%, transparent 60%),
        linear-gradient(185deg, rgba(20, 20, 28, 0.85) 0%, rgba(15, 15, 20, 0.9) 50%, rgba(25, 22, 30, 0.95) 100%);
    background-attachment: fixed;
}

.interlude-3 {
    background-color: #151520;
    background-image:
        radial-gradient(ellipse at 50% 60%, rgba(139, 26, 26, 0.06) 0%, transparent 50%),
        linear-gradient(170deg, rgba(15, 15, 20, 0.85) 0%, rgba(20, 18, 25, 0.9) 60%, rgba(15, 15, 20, 0.95) 100%);
    background-attachment: fixed;
}

.interlude-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--smoke);
}

/* === Wax Seal === */
.wax-seal {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--crimson);
    background-image: radial-gradient(circle at 38% 38%, rgba(200, 80, 80, 0.4) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

.seal-monogram {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    color: var(--parchment);
    line-height: 1;
}

.seal-small {
    width: 36px;
    height: 36px;
    margin-top: 1.5em;
}

.seal-small .seal-monogram {
    font-size: 18px;
}

/* === Ornament === */
.ornament {
    text-align: center;
    font-family: var(--font-body);
    font-size: 1.2rem;
    color: var(--fog);
    margin-top: 2em;
    letter-spacing: 0.3em;
}

.spread-light .ornament {
    color: var(--fog);
}

/* === Footer === */
.site-footer {
    width: 100%;
    padding: 4vh 5vw 6vh;
    background-color: var(--ink);
    text-align: center;
    position: relative;
    z-index: 2;
}

.footer-inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-inner .double-rule {
    width: 40%;
    margin-bottom: 2em;
}

.footer-inner .double-rule .rule-line {
    transform: scaleX(1);
    opacity: 0.3;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5em;
}

.footer-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--parchment);
    letter-spacing: -0.01em;
}

.footer-edition {
    font-family: var(--font-utility);
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fog);
}

/* === Responsive === */
@media (max-width: 900px) {
    .spread-grid.primary-left,
    .spread-grid.primary-right {
        grid-template-columns: 1fr;
        gap: 2em;
    }

    .spread-gutter {
        display: none;
    }

    .spread {
        padding: 6vh 6vw;
    }

    .spread-grid.primary-right {
        direction: ltr;
    }

    .spread-grid.primary-right > .spread-secondary {
        order: 2;
    }

    .spread-grid.primary-right > .spread-primary {
        order: 1;
    }

    .footnote-rail {
        position: static;
        max-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .footnote {
        flex: 1;
        min-width: 200px;
    }

    .parallax-interlude {
        background-attachment: scroll;
        height: 50vh;
    }

    .nav-links {
        gap: 1em;
    }

    .pull-quote {
        flex-direction: column;
        gap: 1em;
    }

    .pull-quote-rule-left,
    .pull-quote-rule-right {
        width: 60%;
        height: 3px;
        min-height: auto;
    }
}

@media (max-width: 600px) {
    .nav-pipe,
    .nav-links {
        display: none;
    }

    .masthead-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .double-rule {
        width: 80%;
    }
}

/* === Selection === */
::selection {
    background-color: var(--crimson);
    color: var(--parchment);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--ink);
}

::-webkit-scrollbar-thumb {
    background: var(--fog);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}
