/* ============================================================
   RRIPPL.com - Deep-Sea Surveillance Glitch Aesthetic
   Duotone: Cyan (#00e5ff) + Coral (#ff6b6b) on Deep Black (#0a0e17)
   Typography: IBM Plex Mono
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-black: #0a0e17;
    --signal-cyan: #00e5ff;
    --coral-warning: #ff6b6b;
    --phosphor-white: #e0f7fa;
    --pale-cyan: #b2ebf2;
    --glitch-magenta: #e040fb;
    --pure-black: #000000;
    --glitch-offset: 3px;
    --glitch-seed: 42;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::selection {
    background: var(--signal-cyan);
    color: var(--deep-black);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--pure-black);
    color: var(--phosphor-white);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    animation: powerOn 2s ease-out forwards;
}

@keyframes powerOn {
    0% { background-color: var(--pure-black); }
    100% { background-color: var(--deep-black); }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--deep-black);
}

::-webkit-scrollbar-thumb {
    background: var(--signal-cyan);
}

/* --- Scan-line Overlay --- */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    animation: scanlinesFadeIn 1s 2s ease-out forwards;
}

.scanlines::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 229, 255, 0.03) 2px,
        rgba(0, 229, 255, 0.03) 3px
    );
}

/* Sweeping scan-line animation */
.scanlines::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 229, 255, 0.08);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
    animation: scanSweep 3s linear infinite;
}

@keyframes scanlinesFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes scanSweep {
    0% { top: 0; }
    100% { top: 100%; }
}

/* --- Signal Header --- */
.signal-header {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.header-content {
    position: relative;
    text-align: center;
    z-index: 2;
}

.brand-title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--signal-cyan);
    letter-spacing: 0.02em;
    min-height: 1.2em;
    position: relative;
}

/* Typing cursor */
.brand-title::after {
    content: '|';
    animation: cursorBlink 0.6s steps(1) infinite;
    color: var(--signal-cyan);
}

.brand-title.typed::after {
    animation: cursorBlink 0.6s steps(1) infinite 2s;
    animation-fill-mode: forwards;
}

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

.signal-indicator {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    animation: fadeIn 1s 4.5s ease-out forwards;
}

.signal-indicator .label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    letter-spacing: 0.15em;
    color: var(--signal-cyan);
    text-transform: uppercase;
}

.signal-indicator .blink {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--signal-cyan);
    border-radius: 50%;
    animation: blinkPulse 1.5s ease-in-out infinite;
}

@keyframes blinkPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--signal-cyan); }
    50% { opacity: 0.3; box-shadow: none; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* --- Ghost Fish --- */
.ghost-fish {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 350px;
    height: 350px;
    opacity: 0;
    color: var(--signal-cyan);
    z-index: 1;
    animation: ghostFishFloat 12s ease-in-out infinite, ghostFishFadeIn 2s 4s ease-out forwards;
}

@keyframes ghostFishFadeIn {
    0% { opacity: 0; }
    100% { opacity: 0.08; }
}

@keyframes ghostFishFloat {
    0% { transform: translate(-50%, -50%) translate(0, 0); }
    25% { transform: translate(-50%, -50%) translate(10px, -8px); }
    50% { transform: translate(-50%, -50%) translate(-5px, 5px); }
    75% { transform: translate(-50%, -50%) translate(8px, 10px); }
    100% { transform: translate(-50%, -50%) translate(0, 0); }
}

.ghost-fish .fish-svg {
    width: 100%;
    height: 100%;
}

/* --- Content Wrapper --- */
.content-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 2;
    will-change: transform;
    animation: pixelDisplacement 10s steps(1) infinite;
}

@keyframes pixelDisplacement {
    0%, 79% { transform: translateX(0); }
    79.5% { transform: translateX(3px); }
    80% { transform: translateX(0); }
    100% { transform: translateX(0); }
}

/* --- Transmission Blocks --- */
.transmission-block {
    border: 1px solid var(--signal-cyan);
    padding: 40px 32px;
    margin-bottom: 120px;
    position: relative;
    background: transparent;
    transition: background 0.3s ease;
}

.transmission-block.static-burst {
    animation: staticBurst 0.3s steps(3) forwards;
}

@keyframes staticBurst {
    0% { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' seed='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E"); }
    33% { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' seed='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E"); }
    66% { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' seed='5'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E"); }
    100% { background: transparent; }
}

.block-label {
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--deep-black);
    padding: 0 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    letter-spacing: 0.15em;
    color: var(--signal-cyan);
    text-transform: uppercase;
    cursor: default;
}

/* Label scramble hover effect */
.block-label::before {
    content: attr(data-scramble);
    position: absolute;
    top: 0;
    left: 8px;
    color: var(--signal-cyan);
    background: var(--deep-black);
    overflow: hidden;
    width: 0;
}

.block-label:hover::before {
    width: 100%;
    animation: scrambleReveal 0.4s steps(1) forwards;
}

@keyframes scrambleReveal {
    0% { content: '>#@!$%&*'; width: 100%; }
    20% { content: 'S!GN@L_0'; }
    40% { content: 'TR#N$M!T'; }
    60% { content: 'D@T#_##_'; }
    80% { content: attr(data-scramble); width: 100%; }
    100% { width: 0; }
}

.transmission-block h2 {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: 0.02em;
    color: var(--phosphor-white);
    margin-bottom: 24px;
}

.transmission-block p {
    color: rgba(178, 235, 242, 0.85);
    margin-bottom: 16px;
}

.transmission-block p:last-child {
    margin-bottom: 0;
}

.accent {
    font-weight: 600;
    color: var(--signal-cyan);
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

/* --- Fish Illustrations --- */
.fish-illustration {
    margin: 32px 0;
    display: flex;
    justify-content: center;
    color: var(--signal-cyan);
    position: relative;
}

.fish-svg {
    width: 100%;
    max-width: 320px;
    height: auto;
    transition: filter 0.2s ease;
}

/* Channel split hover effect on fish SVGs */
.fish-illustration:hover .fish-svg {
    filter:
        drop-shadow(-2px 0 0 var(--signal-cyan))
        drop-shadow(2px 0 0 var(--coral-warning))
        drop-shadow(0 -1px 0 var(--glitch-magenta));
}

.fish-illustration::before,
.fish-illustration::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* --- Interference Zones --- */
.interference-zone {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    height: 60px;
    position: relative;
    overflow: hidden;
    margin-bottom: 120px;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 4px,
            rgba(0, 229, 255, 0.06) 4px,
            rgba(0, 229, 255, 0.06) 6px,
            transparent 6px,
            transparent 12px,
            rgba(255, 107, 107, 0.04) 12px,
            rgba(255, 107, 107, 0.04) 14px
        );
    animation: interferenceShift 0.15s steps(1) infinite;
}

@keyframes interferenceShift {
    0% { background-position: 0 0; }
    25% { background-position: 0 -8px; }
    50% { background-position: 0 -3px; }
    75% { background-position: 0 -12px; }
    100% { background-position: 0 0; }
}

/* Data corruption bars within interference zones */
.corruption-bar {
    position: absolute;
    top: var(--bar-top, 50%);
    left: 15%;
    width: var(--bar-width, 50%);
    height: 12px;
    background: var(--coral-warning);
    opacity: 0;
    animation: corruptionFlash 2.5s var(--bar-delay, 0s) steps(1) infinite;
}

@keyframes corruptionFlash {
    0%, 90% { opacity: 0; }
    92% { opacity: 0.6; }
    94% { opacity: 0.2; }
    96% { opacity: 0.5; }
    98% { opacity: 0; }
    100% { opacity: 0; }
}

/* --- Deep Signal Footer --- */
.deep-signal-footer {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 80px 24px 120px;
    position: relative;
    z-index: 2;
}

.footer-column {
    text-align: center;
    margin-bottom: 60px;
}

.footer-wide {
    width: 100%;
    max-width: 680px;
}

.footer-medium {
    width: 100%;
    max-width: 320px;
}

.footer-medium .footer-text {
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    color: rgba(178, 235, 242, 0.5);
    line-height: 1.85;
}

.footer-narrow {
    width: 100%;
    max-width: 160px;
}

.footer-column .block-label {
    position: static;
    display: inline-block;
    background: transparent;
}

/* --- Lionfish Entry Animation --- */
.lionfish-container {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.lionfish-container.visible {
    opacity: 1;
}

.lionfish .spine {
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
}

.lionfish-container.visible .spine-1 {
    animation: drawSpine 0.4s 0s ease-out forwards;
}
.lionfish-container.visible .spine-2 {
    animation: drawSpine 0.4s 0.1s ease-out forwards;
}
.lionfish-container.visible .spine-3 {
    animation: drawSpine 0.4s 0.2s ease-out forwards;
}
.lionfish-container.visible .spine-4 {
    animation: drawSpine 0.4s 0.3s ease-out forwards;
}
.lionfish-container.visible .spine-5 {
    animation: drawSpine 0.4s 0.4s ease-out forwards;
}
.lionfish-container.visible .spine-6 {
    animation: drawSpine 0.4s 0.5s ease-out forwards;
}
.lionfish-container.visible .spine-7 {
    animation: drawSpine 0.4s 0.6s ease-out forwards;
}
.lionfish-container.visible .spine-8 {
    animation: drawSpine 0.4s 0.7s ease-out forwards;
}
.lionfish-container.visible .spine-9 {
    animation: drawSpine 0.4s 0.8s ease-out forwards;
}
.lionfish-container.visible .spine-10 {
    animation: drawSpine 0.4s 0.9s ease-out forwards;
}
.lionfish-container.visible .spine-11 {
    animation: drawSpine 0.4s 1.0s ease-out forwards;
}
.lionfish-container.visible .spine-12 {
    animation: drawSpine 0.4s 1.1s ease-out forwards;
}
.lionfish-container.visible .spine-13 {
    animation: drawSpine 0.4s 1.2s ease-out forwards;
}
.lionfish-container.visible .spine-14 {
    animation: drawSpine 0.4s 1.3s ease-out forwards;
}

@keyframes drawSpine {
    0% { stroke-dashoffset: 120; }
    100% { stroke-dashoffset: 0; }
}

/* --- Footer End --- */
.footer-end {
    margin-top: 40px;
    text-align: center;
}

.end-signal {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 1.5rem;
    color: var(--signal-cyan);
    opacity: 0.3;
    letter-spacing: 0.5em;
    animation: endPulse 3s ease-in-out infinite;
}

@keyframes endPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.08; }
}

/* --- Glitch Effect on Content Wrapper --- */
/* Additional chromatic aberration keyframes for glitch moments */
@keyframes glitchSlice {
    0%, 95% {
        clip-path: none;
        transform: translateX(0);
    }
    96% {
        clip-path: inset(20% 0 60% 0);
        transform: translateX(-4px);
    }
    97% {
        clip-path: inset(60% 0 10% 0);
        transform: translateX(4px);
    }
    98% {
        clip-path: inset(40% 0 30% 0);
        transform: translateX(-2px);
    }
    99% {
        clip-path: none;
        transform: translateX(0);
    }
    100% {
        clip-path: none;
        transform: translateX(0);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 0 16px;
    }

    .transmission-block {
        padding: 28px 20px;
        margin-bottom: 80px;
    }

    .interference-zone {
        margin-bottom: 80px;
        height: 40px;
    }

    .ghost-fish {
        width: 250px;
        height: 250px;
    }

    .footer-medium {
        max-width: 240px;
    }

    .footer-narrow {
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .transmission-block {
        padding: 20px 14px;
        margin-bottom: 60px;
    }

    .interference-zone {
        margin-bottom: 60px;
    }

    .ghost-fish {
        width: 180px;
        height: 180px;
    }
}
