/* ============================
   diplomacy.day - Styles
   ============================ */

:root {
    --parchment: #F5ECD7;
    --umber: #3D2B1F;
    --gold: #C4A77D;
    --sienna: #8B7355;
    --seal-red: #8B2500;
    --treaty-ink: #2C2118;
    --vellum: #F0E6CE;
    --courier-green: #4A5D3A;

    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Lora', serif;
    --font-meta: 'Commissioner', sans-serif;
    --font-ornament: 'Cinzel Decorative', serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--umber);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
}

/* Paper grain overlay */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

::selection {
    background: var(--gold);
    color: var(--umber);
}

/* ============================
   The Seal (Hero)
   ============================ */
.seal-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-seal {
    position: relative;
    width: 120px;
    height: 120px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}

.hero-seal.visible {
    opacity: 1;
    transform: scale(1);
}

.seal-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--sienna);
}

.seal-ring-outer {
    top: 0; left: 0; width: 100%; height: 100%;
}

.seal-ring-mid {
    top: 8px; left: 8px; width: calc(100% - 16px); height: calc(100% - 16px);
    border-style: dashed;
}

.seal-ring-inner {
    top: 16px; left: 16px; width: calc(100% - 32px); height: calc(100% - 32px);
}

.seal-wax {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--seal-red), #6B1D00);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.seal-monogram {
    font-family: var(--font-ornament);
    font-weight: 700;
    font-size: 20px;
    color: var(--parchment);
    letter-spacing: 0.05em;
    opacity: 0;
    transition: opacity 0.6s ease 1.4s;
}

.hero-seal.visible .seal-monogram {
    opacity: 1;
}

/* Seal crack animation */
.hero-seal.cracking {
    animation: none;
}

.hero-seal.cracking::before,
.hero-seal.cracking::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    transition: transform 0.6s ease, opacity 0.8s ease;
}

.seal-subtitle {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(14px, 2vw, 18px);
    font-variant: small-caps;
    letter-spacing: 0.3em;
    color: var(--umber);
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease 2.2s, transform 0.8s ease 2.2s;
}

.seal-section.active .seal-subtitle {
    opacity: 1;
    transform: translateY(0);
}

/* ============================
   Flourish Divider
   ============================ */
.flourish-divider {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
    opacity: 0.6;
}

/* ============================
   The Dispatch
   ============================ */
.dispatch {
    padding: 60px 20px;
}

.dispatch-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1100px;
    margin: 0 auto;
    align-items: start;
}

.dispatch-map {
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.dispatch-map.visible {
    opacity: 1;
    transform: translateX(0);
}

.map-fragment {
    width: 100%;
    height: 400px;
    position: relative;
    background: var(--vellum);
    border: 1px solid var(--gold);
    border-radius: 2px;
    overflow: hidden;
}

.map-fragment::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(196, 167, 125, 0.15);
    box-shadow:
        0 0 0 30px transparent,
        0 0 0 31px rgba(196, 167, 125, 0.1),
        0 0 0 60px transparent,
        0 0 0 61px rgba(196, 167, 125, 0.08),
        0 0 0 90px transparent,
        0 0 0 91px rgba(196, 167, 125, 0.06),
        0 0 0 120px transparent,
        0 0 0 121px rgba(196, 167, 125, 0.04);
}

.map-fragment::after {
    content: '';
    position: absolute;
    top: 40%;
    left: 30%;
    width: 200px;
    height: 150px;
    border-radius: 40% 60% 50% 50%;
    border: 1px solid rgba(196, 167, 125, 0.12);
    transform: rotate(-15deg);
}

.dispatch-text {
    border-left: 1px solid var(--gold);
    padding-left: 32px;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s ease 0.2s, transform 0.8s ease 0.2s;
}

.dispatch-text.visible {
    opacity: 1;
    transform: translateX(0);
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-variant: small-caps;
    font-size: clamp(28px, 4vw, 42px);
    letter-spacing: 0.04em;
    color: var(--umber);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.body-prose {
    color: var(--umber);
    margin-bottom: 1.25rem;
    line-height: 1.75;
}

.body-prose em {
    font-style: italic;
    color: var(--sienna);
}

/* ============================
   The Archive Chamber
   ============================ */
.archive-chamber {
    padding: 80px 20px;
}

.archive-grid {
    display: grid;
    grid-template-columns: 65% 30%;
    gap: 5%;
    max-width: 1100px;
    margin: 0 auto;
}

.archive-cards {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.envelope-card {
    background: var(--vellum);
    border: 1px solid var(--gold);
    padding: clamp(24px, 3vw, 40px);
    position: relative;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease;
    cursor: default;
}

.envelope-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-1 { transform: translateY(24px) rotate(-0.5deg); }
.card-2 { transform: translateY(24px) rotate(0.8deg); }
.card-3 { transform: translateY(24px) rotate(-0.3deg); }
.card-4 { transform: translateY(24px) rotate(0.5deg); }

.card-1.visible { transform: translateY(0) rotate(-0.5deg); }
.card-2.visible { transform: translateY(0) rotate(0.8deg); }
.card-3.visible { transform: translateY(0) rotate(-0.3deg); }
.card-4.visible { transform: translateY(0) rotate(0.5deg); }

.envelope-card:hover {
    transform: translateY(-4px) rotate(0deg);
    box-shadow: 0 8px 24px rgba(61, 43, 31, 0.1);
}

.wax-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--seal-red), #6B1D00);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.card-label {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sienna);
    display: block;
    margin-bottom: 0.75rem;
}

.card-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-variant: small-caps;
    font-size: clamp(20px, 2.5vw, 28px);
    letter-spacing: 0.04em;
    color: var(--umber);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.card-text {
    color: var(--umber);
    font-size: 16px;
    line-height: 1.7;
}

/* Timeline */
.archive-timeline {
    position: relative;
    padding-top: 20px;
}

.timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--sienna);
    transform: translateX(-50%);
}

.timeline-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 120px;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.timeline-node.visible {
    opacity: 1;
    transform: scale(1);
}

.timeline-diamond {
    width: 8px;
    height: 8px;
    background: var(--parchment);
    border: 1px solid var(--sienna);
    transform: rotate(45deg);
}

.timeline-date {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.08em;
    color: var(--sienna);
    margin-top: 8px;
}

/* ============================
   The Treaty Table
   ============================ */
.treaty-table {
    background: var(--treaty-ink);
    padding: 8rem 20px;
    transition: background 0.6s ease;
}

.treaty-border {
    max-width: 720px;
    margin: 0 auto;
    border: 1px solid var(--gold);
    border-image: repeating-linear-gradient(
        90deg,
        var(--gold) 0px,
        var(--gold) 4px,
        transparent 4px,
        transparent 12px
    ) 1;
    padding: clamp(40px, 6vw, 80px);
    opacity: 0;
    transition: opacity 1s ease 0.5s;
}

.treaty-table.visible .treaty-border {
    opacity: 1;
}

.treaty-heading {
    font-family: var(--font-display);
    font-weight: 300;
    font-variant: small-caps;
    font-size: clamp(32px, 5vw, 56px);
    letter-spacing: 0.04em;
    color: var(--parchment);
    margin-bottom: 2rem;
    line-height: 1.3;
    text-align: center;
}

.treaty-prose {
    color: var(--parchment);
    font-size: 18px;
    line-height: 1.75;
    margin-bottom: 1.5rem;
    text-align: center;
}

.treaty-prose em {
    color: var(--gold);
}

/* ============================
   The Colophon
   ============================ */
.colophon {
    padding: 4rem 20px;
    text-align: center;
}

.colophon-flourish {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.flourish-draw path,
.flourish-draw circle {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease;
}

.colophon.visible .flourish-draw path,
.colophon.visible .flourish-draw circle {
    stroke-dashoffset: 0;
}

.colophon-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.colophon.visible .colophon-content {
    opacity: 1;
}

.wax-dot-footer {
    position: static;
    width: 24px;
    height: 24px;
    margin-bottom: 0.5rem;
}

.colophon-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-variant: small-caps;
    font-size: 18px;
    letter-spacing: 0.15em;
    color: var(--sienna);
}

.colophon-meta {
    font-family: var(--font-meta);
    font-weight: 300;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sienna);
}

/* ============================
   Mobile
   ============================ */
@media (max-width: 768px) {
    .dispatch-grid {
        grid-template-columns: 1fr;
    }

    .dispatch-map {
        height: 250px;
    }

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

    .archive-timeline {
        display: none;
    }

    .map-fragment {
        height: 250px;
    }
}

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

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

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