/* ================================================
   mujun.quest — Holographic Paradox Observatory
   ================================================ */

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

:root {
    --void-indigo: #0a081e;
    --nebula-navy: #1a1640;
    --aurora-mint: #7ee8c7;
    --prism-violet: #c084fc;
    --ionosphere-blue: #38bdf8;
    --refraction-pink: #f0abfc;
    --ice-white: #e0f0ff;
    --muted-periwinkle: #b8c9e0;
    --aurora-gradient: linear-gradient(135deg, #7ee8c7 0%, #38bdf8 25%, #c084fc 50%, #f0abfc 75%, #7ee8c7 100%);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-indigo);
    color: var(--muted-periwinkle);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ---- HERO: Observatory Deck ---- */

#hero {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

#hero.collapsed {
    pointer-events: none;
}

#hero-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

#hero-flash.flash {
    animation: flash-pulse 0.15s ease-out;
}

@keyframes flash-pulse {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

#kanji-spear, #kanji-shield {
    position: absolute;
    will-change: transform, opacity;
    filter: drop-shadow(0 0 20px rgba(192, 132, 252, 0.3));
    transition: transform 4s ease-in-out, opacity 0.8s;
}

#kanji-spear {
    left: calc(50% - 280px);
    top: 50%;
    transform: translate(0, -50%);
}

#kanji-shield {
    right: calc(50% - 280px);
    top: 50%;
    transform: translate(0, -50%);
    filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.3));
}

#kanji-spear.drift { transform: translate(80px, -50%); }
#kanji-shield.drift { transform: translate(-80px, -50%); }

#kanji-spear.explode, #kanji-shield.explode {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s;
}
#kanji-spear.explode {
    transform: translate(-300px, -50%) rotate(-45deg) scale(0.3);
    opacity: 0;
}
#kanji-shield.explode {
    transform: translate(300px, -50%) rotate(45deg) scale(0.3);
    opacity: 0;
}

.kanji-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 2s ease-out;
}

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

#hero-question {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    color: var(--muted-periwinkle);
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease-in;
    white-space: nowrap;
}

#hero-question.visible {
    opacity: 1;
}

#hero.collapsed #kanji-spear,
#hero.collapsed #kanji-shield {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s;
}

#hero.hidden {
    display: none;
}

/* ---- TOP BAR ---- */

#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
    background: rgba(10, 8, 30, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(126, 232, 199, 0.15);
    opacity: 0;
    transition: opacity 0.6s;
}

#topbar.visible {
    opacity: 1;
}

.topbar-domain {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aurora-mint);
}

.topbar-counter {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-periwinkle);
}

.topbar-toggle {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--aurora-mint);
    background: transparent;
    border: 1px solid rgba(126, 232, 199, 0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
}

.topbar-toggle:hover {
    border-color: var(--aurora-mint);
    color: var(--ice-white);
}

/* ---- DASHBOARD ---- */

#dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 5rem 1.5rem 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s ease-in;
}

#dashboard.visible {
    opacity: 1;
}

/* ---- PARADOX CARDS ---- */

.paradox-card {
    position: relative;
    background: rgba(26, 22, 64, 0.55);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 2rem 1.8rem;
    transform: translateZ(0) rotate3d(1, 1, 0, 0.5deg);
    will-change: transform, box-shadow;
    transition: transform 0.4s, box-shadow 0.4s;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

.paradox-card.reveal {
    opacity: 1;
    transform: translateY(0) rotate3d(1, 1, 0, 0.5deg);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

/* Aurora border */
.paradox-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: var(--aurora-gradient);
    background-size: 200% 200%;
    animation: aurora-flow 8s linear infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes aurora-flow {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

.paradox-card:hover {
    transform: translateY(-4px) rotate3d(1, 1, 0, 0.5deg);
    box-shadow: 0 12px 40px rgba(126, 232, 199, 0.12);
}

.paradox-card:hover::before {
    animation-duration: 4s;
}

.card-inner {
    position: relative;
    z-index: 2;
}

.card-icon {
    margin-bottom: 1rem;
}

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

.paradox-card.reveal .draw-path {
    stroke-dashoffset: 0;
}

.card-title {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4.5vw, 3.2rem);
    letter-spacing: 0.03em;
    color: var(--ice-white);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.card-body {
    color: var(--muted-periwinkle);
    margin-bottom: 1.2rem;
}

.contradiction-meter {
    width: 100%;
    height: 4px;
    background: rgba(184, 201, 224, 0.15);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.meter-fill {
    height: 100%;
    background: var(--aurora-gradient);
    background-size: 200% 200%;
    animation: aurora-flow 6s linear infinite;
    border-radius: 2px;
    transition: width 1s ease-out;
}

.meter-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aurora-mint);
}

/* Floating decorative shapes */
.card-float {
    position: absolute;
    width: 40px;
    height: 40px;
    top: 1rem;
    right: 1rem;
    opacity: 0.25;
    pointer-events: none;
    z-index: 1;
}

.shape-morph {
    background: var(--prism-violet);
    border-radius: 50%;
    animation: float-drift 9s ease-in-out infinite alternate, shape-shift 10s ease-in-out infinite;
}

.shape-triangle {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 35px solid var(--ionosphere-blue);
    background: none;
    animation: float-drift 11s ease-in-out infinite alternate;
}

.shape-infinity {
    background: none;
    border: 2px solid var(--aurora-mint);
    width: 40px;
    height: 20px;
    border-radius: 50%;
    animation: float-drift 7s ease-in-out infinite alternate;
}

@keyframes float-drift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-12px, 15px) rotate(15deg); }
}

@keyframes shape-shift {
    0%, 100% { border-radius: 50%; }
    50% { border-radius: 8px; }
}

/* ---- COLLISION ZONE ---- */

#collision-zone {
    grid-column: 1 / -1;
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 300px;
    margin: 2rem 0;
    border-radius: 12px;
    overflow: hidden;
}

.collision-left, .collision-right {
    padding: 3rem 2.5rem;
    position: relative;
    z-index: 2;
}

.collision-left {
    background: rgba(192, 132, 252, 0.08);
    clip-path: polygon(0 0, 100% 3%, 95% 97%, 0 100%);
}

.collision-right {
    background: rgba(56, 189, 248, 0.08);
    clip-path: polygon(5% 3%, 100% 0, 100% 100%, 0 97%);
    mix-blend-mode: screen;
}

.collision-left h2, .collision-right h2 {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.4rem);
    color: var(--ice-white);
    margin-bottom: 1rem;
}

.collision-left h2 { color: var(--prism-violet); }
.collision-right h2 { color: var(--ionosphere-blue); }

.collision-interference {
    position: absolute;
    left: 30%;
    right: 30%;
    top: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(126, 232, 199, 0.15), transparent 70%);
    animation: interference-pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes interference-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* ---- RESOLUTION LAYER ---- */

#resolution {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 4rem 2rem;
}

.resolution-text {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    color: var(--ice-white);
    letter-spacing: 0.02em;
    max-width: 700px;
    position: relative;
    z-index: 2;
}

.resolution-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(126, 232, 199, 0.08) 0%, transparent 70%);
    animation: breathe 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* ---- SEQUENTIAL MODE ---- */

body.sequential #dashboard {
    grid-template-columns: 1fr;
    max-width: 720px;
}

body.sequential #collision-zone {
    grid-template-columns: 1fr;
}

body.sequential .collision-left,
body.sequential .collision-right {
    clip-path: none;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 680px) {
    #kanji-spear, #kanji-shield {
        width: 160px;
        height: 160px;
    }
    #kanji-spear { left: calc(50% - 170px); }
    #kanji-shield { right: calc(50% - 170px); }

    #hero-question {
        white-space: normal;
        width: 80%;
    }

    #collision-zone {
        grid-template-columns: 1fr;
    }

    .collision-left, .collision-right {
        clip-path: none;
    }
}
