:root {
    --deep-corporate: #0a1628;
    --spectral-teal: #00d4aa;
    --fluorescent-blue: #3a86ff;
    --faded-ivory: #f0ece2;
    --corporate-gold: #c9a227;
    --phantom-lavender: #b8a9d4;
    --error-red: #ff4757;
    --charcoal-steel: #2d3748;
    --mid-navy: #162447;
    --dark-navy: #1b3a5c;
    --hex-size: 200px;
    --hex-gap: 8px;
}

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

body {
    background: var(--deep-corporate);
    color: var(--faded-ivory);
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Wave-form background canvas */
#waveCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#waveCanvas.visible {
    opacity: 0.15;
}

/* Ghost particles layer */
#ghostParticles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    pointer-events: none;
}

.ghost-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--phantom-lavender);
    animation: floatUp 12s infinite ease-in-out;
}

@keyframes floatUp {
    0% { transform: translateY(0) translateX(0); opacity: 0; }
    10% { opacity: 0.4; }
    90% { opacity: 0.2; }
    100% { transform: translateY(-100vh) translateX(30px); opacity: 0; }
}

/* Ghost kanji */
#ghostKanji {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.ghost-kanji-char {
    position: absolute;
    font-family: 'Share Tech Mono', monospace;
    font-size: 120px;
    color: var(--faded-ivory);
    opacity: 0;
    animation: kanjiDrift 6s ease-in-out forwards;
}

@keyframes kanjiDrift {
    0% { opacity: 0; transform: translateY(0); }
    15% { opacity: 0.04; }
    85% { opacity: 0.04; }
    100% { opacity: 0; transform: translateY(-80px); }
}

/* Corporate mon/crest */
#corporateMon {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 30;
    animation: monPulse 4s ease-in-out infinite;
}

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

.mon-wave {
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: monWaveStroke 4s ease-in-out infinite;
}

.mon-wave-2 { animation-delay: 0.3s; }
.mon-wave-3 { animation-delay: 0.6s; }

@keyframes monWaveStroke {
    0% { stroke-dashoffset: 60; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -60; }
}

/* Honeycomb grid */
#honeycombGrid {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.hex-row {
    display: flex;
    gap: var(--hex-gap);
    justify-content: center;
}

.hex-row-offset {
    transform: translateX(calc(var(--hex-size) / 2 + var(--hex-gap) / 2));
}

.hex-cell {
    width: var(--hex-size);
    height: calc(var(--hex-size) * 1.1547);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--charcoal-steel);
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.5);
    position: relative;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, var(--deep-corporate) 0%, var(--mid-navy) 50%, var(--deep-corporate) 100%);
    z-index: 1;
    transition: background 0.3s ease;
}

.hex-cell:hover::before {
    background: linear-gradient(135deg, var(--deep-corporate) 0%, var(--dark-navy) 50%, var(--deep-corporate) 100%);
}

.hex-cell:hover {
    filter: drop-shadow(0 0 12px rgba(0, 212, 170, 0.4));
}

.hex-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    gap: 4px;
}

.hex-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(0.6rem, 1.2vw, 0.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--spectral-teal);
}

.hex-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    letter-spacing: 0.08em;
    color: var(--faded-ivory);
}

.hex-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.6rem, 1vw, 0.75rem);
    letter-spacing: 0.06em;
    color: var(--phantom-lavender);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.hex-cell:hover .hex-subtitle {
    opacity: 1;
}

/* Module overlay */
#moduleOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: rgba(10, 22, 40, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#moduleOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.module-expanded {
    width: 80vw;
    max-width: 800px;
    height: 80vh;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, var(--charcoal-steel) 0%, var(--deep-corporate) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.module-content {
    padding: 15% 12% 20%;
    overflow-y: auto;
    height: 100%;
    width: 100%;
    text-align: center;
}

.module-content h2 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--spectral-teal);
    margin-bottom: 8px;
}

.module-content h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.08em;
    color: var(--faded-ivory);
    margin-bottom: 24px;
}

.module-content p {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.6vw, 1.15rem);
    line-height: 1.8;
    letter-spacing: 0.02em;
    color: var(--faded-ivory);
    margin-bottom: 16px;
    text-align: left;
}

.module-content .data-field {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    letter-spacing: 0.06em;
    color: var(--phantom-lavender);
    opacity: 0.6;
    margin: 12px 0;
    text-align: left;
}

.module-content .wave-divider {
    width: 100%;
    height: 20px;
    margin: 24px 0;
}

.module-content .wave-divider path {
    stroke: var(--spectral-teal);
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 200;
    animation: waveDividerAnim 4s ease-in-out infinite;
}

@keyframes waveDividerAnim {
    0% { stroke-dashoffset: 200; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -200; }
}

.return-btn {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: 1px solid var(--spectral-teal);
    color: var(--spectral-teal);
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 8px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
    background: rgba(0, 212, 170, 0.05);
    z-index: 2;
}

.return-btn:hover {
    background: rgba(0, 212, 170, 0.15);
    color: var(--faded-ivory);
}

/* Nav wave bar */
#navWave {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 15;
}

/* Scrollbar styling for module content */
.module-content::-webkit-scrollbar {
    width: 4px;
}

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

.module-content::-webkit-scrollbar-thumb {
    background: var(--spectral-teal);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --hex-size: 140px;
        --hex-gap: 4px;
    }

    .hex-row-offset {
        transform: translateX(calc(var(--hex-size) / 2 + var(--hex-gap) / 2));
    }

    .module-expanded {
        width: 95vw;
        height: 85vh;
    }

    .module-content {
        padding: 20% 8% 25%;
    }
}

@media (max-width: 480px) {
    :root {
        --hex-size: 110px;
    }
}
