/* Upside Down World - Stranger Things inspired */
:root {
    --ud-bg-dark: #0A0E17;
    --ud-bg-darker: #050810;
    --ud-red-primary: #8B2635;
    --ud-red-accent: #FF2A2A;
    --ud-red-highlight: #FF6B35;
    --ud-text-decay: #B8B0A8;
    --ud-border-decay: #5A4A42;
    --ud-particle-color: rgba(139, 38, 53, 0.3);
}

body.upside-down {
    background-color: var(--ud-bg-dark);
    color: var(--ud-text-decay);
    position: relative;
    overflow-x: hidden;
}

/* Vignette effect */
body.upside-down::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.8) 70%, rgba(0,0,0,0.95) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Red tint overlay */
body.upside-down::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(139, 38, 53, 0.03);
    pointer-events: none;
    z-index: 1;
}

/* Top Navigation */
body.upside-down .top-nav {
    background: rgba(10, 14, 23, 0.9);
    border-bottom: 1px solid var(--ud-red-primary);
    box-shadow: 0 2px 12px 0 rgba(139, 38, 53, 0.3);
}

body.upside-down .nav-left h1 {
    color: var(--ud-red-highlight);
    text-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
}

/* Bulb Button - glowing 3D立体发光 */
body.upside-down .bulb-btn {
    background: linear-gradient(145deg, #fff9e6, #ffecb3);
    border: none;
    box-shadow:
        0 0 30px #ff4500,
        0 0 60px rgba(255, 69, 0, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 0 rgba(255, 69, 0, 0.3);
    animation: bulb-pulse 1.5s infinite alternate;
    transform: translateY(0);
}

body.upside-down .bulb-btn::before {
    background: linear-gradient(145deg, #ffefc6, #fff9e6);
    box-shadow:
        inset 0 2px 4px rgba(255, 215, 0, 0.4),
        inset 0 -2px 4px rgba(255, 255, 255, 0.9);
}

body.upside-down .bulb-btn .iconify {
    color: #ff4500;
    filter: drop-shadow(0 0 6px rgba(255, 69, 0, 0.8));
    animation: icon-pulse 1s infinite alternate;
}

@keyframes bulb-pulse {
    0% {
        box-shadow:
            0 0 30px #ff4500,
            0 0 60px rgba(255, 69, 0, 0.5),
            inset 0 2px 0 rgba(255, 255, 255, 0.9),
            inset 0 -2px 0 rgba(255, 69, 0, 0.3);
        transform: translateY(0);
    }
    100% {
        box-shadow:
            0 0 40px #ff2a2a,
            0 0 80px rgba(255, 42, 42, 0.6),
            inset 0 2px 0 rgba(255, 255, 255, 1),
            inset 0 -2px 0 rgba(255, 42, 42, 0.4);
        transform: translateY(-2px);
    }
}

@keyframes icon-pulse {
    0% {
        filter: drop-shadow(0 0 6px rgba(255, 69, 0, 0.8));
        transform: scale(1);
    }
    100% {
        filter: drop-shadow(0 0 12px rgba(255, 42, 42, 1));
        transform: scale(1.05);
    }
}

/* AI Button */
body.upside-down .ai-btn {
    background: rgba(139, 38, 53, 0.2);
    border-color: var(--ud-red-primary);
    color: var(--ud-red-highlight);
}

body.upside-down .ai-btn:hover {
    background: rgba(139, 38, 53, 0.4);
    box-shadow: 0 0 12px var(--ud-red-accent);
}

/* Sidebar */
body.upside-down .sidebar {
    background: rgba(10, 14, 23, 0.8);
    border-right: 1px solid var(--ud-red-primary);
    box-shadow: 4px 0 12px rgba(139, 38, 53, 0.2);
}

body.upside-down .avatar {
    border-color: var(--ud-red-highlight);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
    filter: sepia(0.3) hue-rotate(-10deg);
}

body.upside-down .job-title {
    color: #B8B0A8;
}

body.upside-down .basic-info h3,
body.upside-down .quick-nav h3 {
    color: var(--ud-red-highlight);
}

body.upside-down .quick-nav a {
    color: #B8B0A8;
    border-left: 3px solid transparent;
}

body.upside-down .quick-nav a:hover {
    background: rgba(139, 38, 53, 0.2);
    color: var(--ud-red-highlight);
    border-left-color: var(--ud-red-highlight);
}

/* Tabs */
body.upside-down .tab-header {
    border-bottom-color: var(--ud-red-primary);
}

body.upside-down .tab-link {
    color: #B8B0A8;
    position: relative;
    overflow: hidden;
}

body.upside-down .tab-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: var(--ud-red-accent);
    transition: left 0.3s;
}

body.upside-down .tab-link:hover {
    color: var(--ud-red-highlight);
}

body.upside-down .tab-link:hover::after {
    left: 0;
}

body.upside-down .tab-link.active {
    color: var(--ud-red-accent);
    border-bottom-color: var(--ud-red-accent);
}

body.upside-down .core-description {
    background: rgba(10, 14, 23, 0.6);
    border-left-color: var(--ud-red-accent);
    color: #B8B0A8;
    box-shadow: 0 2px 12px 0 rgba(139, 38, 53, 0.3);
    border: 1px solid var(--ud-border-decay);
    position: relative;
    overflow: hidden;
}

body.upside-down .core-description::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, var(--ud-red-primary), transparent);
    z-index: -1;
    animation: border-glow 3s linear infinite;
}

@keyframes border-glow {
    0% { opacity: 0.3; }
    50% { opacity: 0.7; }
    100% { opacity: 0.3; }
}

/* Cards */
body.upside-down .project-card,
body.upside-down .timeline-item,
body.upside-down .project-item,
body.upside-down .skill-category {
    background: rgba(10, 14, 23, 0.6);
    border: 1px solid var(--ud-border-decay);
    box-shadow: 0 2px 12px 0 rgba(139, 38, 53, 0.2);
    color: #B8B0A8;
    position: relative;
    overflow: hidden;
}

body.upside-down .project-card::before,
body.upside-down .timeline-item::before,
body.upside-down .project-item::before,
body.upside-down .skill-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ud-red-accent), transparent);
}

body.upside-down .project-card:hover {
    box-shadow: 0 8px 24px rgba(139, 38, 53, 0.4);
    border-color: var(--ud-red-accent);
}

body.upside-down .project-card img {
    filter: sepia(0.4) contrast(1.1) brightness(0.8);
}

body.upside-down .project-tag {
    background: rgba(139, 38, 53, 0.3);
    color: #FFA07A;
}

/* Timeline */
body.upside-down .timeline::before {
    background: var(--ud-red-primary);
}

body.upside-down .timeline-item::before {
    background: var(--ud-red-accent);
    box-shadow: 0 0 0 2px var(--ud-bg-dark), 0 0 8px var(--ud-red-accent);
}

/* Headers */
body.upside-down section h2 {
    color: var(--ud-red-highlight);
    border-bottom-color: var(--ud-red-primary);
    text-shadow: 0 0 6px rgba(255, 107, 53, 0.4);
}

/* AI Sidebar */
body.upside-down .ai-sidebar {
    background: rgba(10, 14, 23, 0.95);
    border-left-color: var(--ud-red-primary);
}

body.upside-down .ai-header {
    border-bottom-color: var(--ud-red-primary);
}

body.upside-down .message.assistant {
    background: rgba(139, 38, 53, 0.2);
    color: #B8B0A8;
    border: 1px solid var(--ud-border-decay);
}

body.upside-down .message.user {
    background: var(--ud-red-primary);
    color: white;
}

body.upside-down .ai-input textarea {
    background: rgba(10, 14, 23, 0.7);
    border-color: var(--ud-red-primary);
    color: #B8B0A8;
}

body.upside-down .ai-input button {
    background: var(--ud-red-primary);
}

body.upside-down .ai-input button:hover {
    background: var(--ud-red-accent);
}

body.upside-down .quick-tip {
    background: rgba(139, 38, 53, 0.3);
    color: #FFA07A;
}

body.upside-down .quick-tip:hover {
    background: rgba(139, 38, 53, 0.5);
}

/* Floating AI Button */
body.upside-down .ai-float-btn {
    background: var(--ud-red-primary);
    box-shadow: 0 4px 20px rgba(139, 38, 53, 0.5);
}

body.upside-down .notification-dot {
    background: var(--ud-red-accent);
    box-shadow: 0 0 8px var(--ud-red-accent);
}

/* Core Info Overlay */
body.upside-down .core-info-overlay {
    display: block;
    background: rgba(5, 8, 16, 0.95);
    border-color: var(--ud-red-accent);
    box-shadow: 0 0 40px rgba(255, 42, 42, 0.5);
    animation: overlay-float 6s ease-in-out infinite;
}

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

body.upside-down .core-info-content h2 {
    color: var(--ud-red-accent);
    text-shadow: 0 0 10px rgba(255, 42, 42, 0.7);
}

/* Text character fragmentation - will be controlled by JS */
.char-fragment {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    font-family: 'Rubik Glitch', monospace;
    color: var(--ud-red-highlight);
    text-shadow: 0 0 4px rgba(255, 107, 53, 0.8);
    opacity: 0;
}

/* Particle effects */
.ash-particle {
    position: fixed;
    width: 2px;
    height: 2px;
    background: var(--ud-particle-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

/* Glitch effect on avatar */
body.upside-down .avatar {
    animation: glitch-avatar 5s infinite;
}

@keyframes glitch-avatar {
    0%, 100% { filter: sepia(0.3) hue-rotate(-10deg); }
    95% { filter: sepia(0.3) hue-rotate(-10deg); }
    96% { filter: sepia(0.3) hue-rotate(90deg) brightness(1.5); }
    97% { filter: sepia(0.3) hue-rotate(-10deg); }
    98% { filter: sepia(0.3) hue-rotate(180deg) contrast(2); }
    99% { filter: sepia(0.3) hue-rotate(-10deg); }
}

/* TV static overlay */
.tv-static {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
    opacity: 0.05;
    pointer-events: none;
    z-index: 3;
    animation: static-move 0.1s infinite;
}

@keyframes static-move {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Bio‑organic UI elements */
.bio-border {
    border-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='M0,0 L100,0 L100,100 L0,100 Z' fill='none' stroke='%238B2635' stroke-width='2' stroke-dasharray='5,5'/%3E%3C/svg%3E") 1;
}

body.upside-down .project-card,
body.upside-down .skill-category {
    border-image-slice: 1;
    border-image-width: 1;
    border-image-outset: 0;
    border-image-source: 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='M0,0 L100,0 L100,100 L0,100 Z' fill='none' stroke='%238B2635' stroke-width='2' stroke-dasharray='5,5'/%3E%3C/svg%3E");
}

/* Pulsing glow for important elements */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 5px rgba(139, 38, 53, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 42, 42, 0.8); }
    100% { box-shadow: 0 0 5px rgba(139, 38, 53, 0.5); }
}

body.upside-down .core-info-overlay {
    animation: pulse-glow 2s infinite;
}