/* muhan.ai - Cyberpunk Infinity Interface */

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

:root {
    --deep-ground: #0E0A14;
    --module-dark: #18141E;
    --module-light: #201C28;
    --burgundy: #6A2040;
    --cream: #E8D8C8;
    --data-highlight: #C8A888;
    --particle-a: #8A4060;
    --particle-b: #C8A888;
    --active: #E84868;
    --grid-gap: 8px;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--deep-ground);
    color: var(--cream);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.2vw, 0.98rem);
    line-height: 1.6;
}

/* Home marker */
.home-marker {
    position: fixed;
    top: 12px;
    left: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    color: var(--data-highlight);
    opacity: 0.4;
    z-index: 100;
    pointer-events: none;
}

/* Grid Container */
.grid-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(120px, auto);
    gap: var(--grid-gap);
    max-width: 1400px;
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    padding: var(--grid-gap);
}

/* Base Module */
.module {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(200, 168, 136, 0.06);
}

.module:hover {
    border-color: rgba(200, 168, 136, 0.15);
}

.module.expanded {
    border-color: var(--active);
    z-index: 10;
}

/* Module Types */
.module-data {
    background: var(--module-dark);
}

.module-text {
    background: var(--module-light);
}

.module-particle {
    background: var(--module-dark);
}

.module-empty.module-burgundy {
    background: var(--burgundy);
    cursor: default;
}

.module-empty.module-cream {
    background: var(--cream);
    cursor: default;
}

/* Module Inner */
.module-inner {
    width: 100%;
    height: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.module-expanded {
    display: none;
    margin-top: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.module.expanded .module-expanded {
    display: block;
    opacity: 1;
}

/* Title Module */
.module-title {
    background: var(--module-dark);
}

.site-title {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 4vw, 3.2rem);
    color: var(--cream);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.site-title-kr {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--data-highlight);
    margin-top: 4px;
    line-height: 1.2;
}

.site-title-en {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--data-highlight);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    display: block;
    margin-top: 8px;
}

/* Module Labels */
.module-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.65rem;
    color: var(--data-highlight);
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: block;
    margin-bottom: 8px;
}

.module-stat {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: var(--cream);
    margin-top: 4px;
}

.module-stat sup {
    font-size: 0.6em;
    color: var(--active);
}

/* Module Headers */
.module-inner h2 {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: var(--cream);
    margin-bottom: 6px;
}

/* Module body text */
.module-expanded p {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.8rem, 1.1vw, 0.92rem);
    color: var(--cream);
    opacity: 0.8;
    line-height: 1.65;
    margin-bottom: 10px;
}

/* Attention Matrix Grid */
.attention-grid {
    display: grid;
    gap: 2px;
    width: fit-content;
    margin-top: 6px;
}

.attention-grid-large {
    margin-top: 12px;
}

.attention-cell {
    width: 12px;
    height: 12px;
    transition: background-color 2s ease;
}

.attention-grid-large .attention-cell {
    width: 10px;
    height: 10px;
}

/* Network Graph */
.network-graph {
    width: 100%;
    height: auto;
    margin-top: 6px;
}

.network-graph-large {
    margin-top: 12px;
}

/* Number Stream */
.number-stream {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--data-highlight);
    line-height: 1.4;
    overflow: hidden;
    max-height: 80px;
    margin-top: 6px;
}

.number-stream-large {
    max-height: 160px;
}

.number-stream-row {
    opacity: 0.4;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}

.number-stream-row.active {
    opacity: 0.7;
}

/* Particle Canvas */
.particle-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Expanded state overlay effect */
.module.expanded::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(232, 72, 104, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

/* Scrollbar styling for expanded modules */
.module.expanded .module-inner {
    overflow-y: auto;
}

.module-inner::-webkit-scrollbar {
    width: 3px;
}

.module-inner::-webkit-scrollbar-track {
    background: transparent;
}

.module-inner::-webkit-scrollbar-thumb {
    background: rgba(200, 168, 136, 0.2);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    html, body {
        overflow: auto;
    }

    .module-title {
        grid-column: 1/3 !important;
        grid-row: auto !important;
    }

    .module {
        grid-column: auto !important;
        grid-row: auto !important;
        min-height: 120px;
    }

    .module-title {
        min-height: 200px;
    }

    .module-particle {
        min-height: 180px;
    }
}

@media (max-width: 560px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
    }
}
