/* =========================================================
   diplomatic.wiki -- Editorial magazine-spread design
   Palette: ink/paper, dark inversions, accent red
   Type: Playfair Display / Source Serif 4 / IBM Plex Sans
   ========================================================= */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Source Serif 4", "IBM Plex Serif", Georgia, serif;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: #1A1A1A;
    background-color: #F7F4EF;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Fixed UI ---------- */
.wordmark {
    position: fixed;
    top: 18px;
    left: 22px;
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #0D0D0D;
    z-index: 1000;
    mix-blend-mode: difference;
    /* mix-blend-mode against ink-black requires light color underneath */
    color: #F0EDE8;
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background-color: #0D0D0D;
    z-index: 1001;
    transition: background-color 0.3s ease;
}

.progress-bar.on-dark {
    background-color: #F0EDE8;
}

/* ---------- Spread Base ---------- */
.spread {
    position: relative;
    min-height: 100vh;
    width: 100%;
    padding: clamp(3rem, 6vh, 6rem) clamp(1.5rem, 4vw, 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #F7F4EF;
    overflow: hidden;
    border-bottom: 1px solid #C8C8C8;
}

.spread:last-child {
    border-bottom: none;
}

.spread-inner {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 700ms ease-out, transform 700ms ease-out;
}

.spread.is-visible .spread-inner {
    opacity: 1;
    transform: translateY(0);
}

/* Roman numeral watermark in top-right */
.spread::before {
    content: attr(data-numeral);
    position: absolute;
    top: clamp(2rem, 5vh, 4rem);
    right: clamp(2rem, 5vw, 5rem);
    font-family: "Playfair Display", serif;
    font-size: 8rem;
    font-weight: 700;
    line-height: 1;
    color: #0D0D0D;
    opacity: 0.06;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

/* Dark inversions */
.spread-dark {
    background-color: #111111;
    color: #F0EDE8;
}

.spread-dark::before {
    color: #F0EDE8;
    opacity: 0.08;
}

.spread-dark {
    clip-path: inset(0 0 0 0);
    transition: clip-path 600ms ease-out;
}

.spread-dark:not(.is-visible) {
    clip-path: inset(10% 10% 10% 10%);
}

.spread-dark.is-visible {
    clip-path: inset(0 0 0 0);
}

/* Parchment alt */
.spread-parchment {
    background-color: #E8E2D8;
}

/* ---------- Masthead Spread ---------- */
.spread-masthead {
    text-align: center;
    flex-direction: column;
    padding-top: clamp(5rem, 12vh, 9rem);
    padding-bottom: clamp(5rem, 12vh, 9rem);
}

.spread-masthead .spread-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.2rem, 2.5vh, 2rem);
}

.masthead-rule {
    width: 70%;
    max-width: 800px;
    height: 1px;
    background-color: #0D0D0D;
}

.volume-line {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #666666;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.volume-sep {
    color: #C8C8C8;
}

.masthead-title {
    font-family: "Playfair Display", serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: #0D0D0D;
}

.masthead-dot {
    color: #8B1A1A;
}

.masthead-subtitle {
    font-family: "Playfair Display", serif;
    font-size: clamp(1rem, 1.4vw, 1.4rem);
    font-style: italic;
    font-weight: 400;
    color: #1A1A1A;
    max-width: 600px;
    line-height: 1.4;
}

.masthead-edition {
    margin-top: clamp(1rem, 3vh, 2rem);
}

.edition-text {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #666666;
}

/* ---------- Pull Quote Spread ---------- */
.spread-pullquote {
    text-align: center;
}

.spread-pullquote .spread-inner {
    padding: 8vh 0;
}

.pullquote {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 4rem);
}

.pullquote p {
    font-family: "Playfair Display", serif;
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1.25;
    color: #0D0D0D;
    margin-bottom: 2rem;
    text-indent: 0;
}

.spread-dark .pullquote p {
    color: #F0EDE8;
}

.pullquote cite {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.85rem;
    font-style: normal;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #666666;
}

.spread-dark .pullquote cite {
    color: #C8C8C8;
}

/* Pull-quote enters with fade only */
.spread-pullquote .spread-inner {
    transform: translateY(0);
    transition: opacity 1200ms ease-out;
}

.spread-pullquote:not(.is-visible) .spread-inner {
    opacity: 0;
}

.spread-pullquote.is-visible .spread-inner {
    opacity: 1;
}

/* ---------- Editorial (Multi-Column) ---------- */
.spread-editorial {
    align-items: flex-start;
    padding-top: clamp(4rem, 9vh, 7rem);
    padding-bottom: clamp(4rem, 9vh, 7rem);
}

.editorial-header {
    margin-bottom: clamp(2.5rem, 5vh, 4rem);
    text-align: left;
}

.section-eyebrow {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #8B1A1A;
    display: block;
    margin-bottom: 0.8rem;
}

.section-heading {
    font-family: "Playfair Display", serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: #0D0D0D;
    margin-bottom: 1.5rem;
}

.section-rule {
    position: relative;
    width: 40%;
    max-width: 320px;
    height: 1px;
    background-color: #C8C8C8;
    margin: 1rem 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diamond {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #0D0D0D;
    transform: rotate(45deg);
    top: 50%;
    left: 50%;
    margin-left: -3px;
    margin-top: -3px;
}

.spread-dark .section-rule {
    background-color: #333333;
}

.spread-dark .diamond {
    background-color: #F0EDE8;
}

/* Column grid layouts */
.editorial-columns {
    display: grid;
    gap: clamp(2rem, 4vw, 5rem);
    position: relative;
}

.editorial-columns.two-col {
    grid-template-columns: 1fr 2fr;
}

.editorial-columns.three-col {
    grid-template-columns: repeat(3, 1fr);
}

/* Column divider rules - drawn between columns */
.editorial-columns.two-col::before,
.editorial-columns.three-col::before,
.editorial-columns.three-col::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #C8C8C8;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 900ms ease-out;
}

.editorial-columns.two-col::before {
    left: calc(33.333% + clamp(1rem, 2vw, 2.5rem) - clamp(1rem, 2vw, 2.5rem) / 2);
    left: 33.333%;
    transform: translateX(-50%) scaleY(0);
}

.spread.is-visible .editorial-columns.two-col::before {
    transform: translateX(-50%) scaleY(1);
}

.editorial-columns.three-col::before {
    left: 33.333%;
    transform: translateX(-50%) scaleY(0);
}

.editorial-columns.three-col::after {
    left: 66.666%;
    transform: translateX(-50%) scaleY(0);
}

.spread.is-visible .editorial-columns.three-col::before,
.spread.is-visible .editorial-columns.three-col::after {
    transform: translateX(-50%) scaleY(1);
}

.spread-dark .editorial-columns.two-col::before,
.spread-dark .editorial-columns.three-col::before,
.spread-dark .editorial-columns.three-col::after {
    background-color: #333333;
}

/* Columns */
.column {
    position: relative;
}

.column p {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: #1A1A1A;
    text-align: justify;
    hyphens: auto;
}

.spread-dark .column p {
    color: #F0EDE8;
}

.column p + p {
    text-indent: 1.5em;
    margin-top: 0;
}

/* Drop cap */
.drop-cap {
    position: relative;
}

.drop-cap .initial {
    font-family: "Playfair Display", serif;
    font-size: 4.5em;
    font-weight: 700;
    line-height: 0.85;
    color: #8B1A1A;
    float: left;
    margin-right: 0.15em;
    margin-top: 0.05em;
    margin-bottom: -0.1em;
    display: inline-block;
    transform: scale(0.8);
    transform-origin: left top;
    transition: transform 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 200ms;
}

.spread.is-visible .drop-cap .initial {
    transform: scale(1);
}

/* Margin column */
.column-margin {
    border-right: none;
    padding-right: 0;
}

.margin-note {
    margin-bottom: 2rem;
    padding-left: 0.8em;
    border-left: 3px solid #8B1A1A;
}

.margin-note .margin-label {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #8B1A1A;
    display: block;
    margin-bottom: 0.4rem;
}

.margin-note p {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.82rem;
    line-height: 1.55;
    letter-spacing: 0.01em;
    color: #666666;
    text-align: left;
    text-indent: 0;
    hyphens: none;
}

.spread-dark .margin-note p {
    color: #C8C8C8;
}

/* ---------- Statement / Aphorism Spread ---------- */
.spread-statement {
    text-align: center;
}

.statement-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 4vw, 4rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.statement-kicker {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #8B1A1A;
}

.spread-dark .statement-kicker {
    color: #C8C8C8;
}

.statement-text {
    font-family: "Playfair Display", serif;
    font-size: clamp(1.8rem, 3.2vw, 2.8rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1.3;
    letter-spacing: -0.005em;
    color: #0D0D0D;
}

.spread-dark .statement-text {
    color: #F0EDE8;
}

.spread-parchment .statement-text {
    color: #0D0D0D;
}

.statement-rule {
    position: relative;
    width: 40%;
    max-width: 320px;
    height: 1px;
    background-color: #C8C8C8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spread-dark .statement-rule {
    background-color: #333333;
}

.statement-attrib {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #666666;
}

.spread-dark .statement-attrib {
    color: #C8C8C8;
}

/* ---------- Colophon Spread ---------- */
.spread-colophon {
    text-align: center;
    background-color: #F7F4EF;
}

.spread-colophon .spread-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.colophon-rule {
    position: relative;
    width: 40%;
    max-width: 320px;
    height: 1px;
    background-color: #C8C8C8;
}

.colophon-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.colophon-domain {
    font-family: "Playfair Display", serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0D0D0D;
    text-indent: 0;
}

.colophon-line {
    font-family: "IBM Plex Sans", sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #666666;
    text-indent: 0;
    max-width: 500px;
    line-height: 1.6;
}

.colophon-year {
    font-family: "Playfair Display", serif;
    font-size: 1.2rem;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.1em;
    color: #0D0D0D;
    margin-top: 1rem;
    text-indent: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    /* Footnote rail collapses (we already use margin column inline) */
}

@media (max-width: 900px) {
    .editorial-columns.two-col,
    .editorial-columns.three-col {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .editorial-columns.two-col::before,
    .editorial-columns.three-col::before,
    .editorial-columns.three-col::after {
        display: none;
    }

    .column-margin {
        order: 2;
        border-top: 1px solid #C8C8C8;
        padding-top: 2rem;
    }

    .column-main {
        order: 1;
    }

    .pullquote p {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
    }

    .masthead-title {
        font-size: clamp(3rem, 14vw, 6rem);
    }

    .spread::before {
        font-size: 5rem;
    }
}

@media (max-width: 600px) {
    .spread {
        padding: clamp(2rem, 5vh, 4rem) 1.25rem;
    }

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

    .drop-cap .initial {
        font-size: 3em;
    }

    .spread::before {
        display: none;
    }

    .volume-line {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    .pullquote p {
        font-size: clamp(1.2rem, 6vw, 1.8rem);
    }

    .section-heading {
        font-size: clamp(1.6rem, 7vw, 2.4rem);
    }

    .statement-text {
        font-size: clamp(1.3rem, 5.5vw, 2rem);
    }

    .column p {
        text-align: left;
    }
}
