/* ===========================================
   mujun.wiki — Vaporwave Paradox Archive
   Design: retrowave paradox archive
   Palette: duotone plum + synthetic pink
   =========================================== */

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

:root {
    --deep-void: #1a0a2e;
    --void-gradient: #2a1040;
    --paradox-pink: #e47aad;
    --haze-lavender: #d4c5e8;
    --contradiction-cyan: #4de8c2;
    --artifact-gold: #c4a850;
    --bloom-white: #f0e4f4;
    --signal-magenta: #a83279;
    --font-display: 'Varela Round', sans-serif;
    --font-body: 'Nunito', sans-serif;
    --font-margin: 'Quicksand', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body.void {
    background: linear-gradient(165deg, var(--deep-void) 0%, var(--void-gradient) 100%);
    min-height: 100vh;
    color: var(--haze-lavender);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    position: relative;
}

/* --- Grid Underlay --- */
.grid-underlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(to right, rgba(228, 122, 173, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(228, 122, 173, 0.06) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image:
        linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5) 90%);
    -webkit-mask-image:
        linear-gradient(180deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.5) 90%);
}

/* --- Lens Flares --- */
.lens-flare {
    position: fixed;
    pointer-events: none;
    z-index: 1;
    border-radius: 50%;
}

.lens-flare--top-right {
    top: -10vh;
    right: -5vw;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(228, 122, 173, 0.15) 0%, rgba(228, 122, 173, 0.05) 30%, rgba(77, 232, 194, 0.03) 60%, transparent 70%);
    animation: drift 20s ease-in-out infinite alternate;
}

.lens-flare--bottom-left {
    bottom: -15vh;
    left: -10vw;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(228, 122, 173, 0.1) 0%, rgba(77, 232, 194, 0.04) 40%, transparent 65%);
    animation: drift 25s ease-in-out infinite alternate-reverse;
}

.lens-flare--mid-center {
    top: 40vh;
    left: 30vw;
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, rgba(196, 168, 80, 0.06) 0%, rgba(228, 122, 173, 0.03) 40%, transparent 60%);
    animation: drift 30s ease-in-out infinite alternate;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); opacity: 0.4; }
    100% { transform: translate(5vw, -3vh) scale(1.15); opacity: 0.25; }
}

/* --- Header --- */
.wiki-header {
    position: relative;
    z-index: 10;
    padding: 12vh 8vw 6vh;
    text-align: center;
}

.contradiction-glyph {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    opacity: 0;
    animation: fadeInGlyph 2s ease-out 0.5s forwards;
}

.glyph-svg {
    width: 100%;
    height: 100%;
}

.glyph-spear, .glyph-shield {
    transition: d 400ms ease-in-out, opacity 400ms ease-in-out;
}

.contradiction-glyph:hover .glyph-shield {
    opacity: 1;
    stroke: var(--contradiction-cyan);
}

.contradiction-glyph:hover .glyph-spear {
    stroke: var(--signal-magenta);
}

@keyframes fadeInGlyph {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}

.wiki-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.4rem, 5vw, 4.2rem);
    letter-spacing: 0.01em;
    line-height: 1.12;
    color: var(--paradox-pink);
    opacity: 0;
    animation: titleReveal 1.5s ease-out 1s forwards;
}

.title-kanji {
    display: block;
    font-size: 1.6em;
    margin-bottom: 0.1em;
}

.title-latin {
    display: block;
    font-size: 0.45em;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--haze-lavender);
    opacity: 0.7;
}

@keyframes titleReveal {
    from { opacity: 0; transform: translateY(2rem); }
    to { opacity: 1; transform: translateY(0); }
}

.wiki-subtitle {
    font-family: var(--font-margin);
    font-weight: 300;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--haze-lavender);
    opacity: 0;
    margin-top: 1.5rem;
    animation: titleReveal 1.5s ease-out 1.8s forwards;
}

/* --- Broken Grid Main --- */
.broken-grid {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4vh 4vw 10vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
}

/* --- Entry Cards --- */
.entry {
    position: relative;
    display: grid;
    grid-template-columns: 25% 1fr;
    gap: 1.5rem;
    background: linear-gradient(135deg, rgba(26, 10, 46, 0.6) 0%, rgba(42, 16, 64, 0.4) 100%);
    border: 1px solid rgba(228, 122, 173, 0.12);
    border-radius: 2px;
    padding: 2rem 2rem 2rem 0;
    transform: rotate(var(--tilt, 0deg));
    opacity: 0;
    transition: opacity 800ms ease-out, transform 800ms ease-out;
    will-change: opacity, transform;
}

.entry.visible {
    opacity: 1;
}

.entry--offset-left {
    grid-column: 1 / 10;
    margin-left: 2vw;
}

.entry--offset-right {
    grid-column: 4 / 13;
    margin-top: -6vh;
    margin-right: 2vw;
}

.entry--center {
    grid-column: 2 / 12;
}

.entry--dense {
    margin-top: -4vh;
}

.entry--tangle {
    margin-top: -8vh;
}

.entry:hover {
    border-color: rgba(228, 122, 173, 0.3);
    box-shadow: 0 0 40px rgba(228, 122, 173, 0.08);
}

/* overlap blend zones */
.entry--offset-right + .entry--offset-left,
.entry--offset-left + .entry--offset-right {
    mix-blend-mode: normal;
}

/* --- Margin Notes (Medieval Marginalia) --- */
.margin-notes {
    padding: 1rem 1rem 1rem 1.5rem;
    opacity: 0.75;
    border-right: 1px solid rgba(228, 122, 173, 0.08);
}

.floral-svg {
    width: 60px;
    height: auto;
    margin-bottom: 1rem;
}

.botanical-draw path,
.botanical-draw circle {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease-out;
}

.entry.visible .botanical-draw path,
.entry.visible .botanical-draw circle {
    stroke-dashoffset: 0;
}

.margin-label {
    display: block;
    font-family: var(--font-margin);
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--paradox-pink);
    margin-bottom: 0.5rem;
}

.margin-text {
    font-family: var(--font-margin);
    font-weight: 300;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--haze-lavender);
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.margin-ref {
    display: block;
    font-family: var(--font-margin);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: var(--contradiction-cyan);
    opacity: 0.6;
    transition: opacity 300ms ease;
}

.entry:hover .margin-ref {
    opacity: 1;
}

/* --- Entry Body --- */
.entry-body {
    padding: 0.5rem 1.5rem;
}

.entry-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--paradox-pink);
    cursor: pointer;
    transition: color 300ms ease;
    margin-bottom: 0.5rem;
}

.entry-title:hover {
    color: var(--contradiction-cyan);
}

.entry-excerpt {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--haze-lavender);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: opacity 300ms ease;
}

.entry.expanded .entry-excerpt {
    display: none;
}

.entry-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.entry.expanded .entry-content {
    max-height: 1200px;
}

.entry-content p {
    margin-top: 1rem;
    color: var(--haze-lavender);
}

.entry-content em {
    color: var(--bloom-white);
    font-style: italic;
}

.entry-logic {
    margin-top: 1.2rem;
    padding: 0.8rem 1rem;
    background: rgba(26, 10, 46, 0.5);
    border-left: 2px solid var(--artifact-gold);
    border-radius: 0 2px 2px 0;
}

.logic-notation {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--bloom-white);
    letter-spacing: 0.02em;
}

/* --- Deeper Link Button --- */
.deeper-link {
    display: inline-block;
    margin-top: 1.5rem;
    padding: 0.5rem 1.2rem;
    background: transparent;
    border: 1px solid var(--paradox-pink);
    color: var(--paradox-pink);
    font-family: var(--font-margin);
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 300ms ease;
    border-radius: 1px;
}

.deeper-link:hover {
    background: var(--paradox-pink);
    color: var(--deep-void);
    box-shadow: 0 0 20px rgba(228, 122, 173, 0.3);
}

/* --- Glyph Dividers --- */
.glyph-divider {
    grid-column: 4 / 10;
    text-align: center;
    padding: 2rem 0;
    opacity: 0.5;
}

.glyph-divider--shifted {
    grid-column: 5 / 11;
    margin-left: 4vw;
}

.divider-svg {
    width: 160px;
    height: 48px;
}

/* --- Panel Overlay --- */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 10, 46, 0.6);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease;
}

.panel-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* --- Slide Panels --- */
.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 90vw;
    max-width: 600px;
    height: 100vh;
    background: linear-gradient(180deg, #1a0a2e 0%, #2a1040 60%, #1a0a2e 100%);
    border-left: 1px solid rgba(228, 122, 173, 0.2);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
    padding: 3rem 2.5rem;
}

.slide-panel.active {
    transform: translateX(0);
}

.panel-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: 1px solid rgba(228, 122, 173, 0.3);
    color: var(--paradox-pink);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 300ms ease;
    border-radius: 2px;
}

.panel-close:hover {
    background: var(--paradox-pink);
    color: var(--deep-void);
}

.panel-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: var(--paradox-pink);
    margin-bottom: 2rem;
    padding-right: 3rem;
}

.panel-body p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.72;
    color: var(--haze-lavender);
    margin-bottom: 1.2rem;
}

.panel-note {
    padding: 1rem;
    border-left: 2px solid var(--artifact-gold);
    background: rgba(196, 168, 80, 0.05);
    font-style: italic;
}

/* --- Roman Bust Silhouettes --- */
.bust-silhouette {
    position: fixed;
    pointer-events: none;
    z-index: 2;
}

.bust-silhouette--1 {
    bottom: 5vh;
    right: -2vw;
    width: 200px;
    height: 280px;
    background: linear-gradient(180deg, rgba(228, 122, 173, 0.04) 0%, rgba(42, 16, 64, 0.06) 100%);
    clip-path: polygon(35% 0%, 65% 0%, 70% 8%, 72% 18%, 70% 28%, 75% 32%, 80% 45%, 78% 55%, 72% 58%, 75% 65%, 85% 75%, 90% 85%, 95% 100%, 5% 100%, 10% 85%, 15% 75%, 25% 65%, 28% 58%, 22% 55%, 20% 45%, 25% 32%, 30% 28%, 28% 18%, 30% 8%);
    opacity: 0.3;
}

.bust-silhouette--2 {
    top: 30vh;
    left: -3vw;
    width: 150px;
    height: 210px;
    background: linear-gradient(180deg, rgba(77, 232, 194, 0.03) 0%, rgba(42, 16, 64, 0.04) 100%);
    clip-path: polygon(40% 0%, 60% 0%, 65% 10%, 68% 20%, 65% 30%, 70% 35%, 75% 48%, 72% 55%, 68% 58%, 70% 65%, 80% 78%, 85% 90%, 90% 100%, 10% 100%, 15% 90%, 20% 78%, 30% 65%, 32% 58%, 28% 55%, 25% 48%, 30% 35%, 35% 30%, 32% 20%, 35% 10%);
    opacity: 0.2;
    transform: scaleX(-1);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .broken-grid {
        display: flex;
        flex-direction: column;
        gap: 2rem;
        padding: 2vh 4vw 6vh;
    }

    .entry {
        grid-template-columns: 1fr;
        transform: rotate(0deg) !important;
        margin: 0 !important;
    }

    .entry--offset-left,
    .entry--offset-right,
    .entry--center {
        grid-column: auto;
    }

    .margin-notes {
        display: flex;
        gap: 1rem;
        align-items: center;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid rgba(228, 122, 173, 0.08);
    }

    .floral-svg {
        width: 40px;
        margin-bottom: 0;
    }

    .margin-text {
        display: none;
    }

    .glyph-divider,
    .glyph-divider--shifted {
        grid-column: auto;
        margin-left: 0;
    }

    .wiki-header {
        padding: 8vh 6vw 4vh;
    }

    .slide-panel {
        width: 95vw;
    }

    .bust-silhouette {
        display: none;
    }
}

@media (max-width: 480px) {
    .entry-body {
        padding: 0.5rem 1rem;
    }

    .entry {
        padding: 1.5rem 1rem 1.5rem 0;
    }
}

/* --- Selection Color --- */
::selection {
    background: var(--signal-magenta);
    color: var(--bloom-white);
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(228, 122, 173, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(228, 122, 173, 0.5);
}
