/* ============================================
   diplomatic.wiki — Watercolor Atlas Styles
   ============================================ */

/* CSS Custom Properties */
:root {
    --navy: #1e3a5f;
    --ice-blue: #e0eaf4;
    --rose: #d4a0b0;
    --gold: #c8a862;
    --bronze: #a08840;
    --watercolor-blue: #a8c8e8;
    --frost: #f0f4f8;
    --parchment: #f8f0e0;
    --sage: #c8d8c0;

    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.7;
    color: var(--navy);
    background-color: var(--frost);
    overflow-x: hidden;
}

/* ============================================
   Watercolor Wash Overlays (fixed backgrounds)
   ============================================ */

.watercolor-wash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.wash-1 {
    background: radial-gradient(ellipse at 20% 30%, rgba(168, 200, 232, 0.3) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 70%, rgba(212, 160, 176, 0.2) 0%, transparent 50%);
}

.wash-2 {
    background: radial-gradient(ellipse at 70% 20%, rgba(200, 168, 98, 0.15) 0%, transparent 55%),
                radial-gradient(ellipse at 30% 80%, rgba(168, 200, 232, 0.2) 0%, transparent 50%);
}

.wash-3 {
    background: radial-gradient(ellipse at 50% 50%, rgba(240, 244, 248, 0.4) 0%, transparent 70%);
}

.wash-1.active { opacity: 1; }
.wash-2.active { opacity: 1; }
.wash-3.active { opacity: 1; }

/* ============================================
   Atlas Navigation
   ============================================ */

.atlas-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 1.5rem 2rem;
    transition: background-color 0.6s ease, box-shadow 0.6s ease;
}

.atlas-nav.scrolled {
    background-color: rgba(240, 244, 248, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(30, 58, 95, 0.08);
}

.atlas-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.atlas-nav-label {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 400;
    font-style: italic;
    color: var(--navy);
    letter-spacing: 0.01em;
    opacity: 0.7;
}

.atlas-nav-dots {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--navy);
    background: transparent;
    cursor: pointer;
    transition: all 0.4s ease;
    opacity: 0.4;
    padding: 0;
}

.nav-dot.active {
    background-color: var(--gold);
    border-color: var(--gold);
    opacity: 1;
    transform: scale(1.2);
}

.nav-dot:hover {
    opacity: 0.8;
    border-color: var(--gold);
}

/* ============================================
   Atlas Page (Full-viewport sections)
   ============================================ */

.atlas-page {
    position: relative;
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.watercolor-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* Section-specific watercolor backgrounds */
.opening-bg {
    background:
        radial-gradient(ellipse at 15% 50%, rgba(168, 200, 232, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 30%, rgba(248, 240, 224, 0.4) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 90%, rgba(212, 160, 176, 0.15) 0%, transparent 40%),
        linear-gradient(180deg, var(--frost) 0%, rgba(224, 234, 244, 0.5) 100%);
}

.traditions-bg {
    /* Sage accent: #c8d8c0 */
    background:
        radial-gradient(ellipse at 80% 40%, rgba(200, 168, 98, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 70%, rgba(168, 200, 232, 0.25) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 90%, rgba(200, 216, 192, 0.2) 0%, transparent 40%),
        linear-gradient(180deg, rgba(240, 244, 248, 0.8) 0%, var(--frost) 100%);
}

.treaties-bg {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(212, 160, 176, 0.2) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 70%, rgba(168, 200, 232, 0.3) 0%, transparent 50%),
        linear-gradient(180deg, var(--frost) 0%, rgba(248, 240, 224, 0.3) 100%);
}

.protocol-bg {
    background:
        radial-gradient(ellipse at 60% 25%, rgba(200, 168, 98, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 25% 75%, rgba(212, 160, 176, 0.2) 0%, transparent 45%),
        linear-gradient(180deg, rgba(224, 234, 244, 0.4) 0%, var(--frost) 100%);
}

.colophon-bg {
    /* Uses sage #c8d8c0 */
    background:
        radial-gradient(ellipse at 50% 40%, rgba(248, 240, 224, 0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(168, 200, 232, 0.2) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 60%, rgba(200, 216, 192, 0.15) 0%, transparent 40%),
        linear-gradient(180deg, var(--frost) 0%, rgba(224, 234, 244, 0.6) 100%);
}

/* ============================================
   Atlas Spread Layout
   ============================================ */

.atlas-spread {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 3rem 4rem;
    display: flex;
    gap: 4rem;
    align-items: center;
}

/* ============================================
   Opening Section
   ============================================ */

.opening-left {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.opening-right {
    flex: 1;
}

.diplomatic-seal,
.colophon-seal {
    position: relative;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: perspective(800px) rotateX(5deg) rotateY(-5deg);
    transition: transform 0.8s ease;
}

.diplomatic-seal:hover,
.colophon-seal:hover {
    transform: perspective(800px) rotateX(0deg) rotateY(0deg);
}

.seal-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid;
}

.seal-ring-outer {
    width: 200px;
    height: 200px;
    border-color: rgba(200, 168, 98, 0.4);
    animation: seal-rotate 30s linear infinite;
}

.seal-ring-middle {
    width: 160px;
    height: 160px;
    border-color: rgba(160, 136, 64, 0.3);
    animation: seal-rotate 25s linear infinite reverse;
}

.seal-ring-inner {
    width: 120px;
    height: 120px;
    border-color: rgba(200, 168, 98, 0.25);
    animation: seal-rotate 20s linear infinite;
}

@keyframes seal-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.seal-center {
    position: relative;
    z-index: 2;
}

.seal-emblem {
    width: 60px;
    height: 60px;
}

.opening-edition {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bronze);
    opacity: 0.7;
}

.site-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.title-dot {
    color: var(--gold);
}

.site-subtitle {
    font-family: var(--font-display);
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 400;
    font-style: italic;
    color: var(--navy);
    opacity: 0.7;
    letter-spacing: 0.01em;
    margin-bottom: 1.5rem;
}

.title-rule {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, var(--gold), transparent);
    margin-bottom: 1.5rem;
}

.site-description {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 300;
    line-height: 1.8;
    color: var(--navy);
    opacity: 0.75;
    max-width: 480px;
    margin-bottom: 3rem;
}

.scroll-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

.scroll-indicator:hover {
    opacity: 1;
}

.scroll-text {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--navy);
}

.scroll-arrow {
    animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ============================================
   Content Sections (Traditions, Protocol)
   ============================================ */

.spread-margin-note {
    flex: 0 0 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
}

.margin-numeral {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 400;
    color: var(--gold);
    opacity: 0.5;
}

.margin-title {
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bronze);
    opacity: 0.4;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.spread-main {
    flex: 1;
}

.section-heading {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    margin-bottom: 2.5rem;
    line-height: 1.2;
}

.section-heading em {
    font-weight: 400;
    font-style: italic;
    color: var(--navy);
    opacity: 0.7;
    letter-spacing: 0.01em;
}

.content-columns {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
}

.content-columns.reversed {
    flex-direction: row-reverse;
}

.column-text {
    flex: 1.2;
}

.column-artifact {
    flex: 0.8;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Drop cap */
.drop-cap::first-letter {
    font-family: var(--font-display);
    font-size: 3.5em;
    float: left;
    line-height: 0.8;
    margin-right: 0.1em;
    margin-top: 0.05em;
    color: var(--navy);
    font-weight: 700;
}

.column-text p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--navy);
    opacity: 0.8;
    margin-bottom: 1.2rem;
}

/* ============================================
   Artifact: Treaty Scroll
   ============================================ */

.artifact {
    transform: perspective(800px) rotateX(5deg) rotateY(-8deg);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.artifact:hover {
    transform: perspective(800px) rotateX(2deg) rotateY(-3deg);
}

.scroll-body {
    width: 180px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scroll-top-rod,
.scroll-bottom-rod {
    width: 200px;
    height: 12px;
    background: linear-gradient(180deg, var(--gold), var(--bronze));
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(160, 136, 64, 0.3);
}

.scroll-content {
    width: 170px;
    background: linear-gradient(180deg, var(--parchment), #f5edd5);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 0 20px rgba(200, 168, 98, 0.1);
}

.scroll-line {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(30, 58, 95, 0.2), rgba(30, 58, 95, 0.05));
    border-radius: 1px;
}

.scroll-line.short {
    width: 60%;
}

.scroll-line.medium {
    width: 80%;
}

.scroll-seal-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold), var(--bronze));
    margin: 0.5rem auto 0;
    opacity: 0.6;
    box-shadow: 0 2px 6px rgba(160, 136, 64, 0.3);
}

.artifact-caption {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--navy);
    opacity: 0.5;
    text-align: center;
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

.artifact-caption em {
    font-style: italic;
}

/* ============================================
   Treaty Grid
   ============================================ */

.treaty-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.treaty-card {
    position: relative;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(30, 58, 95, 0.08);
    border-radius: 4px;
    padding: 2rem;
    overflow: hidden;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.treaty-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(30, 58, 95, 0.1);
}

.treaty-wash {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    border-radius: 0 4px 0 120px;
    opacity: 0.15;
    transition: opacity 0.5s ease;
}

.treaty-card:hover .treaty-wash {
    opacity: 0.25;
}

.wash-gold { background: radial-gradient(circle at 100% 0%, var(--gold), transparent); }
.wash-blue { background: radial-gradient(circle at 100% 0%, var(--watercolor-blue), transparent); }
.wash-rose { background: radial-gradient(circle at 100% 0%, var(--rose), transparent); }
.wash-navy { background: radial-gradient(circle at 100% 0%, var(--navy), transparent); }

.treaty-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
    position: relative;
    z-index: 1;
}

.treaty-year {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 400;
    font-style: italic;
    color: var(--gold);
    display: block;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.treaty-desc {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 300;
    line-height: 1.7;
    color: var(--navy);
    opacity: 0.7;
    position: relative;
    z-index: 1;
}

/* ============================================
   Passport Artifact
   ============================================ */

.artifact-passport {
    transform: perspective(800px) rotateX(8deg) rotateY(-10deg);
}

.artifact-passport:hover {
    transform: perspective(800px) rotateX(3deg) rotateY(-4deg);
}

.passport-cover {
    width: 160px;
    height: 220px;
    background: linear-gradient(135deg, var(--navy), #2a4f7a);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    box-shadow:
        4px 4px 0 rgba(30, 58, 95, 0.3),
        8px 8px 0 rgba(30, 58, 95, 0.15),
        0 15px 40px rgba(30, 58, 95, 0.25);
}

.passport-emblem {
    width: 80px;
    height: 80px;
}

.passport-crest {
    width: 100%;
    height: 100%;
}

.passport-label {
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.8;
}

/* ============================================
   Blockquote
   ============================================ */

.atlas-quote {
    margin-top: 1.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--gold);
}

.atlas-quote p {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 400;
    font-style: italic;
    color: var(--navy);
    opacity: 0.8;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.atlas-quote cite {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 400;
    font-style: normal;
    color: var(--bronze);
    opacity: 0.6;
}

/* ============================================
   Colophon (Final Section)
   ============================================ */

.colophon-spread {
    justify-content: center;
}

.colophon-content {
    text-align: center;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.colophon-seal {
    width: 150px;
    height: 150px;
    margin-bottom: 2.5rem;
}

.colophon-seal .seal-ring-outer {
    width: 150px;
    height: 150px;
}

.colophon-seal .seal-ring-middle {
    width: 120px;
    height: 120px;
}

.colophon-seal .seal-ring-inner {
    width: 90px;
    height: 90px;
}

.colophon-seal .seal-emblem {
    width: 45px;
    height: 45px;
}

.colophon-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.colophon-text {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 300;
    line-height: 1.8;
    color: var(--navy);
    opacity: 0.7;
    margin-bottom: 2rem;
}

.colophon-rule {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin-bottom: 1.5rem;
}

.colophon-edition {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--bronze);
    opacity: 0.5;
    margin-bottom: 2rem;
}

.cultural-motifs {
    opacity: 0.4;
    border-top: 1px solid #c8d8c0;
}

.motif-border {
    width: 200px;
    height: 40px;
}

/* ============================================
   Scroll Reveal Animations
   ============================================ */

.atlas-page .atlas-spread {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.atlas-page.visible .atlas-spread {
    opacity: 1;
    transform: translateY(0);
}

.treaty-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.5s ease;
}

.atlas-page.visible .treaty-card {
    opacity: 1;
    transform: translateY(0);
}

.atlas-page.visible .treaty-card:nth-child(1) { transition-delay: 0.1s; }
.atlas-page.visible .treaty-card:nth-child(2) { transition-delay: 0.2s; }
.atlas-page.visible .treaty-card:nth-child(3) { transition-delay: 0.3s; }
.atlas-page.visible .treaty-card:nth-child(4) { transition-delay: 0.4s; }

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 900px) {
    .atlas-spread {
        flex-direction: column;
        padding: 5rem 2rem 3rem;
        gap: 2rem;
    }

    .opening-left {
        flex: none;
        order: -1;
    }

    .diplomatic-seal,
    .colophon-seal {
        width: 150px;
        height: 150px;
    }

    .seal-ring-outer { width: 150px !important; height: 150px !important; }
    .seal-ring-middle { width: 120px !important; height: 120px !important; }
    .seal-ring-inner { width: 90px !important; height: 90px !important; }

    .content-columns,
    .content-columns.reversed {
        flex-direction: column;
        gap: 2.5rem;
    }

    .treaty-grid {
        grid-template-columns: 1fr;
    }

    .spread-margin-note {
        flex-direction: row;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .margin-title {
        writing-mode: horizontal-tb;
    }
}

@media (max-width: 600px) {
    .atlas-spread {
        padding: 4.5rem 1.25rem 2.5rem;
    }

    .site-title {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
    }

    .section-heading {
        font-size: clamp(1.4rem, 6vw, 2rem);
    }

    .diplomatic-seal,
    .colophon-seal {
        width: 120px;
        height: 120px;
    }

    .seal-ring-outer { width: 120px !important; height: 120px !important; }
    .seal-ring-middle { width: 95px !important; height: 95px !important; }
    .seal-ring-inner { width: 70px !important; height: 70px !important; }

    .passport-cover {
        width: 130px;
        height: 180px;
    }

    .scroll-body {
        width: 140px;
    }

    .scroll-top-rod,
    .scroll-bottom-rod {
        width: 160px;
    }

    .scroll-content {
        width: 130px;
    }
}
