/* ============================================
   diplomatic.wiki - Design System Styles
   Inflated 3D + Sci-Fi HUD Fusion
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-bg: #1a1410;
    --panel-surface: #f0e4d4;
    --panel-shadow: #3d2e1f;
    --accent-glow: #d4a054;
    --rose-brass: #b87a6a;
    --muted-text: #8c7b6b;
    --highlight-text: #f2e0c8;
    --dusty-mauve: #9b8a9e;
    --panel-light: #f5ead8;
    --panel-dark: #e8d8c2;
    --cream-light: #f2e0c8;
    --umber-depth: #3d2e1f;
    --dark-text: #2a1f1a;
    --body-light: #d4c4b0;
    --hud-label: #a89279;
    --hud-label-dark: #e8d5bf;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-bg);
    color: var(--body-light);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.65;
    overflow-x: hidden;
}

/* --- Scan Lines Overlay --- */
.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(26, 20, 16, 0.03) 3px,
        rgba(26, 20, 16, 0.03) 4px
    );
}

/* ============================================
   SECTION 1: THE BRIDGE (Hero)
   ============================================ */
.bridge {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: bridgeFadeIn 1.2s ease-out both;
}

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

.bridge-gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(212, 160, 84, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(184, 122, 106, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 30%, rgba(155, 138, 158, 0.08) 0%, transparent 50%),
        var(--deep-bg);
}

/* Compass Ring */
.compass-ring-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(400px, 80vw);
    height: min(400px, 80vw);
    z-index: 1;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.compass-ring-container.scrolled {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    transform: none;
    width: 60px;
    height: 60px;
    z-index: 100;
    opacity: 0.5;
}

.compass-ring {
    width: 100%;
    height: 100%;
    animation: compassRotate 120s linear infinite;
}

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

.bridge-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 20px;
}

.bridge-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(40px, 8vw, 80px);
    font-weight: 700;
    font-variation-settings: 'WONK' 1;
    color: var(--highlight-text);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 20px;
}

.bridge-metadata {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hud-label);
    opacity: 0.7;
}

.bridge-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: chevronPulse 2s ease-in-out infinite;
}

@keyframes chevronPulse {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ============================================
   SECTION 2: THE ARCHIVE GALLERY
   ============================================ */
.archive {
    padding: 120px 40px 80px;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    font-variation-settings: 'WONK' 1;
    color: var(--highlight-text);
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 16px;
}

.section-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hud-label);
    opacity: 0.6;
    text-align: center;
    margin-bottom: 60px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
}

/* Card Base */
.card {
    position: relative;
    background: linear-gradient(165deg, var(--panel-light), var(--panel-dark));
    border-radius: 24px;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(61, 46, 31, 0.35),
        0 2px 8px rgba(61, 46, 31, 0.2),
        inset 0 2px 4px rgba(242, 224, 200, 0.3),
        inset 0 -2px 6px rgba(61, 46, 31, 0.15);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.3s ease;
}

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

.card:hover {
    box-shadow:
        0 12px 40px rgba(61, 46, 31, 0.45),
        0 4px 12px rgba(61, 46, 31, 0.25),
        inset 0 2px 4px rgba(242, 224, 200, 0.35),
        inset 0 -2px 6px rgba(61, 46, 31, 0.1);
}

.card--priority {
    grid-column: span 2;
}

.card--tall {
    grid-row: span 2;
}

/* Card Gradient Mesh */
.card-mesh {
    width: 100%;
    height: 120px;
    border-radius: 24px 24px 0 0;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at var(--mesh-x, 50%) var(--mesh-y, 50%), rgba(212, 160, 84, 0.8) 0%, rgba(184, 122, 106, 0.4) 50%, transparent 80%),
        conic-gradient(from 45deg at 60% 40%, rgba(155, 138, 158, 0.5), rgba(212, 160, 84, 0.6), rgba(184, 122, 106, 0.5), rgba(155, 138, 158, 0.5)),
        radial-gradient(ellipse at calc(100% - var(--mesh-x, 50%)) calc(100% - var(--mesh-y, 50%)), rgba(242, 224, 200, 0.6) 0%, rgba(212, 160, 84, 0.2) 60%, transparent 90%);
    filter: hue-rotate(var(--mesh-hue-shift, 0deg));
}

.card-mesh--tall {
    height: 180px;
}

.card-divider {
    height: 1px;
    background: rgba(212, 160, 84, 0.2);
}

.card-body {
    padding: 20px 24px 24px;
}

.card-category {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hud-label);
    display: block;
    margin-bottom: 8px;
}

.card-title {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    font-weight: 600;
    font-variation-settings: 'WONK' 1;
    color: var(--dark-text);
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 10px;
}

.card-excerpt {
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--muted-text);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card--tall .card-excerpt {
    -webkit-line-clamp: 5;
}

.card--priority .card-excerpt {
    -webkit-line-clamp: 3;
}

/* HUD Corner Brackets */
.card-bracket {
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
}

.card-bracket--tl {
    top: 6px;
    left: 6px;
    border-top: 1px solid rgba(212, 160, 84, 0.4);
    border-left: 1px solid rgba(212, 160, 84, 0.4);
}

.card-bracket--tr {
    top: 6px;
    right: 6px;
    border-top: 1px solid rgba(212, 160, 84, 0.4);
    border-right: 1px solid rgba(212, 160, 84, 0.4);
}

.card-bracket--bl {
    bottom: 6px;
    left: 6px;
    border-bottom: 1px solid rgba(212, 160, 84, 0.4);
    border-left: 1px solid rgba(212, 160, 84, 0.4);
}

.card-bracket--br {
    bottom: 6px;
    right: 6px;
    border-bottom: 1px solid rgba(212, 160, 84, 0.4);
    border-right: 1px solid rgba(212, 160, 84, 0.4);
}

/* ============================================
   SECTION 3: THE TREATY CHAMBER
   ============================================ */
.treaty {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: var(--deep-bg);
    position: relative;
}

.treaty::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 40% 50%, rgba(212, 160, 84, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 60% 70%, rgba(184, 122, 106, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

.treaty-panel {
    position: relative;
    max-width: 720px;
    width: 100%;
    background: linear-gradient(165deg, var(--panel-light), var(--panel-dark));
    border-radius: 24px;
    box-shadow:
        0 8px 32px rgba(61, 46, 31, 0.35),
        0 2px 8px rgba(61, 46, 31, 0.2),
        inset 0 2px 4px rgba(242, 224, 200, 0.3),
        inset 0 -2px 6px rgba(61, 46, 31, 0.15);
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.treaty-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.treaty-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    background: rgba(42, 31, 26, 0.06);
    border-bottom: 1px solid rgba(212, 160, 84, 0.15);
}

.data-arc {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.treaty-header-text {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hud-label);
    opacity: 0.8;
}

.treaty-body {
    padding: 48px;
}

.treaty-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 700;
    font-variation-settings: 'WONK' 1;
    color: var(--dark-text);
    letter-spacing: -0.02em;
    margin-bottom: 28px;
}

.treaty-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 17px;
    color: var(--muted-text);
    line-height: 1.75;
    margin-bottom: 20px;
}

.treaty-text em {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 16px;
    color: #6b5e52;
    font-variation-settings: 'WONK' 1;
}

.treaty-meta {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hud-label);
    opacity: 0.6;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid rgba(212, 160, 84, 0.15);
    line-height: 1.8;
}

.treaty-meta em {
    font-style: italic;
}

/* ============================================
   SECTION 4: THE OBSERVATORY
   ============================================ */
.observatory {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: linear-gradient(180deg, var(--deep-bg) 0%, #2a1f1a 100%);
    position: relative;
}

.observatory-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.orb-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin-bottom: 60px;
}

.gradient-orb {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 35% 35%, rgba(242, 224, 200, 0.6) 0%, transparent 50%),
        conic-gradient(from 120deg at 50% 50%, #d4a054, #b87a6a, #9b8a9e, #d4a054),
        radial-gradient(ellipse at 65% 65%, rgba(184, 122, 106, 0.8) 0%, rgba(155, 138, 158, 0.4) 50%, transparent 80%);
    box-shadow:
        0 0 60px rgba(212, 160, 84, 0.2),
        0 0 120px rgba(212, 160, 84, 0.1),
        inset 0 -20px 40px rgba(42, 31, 26, 0.4);
    animation: orbGlow 8s ease-in-out infinite alternate;
}

@keyframes orbGlow {
    0% { box-shadow: 0 0 60px rgba(212, 160, 84, 0.2), 0 0 120px rgba(212, 160, 84, 0.1), inset 0 -20px 40px rgba(42, 31, 26, 0.4); }
    100% { box-shadow: 0 0 80px rgba(212, 160, 84, 0.3), 0 0 160px rgba(212, 160, 84, 0.15), inset 0 -20px 40px rgba(42, 31, 26, 0.4); }
}

/* Floating Fragments */
.floating-fragment {
    position: absolute;
    background: linear-gradient(165deg, var(--panel-light), var(--panel-dark));
    border-radius: 12px;
    box-shadow:
        0 4px 16px rgba(61, 46, 31, 0.3),
        inset 0 1px 2px rgba(242, 224, 200, 0.3);
    opacity: 0.6;
}

.fragment-1 {
    width: 60px;
    height: 40px;
    top: -30px;
    left: -60px;
    animation: floatOrbit1 30s linear infinite;
}

.fragment-2 {
    width: 45px;
    height: 30px;
    top: 50px;
    right: -50px;
    animation: floatOrbit2 38s linear infinite;
}

.fragment-3 {
    width: 50px;
    height: 35px;
    bottom: -20px;
    left: -40px;
    animation: floatOrbit3 25s linear infinite;
}

.fragment-4 {
    width: 35px;
    height: 25px;
    bottom: 40px;
    right: -70px;
    animation: floatOrbit4 42s linear infinite;
}

.fragment-5 {
    width: 55px;
    height: 20px;
    top: -50px;
    right: -30px;
    animation: floatOrbit5 35s linear infinite;
}

@keyframes floatOrbit1 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -15px) rotate(5deg); }
    50% { transform: translate(-10px, -30px) rotate(-3deg); }
    75% { transform: translate(-25px, -10px) rotate(8deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes floatOrbit2 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-15px, 20px) rotate(-6deg); }
    50% { transform: translate(10px, 35px) rotate(4deg); }
    75% { transform: translate(25px, 15px) rotate(-8deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes floatOrbit3 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, 10px) rotate(7deg); }
    50% { transform: translate(15px, -20px) rotate(-5deg); }
    75% { transform: translate(-15px, -10px) rotate(3deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes floatOrbit4 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-20px, -25px) rotate(-4deg); }
    50% { transform: translate(5px, -15px) rotate(6deg); }
    75% { transform: translate(20px, 10px) rotate(-7deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes floatOrbit5 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(10px, 25px) rotate(5deg); }
    50% { transform: translate(-20px, 10px) rotate(-6deg); }
    75% { transform: translate(-10px, -20px) rotate(4deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.observatory-closing {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 20px;
    font-variation-settings: 'WONK' 1;
    color: var(--body-light);
    max-width: 500px;
    margin-bottom: 40px;
    line-height: 1.6;
}

.return-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-glow);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.return-link:hover {
    opacity: 1;
}

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

    .card--priority {
        grid-column: span 1;
    }

    .card--tall {
        grid-row: span 1;
    }

    .card--tall .card-excerpt {
        -webkit-line-clamp: 2;
    }

    .card-mesh--tall {
        height: 120px;
    }

    .archive {
        padding: 80px 20px 60px;
    }

    .treaty-body {
        padding: 28px;
    }

    .orb-container {
        width: 200px;
        height: 200px;
    }

    .gradient-orb {
        width: 200px;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bridge-title {
        font-size: 36px;
    }

    .section-title {
        font-size: 28px;
    }
}
