/* ===========================
   diplomatic.day - Styles
   Inflated-3D Diplomatic Aesthetic
   =========================== */

/* --- Color Variables --- */
:root {
    --vellum: #F4F1EB;
    --graphite-chamber: #2C2F36;
    --gunmetal: #3B3F45;
    --slate: #4A4E54;
    --seal-gold: #C4A35A;
    --diplomatic-teal: #6B8F9E;
    --olive-branch: #8B9467;
    --terracotta-ink: #D4846A;
    --aged-parchment: #E8E2D6;
    --obsidian: #1E2024;
    --d4cec2: #D4CEC2;
}

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

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

body {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.7;
    color: var(--slate);
    background-color: var(--vellum);
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Rokkitt', serif;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--gunmetal);
    text-shadow: 0 2px 0 rgba(0,0,0,0.06);
}

h2.section-title {
    font-size: clamp(48px, 8vw, 88px);
    margin-bottom: 60px;
    text-align: center;
}

h3 {
    font-size: 24px;
    margin-bottom: 12px;
}

p {
    margin-bottom: 16px;
}

.card-label {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--olive-branch);
    display: block;
    margin-bottom: 10px;
}

/* Dark section overrides */
.section-dark h2,
.section-dark h3 {
    color: var(--aged-parchment);
    text-shadow: 0 2px 0 rgba(0,0,0,0.15);
}

.section-dark p {
    color: var(--d4cec2);
}

.section-dark .card-label {
    color: var(--olive-branch);
}

/* --- Scroll Progress Indicator --- */
#scroll-progress {
    position: fixed;
    right: 20px;
    top: 10vh;
    width: 4px;
    height: 80vh;
    z-index: 1000;
    pointer-events: none;
}

#progress-line {
    width: 100%;
    height: 100%;
}

/* --- Parallax Sections --- */
.parallax-section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background-color: var(--vellum);
}

.parallax-section.section-dark {
    background-color: var(--graphite-chamber);
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.parallax-layer.layer-fg {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    z-index: 3;
}

.parallax-layer.layer-mid {
    z-index: 2;
    pointer-events: none;
}

.parallax-layer.layer-bg {
    z-index: 1;
}

/* --- Background Textures --- */
.bg-texture {
    position: absolute;
    border-radius: 50%;
    opacity: 0.05;
}

.texture-1 {
    width: 500px;
    height: 500px;
    top: -100px;
    right: -150px;
    background: radial-gradient(circle, var(--seal-gold) 0%, transparent 70%);
}

.texture-2 {
    width: 400px;
    height: 400px;
    bottom: -80px;
    left: -100px;
    background: radial-gradient(circle, var(--diplomatic-teal) 0%, transparent 70%);
}

.texture-3 {
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--seal-gold) 0%, transparent 70%);
    opacity: 0.04;
}

.texture-4 {
    width: 500px;
    height: 500px;
    top: 20%;
    right: -100px;
    background: radial-gradient(circle, var(--diplomatic-teal) 0%, transparent 70%);
    opacity: 0.04;
}

.bg-crosshatch {
    position: absolute;
    top: 10%;
    left: 5%;
    opacity: 0.08;
}

.bg-crosshatch-2 {
    top: auto;
    left: auto;
    bottom: 10%;
    right: 8%;
}

.bg-crosshatch-dark {
    top: 5%;
    right: 3%;
    left: auto;
}

.bg-crosshatch-archive {
    bottom: 5%;
    left: 3%;
    top: auto;
}

/* --- Section Dividers --- */
.section-divider {
    position: relative;
    height: 40px;
    z-index: 5;
    background: transparent;
    display: flex;
    align-items: center;
}

.section-divider svg {
    width: 100%;
    height: 20px;
}

/* ===========================
   SECTION 1: THE ANTECHAMBER
   =========================== */
#antechamber {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#antechamber .layer-fg {
    min-height: 100vh;
}

.hero-title {
    text-align: center;
    perspective: 800px;
    opacity: 0;
    animation: heroFadeIn 800ms ease-out 200ms forwards;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inflated-title {
    font-size: clamp(48px, 10vw, 88px);
    line-height: 1.05;
    transform: perspective(800px) rotateY(-4deg) rotateX(2deg);
    color: var(--gunmetal);
    text-shadow:
        0 2px 0 rgba(0,0,0,0.06),
        0 4px 8px rgba(0,0,0,0.04);
    animation: inflateText 1.2s ease-out 400ms both;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

@keyframes inflateText {
    0% {
        text-shadow:
            0 0 0 rgba(0,0,0,0.06),
            0 0 0 rgba(0,0,0,0.04);
    }
    50% {
        text-shadow:
            0 4px 20px rgba(0,0,0,0.1),
            0 8px 30px rgba(0,0,0,0.06);
    }
    100% {
        text-shadow:
            0 2px 12px rgba(0,0,0,0.08),
            0 6px 20px rgba(0,0,0,0.04);
    }
}

.title-line {
    display: block;
}

.title-dot {
    color: var(--seal-gold);
    line-height: 0.5;
}

.hero-subtitle {
    font-family: 'Inconsolata', monospace;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--diplomatic-teal);
    margin-top: 30px;
    opacity: 0;
    animation: subtitleFade 600ms ease-out 1200ms forwards;
}

@keyframes subtitleFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 0.7; transform: translateY(0); }
}

/* Decorative SVGs positioning */
.deco-svg {
    position: absolute;
    pointer-events: none;
}

.olive-branch {
    top: 12%;
    left: 8%;
    opacity: 0;
    animation: decoFadeIn 600ms ease-out 500ms forwards;
}

.envelope {
    bottom: 18%;
    right: 10%;
    opacity: 0;
    animation: decoFadeIn 600ms ease-out 800ms forwards;
}

.globe {
    top: 35%;
    left: 15%;
    opacity: 0;
    animation: decoFadeIn 600ms ease-out 1100ms forwards;
}

.horizon-line {
    top: 60%;
    left: 0;
    width: 100%;
    height: 4px;
    opacity: 0;
    animation: decoFadeIn 800ms ease-out 600ms forwards;
}

@keyframes decoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* SVG draw-in animation */
.draw-in {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawStroke 600ms ease-out forwards;
}

.olive-branch .draw-in {
    animation-delay: 500ms;
}

.envelope .draw-in {
    animation-delay: 800ms;
}

.globe .draw-in {
    animation-delay: 1100ms;
}

@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

/* ===========================
   SECTION 2: THE TREATY HALL
   =========================== */
#treaty-hall .layer-fg {
    padding: 100px 40px;
    min-height: 100vh;
}

.treaty-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    max-width: 1000px;
    width: 100%;
}

.treaty-col-left {
    padding-top: 60px;
}

.treaty-col-right {
    padding-top: 0;
}

/* Inflated Card Styling */
.inflated-card {
    background: linear-gradient(145deg, var(--vellum) 0%, var(--aged-parchment) 100%);
    border-radius: 28px;
    padding: 36px 32px;
    margin-bottom: 40px;
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow:
        0 12px 40px rgba(30,32,36,0.08),
        inset 0 1px 0 rgba(255,255,255,0.5);
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.inflated-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 20px 48px rgba(30,32,36,0.12),
        inset 0 1px 0 rgba(255,255,255,0.6);
}

.inflated-card h3 {
    color: var(--gunmetal);
}

.inflated-card p {
    color: var(--slate);
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 0;
}

/* Mid-ground decorative elements for treaty hall */
.floating-quill {
    top: 20%;
    right: 12%;
}

.floating-seal-mid {
    bottom: 25%;
    left: 8%;
}

.floating-dots {
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
}

/* ===========================
   SECTION 3: THE SEAL CHAMBER
   =========================== */
#seal-chamber {
    min-height: 120vh;
}

#seal-chamber .layer-fg {
    padding: 100px 40px;
    min-height: 120vh;
}

.grand-seal-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.15;
}

.seal-content {
    max-width: 680px;
    width: 100%;
    text-align: center;
}

.seal-text-block {
    background: linear-gradient(145deg, rgba(244,241,235,0.95) 0%, rgba(232,226,214,0.95) 100%);
    border-radius: 24px;
    padding: 36px 32px;
    margin-bottom: 32px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow:
        0 8px 32px rgba(30,32,36,0.06),
        inset 0 1px 0 rgba(255,255,255,0.4);
    text-align: left;
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.seal-text-block:hover {
    transform: translateY(-3px);
    box-shadow:
        0 14px 38px rgba(30,32,36,0.09),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

.seal-text-block p {
    color: var(--slate);
    font-size: 16px;
    margin-bottom: 0;
}

/* Interactive Wax Seal */
.interactive-seal {
    margin-top: 40px;
    display: inline-block;
    cursor: pointer;
    transition: transform 300ms ease-out;
    position: relative;
}

.seal-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196,163,90,0) 0%, rgba(196,163,90,0) 100%);
    transition: background 300ms ease-out;
    pointer-events: none;
}

.interactive-seal:hover .seal-glow {
    background: radial-gradient(circle, rgba(196,163,90,0.1) 0%, rgba(196,163,90,0) 100%);
    width: 160px;
    height: 160px;
}

.interactive-seal:hover {
    transform: rotate(15deg);
}

.interactive-seal:hover .seal-crosshatch {
    opacity: 0.5;
}

.seal-crosshatch {
    transition: opacity 300ms ease-out;
}

.wax-seal {
    filter: drop-shadow(0 4px 12px rgba(196,163,90,0));
    transition: filter 300ms ease-out;
    position: relative;
    z-index: 1;
}

.interactive-seal:hover .wax-seal {
    filter: drop-shadow(0 4px 20px rgba(196,163,90,0.25));
}

/* Floating ribbon */
.floating-ribbon {
    top: 30%;
    right: 5%;
}

.floating-margin-notes {
    top: 15%;
    left: 3%;
}

/* ===========================
   SECTION 4: THE ARCHIVE
   =========================== */
#archive .layer-fg {
    padding: 100px 40px;
    min-height: 100vh;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 1100px;
    width: 100%;
}

.archive-card {
    background: linear-gradient(145deg, rgba(59,63,69,0.8) 0%, rgba(44,47,54,0.9) 100%);
    border-radius: 22px;
    padding: 28px 24px;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow:
        0 8px 28px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.archive-card:hover {
    box-shadow:
        0 16px 40px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.08);
}

.archive-card.depth-1 {
    transform: scale(0.97);
}

.archive-card.depth-2 {
    transform: scale(1.0);
}

.archive-card.depth-3 {
    transform: scale(1.04);
}

.archive-card.depth-1:hover {
    transform: scale(0.97) translateY(-4px);
}

.archive-card.depth-2:hover {
    transform: scale(1.0) translateY(-4px);
}

.archive-card.depth-3:hover {
    transform: scale(1.04) translateY(-4px);
}

.archive-card p {
    color: var(--d4cec2);
    font-size: 15px;
    line-height: 1.65;
    margin-bottom: 0;
}

.archive-card .card-label {
    color: var(--seal-gold);
}

/* Mid-ground decorations for archive */
.floating-envelope-mid {
    top: 15%;
    right: 10%;
}

.floating-branch-mid {
    bottom: 20%;
    left: 5%;
}

.floating-quill-small {
    top: 45%;
    right: 4%;
}

/* ===========================
   SECTION TRANSITION EFFECT
   =========================== */
.parallax-section {
    transition: transform 200ms ease-out;
}

.parallax-section.section-departing {
    transform: scale(0.98);
}

.parallax-section.section-arriving {
    transform: scale(1.0);
}

/* ===========================
   SCROLL-TRIGGERED REVEALS
   =========================== */
.reveal-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

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

/* Stagger siblings */
.treaty-col .reveal-up:nth-child(2) { transition-delay: 80ms; }
.archive-grid .reveal-up:nth-child(2) { transition-delay: 80ms; }
.archive-grid .reveal-up:nth-child(3) { transition-delay: 160ms; }
.archive-grid .reveal-up:nth-child(4) { transition-delay: 240ms; }
.archive-grid .reveal-up:nth-child(5) { transition-delay: 320ms; }
.archive-grid .reveal-up:nth-child(6) { transition-delay: 400ms; }
.archive-grid .reveal-up:nth-child(7) { transition-delay: 480ms; }
.archive-grid .reveal-up:nth-child(8) { transition-delay: 560ms; }
.seal-content .reveal-up:nth-child(2) { transition-delay: 80ms; }
.seal-content .reveal-up:nth-child(3) { transition-delay: 160ms; }
.seal-content .reveal-up:nth-child(4) { transition-delay: 240ms; }
.seal-content .reveal-up:nth-child(5) { transition-delay: 320ms; }

/* Depth-specific stagger for archive cards */
.archive-card.depth-1 .card-label { color: var(--seal-gold); opacity: 0.7; }
.archive-card.depth-2 .card-label { color: var(--seal-gold); opacity: 0.85; }
.archive-card.depth-3 .card-label { color: var(--seal-gold); opacity: 1; }

/* ===========================
   QUILL CURSOR
   =========================== */
.quill-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.quill-cursor.visible {
    opacity: 0.7;
}

/* ===========================
   LINK UNDERLINE DRAW
   =========================== */
a {
    color: var(--diplomatic-teal);
    text-decoration: none;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--diplomatic-teal);
    transition: width 300ms ease-out;
    border-radius: 1px;
}

a:hover::after {
    width: 100%;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 900px) {
    .treaty-columns {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .treaty-col-left {
        padding-top: 0;
    }

    .archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #scroll-progress {
        right: 10px;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 16px;
    }

    .parallax-layer.layer-fg {
        padding: 60px 20px;
    }

    .inflated-card,
    .seal-text-block {
        padding: 24px 20px;
        border-radius: 20px;
    }

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

    .archive-card {
        border-radius: 18px;
        padding: 22px 18px;
    }

    h2.section-title {
        margin-bottom: 40px;
    }

    .treaty-columns {
        gap: 0;
    }

    .deco-svg {
        display: none;
    }

    #scroll-progress {
        display: none;
    }
}
