@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --void-bg: #030305;
    --stardust: #e2e8f0;
    --quantum-cyan: #00f0ff;
    --quantum-purple: #b026ff;
    --grid-color: rgba(255, 255, 255, 0.03);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--void-bg);
    color: var(--stardust);
    overflow-x: hidden;
    /* Starfield background pattern */
    background-image: 
        radial-gradient(1px 1px at 20px 30px, rgba(255,255,255,0.15), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, rgba(255,255,255,0.1), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, rgba(255,255,255,0.05), rgba(0,0,0,0));
    background-size: 200px 200px;
}

.font-mono-accent {
    font-family: 'JetBrains Mono', monospace;
}

/* Quantum Superposition Glow */
.glow-text-quantum {
    text-shadow: 
        -2px 0 15px rgba(0, 240, 255, 0.6), 
        2px 0 15px rgba(176, 38, 255, 0.6);
}

.terminal-box {
    background: linear-gradient(145deg, #0a0a0e 0%, #050508 100%);
    box-shadow: 
        0 0 0 1px rgba(255,255,255,0.05),
        0 20px 40px -10px rgba(0,0,0,0.8),
        inset 0 0 80px rgba(0, 240, 255, 0.02);
    position: relative;
}

.terminal-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--quantum-cyan), var(--quantum-purple), transparent);
    opacity: 0.3;
}

/* Grid overlay for sections */
.grid-overlay {
    background-size: 40px 40px;
    background-image: 
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.glitch-hover:hover {
    animation: glitch-skew-burst 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    color: var(--quantum-cyan);
}

.quantum-border {
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}
.quantum-border:hover {
    border-color: rgba(176, 38, 255, 0.4);
    box-shadow: 0 0 20px rgba(176, 38, 255, 0.1);
}

/* ==============================================================
   GHOST KOENIG EDITOR REQUIRED STYLES 
   ============================================================== */
.kg-width-wide {
    position: relative;
    width: 85vw;
    min-width: 100%;
    margin: auto;
    transform: translateX(calc(50% - 42.5vw));
}

.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
    height: auto;
}

/* ==============================================================
   MATRIX GLITCH & STATIC EFFECTS (Centralized)
   ============================================================== */

/* Base Wrapper isolates the text from bg-clip-text rendering bugs */
.glitch-wrapper {
    position: relative;
    display: inline-block;
    z-index: 1; 
}

.glitch-wrapper::before, .glitch-wrapper::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; 
    pointer-events: none;
    white-space: nowrap;
}

.glitch-wrapper::before {
    color: var(--quantum-cyan);
    z-index: -1;
    text-shadow: 2px 0 var(--quantum-cyan);
}

.glitch-wrapper::after {
    color: #ff003c;
    z-index: -2;
    text-shadow: -2px 0 #ff003c;
}

/* ---------------------------------------------------
   TYPE A: JavaScript Triggered Burst (For Homepage)
   --------------------------------------------------- */
.is-glitching {
    animation: glitch-skew-burst 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.is-glitching::before {
    opacity: 1;
    animation: glitch-anim-1-burst 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
.is-glitching::after {
    opacity: 1;
    animation: glitch-anim-2-burst 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes glitch-anim-1-burst {
    0% { clip-path: inset(0 0 0 0); transform: translate(0); }
    15% { clip-path: inset(10% 0 60% 0); transform: translate(-15px, 5px); }
    30% { clip-path: inset(30% 0 20% 0); transform: translate(15px, -5px); }
    45% { clip-path: inset(70% 0 10% 0); transform: translate(-15px, 10px); }
    60% { clip-path: inset(20% 0 50% 0); transform: translate(15px, -2px); }
    75% { clip-path: inset(50% 0 30% 0); transform: translate(-5px, 5px); }
    90% { clip-path: inset(5% 0 80% 0); transform: translate(5px, -5px); }
    100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

@keyframes glitch-anim-2-burst {
    0% { clip-path: inset(0 0 0 0); transform: translate(0); }
    15% { clip-path: inset(20% 0 80% 0); transform: translate(15px, -5px); }
    30% { clip-path: inset(60% 0 10% 0); transform: translate(-15px, 5px); }
    45% { clip-path: inset(40% 0 50% 0); transform: translate(15px, -15px); }
    60% { clip-path: inset(80% 0 5% 0); transform: translate(-15px, 5px); }
    75% { clip-path: inset(10% 0 70% 0); transform: translate(5px, -5px); }
    90% { clip-path: inset(30% 0 50% 0); transform: translate(-5px, 5px); }
    100% { clip-path: inset(0 0 0 0); transform: translate(0); }
}

@keyframes glitch-skew-burst {
    0% { transform: skew(0deg); }
    20% { transform: skew(-15deg); }
    40% { transform: skew(15deg); }
    60% { transform: skew(-10deg); }
    80% { transform: skew(10deg); }
    100% { transform: skew(0deg); }
}

/* ---------------------------------------------------
   TYPE B: Infinite CSS Loop (For Static Page Titles)
   --------------------------------------------------- */
.glitch-infinite {
    animation: glitch-skew-loop 4s infinite linear alternate-reverse;
}
.glitch-infinite::before {
    animation: glitch-anim-1-loop 4s infinite linear alternate-reverse;
}
.glitch-infinite::after {
    animation: glitch-anim-2-loop 4s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1-loop {
    0%, 85% { opacity: 0; clip-path: inset(0 0 0 0); transform: translate(0); }
    86% { opacity: 1; clip-path: inset(10% 0 60% 0); transform: translate(-15px, 5px); }
    88% { opacity: 1; clip-path: inset(30% 0 20% 0); transform: translate(15px, -5px); }
    90% { opacity: 1; clip-path: inset(70% 0 10% 0); transform: translate(-15px, 10px); }
    92% { opacity: 1; clip-path: inset(20% 0 50% 0); transform: translate(15px, -2px); }
    94% { opacity: 1; clip-path: inset(50% 0 30% 0); transform: translate(-5px, 5px); }
    96% { opacity: 1; clip-path: inset(5% 0 80% 0); transform: translate(5px, -5px); }
    98% { opacity: 1; clip-path: inset(40% 0 40% 0); transform: translate(-15px, 5px); }
    100% { opacity: 0; clip-path: inset(0 0 0 0); transform: translate(0); }
}

@keyframes glitch-anim-2-loop {
    0%, 85% { opacity: 0; clip-path: inset(0 0 0 0); transform: translate(0); }
    87% { opacity: 1; clip-path: inset(20% 0 80% 0); transform: translate(15px, -5px); }
    89% { opacity: 1; clip-path: inset(60% 0 10% 0); transform: translate(-15px, 5px); }
    91% { opacity: 1; clip-path: inset(40% 0 50% 0); transform: translate(15px, -15px); }
    93% { opacity: 1; clip-path: inset(80% 0 5% 0); transform: translate(-15px, 5px); }
    95% { opacity: 1; clip-path: inset(10% 0 70% 0); transform: translate(5px, -5px); }
    97% { opacity: 1; clip-path: inset(30% 0 50% 0); transform: translate(-5px, 5px); }
    99% { opacity: 1; clip-path: inset(70% 0 20% 0); transform: translate(15px, -5px); }
    100% { opacity: 0; clip-path: inset(0 0 0 0); transform: translate(0); }
}

@keyframes glitch-skew-loop {
    0%, 85% { transform: skew(0deg); }
    87% { transform: skew(-15deg); }
    90% { transform: skew(15deg); }
    93% { transform: skew(-10deg); }
    96% { transform: skew(10deg); }
    100% { transform: skew(0deg); }
}