/* ====================================================
   diplomatic.wiki — Holographic Diplomatic Encyclopedia
   ==================================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2e;
    --accent-gold: #d4a843;
    --accent-aged-gold: #b8965a;
    --holo-cyan: #a8e6cf;
    --holo-violet: #c4b5fd;
    --text-parchment: #f0ead6;
    --text-cream: #f5efe0;
    --seal-red: #e74c3c;
    --holo-amber: #fbbf24;
    --gold-light: #e8d5a3;
    --content-width: 720px;
    --rotateX: 0deg;
    --rotateY: 0deg;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-parchment);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.2rem);
    line-height: 1.85;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Marble Gutters --- */
.marble-gutter {
    position: fixed;
    top: 0;
    bottom: 0;
    width: calc((100vw - var(--content-width)) / 2 - 20px);
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(168, 230, 207, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(196, 181, 253, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(212, 168, 67, 0.02) 0%, transparent 50%);
    background-size: 200% 200%;
    animation: gutter-shimmer 20s ease infinite;
}

#gutter-left {
    left: 0;
}

#gutter-right {
    right: 0;
}

@keyframes gutter-shimmer {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
}

/* --- Column Spine --- */
#column-spine {
    position: fixed;
    left: calc((100vw - var(--content-width)) / 2 - 1px);
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(
        to bottom,
        var(--accent-gold) 0%,
        var(--holo-cyan) 25%,
        var(--holo-violet) 50%,
        var(--holo-amber) 75%,
        var(--accent-gold) 100%
    );
    opacity: 0.4;
    z-index: 1;
    pointer-events: none;
}

/* --- Floating Diplomatic Seal --- */
#diplomatic-seal {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 56px;
    height: 56px;
    z-index: 100;
    cursor: pointer;
    animation: seal-spin 120s linear infinite;
    transition: opacity 0.3s ease;
    opacity: 0.7;
}

#diplomatic-seal:hover {
    opacity: 1;
}

#diplomatic-seal svg {
    width: 100%;
    height: 100%;
}

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

/* --- Main Content Column --- */
#encyclopedia {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}

/* --- Wiki Entry Base --- */
.wiki-entry {
    padding: 80px 0;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

.wiki-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Entry Hero (First Entry) --- */
.entry-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 120px;
    padding-bottom: 120px;
}

/* --- Entry Header --- */
.entry-header {
    margin-bottom: 3rem;
}

.entry-label {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    color: var(--accent-aged-gold);
    display: block;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.entry-title {
    font-family: 'Poiret One', cursive;
    font-size: clamp(2rem, 5vw, 4.5rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    line-height: 1.15;
    color: var(--accent-gold);
    position: relative;
}

/* --- Holographic Text Shimmer --- */
.holographic-text {
    background: linear-gradient(
        135deg,
        var(--accent-gold) 0%,
        var(--gold-light) 20%,
        var(--accent-gold) 40%,
        var(--holo-cyan) 50%,
        var(--accent-gold) 60%,
        var(--gold-light) 80%,
        var(--accent-gold) 100%
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: holographic-shift 8s ease infinite;
}

@keyframes holographic-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Entry Body --- */
.entry-body {
    position: relative;
}

.entry-body p {
    margin-bottom: 2.5rem;
    color: var(--text-parchment);
}

.entry-body em {
    font-style: italic;
    color: var(--text-cream);
}

.entry-intro {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    color: var(--text-cream);
    font-weight: 300;
}

/* --- Monospace --- */
.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--holo-cyan);
}

/* --- Entry Marginalia --- */
.entry-marginalia {
    position: absolute;
    top: 100px;
    left: -180px;
    width: 150px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(212, 168, 67, 0.2);
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--accent-aged-gold);
    line-height: 1.6;
    opacity: 0.8;
    background: linear-gradient(135deg, var(--bg-tertiary), rgba(42, 42, 46, 0.8));
    box-shadow: 0 0 20px rgba(168, 230, 207, 0.05);
}

/* --- Art Deco Divider --- */
.art-deco-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent-gold) 20%,
        var(--accent-gold) 80%,
        transparent
    );
    opacity: 0.5;
}

.divider-diamond {
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--accent-gold), var(--holo-cyan));
    transform: rotate(45deg);
    flex-shrink: 0;
    opacity: 0.7;
}

/* --- Tapering Dividers --- */
.tapering-end {
    margin-top: 4rem;
    text-align: center;
}

.art-deco-divider.small {
    max-width: 60%;
    margin: 0 auto;
    padding: 20px 0;
}

.art-deco-divider.small .divider-diamond {
    width: 10px;
    height: 10px;
}

.art-deco-divider.smaller {
    max-width: 35%;
    margin: 0 auto;
    padding: 16px 0;
}

.art-deco-divider.smaller .divider-diamond {
    width: 8px;
    height: 8px;
}

.art-deco-divider.smallest {
    max-width: 15%;
    margin: 0 auto;
    padding: 12px 0;
}

.art-deco-divider.smallest .divider-diamond {
    width: 6px;
    height: 6px;
}

.fin-text {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.875rem;
    letter-spacing: 0.3em;
    color: var(--accent-aged-gold);
    margin-top: 2rem;
    opacity: 0.6;
}

/* --- Holographic Card --- */
.holographic-card {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid rgba(212, 168, 67, 0.3);
    border-radius: 12px;
    padding: 2.5rem;
    margin: 2.5rem 0;
    overflow: hidden;
    transform: perspective(1000px) rotateX(var(--rotateX)) rotateY(var(--rotateY));
    transition: transform 0.6s ease;
}

.holo-card-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(212, 168, 67, 0.05) 0%,
        rgba(168, 230, 207, 0.08) 25%,
        rgba(196, 181, 253, 0.08) 50%,
        rgba(251, 191, 36, 0.05) 75%,
        rgba(212, 168, 67, 0.05) 100%
    );
    background-size: 300% 300%;
    animation: holographic-shift 8s ease infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.holographic-card:hover .holo-card-shimmer {
    opacity: 1;
}

.holo-card-content {
    position: relative;
    z-index: 1;
}

/* --- Pull Quote --- */
.pull-quote {
    border-left: 3px solid var(--accent-gold);
    padding: 1.5rem 2rem;
    margin: 3rem 0;
    background: linear-gradient(
        135deg,
        rgba(42, 42, 46, 0.6),
        rgba(26, 26, 26, 0.8)
    );
    border-radius: 0 8px 8px 0;
    position: relative;
}

.pull-quote::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(212, 168, 67, 0.02) 2px,
            rgba(212, 168, 67, 0.02) 3px
        );
    pointer-events: none;
    border-radius: 0 8px 8px 0;
}

.pull-quote blockquote {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    font-style: italic;
    color: var(--text-cream);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.pull-quote cite {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    color: var(--accent-aged-gold);
    letter-spacing: 0.05em;
}

/* --- SVG Illustrations --- */
.svg-illustration {
    margin: 3rem auto;
    max-width: 400px;
    opacity: 0.8;
}

.svg-illustration svg {
    width: 100%;
    height: auto;
}

.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2.5s ease;
}

.draw-path.drawn {
    stroke-dashoffset: 0;
}

/* --- Entry Wide (Marble Archive) --- */
.entry-wide {
    max-width: 90vw;
    margin-left: calc((var(--content-width) - 90vw) / 2);
    width: 90vw;
}

/* --- Marble Panel --- */
.marble-panel {
    background:
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 40px,
            rgba(212, 168, 67, 0.03) 40px,
            rgba(212, 168, 67, 0.03) 41px
        ),
        linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(212, 168, 67, 0.15);
    border-radius: 16px;
    padding: 3rem;
    margin: 2.5rem 0;
    position: relative;
    overflow: hidden;
    transition: border-color 0.4s ease;
}

.marble-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 80px,
            rgba(212, 168, 67, 0.02) 80px,
            rgba(212, 168, 67, 0.02) 81px
        );
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.4s ease;
}

.marble-panel:hover::before {
    opacity: 1;
}

.marble-panel:hover {
    border-color: rgba(212, 168, 67, 0.3);
}

/* --- Archive Grid --- */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    position: relative;
    z-index: 1;
}

/* --- Archive Card --- */
.archive-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 10px;
    border: 1px solid rgba(212, 168, 67, 0.15);
    transition: transform 0.3s ease, border-color 0.4s ease;
}

.archive-card:hover {
    transform: translateY(-4px);
}

.holographic-border {
    position: relative;
}

.holographic-border::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 11px;
    background: linear-gradient(
        135deg,
        var(--accent-gold),
        var(--holo-cyan),
        var(--holo-violet),
        var(--holo-amber),
        var(--accent-gold)
    );
    background-size: 300% 300%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
    animation: holographic-shift 6s ease infinite;
}

.holographic-border:hover::after {
    opacity: 1;
}

.archive-card-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.archive-card-body {
    font-size: 0.95rem;
    color: var(--text-parchment);
    margin-bottom: 1.2rem;
    line-height: 1.75;
}

.archive-ref {
    color: var(--holo-cyan);
    opacity: 0.7;
}

/* --- Classified Block --- */
.classified-block {
    background: var(--bg-secondary);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 10px;
    margin: 2.5rem 0;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: filter 0.1s ease;
}

.classified-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(231, 76, 60, 0.08);
    border-bottom: 1px solid rgba(231, 76, 60, 0.15);
}

.classified-badge {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--seal-red);
    border: 1px solid var(--seal-red);
    padding: 3px 10px;
    border-radius: 3px;
}

.classified-content {
    padding: 1.5rem;
}

.redacted {
    color: var(--text-parchment);
    position: relative;
    user-select: none;
}

.redacted::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1.6em,
        rgba(26, 26, 26, 0.85) 1.6em,
        rgba(26, 26, 26, 0.85) 1.8em
    );
    pointer-events: none;
}

/* --- Shake Animation --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-4px); }
    20% { transform: translateX(4px); }
    30% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    50% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    70% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
    90% { transform: translateX(-1px); }
}

.shake-target.shaking {
    animation: shake 400ms ease-in-out;
}

.shake-target.flash {
    filter: hue-rotate(30deg) brightness(1.2);
    border-color: var(--seal-red);
}

/* --- Entry Final --- */
.entry-final {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.seal-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.seal-watermark svg {
    width: 100%;
    height: 100%;
}

.entry-final .entry-header,
.entry-final .entry-body,
.entry-final .tapering-end {
    position: relative;
    z-index: 1;
}

.final-text {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    line-height: 2;
    color: var(--text-cream);
}

/* --- Terminal Space --- */
.terminal-space {
    min-height: 40vh;
    background: var(--bg-primary);
}

/* --- Text Color Utilities --- */
.text-red {
    color: var(--seal-red);
}

/* --- Marble Vein Drift (Body Background) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 200px,
            rgba(212, 168, 67, 0.015) 200px,
            rgba(212, 168, 67, 0.015) 201px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 300px,
            rgba(168, 230, 207, 0.01) 300px,
            rgba(168, 230, 207, 0.01) 301px
        );
    background-size: 400% 400%;
    animation: marble-drift 60s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes marble-drift {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .entry-marginalia {
        position: relative;
        left: auto;
        top: auto;
        width: auto;
        margin-top: 2rem;
        display: inline-block;
    }

    .entry-wide {
        max-width: 100%;
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 768px) {
    #diplomatic-seal {
        width: 40px;
        height: 40px;
        top: 16px;
        left: 16px;
    }

    #column-spine {
        display: none;
    }

    .marble-gutter {
        display: none;
    }

    #encyclopedia {
        padding: 0 16px;
    }

    .entry-hero {
        padding-top: 80px;
        padding-bottom: 80px;
    }

    .wiki-entry {
        padding: 50px 0;
    }

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

    .holographic-card {
        padding: 1.5rem;
    }

    .marble-panel {
        padding: 1.5rem;
    }

    .pull-quote {
        padding: 1rem 1.5rem;
    }

    .seal-watermark {
        width: 300px;
        height: 300px;
    }
}

/* --- Constellation Dots (decorative) --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(1px 1px at 10% 20%, rgba(212, 168, 67, 0.15) 50%, transparent 100%),
        radial-gradient(1px 1px at 30% 65%, rgba(168, 230, 207, 0.12) 50%, transparent 100%),
        radial-gradient(1px 1px at 70% 30%, rgba(196, 181, 253, 0.12) 50%, transparent 100%),
        radial-gradient(1px 1px at 85% 75%, rgba(212, 168, 67, 0.1) 50%, transparent 100%),
        radial-gradient(1px 1px at 50% 90%, rgba(168, 230, 207, 0.1) 50%, transparent 100%),
        radial-gradient(1px 1px at 15% 80%, rgba(196, 181, 253, 0.08) 50%, transparent 100%),
        radial-gradient(1px 1px at 90% 15%, rgba(212, 168, 67, 0.08) 50%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}
