/* BADGLITCH - Main Stylesheet */
:root {
    --neon-pink: #ff00ff;
    --neon-green: #00ff8c;
    --glitch-blue: #0dfaff;
    --toxic-purple: #9d00ff;
    --bg-dark: #0a0a0a;
    --terminal-green: #0cff0c;
}

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

html, body {
    font-family: 'VT323', monospace;
    background-color: var(--bg-dark);
    color: white;
    overflow-x: hidden;
    cursor: none;
    position: relative;
}

/* Body subtle animation */
@keyframes subtle-shift {
    0%, 100% { background-position: 0 0; }
    50% { background-position: 10px 5px; }
}

/* SVG Filters */
.filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Noise Effect - increased intensity */
.noise-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.12; /* Increased from 0.05 */
}

.noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    animation: noise 0.1s infinite; /* Faster animation (was 0.2s) */
}

@keyframes noise {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -2%); } /* Increased movement */
    20% { transform: translate(2%, 2%); }
    30% { transform: translate(-4%, -4%); }
    40% { transform: translate(6%, 6%); }
    50% { transform: translate(-6%, -6%); }
    60% { transform: translate(4%, 4%); }
    70% { transform: translate(-2%, -2%); }
    80% { transform: translate(2%, 2%); }
    90% { transform: translate(-4%, -4%); }
    100% { transform: translate(0, 0); }
}

/* CRT Scanlines - more intense */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 50%, 
        rgba(0, 0, 0, 0.3) 50%
    );
    background-size: 100% 3px; /* Smaller lines (was 4px) */
    z-index: 9999;
    pointer-events: none;
    opacity: 0.25; /* Increased opacity (was 0.15) */
    animation: scan-shift 10s infinite linear, vhs-flicker 8s infinite;
}

@keyframes scan-shift {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

@keyframes vhs-flicker {
    0%, 100% { opacity: 0.25; }
    15% { opacity: 0.4; }
    16% { opacity: 0.25; }
    40% { opacity: 0.25; }
    41% { opacity: 0.5; }
    42% { opacity: 0.25; }
    75% { opacity: 0.25; }
    76% { opacity: 0.4; }
    77% { opacity: 0.25; }
}

/* Main container */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 8rem;
    position: relative;
}

/* Section Titles - more intense glow */
.section-title {
    font-size: 2.5rem;
    color: var(--neon-green);
    margin-bottom: 2rem;
    text-shadow: 0 0 8px var(--neon-green), 0 0 15px var(--neon-green);
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    display: inline-block;
    animation: title-glitch 4s infinite;
}

@keyframes title-glitch {
    0%, 100% { transform: translateX(0); }
    5% { transform: translateX(-2px); }
    10% { transform: translateX(2px); }
    15% { transform: translateX(-2px); }
    16% { transform: translateX(0); }
    85% { transform: translateX(0); }
    90% { transform: translateX(2px); }
    95% { transform: translateX(-2px); }
    96% { transform: translateX(0); }
}

.section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 100%;
    height: 2px;
    background: var(--neon-green);
    box-shadow: 0 0 15px 2px var(--neon-green); /* Brighter glow */
    opacity: 0.8; /* Increased from 0.7 */
    animation: line-flicker 2s infinite;
}

@keyframes line-flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.5; }
}

/* Blinking cursor effect - faster blink */
.blink {
    animation: blink 0.7s infinite; /* Faster (was 1s) */
}

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

/* ==================== HERO SECTION ==================== */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
}

.hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.hero-text {
    flex: 1;
    max-width: 50%;
}

.glitch-title {
    font-size: 5rem;
    color: white;
    position: relative;
    animation: glitch-skew 0.5s infinite linear alternate-reverse; /* Faster (was 1s) */
    letter-spacing: 5px;
}

.glitch-title::before,
.glitch-title::after {
    content: 'BADGLITCH';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-title::before {
    color: var(--neon-pink);
    animation: glitch-anim-1 1s infinite linear alternate-reverse, rgb-shift 2s infinite linear;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    transform: translate(-4px, -4px); /* More offset (was -2px) */
    text-shadow: 3px 2px 0 red;
}

.glitch-title::after {
    color: var(--glitch-blue);
    animation: glitch-anim-2 1s infinite linear alternate-reverse, rgb-shift-reverse 2s infinite linear;
    clip-path: polygon(0 80%, 100% 20%, 100% 100%, 0 100%);
    transform: translate(4px, 4px); /* More offset (was 2px) */
    text-shadow: -3px -2px 0 blue;
}

.subtitle {
    font-size: 2rem;
    color: var(--neon-pink);
    margin-top: 1rem;
    text-shadow: 0 0 8px var(--neon-pink); /* Brighter glow */
    animation: flicker 2s infinite; /* Faster (was 3s) */
    letter-spacing: 1px;
}

.terminal-text {
    margin-top: 2rem;
    font-size: 1.2rem;
    color: var(--terminal-green);
}

.terminal-text .line {
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 1s forwards;
}

.terminal-text .line:nth-child(1) { animation-delay: 0.5s; }
.terminal-text .line:nth-child(2) { animation-delay: 1.5s; }
.terminal-text .line:nth-child(3) { animation-delay: 2.5s; }
.terminal-text .line:nth-child(4) { animation-delay: 3.5s; }

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 50%;
    position: relative;
}

.hero-image::before {
    display: none; /* Hide the overlay gradient */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
                               rgba(255, 0, 255, 0.1), 
                               transparent, 
                               rgba(13, 250, 255, 0.1));
    mix-blend-mode: overlay;
    animation: overlay-shift 5s infinite alternate;
    pointer-events: none;
}

@keyframes overlay-shift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(10px, 10px); }
}

.glitch-img {
    max-width: 100%;
    height: auto;
    filter: url(#glitch);
    animation: pulse 3s infinite, random-glitch 8s infinite; /* Added second animation, faster pulse */
    box-shadow: none; /* Removed: 0 0 30px rgba(157, 0, 255, 0.8); */
}

@keyframes random-glitch {
    0%, 100% { filter: url(#glitch); }
    25% { filter: url(#glitch) hue-rotate(30deg); }
    26% { filter: url(#glitch) hue-rotate(0deg); }
    74% { filter: url(#glitch); }
    75% { filter: url(#glitch) hue-rotate(-30deg) brightness(1.2); }
    76% { filter: url(#glitch); }
}

/* ==================== EXPERIMENTS SECTION ==================== */
#experiments {
    padding-top: 3rem;
}

.experiment-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.experiment-card {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--neon-green);
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 0 15px rgba(0, 255, 140, 0.4); /* Brighter glow */
    position: relative;
    transform: perspective(500px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
    animation: random-shift 15s infinite; /* Random shifting */
    clip-path: polygon(
        0 0, 
        98% 2%, 
        100% 3%, 
        99% 98%, 
        96% 100%, 
        3% 97%, 
        0 95%
    ) !important;
}

@keyframes random-shift {
    0%, 100% { transform: translateX(0) translateY(0) perspective(500px); }
    25% { transform: translateX(3px) translateY(-2px) perspective(500px); }
    50% { transform: translateX(-4px) translateY(1px) perspective(500px); }
    75% { transform: translateX(2px) translateY(3px) perspective(500px); }
}

.experiment-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(0, 255, 140, 0.2), /* More intense (was 0.1) */
        transparent
    );
    transform: rotate(45deg);
    transition: transform 0.5s;
    z-index: -1;
}

.experiment-card:hover {
    box-shadow: 0 0 25px rgba(0, 255, 140, 0.7); /* Brighter glow on hover */
    animation: card-shake 0.3s; /* Faster animation (was 0.5s) */
    transform: scale(1.05) !important;
}

.experiment-card:hover::before {
    transform: translateX(100%) rotate(45deg);
}

.experiment-card h3 {
    font-size: 1.8rem;
    color: var(--toxic-purple);
    margin-bottom: 1rem;
    text-shadow: 0 0 8px var(--toxic-purple); /* Brighter glow */
    position: relative;
    display: inline-block;
}

/* Added text distortion on card titles */
.experiment-card h3::before {
    content: attr(data-text);
    position: absolute;
    left: -2px;
    text-shadow: 2px 0 var(--neon-pink);
    top: 0;
    color: var(--toxic-purple);
    background: var(--bg-dark);
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
    animation: text-noise 3s infinite linear alternate-reverse;
}

@keyframes text-noise {
    0% {
        clip: rect(0, 900px, 5px, 0);
    }
    20% {
        clip: rect(0, 900px, 10px, 0);
    }
    40% {
        clip: rect(0, 900px, 2px, 0);
    }
    60% {
        clip: rect(0, 900px, 15px, 0);
    }
    80% {
        clip: rect(0, 900px, 8px, 0);
    }
    100% {
        clip: rect(0, 900px, 12px, 0);
    }
}

.experiment-card p {
    font-size: 1.2rem;
    color: #ccc;
    margin-bottom: 1.5rem;
}

.run-btn {
    background: transparent;
    border: 1px solid var(--neon-pink);
    color: var(--neon-pink);
    padding: 0.5rem 1rem;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
    text-shadow: 0 0 5px var(--neon-pink); /* Added glow */
}

.run-btn:hover {
    background-color: rgba(255, 0, 255, 0.3); /* More intense (was 0.2) */
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.7); /* Brighter glow */
    animation: button-glitch 0.3s infinite; /* Added animation */
}

@keyframes button-glitch {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
}

.run-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 0, 255, 0.6), /* More intense (was 0.4) */
        transparent
    );
    transition: left 0.3s;
}

.run-btn:hover::before {
    left: 100%;
}

/* ==================== ABOUT SECTION ==================== */
.terminal-about {
    background: rgba(10, 10, 10, 0.8);
    border: 1px solid var(--glitch-blue);
    padding: 2rem;
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--terminal-green);
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 0 20px rgba(13, 250, 255, 0.4); /* Brighter glow */
    animation: terminal-flicker 5s infinite;
}

@keyframes terminal-flicker {
    0%, 100% { border-color: var(--glitch-blue); }
    25% { border-color: var(--neon-pink); }
    50% { border-color: var(--glitch-blue); }
    75% { border-color: var(--toxic-purple); }
}

.terminal-about p {
    margin-bottom: 0.5rem;
    position: relative;
}

/* Add random line glitches to terminal text */
.terminal-about p:nth-child(odd)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -10px;
    width: calc(100% + 20px);
    height: 1px;
    background-color: var(--neon-green);
    opacity: 0;
    animation: line-glitch 8s infinite;
}

@keyframes line-glitch {
    0%, 100% { opacity: 0; }
    10%, 10.5% { opacity: 0.8; }
    10.6% { opacity: 0; }
}

.terminal-about strong {
    color: var(--neon-pink);
    font-weight: normal;
    text-shadow: 0 0 8px var(--neon-pink); /* Brighter glow */
    animation: strong-flicker 2s infinite;
}

@keyframes strong-flicker {
    0%, 100% { opacity: 1; text-shadow: 0 0 8px var(--neon-pink); }
    25% { opacity: 0.7; text-shadow: 0 0 5px var(--neon-pink); }
    50% { opacity: 1; text-shadow: 0 0 10px var(--neon-pink); }
    75% { opacity: 0.8; text-shadow: 0 0 7px var(--neon-pink); }
}

.watermark {
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 1rem;
    color: var(--neon-green);
    opacity: 0.7;
    transform: rotate(-5deg);
    animation: watermark-flicker 3s infinite;
}

@keyframes watermark-flicker {
    0%, 100% { opacity: 0.7; transform: rotate(-5deg); }
    50% { opacity: 0.5; transform: rotate(-6deg); }
}

/* ==================== CONNECT SECTION ==================== */
.terminal-message {
    font-size: 1.2rem;
    color: var(--glitch-blue);
    margin-bottom: 2rem;
    text-shadow: 0 0 5px var(--glitch-blue); /* Added glow */
}

.connect-links {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    animation: link-container-shift 10s infinite alternate;
}

@keyframes link-container-shift {
    0%, 100% { transform: translateX(0); }
    33% { transform: translateX(5px); }
    66% { transform: translateX(-5px); }
}

.link-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid currentColor;
    padding: 0.8rem;
    transition: transform 0.3s, filter 0.3s;
    position: relative;
    overflow: hidden;
}

.link-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.1),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s;
}

.link-icon:hover::before {
    opacity: 1;
}

.link-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.github {
    color: var(--neon-green);
}

.twitter {
    color: var(--glitch-blue);
}

.email {
    color: var(--neon-pink);
}

.link-icon:hover {
    transform: scale(1.1);
    filter: brightness(1.8); /* Brighter on hover (was 1.5) */
    animation: vibrate 0.2s linear infinite; /* Faster vibration (was 0.3s) */
}

.terminal-footer {
    font-size: 1.2rem;
    color: var(--toxic-purple);
    margin-top: 3rem;
    animation: terminal-footer-shift 8s infinite;
}

@keyframes terminal-footer-shift {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(3px); }
    50% { transform: translateX(-2px); }
    75% { transform: translateX(1px); }
}

/* ==================== ANIMATIONS ==================== */
@keyframes glitch-anim-1 {
    0% { clip-path: inset(40% 0 61% 0); }
    20% { clip-path: inset(92% 0 1% 0); }
    40% { clip-path: inset(43% 0 1% 0); }
    60% { clip-path: inset(25% 0 58% 0); }
    80% { clip-path: inset(54% 0 7% 0); }
    100% { clip-path: inset(58% 0 43% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(24% 0 29% 0); }
    20% { clip-path: inset(54% 0 44% 0); }
    40% { clip-path: inset(51% 0 36% 0); }
    60% { clip-path: inset(72% 0 9% 0); }
    80% { clip-path: inset(41% 0 59% 0); }
    100% { clip-path: inset(15% 0 85% 0); }
}

/* More intense glitch skew */
@keyframes glitch-skew {
    0% { transform: skew(-2deg); }
    10% { transform: skew(1deg); }
    20% { transform: skew(1.5deg); }
    30% { transform: skew(0.5deg); }
    40% { transform: skew(-0.8deg); }
    50% { transform: skew(0.4deg); }
    60% { transform: skew(1.2deg); }
    70% { transform: skew(-1.5deg); }
    80% { transform: skew(-0.4deg); }
    90% { transform: skew(0.8deg); }
    100% { transform: skew(0deg); }
}

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

/* More intense flicker */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    8% { opacity: 0.7; }
    10% { opacity: 0.9; }
    14% { opacity: 0.2; }
    20% { opacity: 0.6; }
    30% { opacity: 1; }
    40% { opacity: 0.5; }
    50% { opacity: 1; }
    60% { opacity: 0.4; }
    70% { opacity: 1; }
    80% { opacity: 0.8; }
    90% { opacity: 0.2; }
    94% { opacity: 0.9; }
}

/* More intense pulse */
@keyframes pulse {
    0% { transform: scale(1); filter: url(#glitch) brightness(1); }
    30% { transform: scale(1.03); filter: url(#glitch) brightness(1.3); }
    60% { transform: scale(0.98); filter: url(#glitch) brightness(0.9); }
    100% { transform: scale(1); filter: url(#glitch) brightness(1); }
}

/* More intense card shake */
@keyframes card-shake {
    0% { transform: translateX(0); }
    15% { transform: translateX(8px); }
    30% { transform: translateX(-8px); }
    45% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* More intense vibration */
@keyframes vibrate {
    0% { transform: translate(0) scale(1.1); }
    20% { transform: translate(3px, 3px) scale(1.1); }
    40% { transform: translate(-3px, -3px) scale(1.1); }
    60% { transform: translate(-3px, 3px) scale(1.1); }
    80% { transform: translate(3px, -3px) scale(1.1); }
    100% { transform: translate(0) scale(1.1); }
}

/* Media Queries */
@media (max-width: 800px) {
    .hero-content {
        flex-direction: column;
    }
    
    .hero-text,
    .hero-image {
        max-width: 100%;
        margin-bottom: 2rem;
    }
    
    .glitch-title {
        font-size: 4rem;
    }
    
    .subtitle {
        font-size: 1.5rem;
    }
    
    .experiment-grid {
        grid-template-columns: 1fr;
    }
}

/* Add a page-wide glitch overlay */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 50%, 
        rgba(255, 0, 255, 0.05) 50%
    );
    background-size: 100% 4px;
    z-index: 9990;
    pointer-events: none;
    opacity: 0;
    mix-blend-mode: overlay;
}

/* Activate the body glitch overlay during page-glitch */
body.page-glitch::after {
    opacity: 1;
    animation: scan-lines-intense 0.8s linear;
}

/* Additional animation for the glitch overlay */
@keyframes scan-lines-intense {
    0% { background-position: 0 0; }
    10% { background-position: -5px 10px; }
    20% { background-position: 5px 20px; }
    30% { background-position: -10px 30px; }
    40% { background-position: 15px 0; }
    50% { background-position: -15px 10px; }
    60% { background-position: 10px 50px; }
    70% { background-position: -8px 70px; }
    80% { background-position: 8px 80px; }
    90% { background-position: -20px 10px; }
    100% { background-position: 0 100px; }
}

/* Modify existing animations */
body.page-glitch .glitch-title {
    animation: extreme-title-glitch 0.8s linear !important;
}

@keyframes extreme-title-glitch {
    0% { transform: translate(0); }
    10% { transform: translate(-15px, 5px) skew(-20deg); }
    20% { transform: translate(15px, -5px) skew(15deg); }
    30% { transform: translate(-10px, 0) skew(-5deg); }
    40% { transform: translate(10px, 0) skew(10deg); }
    50% { transform: translate(0, 5px) skew(-15deg); }
    60% { transform: translate(0, -5px) skew(5deg); }
    70% { transform: translate(-5px, 0) skew(-10deg); }
    80% { transform: translate(5px, 0) skew(5deg); }
    90% { transform: translate(0, 0) skew(-5deg); }
    100% { transform: translate(0) skew(0); }
}

/* Enhance the entire screen glitch effect */
body.page-glitch main {
    animation: content-shift 0.8s ease-in-out;
    pointer-events: none; /* Prevent interaction during glitch to avoid scroll issues */
}

/* Make content pointer-events work again after glitch */
body:not(.page-glitch) main {
    pointer-events: auto;
}

/* Preserve scroll position during glitch by not affecting the body's scroll position */
@keyframes content-shift {
    0% { transform: translateX(0); }
    10% { transform: translateX(-20px); clip-path: inset(5% 0 0 0); }
    20% { transform: translateX(20px); clip-path: inset(0 5% 0 0); }
    30% { transform: translateY(10px); clip-path: inset(0 0 5% 0); }
    40% { transform: translateY(-10px); clip-path: inset(0 0 0 5%); }
    50% { transform: translate(15px, 5px); clip-path: none; }
    55% { transform: translate(0, 0); clip-path: inset(10% 0 0 0); }
    60% { transform: translate(-15px, -5px); clip-path: inset(2% 0 2% 0); }
    65% { transform: translate(20px, 10px); clip-path: inset(0 10% 0 0); }
    70% { transform: translate(10px, 0); clip-path: none; }
    75% { transform: translate(-20px, 5px); clip-path: inset(5% 5% 0 0); }
    80% { transform: translate(-10px, 0); clip-path: inset(0 2% 0 2%); }
    85% { transform: translate(15px, -10px); clip-path: inset(0 0 10% 0); }
    90% { transform: translate(0, 5px); clip-path: none; }
    95% { transform: translate(-5px, -5px); clip-path: inset(2% 0 0 5%); }
    100% { transform: translate(0, 0); clip-path: none; }
}

/* Add additional effects during page-glitch */
body.page-glitch .experiment-card {
    animation: card-extreme-glitch 0.8s linear !important;
}

@keyframes card-extreme-glitch {
    0% { transform: perspective(500px) rotateX(0deg) rotateY(0deg); filter: none; }
    15% { transform: perspective(500px) rotateX(10deg) rotateY(-5deg); filter: hue-rotate(90deg); }
    30% { transform: perspective(500px) rotateX(-8deg) rotateY(10deg); filter: contrast(150%); }
    45% { transform: perspective(500px) rotateX(5deg) rotateY(-15deg); filter: brightness(120%) saturate(200%); }
    60% { transform: perspective(500px) rotateX(-12deg) rotateY(0deg); filter: invert(70%); }
    75% { transform: perspective(500px) rotateX(0deg) rotateY(12deg); filter: hue-rotate(180deg); }
    90% { transform: perspective(500px) rotateX(5deg) rotateY(-5deg); filter: contrast(180%) brightness(80%); }
    100% { transform: perspective(500px) rotateX(0deg) rotateY(0deg); filter: none; }
}

/* Make links glitch too */
body.page-glitch .link-icon {
    animation: link-glitch 0.8s linear !important;
}

@keyframes link-glitch {
    0% { transform: scale(1); filter: none; }
    20% { transform: scale(1.2) translateX(-5px); filter: hue-rotate(90deg); }
    40% { transform: scale(0.9) translateX(8px); filter: invert(100%); }
    60% { transform: scale(1.1) translateY(-5px); filter: contrast(200%); }
    80% { transform: scale(0.95) translateY(8px); filter: brightness(150%) saturate(200%); }
    100% { transform: scale(1); filter: none; }
}

/* Add glowing effect during glitch */
body.page-glitch * {
    transition: text-shadow 0.1s ease-out;
}

body.page-glitch h1, body.page-glitch h2, body.page-glitch h3 {
    text-shadow: 0 0 15px currentColor, 0 0 20px var(--neon-pink) !important;
}

/* Cursor RGB trail */
.cursor-dot,
.cursor-dot-outline {
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    z-index: 99999;
}

.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background-color: var(--neon-pink);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    animation: cursor-pulse 0.8s infinite alternate;
}

.cursor-dot-outline {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid var(--glitch-blue);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9998;
    mix-blend-mode: exclusion;
    animation: cursor-pulse 1.2s infinite alternate-reverse;
}

.cursor-trail {
    position: fixed;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    opacity: 0.7;
    mix-blend-mode: screen;
    animation: trail-fade 1s forwards;
}

.red-trail {
    background-color: rgba(255, 0, 0, 0.8);
    transform: translateX(-3px);
}

.green-trail {
    background-color: rgba(0, 255, 0, 0.8);
    transform: translateX(0);
}

.blue-trail {
    background-color: rgba(0, 0, 255, 0.8);
    transform: translateX(3px);
}

@keyframes cursor-pulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-50%, -50%) scale(1.5); }
}

@keyframes trail-fade {
    0% { opacity: 0.7; }
    100% { opacity: 0; transform: translateY(20px) scale(0); }
}

/* ==================== VHS STYLE EFFECTS ==================== */
/* VHS Tracking lines that randomly appear */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 50%, 
        rgba(0, 0, 0, 0.3) 50%
    );
    background-size: 100% 3px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.25;
    animation: scan-shift 10s infinite linear, vhs-flicker 8s infinite;
}

@keyframes vhs-flicker {
    0%, 100% { opacity: 0.25; }
    15% { opacity: 0.4; }
    16% { opacity: 0.25; }
    40% { opacity: 0.25; }
    41% { opacity: 0.5; }
    42% { opacity: 0.25; }
    75% { opacity: 0.25; }
    76% { opacity: 0.4; }
    77% { opacity: 0.25; }
}

/* ==================== FAKE REBOOT EFFECT ==================== */
.fake-reboot {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--terminal-green);
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    line-height: 1.3;
    text-align: left;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

.fake-reboot.active {
    opacity: 1;
    pointer-events: auto;
}

.reboot-text {
    max-width: 700px;
    width: 100%;
    white-space: pre;
}

/* ==================== STAGGERED CARD LAYOUT ==================== */
/* Make experiment cards look more 'wrong' */
.experiment-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.experiment-card:nth-child(1) {
    transform: rotate(-2deg) translateY(-5px);
}

.experiment-card:nth-child(2) {
    transform: rotate(1deg) translateY(10px);
}

.experiment-card:nth-child(3) {
    transform: rotate(-1deg) translateY(0);
}

.experiment-card:nth-child(4) {
    transform: rotate(2deg) translateY(-8px);
}

/* Make cards preserve their staggered rotation even during hover effects */
.experiment-card:hover {
    transform: scale(1.05) !important;
}

/* More extreme RGB split for the title */
@keyframes rgb-shift {
    0% { text-shadow: 3px 2px 0 red; }
    33% { text-shadow: 4px -2px 0 green; }
    66% { text-shadow: -4px 3px 0 blue; }
    100% { text-shadow: 3px 2px 0 red; }
}

@keyframes rgb-shift-reverse {
    0% { text-shadow: -3px -2px 0 blue; }
    33% { text-shadow: 3px -1px 0 red; }
    66% { text-shadow: -2px 3px 0 green; }
    100% { text-shadow: -3px -2px 0 blue; }
}

/* BROKEN REBOOT OVERLAY */
.fake-reboot {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black;
    color: var(--terminal-green);
    font-family: 'VT323', monospace;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    overflow: hidden;
}

.fake-reboot.active {
    display: flex;
}

.reboot-text {
    font-size: 1.5rem;
    line-height: 1.6;
    white-space: pre-line;
    max-width: 80%;
}

/* Adding CRAZY broken text effects */
h1, h2, h3 {
    position: relative;
    overflow: visible;
}

/* Broken text that leaks outside container */
h1::before, h2::before, h3::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    transform-origin: center;
    animation: text-fracture 15s infinite alternate;
    opacity: 0.1;
    filter: blur(1px);
}

@keyframes text-fracture {
    0% { transform: scale(1) rotate(0deg); }
    20% { transform: scale(1.2, 0.8) rotate(5deg); }
    40% { transform: scale(0.8, 1.2) rotate(-5deg); }
    60% { transform: scale(1.1) skew(10deg, 5deg); }
    80% { transform: scale(0.9) skew(-5deg, -10deg); }
    100% { transform: scale(1.3) rotate(8deg); }
}

/* Destructive elements that "break" the layout */
.experiment-card {
    position: relative;
    z-index: 1;
}

.experiment-card:nth-child(odd)::after {
    content: '';
    position: absolute;
    width: 140%;
    height: 140%;
    top: -20%;
    left: -20%;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 10px,
        rgba(255, 0, 255, 0.05) 10px,
        rgba(255, 0, 255, 0.05) 20px
    );
    z-index: -1;
    transform-origin: center;
    animation: destroy-grid 20s infinite alternate;
    pointer-events: none;
}

@keyframes destroy-grid {
    0%, 100% { transform: rotate(0) scale(1); opacity: 0.05; }
    25% { transform: rotate(45deg) scale(1.2); opacity: 0.1; }
    50% { transform: rotate(-30deg) scale(0.9); opacity: 0.15; }
    75% { transform: rotate(20deg) scale(1.1); opacity: 0.05; }
}

/* Truly broken page elements during glitch */
body.page-glitch .experiment-grid {
    animation: shatter-grid 0.8s linear;
}

@keyframes shatter-grid {
    0% { transform: translateZ(0); }
    20% { transform: rotateY(20deg) scale(0.95); }
    40% { transform: rotateY(-40deg) scale(1.05) skewX(10deg); }
    60% { transform: rotateX(30deg) scale(0.9) skewY(-10deg); }
    80% { transform: rotateX(-20deg) rotateZ(15deg) scale(1.1); }
    100% { transform: translateZ(0); }
}

/* Vortex effect for sections during max glitch */
body.page-glitch section {
    animation: vortex 0.8s ease-in-out;
    transform-style: preserve-3d;
    perspective: 800px;
}

@keyframes vortex {
    0%, 100% { transform: translateZ(0) rotateX(0) rotateY(0); }
    25% { transform: translateZ(-100px) rotateX(15deg) rotateY(-10deg); }
    50% { transform: translateZ(50px) rotateX(-20deg) rotateY(20deg); }
    75% { transform: translateZ(-50px) rotateX(10deg) rotateY(-15deg); }
}

/* Terminal ASCII noise */
.terminal-about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%230cff0c' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.3;
    z-index: -1;
}

/* Broken button effects */
.run-btn {
    position: relative;
    overflow: visible;
}

.run-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        var(--neon-pink) 0%,
        transparent 50%,
        var(--glitch-blue) 100%
    );
    opacity: 0;
    z-index: -1;
    mix-blend-mode: overlay;
    filter: blur(8px);
    transform: scale(1.2);
    transition: opacity 0.3s;
}

.run-btn:hover::after {
    opacity: 1;
    animation: button-radiation 0.5s linear infinite;
}

@keyframes button-radiation {
    0% { transform: scale(1.2) rotate(0deg); }
    50% { transform: scale(1.3) rotate(180deg); }
    100% { transform: scale(1.2) rotate(360deg); }
}

/* Broken page scroll animation */
@keyframes broken-scroll {
    0% { transform: translateY(0); }
    10% { transform: translateY(-20px); }
    20% { transform: translateY(15px); }
    30% { transform: translateY(-10px); }
    40% { transform: translateY(5px); }
    50% { transform: translateY(0); }
}

/* Apply broken scroll to sections during extreme glitch */
body.extreme-glitch section {
    animation: broken-scroll 0.3s linear;
}

/* Insane RGB splitting on all text during glitch */
body.page-glitch p, body.page-glitch h1, body.page-glitch h2, body.page-glitch h3, body.page-glitch button {
    position: relative;
}

body.page-glitch p::before, 
body.page-glitch h1::before, 
body.page-glitch h2::before, 
body.page-glitch h3::before, 
body.page-glitch button::before {
    content: attr(data-text);
    position: absolute;
    left: -3px;
    top: 0;
    color: #f0f;
    z-index: -1;
    animation: rgb-split 0.8s infinite linear alternate;
}

body.page-glitch p::after, 
body.page-glitch h1::after, 
body.page-glitch h2::after, 
body.page-glitch h3::after, 
body.page-glitch button::after {
    content: attr(data-text);
    position: absolute;
    left: 3px;
    top: 0;
    color: #0ff; 
    z-index: -2;
    animation: rgb-split 0.8s infinite linear alternate-reverse;
}

@keyframes rgb-split {
    0% { transform: translateX(-3px) skewX(10deg); }
    25% { transform: translateY(2px) skewX(-5deg); }
    50% { transform: translateX(3px) skewY(5deg); }
    75% { transform: translateY(-2px) skewY(-5deg); }
    100% { transform: translateX(-3px) skewX(10deg); }
}

/* TV Power off effect */
.tv-off {
    animation: tv-power-off 0.8s forwards;
}

@keyframes tv-power-off {
    0% { transform: scale(1); filter: brightness(1); }
    5% { transform: scale(1.02); filter: brightness(1.5) contrast(1.2); }
    10% { transform: scale(1); filter: brightness(1) contrast(1); }
    30% { transform: scale(1); filter: brightness(1); }
    40% { transform: scaleY(0.01); filter: brightness(0); }
    100% { transform: scaleY(0); filter: brightness(0); }
}

/* Glitchy background noise pattern */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
    animation: noise-drift 30s infinite linear;
}

@keyframes noise-drift {
    0% { background-position: 0 0; }
    100% { background-position: 100% 100%; }
}

/* Totally broken animations for the page glitch */
body.page-glitch .glitch-title {
    animation: shatter-text 0.8s linear forwards !important;
}

@keyframes shatter-text {
    0% { transform: translateZ(0); }
    10% { transform: translateZ(20px) rotateX(10deg); }
    20% { transform: translateZ(-20px) rotateY(-20deg) skewX(10deg); }
    30% { transform: translateZ(30px) rotateZ(15deg) skewY(-5deg); }
    40% { transform: translateZ(-10px) rotateX(-25deg) scale(1.1, 0.9); }
    50% { transform: translateZ(0) rotate(0) skew(0, 0) scale(1); }
    60% { transform: translateZ(15px) rotateY(15deg) skewX(-10deg); }
    70% { transform: translateZ(-25px) rotateX(-10deg) scale(0.95, 1.05); }
    80% { transform: translateZ(10px) rotateZ(-5deg) skewY(10deg); }
    90% { transform: translateZ(-5px) scale(1.05, 0.95); }
    100% { transform: translateZ(0); }
} 