/* showa.boo - Spectral Archaeology Interface */
/* Colors: #00e5ff, #d4d0c8, #e63946, #ff6b35, #1a1c20, #050508, #4a6670, #b8e6f0 */
/* Fonts: Share Tech Mono, Noto Serif JP, Zen Antique Soft, IBM Plex Mono */

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

html {
    scroll-behavior: auto;
}

body {
    background-color: #050508;
    color: #d4d0c8;
    font-family: 'Noto Serif JP', serif;
    overflow-x: hidden;
    min-height: 100vh;
}

/* === Canvas Particle Layer === */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* === Modular Grid === */
.showa-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(180px, auto);
    gap: 3px;
    padding: 3px;
    max-width: 100vw;
    min-height: 100vh;
}

/* Grid gap glow */
.showa-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 229, 255, 0.04);
    z-index: -1;
    pointer-events: none;
}

/* === Module Base === */
.module {
    opacity: 0;
    transform: translateY(15px) scale(0.85);
    position: relative;
    overflow: hidden;
}

.module.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: moduleEnter 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes moduleEnter {
    0% {
        opacity: 0;
        transform: translateY(15px) scale(0.85);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* === Grid Span Classes === */
.span-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

.span-1x1 {
    grid-column: span 1;
    grid-row: span 1;
}

.span-1x2 {
    grid-column: span 1;
    grid-row: span 2;
}

.span-2x1 {
    grid-column: span 2;
    grid-row: span 1;
}

.span-full {
    grid-column: 1 / -1;
    grid-row: span 1;
}

.span-pano {
    grid-column: 1 / -1;
    grid-row: span 2;
}

/* === Signal Blocks === */
.signal-block {
    background-color: #1a1c20;
    border: 1px solid rgba(0, 229, 255, 0.4);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    filter: url(#showa-noise-signal);
    transition: border-color 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.signal-block:hover {
    border-color: #b8e6f0;
}

.signal-strength {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 2px;
    align-items: flex-end;
}

.signal-strength .bar {
    display: block;
    width: 3px;
    background-color: #00e5ff;
    opacity: 0.7;
}

.signal-strength .bar:nth-child(1) { animation: signalPulse 4.2s ease-in-out infinite; }
.signal-strength .bar:nth-child(2) { animation: signalPulse 3.5s ease-in-out infinite 0.3s; }
.signal-strength .bar:nth-child(3) { animation: signalPulse 5.1s ease-in-out infinite 0.7s; }
.signal-strength .bar:nth-child(4) { animation: signalPulse 3.8s ease-in-out infinite 1.1s; }
.signal-strength .bar:nth-child(5) { animation: signalPulse 6.2s ease-in-out infinite 0.5s; }

.signal-fading .bar {
    background-color: #4a6670;
}

@keyframes signalPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.2; }
}

.module-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #00e5ff;
    margin-bottom: 8px;
}

.module-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: #4a6670;
    margin-bottom: 12px;
}

.module-body {
    font-family: 'Noto Serif JP', serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.85;
    color: #d4d0c8;
    text-shadow: 0 0 2px rgba(0, 229, 255, 0.3);
}

/* === Ghost Blocks === */
.ghost-block {
    background-color: #1a1c20;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    filter: url(#showa-noise-ghost);
    transition: border-color 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid rgba(0, 229, 255, 0.15);
}

.ghost-block:hover {
    border-color: #b8e6f0;
}

.ghost-kanji {
    font-family: 'Zen Antique Soft', serif;
    font-size: 120px;
    font-weight: 400;
    color: #d4d0c8;
    line-height: 1;
    position: relative;
    z-index: 1;
    animation: kanjiErode 12s ease-in-out infinite;
}

.ghost-kanji-shadow {
    font-family: 'Zen Antique Soft', serif;
    font-size: 120px;
    font-weight: 400;
    color: rgba(0, 229, 255, 0.2);
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(calc(-50% + 2px), calc(-50% + 2px));
    z-index: 0;
}

@keyframes kanjiErode {
    0%, 100% { opacity: 0.9; filter: blur(0px); }
    50% { opacity: 0.5; filter: blur(1.5px); }
}

/* === Void Blocks === */
.void-block {
    background-color: #050508;
    border: none;
}

/* Make void blocks visible immediately with no animation */
.void-block.visible {
    animation: none;
    opacity: 1;
    transform: none;
}

/* === Waveform Blocks === */
.waveform-block {
    background-color: #1a1c20;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    filter: url(#showa-noise-waveform);
    min-height: 80px;
}

.waveform-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #4a6670;
    margin-bottom: 8px;
}

.waveform-bars {
    width: 100%;
    height: 40px;
    background: repeating-linear-gradient(
        90deg,
        #ff6b35 0px, #ff6b35 3px,
        transparent 3px, transparent 5px,
        #ff6b35 5px, #ff6b35 6px,
        transparent 6px, transparent 9px,
        #ff6b35 9px, #ff6b35 14px,
        transparent 14px, transparent 16px,
        #ff6b35 16px, #ff6b35 18px,
        transparent 18px, transparent 22px,
        #ff6b35 22px, #ff6b35 24px,
        transparent 24px, transparent 26px,
        #ff6b35 26px, #ff6b35 32px,
        transparent 32px, transparent 34px,
        #ff6b35 34px, #ff6b35 36px,
        transparent 36px, transparent 40px
    );
    background-size: 40px 100%;
    opacity: 0.7;
    mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 20%,
        black 50%,
        transparent 80%,
        black 90%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        black 20%,
        black 50%,
        transparent 80%,
        black 90%,
        transparent 100%
    );
}

.waveform-alt {
    background: repeating-linear-gradient(
        90deg,
        #ff6b35 0px, #ff6b35 5px,
        transparent 5px, transparent 7px,
        #ff6b35 7px, #ff6b35 9px,
        transparent 9px, transparent 13px,
        #ff6b35 13px, #ff6b35 20px,
        transparent 20px, transparent 22px,
        #ff6b35 22px, #ff6b35 25px,
        transparent 25px, transparent 30px,
        #ff6b35 30px, #ff6b35 32px,
        transparent 32px, transparent 36px,
        #ff6b35 36px, #ff6b35 42px,
        transparent 42px, transparent 45px
    );
    background-size: 45px 100%;
}

.waveform-peak {
    background: repeating-linear-gradient(
        90deg,
        #ff6b35 0px, #ff6b35 6px,
        transparent 6px, transparent 8px,
        #ff6b35 8px, #ff6b35 12px,
        transparent 12px, transparent 14px,
        #ff6b35 14px, #ff6b35 22px,
        transparent 22px, transparent 24px,
        #ff6b35 24px, #ff6b35 28px,
        transparent 28px, transparent 30px,
        #ff6b35 30px, #ff6b35 38px,
        transparent 38px, transparent 40px,
        #ff6b35 40px, #ff6b35 44px,
        transparent 44px, transparent 48px
    );
    background-size: 48px 100%;
    opacity: 0.9;
}

/* === Panorama Blocks === */
.panorama-block {
    background: linear-gradient(135deg, #1a1c20 0%, #050508 50%, #1a1c20 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: url(#showa-noise-panorama);
    padding: 40px;
    min-height: 240px;
}

.panorama-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    width: 100%;
}

.pano-fragment {
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: block;
    width: 100%;
}

.pano-visible {
    font-size: 18px;
    color: #d4d0c8;
    text-shadow: 0 0 4px rgba(0, 229, 255, 0.4);
}

.pano-degraded {
    font-size: 13px;
    color: #4a6670;
    text-shadow: 0 0 2px rgba(0, 229, 255, 0.2);
    opacity: 0.7;
}

.pano-corrupted {
    font-size: 10px;
    color: #e63946;
    letter-spacing: 0.3em;
    opacity: 0.5;
    animation: corruptFlicker 4s ease-in-out infinite;
}

@keyframes corruptFlicker {
    0%, 90%, 100% { opacity: 0.5; }
    93% { opacity: 0.1; }
    96% { opacity: 0.8; }
}

/* === Scroll Indicator === */
.scroll-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.crosshair {
    font-family: 'Share Tech Mono', monospace;
    font-size: 20px;
    color: #00e5ff;
    opacity: 0.8;
    line-height: 1;
}

.scroll-percent {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    font-weight: 300;
    letter-spacing: 0.2em;
    color: #4a6670;
}

/* === Responsive: Below 768px === */
@media (max-width: 768px) {
    .showa-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(140px, auto);
    }

    .span-2x2 {
        grid-column: span 2;
        grid-row: span 2;
    }

    .span-1x1 {
        grid-column: span 1;
        grid-row: span 1;
    }

    .span-1x2 {
        grid-column: span 1;
        grid-row: span 1;
    }

    .span-2x1 {
        grid-column: span 2;
        grid-row: span 1;
    }

    .span-full {
        grid-column: 1 / -1;
    }

    .span-pano {
        grid-column: 1 / -1;
        grid-row: span 1;
        min-height: 180px;
    }

    .void-block {
        display: none;
    }

    .ghost-kanji,
    .ghost-kanji-shadow {
        font-size: 80px;
    }

    .module-body {
        font-size: 14px;
        line-height: 1.7;
    }

    .pano-visible {
        font-size: 14px;
    }

    .pano-degraded {
        font-size: 11px;
    }

    .pano-corrupted {
        font-size: 8px;
    }

    .panorama-block {
        padding: 24px;
        min-height: 160px;
    }

    .signal-block {
        padding: 16px;
    }
}

/* === Critical / wartime accent === */
.signal-block[data-delay="6"] .module-label {
    color: #e63946;
}

.signal-block[data-delay="6"] {
    border-color: rgba(230, 57, 70, 0.4);
}

.signal-block[data-delay="6"]:hover {
    border-color: rgba(230, 57, 70, 1);
}

.signal-block[data-delay="25"] .module-label {
    color: #4a6670;
}

.signal-block[data-delay="25"] {
    border-color: rgba(74, 102, 112, 0.3);
}
