/* mujun.day - Paradox in Marble and Terminal */
/* Colors: #f0f4f8, #c8ccd4, #39ff85, #0a0f14, #a8d4e6, #e8ddd0, #0d1117, #2de680 */

:root {
    --frost-white: #f0f4f8;
    --marble-vein: #c8ccd4;
    --terminal-green: #39ff85;
    --paradox-black: #0a0f14;
    --frost-blue: #a8d4e6;
    --marble-warm: #e8ddd0;
    --deep-void: #0d1117;
    --crack-glow: #2de680;
    --error-red: #ff6b6b;
    --marble-secondary: #e8edf2;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    background: var(--frost-white);
    color: var(--paradox-black);
    overflow-x: hidden;
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* ============== SIDEBAR / TERMINAL ============== */

.terminal-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: rgba(13, 17, 23, 0.95);
    color: var(--terminal-green);
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 0.9vw, 0.875rem);
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid rgba(57, 255, 133, 0.15);
}

.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid rgba(57, 255, 133, 0.1);
    flex-shrink: 0;
}

.terminal-prompt {
    font-weight: 700;
    color: var(--terminal-green);
    opacity: 0.8;
}

.terminal-log {
    flex: 1;
    overflow: hidden;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.terminal-line {
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.5s ease;
    font-weight: 400;
    padding: 2px 0;
}

.terminal-line.faded {
    opacity: 0.3;
}

.terminal-line.error {
    color: var(--error-red);
    font-weight: 700;
}

.terminal-line.glitch {
    animation: glitch 0.1s linear;
}

.terminal-cursor-line {
    padding: 8px 16px 20px;
    flex-shrink: 0;
}

.terminal-prompt-symbol {
    color: var(--terminal-green);
    font-weight: 700;
}

.blinking-cursor {
    animation: blink 1s step-end infinite;
    color: var(--terminal-green);
}

/* Sidebar handle for mobile */
.sidebar-handle {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(13, 17, 23, 0.95);
    color: var(--terminal-green);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    z-index: 101;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(57, 255, 133, 0.2);
}

.handle-prompt {
    font-weight: 700;
}

/* ============== MAIN CONTENT ============== */

.main-content {
    grid-column: 2;
    position: relative;
}

/* ============== PANELS ============== */

.panel {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.marble-surface {
    background:
        repeating-linear-gradient(
            78deg,
            transparent,
            transparent 120px,
            rgba(200, 204, 212, 0.08) 120px,
            rgba(200, 204, 212, 0.08) 121px
        ),
        repeating-linear-gradient(
            162deg,
            transparent,
            transparent 80px,
            rgba(200, 204, 212, 0.05) 80px,
            rgba(200, 204, 212, 0.05) 81px
        ),
        radial-gradient(ellipse at 20% 50%, rgba(232, 221, 208, 0.15), transparent 70%),
        radial-gradient(ellipse at 80% 20%, rgba(200, 204, 212, 0.1), transparent 60%),
        linear-gradient(135deg, #f0f4f8 0%, #e8edf2 50%, #f0f4f8 100%);
    backdrop-filter: blur(2px);
}

.marble-stressed {
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 60px,
            rgba(200, 204, 212, 0.12) 60px,
            rgba(200, 204, 212, 0.12) 61px
        ),
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 40px,
            rgba(232, 221, 208, 0.1) 40px,
            rgba(232, 221, 208, 0.1) 41px
        ),
        repeating-linear-gradient(
            78deg,
            transparent,
            transparent 120px,
            rgba(200, 204, 212, 0.08) 120px,
            rgba(200, 204, 212, 0.08) 121px
        ),
        radial-gradient(ellipse at 30% 40%, rgba(232, 221, 208, 0.25), transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(232, 221, 208, 0.2), transparent 50%),
        linear-gradient(135deg, #f0f4f8 0%, #e8edf2 50%, #f0f4f8 100%);
}

.marble-cracked {
    background:
        repeating-linear-gradient(
            30deg,
            transparent,
            transparent 30px,
            rgba(57, 255, 133, 0.04) 30px,
            rgba(57, 255, 133, 0.04) 31px
        ),
        repeating-linear-gradient(
            150deg,
            transparent,
            transparent 25px,
            rgba(57, 255, 133, 0.03) 25px,
            rgba(57, 255, 133, 0.03) 26px
        ),
        repeating-linear-gradient(
            78deg,
            transparent,
            transparent 80px,
            rgba(200, 204, 212, 0.1) 80px,
            rgba(200, 204, 212, 0.1) 81px
        ),
        radial-gradient(ellipse at 50% 50%, rgba(57, 255, 133, 0.05), transparent 70%),
        linear-gradient(135deg, #f0f4f8 0%, #e8edf2 50%, #f0f4f8 100%);
}

.panel-label {
    position: absolute;
    top: 24px;
    right: 32px;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(0.625rem, 0.8vw, 0.75rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--marble-vein);
    z-index: 2;
}

/* ============== KANJI ============== */

.kanji-monument {
    font-family: 'Noto Serif JP', serif;
    font-weight: 900;
    font-size: clamp(8rem, 25vw, 20rem);
    color: var(--frost-white);
    text-shadow:
        1px 1px 0 rgba(200, 204, 212, 0.8),
        2px 2px 0 rgba(200, 204, 212, 0.6),
        3px 3px 0 rgba(200, 204, 212, 0.4),
        4px 4px 0 rgba(200, 204, 212, 0.2),
        0 0 40px rgba(57, 255, 133, 0.1);
    position: relative;
    z-index: 1;
    transition: all 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    user-select: none;
}

.kanji-dark {
    color: var(--paradox-black);
    text-shadow:
        1px 1px 0 rgba(200, 204, 212, 0.4),
        2px 2px 0 rgba(200, 204, 212, 0.3),
        3px 3px 0 rgba(200, 204, 212, 0.2),
        0 0 40px rgba(57, 255, 133, 0.15);
}

.kanji-monument.glow-intensified {
    text-shadow:
        1px 1px 0 rgba(200, 204, 212, 0.8),
        2px 2px 0 rgba(200, 204, 212, 0.6),
        3px 3px 0 rgba(200, 204, 212, 0.4),
        4px 4px 0 rgba(200, 204, 212, 0.2),
        0 0 60px rgba(57, 255, 133, 0.3);
}

#kanji-shield {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#kanji-shield.revealed {
    clip-path: inset(0 0 0 0);
}

/* Panel text */
.panel-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: var(--paradox-black);
    margin-top: 2rem;
    position: relative;
    z-index: 2;
    letter-spacing: 0.01em;
    line-height: 1.72;
}

.serif-bold {
    font-weight: 700;
}

.panel-text-bottom {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    max-width: 80%;
}

/* Terminal bleed effect */
.terminal-bleed {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.terminal-bleed-char {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--terminal-green);
    opacity: 0.05;
    animation: bleed-drift 30s linear infinite;
    white-space: nowrap;
}

/* ============== COLLISION PANEL ============== */

.kanji-collision-container {
    position: relative;
    width: clamp(8rem, 25vw, 20rem);
    height: clamp(8rem, 25vw, 20rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kanji-collision {
    position: absolute;
    font-size: clamp(6rem, 20vw, 16rem);
    opacity: 0.5;
    mix-blend-mode: difference;
}

.kanji-collision-spear {
    color: var(--frost-white);
    animation: orbit-spear 20s linear infinite;
}

.kanji-collision-shield {
    color: var(--paradox-black);
    animation: orbit-shield 20s linear infinite;
}

/* ============== CONSTELLATION PANEL ============== */

.constellation-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    height: 60vh;
}

.constellation-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.constellation-line {
    stroke: var(--frost-blue);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 8 4;
    animation: dash-flow 3s linear infinite;
    opacity: 0.6;
}

.fragment {
    position: absolute;
    left: var(--x);
    top: var(--y);
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--paradox-black);
    opacity: 0.7;
    animation: drift 15s ease-in-out infinite alternate;
    text-shadow: 0 0 20px rgba(57, 255, 133, 0.15);
}

/* ============== PARADOX PANEL ============== */

.kanji-paradox {
    font-size: clamp(6rem, 18vw, 14rem);
    color: var(--paradox-black);
    text-shadow:
        1px 1px 0 rgba(200, 204, 212, 0.6),
        2px 2px 0 rgba(200, 204, 212, 0.4),
        3px 3px 0 rgba(200, 204, 212, 0.2),
        0 0 60px rgba(57, 255, 133, 0.2),
        0 0 120px rgba(57, 255, 133, 0.1);
    z-index: 2;
}

.bubble-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* ============== FRACTURE ZONES ============== */

.fracture-zone {
    position: relative;
    overflow: hidden;
    background: var(--deep-void);
}

.fracture-small {
    height: 60px;
    clip-path: polygon(0 20%, 5% 0, 15% 30%, 25% 5%, 35% 25%, 45% 0, 55% 35%, 65% 10%, 75% 28%, 85% 0, 95% 20%, 100% 5%, 100% 80%, 95% 100%, 85% 70%, 75% 95%, 65% 75%, 55% 100%, 45% 65%, 35% 90%, 25% 70%, 15% 100%, 5% 75%, 0 95%);
}

.fracture-large {
    height: 70px;
    clip-path: polygon(0 15%, 8% 0, 12% 40%, 20% 5%, 30% 35%, 38% 0, 50% 30%, 60% 0, 70% 25%, 78% 0, 88% 35%, 100% 10%, 100% 85%, 92% 100%, 82% 65%, 72% 100%, 62% 70%, 52% 100%, 42% 65%, 32% 95%, 22% 70%, 12% 100%, 5% 80%, 0 100%);
}

.fracture-wide {
    height: 80px;
    clip-path: polygon(0 10%, 4% 0, 10% 45%, 18% 0, 26% 35%, 34% 0, 42% 40%, 50% 5%, 58% 45%, 66% 0, 74% 30%, 82% 0, 90% 40%, 100% 0, 100% 90%, 96% 100%, 88% 55%, 80% 100%, 72% 65%, 64% 100%, 56% 60%, 48% 100%, 40% 55%, 32% 100%, 24% 65%, 16% 100%, 8% 60%, 0 100%);
}

.fracture-medium {
    height: 50px;
    clip-path: polygon(0 25%, 10% 0, 20% 30%, 30% 5%, 40% 25%, 50% 0, 60% 35%, 70% 10%, 80% 28%, 90% 0, 100% 20%, 100% 75%, 90% 100%, 80% 72%, 70% 95%, 60% 70%, 50% 100%, 40% 75%, 30% 95%, 20% 70%, 10% 100%, 0 80%);
}

.fracture-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: 0 0 30px rgba(57, 255, 133, 0.3), 0 0 60px rgba(57, 255, 133, 0.15);
    background: linear-gradient(90deg,
        rgba(57, 255, 133, 0.05),
        rgba(57, 255, 133, 0.15) 30%,
        rgba(45, 230, 128, 0.2) 50%,
        rgba(57, 255, 133, 0.15) 70%,
        rgba(57, 255, 133, 0.05)
    );
}

.fracture-glow-intense {
    box-shadow: 0 0 50px rgba(57, 255, 133, 0.5), 0 0 100px rgba(57, 255, 133, 0.25);
    background: linear-gradient(90deg,
        rgba(57, 255, 133, 0.1),
        rgba(57, 255, 133, 0.25) 30%,
        rgba(45, 230, 128, 0.35) 50%,
        rgba(57, 255, 133, 0.25) 70%,
        rgba(57, 255, 133, 0.1)
    );
}

.bubble-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

/* ============== BUBBLES ============== */

.bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(168, 212, 230, 0.4), rgba(168, 212, 230, 0.1) 60%, transparent);
    box-shadow: inset 0 -4px 8px rgba(168, 212, 230, 0.3);
    animation: float var(--float-duration, 15s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
}

.bubble::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

/* ============== ANIMATIONS ============== */

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes glitch {
    0% { transform: skewX(0deg); }
    25% { transform: skewX(-5deg); }
    50% { transform: skewX(3deg); }
    75% { transform: skewX(-2deg); }
    100% { transform: skewX(0deg); }
}

@keyframes bleed-drift {
    0% { transform: translateX(0); opacity: 0.05; }
    50% { transform: translateX(60px); opacity: 0.02; }
    100% { transform: translateX(100px); opacity: 0; }
}

@keyframes orbit-spear {
    0% { transform: translate(-8px, -5px) rotate(0deg); }
    25% { transform: translate(5px, -8px) rotate(3deg); }
    50% { transform: translate(8px, 5px) rotate(0deg); }
    75% { transform: translate(-5px, 8px) rotate(-3deg); }
    100% { transform: translate(-8px, -5px) rotate(0deg); }
}

@keyframes orbit-shield {
    0% { transform: translate(8px, 5px) rotate(0deg); }
    25% { transform: translate(-5px, 8px) rotate(-3deg); }
    50% { transform: translate(-8px, -5px) rotate(0deg); }
    75% { transform: translate(5px, -8px) rotate(3deg); }
    100% { transform: translate(8px, 5px) rotate(0deg); }
}

@keyframes dash-flow {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -24; }
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(var(--drift-x, 10px), var(--drift-y, -10px)); }
}

@keyframes float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0.7;
    }
    50% {
        transform: translateY(-45vh) translateX(12px);
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100vh) translateX(-8px);
        opacity: 0;
    }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* ============== RESPONSIVE ============== */

@media (max-width: 1024px) {
    body {
        grid-template-columns: 1fr;
    }

    .terminal-sidebar {
        position: fixed;
        top: auto;
        bottom: 48px;
        left: 0;
        width: 100%;
        height: 40vh;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        border-right: none;
        border-top: 1px solid rgba(57, 255, 133, 0.2);
    }

    .terminal-sidebar.open {
        transform: translateY(0);
    }

    .sidebar-handle {
        display: flex;
    }

    .main-content {
        grid-column: 1;
    }

    .kanji-monument {
        font-size: clamp(5rem, 20vw, 12rem);
    }

    .kanji-collision {
        font-size: clamp(4rem, 16vw, 10rem);
    }

    .kanji-paradox {
        font-size: clamp(4rem, 15vw, 10rem);
    }
}

@media (max-width: 640px) {
    .kanji-monument {
        font-size: clamp(4rem, 18vw, 8rem);
    }

    .panel-text {
        font-size: 1rem;
        padding: 0 24px;
        text-align: center;
    }

    .constellation-container {
        height: 50vh;
    }

    .fragment {
        font-size: 1.2rem;
    }
}
