:root {
    --primary: #6366f1;
    --secondary: #8b5cf6;
    --accent: #00ffff;
    --dark-bg: #0f0f1e;
    --darker-bg: #0a0a14;
    --card-bg: rgba(30, 30, 60, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--dark-bg);
    font-family: 'Inter', sans-serif;
    color: #e2e8f0;
    overflow-x: hidden;
    line-height: 1.6;
}

.font-orbitron {
    font-family: 'Orbitron', sans-serif;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.4);
    border-color: rgba(99, 102, 241, 0.4);
}

.neon-text {
    color: var(--accent);
    text-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent);
}

.gradient-border {
    position: relative;
    background: linear-gradient(var(--darker-bg), var(--darker-bg)) padding-box,
                linear-gradient(90deg, var(--primary), var(--secondary)) border-box;
    border: 2px solid transparent;
}

.hero-pattern {
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 20%);
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.nav-active {
    color: white;
    font-weight: 600;
    position: relative;
}

.nav-active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

.portfolio-filter-btn {
    padding: 8px 20px;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.portfolio-filter-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: white;
}

.portfolio-filter-btn.active {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    border-color: rgba(99, 102, 241, 0.4);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--darker-bg);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 32px;
}

.modal-close {
    background: transparent;
    border: none;
    color: #a5b4fc;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.article-content {
    line-height: 1.8;
}

.article-content h1,
.article-content h2,
.article-content h3 {
    font-family: 'Orbitron', sans-serif;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: white;
}

.article-content h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.article-content h2 {
    font-size: 1.5rem;
    color: var(--accent);
}

.article-content h3 {
    font-size: 1.25rem;
}

.article-content p {
    margin-bottom: 1.5rem;
    color: #cbd5e1;
}

.article-content code {
    background: rgba(99, 102, 241, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #a5b4fc;
}

.article-content pre {
    background: rgba(15, 23, 42, 0.8);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: #94a3b8;
    font-style: italic;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--dark-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loader {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    border: 3px solid;
    border-color: var(--primary) var(--primary) transparent transparent;
    animation: rotation 1s linear infinite;
}

.loader::after,
.loader::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid;
    border-color: transparent transparent var(--secondary) var(--secondary);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    animation: rotationBack 0.5s linear infinite;
    transform-origin: center center;
}

.loader::before {
    width: 40px;
    height: 40px;
    border-color: var(--accent) var(--accent) transparent transparent;
    animation: rotation 1.5s linear infinite;
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes rotationBack {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

.section-loading {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-loaded {
    opacity: 1;
    transform: translateY(0);
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* МОБИЛЬНОЕ МЕНЮ - ИСПРАВЛЕННЫЕ СТИЛИ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(10px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--darker-bg);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 1px solid rgba(99, 102, 241, 0.2);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--darker-bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.mobile-menu-content {
    padding: 1.5rem;
    padding-top: 0;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.mobile-menu-link {
    display: block;
    padding: 1rem 1.25rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 1.125rem;
    border: 1px solid transparent;
}

.mobile-menu-link:hover,
.mobile-menu-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: white;
    border-left: 4px solid var(--primary);
    transform: translateX(-2px);
}

.mobile-menu-close {
    background: transparent;
    border: none;
    color: #a5b4fc;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.mobile-menu-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .grid {
        gap: 1rem;
    }

    .glass-card {
        padding: 1.5rem;
    }

    .modal-content {
        width: 95%;
        padding: 1rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .mobile-menu {
        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 480px) {
    .mobile-menu {
        width: 100%;
        max-width: 280px;
    }

    .mobile-menu-link {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
}

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0 0 0.5rem 0.5rem;
    z-index: 1001;
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 0;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Кнопка "Наверх" */
#scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    z-index: 40;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}

#scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

#scroll-to-top i {
    width: 20px;
    height: 20px;
}