body {
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
    background: linear-gradient(135deg, #0B1E3D 0%, #1a3a5c 50%, #0f2847 100%);
    background-attachment: fixed;
    scroll-behavior: smooth;
}

/* ========== Page Loading Overlay ========== */
#page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(11, 30, 61, 0.95) 0%, rgba(26, 58, 92, 0.95) 50%, rgba(15, 40, 71, 0.95) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#page-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.page-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 229, 255, 0.2);
    border-top-color: #00E5FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-loading-text {
    position: absolute;
    margin-top: 100px;
    color: #00E5FF;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 2px;
}

/* ========== Accessibility: Skip Links ========== */
.skip-link {
    position: fixed;
    top: -100px;
    left: 0;
    background: #00E5FF;
    color: #0B1E3D;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 0 !important;
    outline: 3px solid #FFFFFF;
    outline-offset: 2px;
}

/* Screen reader only (visually hidden but accessible) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========== Accessibility: Focus Indicators ========== */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #00E5FF;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Focus for navigation links */
.nav-link-toaster:focus,
.nav-link-toaster:focus-visible,
.header-logo:focus,
.header-logo:focus-visible {
    outline: 3px solid #00E5FF !important;
    outline-offset: 4px;
    outline-style: solid !important;
}

/* Focus for MudBlazor components */
.mud-button-root:focus-visible {
    outline: 3px solid #00E5FF !important;
    outline-offset: 2px !important;
}

/* ========== Accessibility: Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .particle-animation .particle {
        animation: none !important;
    }

    .process-card {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .timeline-item {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ========== Toaster Header ========== */
.header-toaster {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    backdrop-filter: blur(20px);
    background: rgba(11, 30, 61, 0.7);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 50px;
    padding: 12px 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.header-toaster.scrolled {
    background: rgba(11, 30, 61, 0.95);
    border-color: rgba(0, 229, 255, 0.4);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 40px;
    color: white;
}

.header-logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -1px;
    white-space: nowrap;
}

.logo-accent {
    color: #00E5FF;
}

.header-nav {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-link-toaster {
    color: #FFFFFF;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s ease;
    cursor: pointer;
}

.nav-link-toaster:hover {
    color: #00E5FF;
}

.nav-link-toaster.scrolled {
    color: #0B1E3D;
}

.nav-link-toaster.scrolled:hover {
    color: #00E5FF;
}

.cta-button {
    background: linear-gradient(90deg, #00E5FF, #0BBFFF);
    color: #0B1E3D;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.cta-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.4);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0B1E3D 0%, #1a2f4d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.loading-container {
    text-align: center;
    color: white;
}

.loading-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 0 0 3rem 0;
    background: linear-gradient(90deg, #FFFFFF 0%, #00E5FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Partikel Animation */
.particle-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #00E5FF;
    border-radius: 50%;
    opacity: 0.7;
}

.particle.p1 { animation: float 3s ease-in-out infinite; top: 10%; left: 20%; }
.particle.p2 { animation: float 3.5s ease-in-out infinite 0.2s; top: 15%; left: 75%; }
.particle.p3 { animation: float 4s ease-in-out infinite 0.4s; top: 50%; left: 10%; }
.particle.p4 { animation: float 3.2s ease-in-out infinite 0.6s; top: 60%; left: 80%; }
.particle.p5 { animation: float 3.8s ease-in-out infinite 0.8s; top: 30%; left: 45%; }
.particle.p6 { animation: float 3.3s ease-in-out infinite 1s; top: 75%; left: 30%; }
.particle.p7 { animation: float 4.2s ease-in-out infinite 1.2s; top: 20%; left: 60%; }
.particle.p8 { animation: float 3.6s ease-in-out infinite 1.4s; top: 70%; left: 50%; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.7; }
    25% { transform: translate(15px, -15px) scale(1.1); opacity: 0.9; }
    50% { transform: translate(-10px, 20px) scale(0.9); opacity: 0.6; }
    75% { transform: translate(10px, 10px) scale(1); opacity: 0.8; }
}

.loading-progress-text {
    font-size: 1.1rem;
    color: #00E5FF;
    letter-spacing: 2px;
    font-weight: 300;
}

html { scroll-behavior: smooth; }

/* Riesige Typografie */
.hero-text {
    font-size: clamp(3rem, 10vw, 8rem) !important;
    line-height: 0.9 !important;
    letter-spacing: -0.05em;
    color: #0B1E3D;
}
.gradient-text { color: #00E5FF; }

/* Container für particles.js */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #0B1E3D;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 50% 50%;
    top: 0;
    left: 0;
    z-index: 0; /* Ganz unten */
}

/* WICHTIG: Damit der Text ÜBER den Partikeln liegt und klickbar bleibt */
.relative.z-10 {
    position: relative;
    z-index: 10;
    pointer-events: none; /* Lässt Maus-Events durch zum Canvas für den Hover-Effekt */
}

/* Buttons und Links müssen wieder klickbar gemacht werden */
.relative.z-10 .mud-button-root, 
.relative.z-10 a, 
.relative.z-10 .pointer-events-auto {
    pointer-events: auto;
}

/* Animationen */
.animate-reveal { animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transform: translateY(50px); }
.fade-in-delayed { animation: fadeIn 1.5s ease-out forwards; opacity: 0; animation-delay: 0.5s; }
.bounce-animation { animation: bounce 2s infinite; }

@keyframes slideUp { to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-10px);} 60% {transform: translateY(-5px);} }

/* Cards */
.service-card { transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); border: 1px solid transparent; }
.service-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px rgba(0,0,0,0.1); }
.nav-link { color: #0B1E3D !important; font-weight: 500; transition: color 0.3s; }
.nav-link:hover { color: #00E5FF !important; }
.relative { position: relative; } .z-10 { z-index: 10; }

/* Morph Text Container */
.morph-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

/* Morph Lines - two separate lines for FECKTER and SOLUTION */
.morph-line-feckter,
.morph-line-solution {
    display: inline-flex;
    align-items: center;
    gap: 0;
    white-space: nowrap;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 0.9;
}

/* FECKTER line - larger text */
.morph-line-feckter {
    font-size: clamp(2rem, 9vw, 9rem);
    color: #FFFFFF;
}

/* SOLUTION line - same size, cyan color */
.morph-line-solution {
    font-size: clamp(2rem, 9vw, 9rem);
    color: #00E5FF;
}

/* Expanding parts - width controlled by JavaScript */
.expanding-part-feckter {
    display: inline-block;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    color: #FFFFFF;
    /* Width is set dynamically via JavaScript - let JS control it */
    flex-shrink: 0;
    flex-basis: auto;
    /* Don't scale - show full width */
    transform: scaleX(1);
    transform-origin: left;
}

.expanding-part-so {
    display: inline-block;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    color: #00E5FF;
    /* Width is set dynamically via JavaScript - let JS control it */
    flex-shrink: 0;
    flex-basis: auto;
    /* Don't scale - show full width */
    transform: scaleX(1);
    transform-origin: left;
}

/* ========== Process Cards Time-Based Animation ========== */
.process-card {
    /* Initial: UNSICHTBAR - rechts außerhalb */
    opacity: 0;
    transform: translateX(100%);
    /* Keine transition im Initial State - Animation via @keyframes */
}

/* Animation triggern wenn Container die Klasse 'animate' bekommt */
.scroll-animation-section.animate .process-card {
    animation: slideInFromRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered delays - jede Card kommt etwas später */
.scroll-animation-section.animate .process-card:nth-child(1) {
    animation-delay: 0s;
}

.scroll-animation-section.animate .process-card:nth-child(2) {
    animation-delay: 0.15s;
}

.scroll-animation-section.animate .process-card:nth-child(3) {
    animation-delay: 0.3s;
}

.scroll-animation-section.animate .process-card:nth-child(4) {
    animation-delay: 0.45s;
}

.scroll-animation-section.animate .process-card:nth-child(5) {
    animation-delay: 0.6s;
}

/* Slide-in Animation */
@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== Typography ========== */
.mud-typography-h3 {
    font-size: 2.5rem !important;
}

/* ========== Timeline Responsive Styles ========== */
/* Mobile: Stack timeline vertically */
@media (max-width: 768px) {
    #timeline .timeline-item {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        margin-bottom: 3rem !important;
        padding-left: 2rem !important;
        text-align: left !important;
    }

    #timeline .timeline-item > div[style*="text-align: right"] {
        text-align: left !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    #timeline .timeline-item > div[style*="padding-left: 3rem"] {
        padding-left: 0 !important;
    }

    /* Hide center dots on mobile, show left-aligned dots */
    #timeline .timeline-item > div[style*="position: relative"] > div[style*="position: absolute"] {
        left: -1.5rem !important;
        transform: translate(0, -50%) !important;
    }

    /* Adjust center line position for mobile */
    #timeline > div > div[style*="position: absolute"][style*="left: 50%"] {
        left: 0 !important;
        transform: translateX(0) !important;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    #timeline .timeline-item {
        gap: 2rem !important;
    }

    #timeline .timeline-item > div[style*="padding-right: 3rem"] {
        padding-right: 1.5rem !important;
    }

    #timeline .timeline-item > div[style*="padding-left: 3rem"] {
        padding-left: 1.5rem !important;
    }
}

/* ========== New Timeline Design with Background Words ========== */
/* Container für ein einzelnes Timeline-Event */
.timeline-item {
    position: relative;
    padding: 4rem 0;
    overflow: hidden; /* Damit das riesige Wort nicht in andere Sektionen ragt */

    /* Initial state für Animation */
    opacity: 0;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Animation states für linke Items */
.timeline-item.fade-left {
    transform: translateX(-100px);
}

.timeline-item.fade-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Animation states für rechte Items */
.timeline-item.fade-right {
    transform: translateX(100px);
}

.timeline-item.fade-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Das riesige Hintergrund-Wort */
.timeline-bg-word {
    position: absolute;
    top: 50%;
    /* Positionierung wird im HTML via Style geregelt (links/rechts) */
    transform: translateY(-50%);

    font-size: clamp(6rem, 12vw, 15rem);
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;

    /* Outline Stil (Hollow Text) - Gut sichtbar auf dunklem Hintergrund */
    color: transparent;
    -webkit-text-stroke: 2px rgba(0, 229, 255, 0.25); /* Deutlich sichtbarer */
    z-index: 0;
    white-space: nowrap;
    pointer-events: none;
}

/* Der Inhalt (Karte) */
.timeline-content {
    position: relative;
    z-index: 2; /* Muss über dem Hintergrundwort liegen */
    background: rgba(11, 30, 61, 0.05); /* Minimal transparenter Hintergrund */
    backdrop-filter: blur(4px); /* Sehr leichter Weichzeichner-Effekt */
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 255, 0.2);
}

/* Der kleine Fokus-Badge */
.focus-badge {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid #00E5FF;
    background: rgba(0, 229, 255, 0.05);
    color: #00E5FF;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 4px;
}

/* ========== MOBILE RESPONSIVE STYLES ========== */
/* Mobile Devices (up to 768px) */
@media (max-width: 768px) {
    /* Hero Section Adjustments */
    .morph-sticky {
        min-height: 70vh !important;
        padding: 60px 20px !important;
    }

    .morph-text-wrapper {
        padding: 0 1rem;
    }

    .morph-line-feckter,
    .morph-line-solution {
        font-size: clamp(1.8rem, 12vw, 4rem) !important;
    }

    .morph-subline {
        padding: 0 1rem;
        margin-top: 2rem;
    }

    /* Section Padding Reduction */
    section.py-20 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    /* Container Padding */
    .mud-container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Typography Scaling */
    .mud-typography-h2 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }

    .mud-typography-h3 {
        font-size: 1.35rem !important;
    }

    .mud-typography-h4 {
        font-size: 1.2rem !important;
    }

    .mud-typography-h5 {
        font-size: 1.1rem !important;
    }

    /* Process Cards - Stack vertically instead of horizontal scroll */
    #processCardsContainer {
        height: auto !important;
        overflow: visible !important;
    }

    #processCardsContainer > div {
        flex-direction: column !important;
        gap: 1.5rem !important;
        padding: 0 1rem !important;
    }

    .process-card {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        width: 100% !important;
    }

    .process-card .mud-paper {
        height: auto !important;
        min-height: 300px !important;
    }

    /* Portfolio Cards - Better mobile spacing */
    #portfolio .mud-grid-item {
        padding: 0.5rem !important;
    }

    #portfolio .mud-paper {
        padding: 1.5rem !important;
    }

    #portfolio .mud-paper > div[style*="height: 150px"] {
        height: 120px !important;
        margin-bottom: 1rem !important;
    }

    /* Timeline Mobile Optimizations */
    .timeline-bg-word {
        font-size: clamp(3rem, 15vw, 8rem) !important;
        opacity: 0.5;
    }

    .timeline-content {
        padding: 1.5rem !important;
    }

    .timeline-item {
        padding: 2rem 0 !important;
    }

    /* AI Philosophy Section */
    #ai-philosophy .mud-grid {
        gap: 2rem !important;
    }

    #ai-philosophy img {
        max-width: 80% !important;
        margin: 0 auto !important;
        display: block !important;
    }

    /* Header Toaster - Make smaller on mobile */
    .header-toaster {
        top: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        padding: 10px 20px;
        border-radius: 30px;
    }

    .header-content {
        gap: 15px;
        justify-content: space-between;
    }

    .header-logo {
        font-size: 1.1rem;
    }

    .header-nav {
        display: none;
    }

    .cta-button {
        padding: 6px 16px;
        font-size: 0.85rem;
    }

    /* Loading Screen */
    .loading-title {
        font-size: 2rem !important;
    }

    .particle-animation {
        width: 100px;
        height: 100px;
    }

    /* Buttons */
    .mud-button-root {
        font-size: 0.875rem !important;
    }

    /* Cardify Page - Mobile Adjustments */
    .mud-typography-h1 {
        font-size: 2rem !important;
    }

    /* Tech Stack Badges */
    div[style*="padding: 0.5rem 1rem"] {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.8rem !important;
    }

    /* Highlights Section - Circular Stats */
    div[style*="width: 100px; height: 100px"] {
        width: 80px !important;
        height: 80px !important;
    }

    /* Impressum Page */
    #impressum .mud-paper {
        padding: 1.5rem !important;
    }
}

/* Tablet Adjustments (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .morph-line-feckter,
    .morph-line-solution {
        font-size: clamp(3rem, 10vw, 7rem) !important;
    }

    section.py-20 {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }

    #processCardsContainer > div {
        padding: 0 2rem !important;
    }

    .process-card {
        flex: 0 0 300px !important;
        min-width: 300px !important;
    }

    .header-toaster {
        padding: 12px 25px;
    }

    .timeline-bg-word {
        font-size: clamp(8rem, 12vw, 12rem) !important;
    }
}

/* Small Mobile Devices (up to 480px) */
@media (max-width: 480px) {
    .morph-line-feckter,
    .morph-line-solution {
        font-size: clamp(1.5rem, 14vw, 3rem) !important;
        letter-spacing: -0.02em;
    }

    .mud-typography-h2 {
        font-size: 1.5rem !important;
    }

    .mud-typography-h3 {
        font-size: 1.2rem !important;
    }

    section.py-20 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .timeline-bg-word {
        font-size: clamp(2.5rem, 18vw, 6rem) !important;
    }

    #portfolio .mud-paper > div[style*="height: 150px"] {
        height: 100px !important;
    }

    .header-toaster {
        padding: 8px 15px;
    }

    .header-logo {
        font-size: 1rem;
    }

    .header-nav {
        display: none;
    }

    .mud-container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .glitch-portrait {
        max-width: 280px !important;
    }
}

/* ========== Glitch Portrait - Digital Consciousness Effect ========== */
.glitch-portrait {
    position: relative;
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 16px;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(0, 229, 255, 0.15);
}

/* All images share base positioning */
.glitch-portrait img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Human base layer - always visible */
.glitch-portrait__base {
    z-index: 1;
}

/* ---- Full Robot Reveal ("AI Thinking" Moment) ---- */
.glitch-portrait__think {
    z-index: 4;
    opacity: 0;
    will-change: opacity;
    animation: aiThink 5s ease-in-out 2s infinite;
}

@keyframes aiThink {
    0%, 100% { opacity: 0; filter: none; }
    /* Pre-glitch flickers */
    14% { opacity: 0; }
    16% { opacity: 0.15; }
    17% { opacity: 0; }
    19% { opacity: 0.3; }
    20% { opacity: 0; }
    21% { opacity: 0.5; }
    22% { opacity: 0.1; }
    /* Full reveal - "AI is thinking" (~2.5s visible) */
    24% { opacity: 1; filter: brightness(1.1); }
    72% { opacity: 1; filter: brightness(1.05); }
    /* Glitch back to human */
    74% { opacity: 0.7; filter: brightness(1.2); }
    75% { opacity: 0.3; }
    76% { opacity: 0.6; }
    77% { opacity: 0; }
}

/* ---- Chromatic Aberration (RGB Split) ---- */
.glitch-portrait__chroma {
    z-index: 3;
    opacity: 0;
    will-change: opacity, transform;
}

.glitch-portrait__chroma--cyan {
    mix-blend-mode: screen;
    filter: hue-rotate(160deg) saturate(3);
    animation: chromaCyan 5s ease 0.5s infinite;
}

.glitch-portrait__chroma--red {
    mix-blend-mode: screen;
    filter: hue-rotate(-30deg) saturate(3);
    animation: chromaRed 5s ease 0.5s infinite;
}

@keyframes chromaCyan {
    0%, 100% { opacity: 0; transform: translateX(0); }
    30.5% { opacity: 0; }
    31% { opacity: 0.4; transform: translateX(4px) translateY(-1px); }
    33% { opacity: 0.3; transform: translateX(2px) translateY(1px); }
    34% { opacity: 0; transform: translateX(0); }
    /* Second burst */
    56% { opacity: 0; }
    56.5% { opacity: 0.3; transform: translateX(3px); }
    58% { opacity: 0; transform: translateX(0); }
}

@keyframes chromaRed {
    0%, 100% { opacity: 0; transform: translateX(0); }
    30.5% { opacity: 0; }
    31% { opacity: 0.4; transform: translateX(-4px) translateY(1px); }
    33% { opacity: 0.3; transform: translateX(-2px) translateY(-1px); }
    34% { opacity: 0; transform: translateX(0); }
    /* Second burst */
    56% { opacity: 0; }
    56.5% { opacity: 0.3; transform: translateX(-3px); }
    58% { opacity: 0; transform: translateX(0); }
}

/* ---- Scan Lines Overlay ---- */
.glitch-portrait__scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    opacity: 0;
    animation: scanlineFlash 5s linear infinite;
}

@keyframes scanlineFlash {
    0%, 100% { opacity: 0; }
    30% { opacity: 0; }
    31% { opacity: 0.8; }
    37% { opacity: 0.6; }
    38% { opacity: 0; }
    55% { opacity: 0; }
    56% { opacity: 0.7; }
    61% { opacity: 0.5; }
    62% { opacity: 0; }
}

/* ---- Cyan Glow Border Pulse ---- */
.glitch-portrait__glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 11;
    pointer-events: none;
    border-radius: 16px;
    box-shadow: inset 0 0 30px rgba(0, 229, 255, 0), 0 0 20px rgba(0, 229, 255, 0);
    animation: glowPulse 5s ease infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: inset 0 0 30px rgba(0, 229, 255, 0), 0 0 20px rgba(0, 229, 255, 0); }
    30% { box-shadow: inset 0 0 30px rgba(0, 229, 255, 0), 0 0 20px rgba(0, 229, 255, 0); }
    31% { box-shadow: inset 0 0 40px rgba(0, 229, 255, 0.15), 0 0 30px rgba(0, 229, 255, 0.2); }
    37% { box-shadow: inset 0 0 35px rgba(0, 229, 255, 0.1), 0 0 25px rgba(0, 229, 255, 0.15); }
    38% { box-shadow: inset 0 0 30px rgba(0, 229, 255, 0), 0 0 20px rgba(0, 229, 255, 0); }
    /* AI thinking glow - synced with aiThink at ~52-58% of its 18s cycle */
    55% { box-shadow: inset 0 0 30px rgba(0, 229, 255, 0), 0 0 20px rgba(0, 229, 255, 0); }
    56% { box-shadow: inset 0 0 50px rgba(0, 229, 255, 0.2), 0 0 40px rgba(0, 229, 255, 0.25); }
    61% { box-shadow: inset 0 0 45px rgba(0, 229, 255, 0.15), 0 0 35px rgba(0, 229, 255, 0.2); }
    62% { box-shadow: inset 0 0 30px rgba(0, 229, 255, 0), 0 0 20px rgba(0, 229, 255, 0); }
}

/* ---- Reduced Motion: Disable Glitch for accessibility ---- */
@media (prefers-reduced-motion: reduce) {
    .glitch-portrait__think,
    .glitch-portrait__chroma,
    .glitch-portrait__scanlines,
    .glitch-portrait__glow {
        animation: none !important;
        opacity: 0 !important;
    }
}