/* interplanetary.quest - Abstract Glitch Art Tech */
/* Palette: #050505, #0a0a0a, #1a1a1a, #c0c0c0, #00ff00, #00ffff, #ff00ff, #ff3333 */
/* Fonts: Space Grotesk 700, Inter 400, Fira Code 400 */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #050505;
    color: #c0c0c0;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ========================================
   SCANLINES + NOISE OVERLAYS
   ======================================== */
#scanlines {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.03;
    pointer-events: none;
    z-index: 999;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

/* ========================================
   SIGNAL INDICATOR (fixed)
   ======================================== */
#signal-indicator {
    position: fixed;
    top: 16px;
    right: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
}

.signal-label {
    font-family: 'Fira Code', monospace;
    font-size: 9px;
    color: #00ff00;
    letter-spacing: 0.2em;
    opacity: 0.6;
}

.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
}

.signal-bar-unit {
    width: 4px;
    background: #1a1a1a;
    transition: background 0.5s ease, height 0.5s ease;
}

.signal-bar-unit[data-bar="1"] { height: 6px; }
.signal-bar-unit[data-bar="2"] { height: 10px; }
.signal-bar-unit[data-bar="3"] { height: 14px; }
.signal-bar-unit[data-bar="4"] { height: 18px; }
.signal-bar-unit[data-bar="5"] { height: 22px; }

.signal-bar-unit.active {
    background: #00ff00;
}

.signal-bar-unit.warn {
    background: #ff3333;
}

/* ========================================
   SHARED LABELS
   ======================================== */
.fira-label {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
}

.fira-label.green { color: #00ff00; }
.fira-label.cyan { color: #00ffff; }
.fira-label.red { color: #ff3333; }
.fira-label.dim { color: #c0c0c0; opacity: 0.3; }

.data-tag {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #c0c0c0;
    opacity: 0.5;
    letter-spacing: 0.1em;
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot.green {
    background: #00ff00;
    box-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
    animation: dotPulse 2s ease infinite;
}

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

/* ========================================
   SECTION 1: RECEIVE (0-100vh)
   ======================================== */
.section-receive {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 48px 24px;
}

.receive-inner {
    text-align: center;
    max-width: 720px;
}

.status-line {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: #00ff00;
    letter-spacing: 0.15em;
    margin-bottom: 32px;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.3s forwards;
}

.brand-glitch {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    color: #c0c0c0;
    position: relative;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.6s forwards;
}

.brand-glitch::before,
.brand-glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    clip-path: inset(0);
}

.brand-glitch::before {
    color: #00ffff;
    animation: glitchTop 3s ease-in-out infinite;
    z-index: -1;
}

.brand-glitch::after {
    color: #ff00ff;
    animation: glitchBottom 3s ease-in-out infinite;
    z-index: -1;
}

@keyframes glitchTop {
    0%, 100% { clip-path: inset(0 0 60% 0); transform: translateX(0); }
    20% { clip-path: inset(0 0 60% 0); transform: translateX(-3px); }
    21% { clip-path: inset(0 0 60% 0); transform: translateX(3px); }
    22% { clip-path: inset(0 0 60% 0); transform: translateX(0); }
    50% { clip-path: inset(10% 0 50% 0); transform: translateX(2px); }
    51% { clip-path: inset(10% 0 50% 0); transform: translateX(-2px); }
    52% { clip-path: inset(0 0 60% 0); transform: translateX(0); }
}

@keyframes glitchBottom {
    0%, 100% { clip-path: inset(60% 0 0 0); transform: translateX(0); }
    20% { clip-path: inset(60% 0 0 0); transform: translateX(3px); }
    21% { clip-path: inset(60% 0 0 0); transform: translateX(-3px); }
    22% { clip-path: inset(60% 0 0 0); transform: translateX(0); }
    50% { clip-path: inset(50% 0 0% 0); transform: translateX(-2px); }
    51% { clip-path: inset(50% 0 0% 0); transform: translateX(2px); }
    52% { clip-path: inset(60% 0 0 0); transform: translateX(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.receive-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeIn 0.8s ease 0.9s forwards;
}

.receive-status {
    opacity: 0;
    animation: fadeIn 0.8s ease 1.1s forwards;
}

/* ========================================
   SECTION 2: DECODE (100-260vh)
   ======================================== */
.section-decode {
    position: relative;
    z-index: 1;
    padding: 80px 24px;
}

.decode-inner {
    max-width: 680px;
    margin: 0 auto;
}

.decode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.tx-block {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.tx-block:hover {
    border-color: rgba(0, 255, 255, 0.3);
}

/* Increasing corruption offsets */
.tx-block[data-corruption="1"] {
    transform: translateX(2px);
}

.tx-block[data-corruption="2"] {
    transform: translateX(-4px);
    border-color: rgba(255, 0, 255, 0.2);
}

.tx-block[data-corruption="3"] {
    transform: translateX(6px);
    border-color: rgba(255, 51, 51, 0.3);
}

.tx-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tx-id {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #00ffff;
    letter-spacing: 0.15em;
}

.tx-timestamp {
    font-family: 'Fira Code', monospace;
    font-size: 9px;
    color: #c0c0c0;
    opacity: 0.3;
}

.tx-body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #c0c0c0;
    line-height: 1.7;
    margin-bottom: 16px;
}

.glitch-block .tx-body {
    text-shadow: 1px 0 #00ffff, -1px 0 #ff00ff;
}

.heavy-glitch-block .tx-body {
    text-shadow: 2px 0 #00ffff, -2px 0 #ff00ff;
    opacity: 0.7;
}

.tx-footer {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.tx-status {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
}

.tx-status.green { color: #00ff00; }
.tx-status.cyan { color: #00ffff; }
.tx-status.amber { color: #ff6b35; }
.tx-status.red { color: #ff3333; }
.tx-status.dim { color: #c0c0c0; opacity: 0.3; }

/* ========================================
   SECTION 3: DECAY (260-340vh)
   ======================================== */
.section-decay {
    position: relative;
    z-index: 1;
    padding: 80px 24px;
    overflow: hidden;
}

.decay-inner {
    max-width: 680px;
    margin: 0 auto;
    position: relative;
}

.decay-header {
    margin-bottom: 32px;
}

.decay-line {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.decay-prefix {
    color: #00ff00;
    flex-shrink: 0;
}

.decay-text {
    color: #c0c0c0;
}

/* Progressive decay effects */
.decay-line[data-decay="2"] {
    opacity: 0.85;
    transform: translateX(2px);
}

.decay-line[data-decay="3"] {
    opacity: 0.7;
    transform: translateX(-3px);
    color: #00ffff;
}

.decay-line[data-decay="3"] .decay-text {
    text-shadow: 1px 0 rgba(0, 255, 255, 0.3);
}

.decay-line[data-decay="4"] {
    opacity: 0.5;
    transform: translateX(5px);
}

.decay-line[data-decay="4"] .decay-text {
    color: #ff3333;
    text-shadow: 1px 0 #ff00ff, -1px 0 #00ffff;
}

.decay-line[data-decay="5"] {
    opacity: 0.35;
    transform: translateX(-6px);
}

.decay-line[data-decay="5"] .decay-text {
    text-shadow: 2px 0 #00ffff, -2px 0 #ff00ff;
}

.decay-line[data-decay="6"] {
    opacity: 0.15;
}

.error-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.error-label {
    position: absolute;
    font-family: 'Fira Code', monospace;
    font-size: 9px;
    color: #ff3333;
    letter-spacing: 0.2em;
    opacity: 0;
    animation: errorFlash 4s ease-in-out infinite;
}

.error-label:nth-child(2) { animation-delay: 1s; }
.error-label:nth-child(3) { animation-delay: 2s; }
.error-label:nth-child(4) { animation-delay: 3s; }

@keyframes errorFlash {
    0%, 100% { opacity: 0; }
    10% { opacity: 0.8; }
    15% { opacity: 0; }
    18% { opacity: 0.6; }
    20% { opacity: 0; }
}

/* ========================================
   SECTION 4: LOST (340vh+)
   ======================================== */
.section-lost {
    position: relative;
    z-index: 1;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    overflow: hidden;
}

.lost-inner {
    text-align: center;
    position: relative;
    z-index: 2;
}

.lost-bar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 40px;
}

.lost-bar-track {
    width: 120px;
    height: 4px;
    background: #1a1a1a;
    overflow: hidden;
}

.lost-bar-fill {
    width: 8%;
    height: 100%;
    background: #ff3333;
    transition: width 1s ease;
}

.lost-bar-label {
    font-family: 'Fira Code', monospace;
    font-size: 9px;
    color: #ff3333;
    opacity: 0.6;
    letter-spacing: 0.1em;
}

.lost-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.2rem);
    color: #ff3333;
    position: relative;
    margin-bottom: 16px;
    animation: glitchLost 2s ease-in-out infinite;
}

.lost-title::before,
.lost-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.lost-title::before {
    color: #00ffff;
    clip-path: inset(0 0 65% 0);
    animation: glitchTop 1.5s ease-in-out infinite;
}

.lost-title::after {
    color: #ff00ff;
    clip-path: inset(65% 0 0 0);
    animation: glitchBottom 1.5s ease-in-out infinite;
}

@keyframes glitchLost {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0; }
    94% { opacity: 1; }
    96% { opacity: 0; }
    97% { opacity: 1; }
}

.lost-sub {
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #c0c0c0;
    opacity: 0.3;
    letter-spacing: 0.15em;
    margin-bottom: 40px;
}

.lost-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #1a1a1a;
    letter-spacing: 0.1em;
}

.static-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30%;
    background: linear-gradient(to bottom, transparent, rgba(5, 5, 5, 0.8));
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
    .receive-meta {
        flex-direction: column;
        gap: 8px;
    }

    .tx-block-header {
        flex-direction: column;
        gap: 4px;
    }

    .tx-footer {
        flex-direction: column;
        gap: 8px;
    }

    .decode-header {
        flex-direction: column;
    }

    .decay-line {
        font-size: 11px;
    }

    .error-labels {
        display: none;
    }
}
