/* Современный Reset и Variables */
:root {
    --bg-color: #030305;
    --surface-color: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-primary: #8b5cf6; /* Фиолетовый неон */
    --accent-secondary: #06b6d4; /* Бирюзовый неон */
    --accent-tertiary: #ec4899; /* Розовый неон */
    
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Типографика */
h1, h2, h3, h4, .logo {
    font-family: var(--font-display);
    font-weight: 700;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-accent {
    color: var(--accent-secondary);
}

.text-muted {
    color: var(--text-muted);
}

/* Утилиты Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.min-h-screen {
    min-height: 100vh;
}

.section-padding {
    padding: 6rem 0;
}

.text-center {
    text-align: center;
}

.relative {
    position: relative;
}

/* Glassmorphism утилиты */
.glass {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-nav {
    background: rgba(3, 3, 5, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

/* Фоновые свечения */
.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.glow-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: var(--accent-primary);
}

.glow-2 {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: var(--accent-secondary);
}

/* Навигация */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 0;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--text-main);
}

/* Кнопки */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
}

/* Hero Section */
.hero-content {
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding-top: 5rem; /* Оффсет для навбара */
}

.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-secondary);
    font-weight: 500;
    display: inline-block;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.1;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Projects Section */
.section-header {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    padding: 2rem;
    border-radius: 16px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-5px);
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.project-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.github-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    border-bottom: 1px solid transparent;
}

.github-link:hover {
    color: var(--text-main);
    border-color: var(--text-main);
}

.project-title {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Contacts Section */
.contact-box {
    padding: 4rem 2rem;
    border-radius: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Animations */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =============== MOBILE RESPONSIVE =============== */
@media (max-width: 768px) {
    .section-padding {
        padding: 4rem 0;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions .btn {
        text-align: center;
    }

    .section-title {
        font-size: 1.8rem;
    }

    /* Hide desktop-only controls on mobile */
    .desktop-only {
        display: none !important;
    }

    /* Mobile burger menu: fullscreen overlay */
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(3, 3, 5, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        z-index: 99;
        display: none;
        padding: 2rem;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li a {
        font-size: 1.4rem;
    }

    /* lang + theme row inside mobile menu */
    .mobile-nav-controls {
        display: flex !important;
        align-items: center;
        gap: 1rem;
        margin-top: 0.5rem;
        padding-top: 1.25rem;
        border-top: 1px solid var(--border-color);
        width: 100%;
        justify-content: center;
    }

    .burger-menu {
        z-index: 100;
    }

    /* Hide nav-controls on project pages header on mobile */
    header .nav-controls:not(.desktop-only) {
        display: none;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    /* Spec grid: 2 cols on tablet, 1 on small */
    .spec-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Services: single column */
    .srv-grid {
        grid-template-columns: 1fr;
    }

    /* Service card header: stack icon + title vertically if needed */
    .srv-card-header {
        flex-wrap: wrap;
    }

    .srv-title {
        font-size: 1rem;
        flex: 1;
        min-width: 0;
    }

    /* About section */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-photo-container {
        aspect-ratio: 3/2;
        max-width: 280px;
        margin: 0 auto;
    }

    /* Timeline */
    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        padding-left: 60px;
        padding-right: 0;
    }

    .timeline-item:nth-child(even) {
        padding-left: 60px;
        padding-right: 0;
    }

    .timeline-item::before,
    .timeline-item:nth-child(even)::before {
        left: 12px;
        right: auto;
    }

    /* Contact box */
    .contact-box {
        padding: 2.5rem 1.5rem;
    }

    .contact-links {
        flex-direction: column;
    }

    /* CTA section */
    .flex-center[style*="gap"] {
        flex-direction: column;
        align-items: stretch;
    }

    /* Workflow */
    .workflow-steps {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .spec-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .srv-card {
        padding: 1.25rem;
    }

    .spec-card {
        padding: 1.25rem;
    }

    .nav-controls {
        gap: 0.5rem;
        margin-left: 0.5rem;
    }

    .lang-btn {
        font-size: 0.72rem;
        padding: 0.15rem 0.4rem;
    }
}

/* Стили для детальных страниц (Readme Content) */
.readme-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.readme-content h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.readme-content h3 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.readme-content p {
    margin-bottom: 1.2rem;
    color: var(--text-muted);
}

.readme-content ul, .readme-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

.readme-content li {
    margin-bottom: 0.5rem;
}

.readme-content strong {
    color: var(--text-main);
}

.readme-content pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.lightbox-overlay.active {
    display: flex;
}
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    z-index: 1001;
}
/* Responsive tweak for media layout */
@media (max-width: 600px) {
    .steam-layout {
        grid-template-columns: 1fr;
    }
    .media-gallery, .main-media, .thumbnail-slider {
        width: 100%;
    }
}

.readme-content code {
    font-family: 'Consolas', 'Monaco', monospace;
    color: var(--accent-secondary);
    font-size: 0.95rem;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

.glass-table th, .glass-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
}

.glass-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-weight: 600;
}

/* Steam-like Layout */
.steam-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: start;
}

.steam-layout > div {
    min-width: 0;
}

@media (max-width: 992px) {
    .steam-layout {
        grid-template-columns: 1fr;
    }
}

.media-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.main-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: #0a0a0f;
    border: 2px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.15), 0 8px 32px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.3s ease;
}

.media-placeholder {
    width: 100%;
    height: 100%;
}

.thumbnail-slider {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.thumbnail-slider::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-slider::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.thumbnail {
    width: 140px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    position: relative;
}

.thumbnail::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: transparent;
    transition: background 0.25s ease;
}

.thumbnail:hover {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
}

.thumbnail.active {
    border-color: #8b5cf6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6), 0 0 6px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.project-info-table {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    text-align: left;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.info-value {
    color: var(--text-main);
    font-size: 0.95rem;
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    align-items: center;
}

@media (max-width: 992px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

.about-photo-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.about-photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.about-bio {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.skill-badge {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
}

.skill-badge:hover {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.1);
}

/* Timeline Section */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--accent-primary), var(--accent-secondary), transparent);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    width: 50%;
    padding-right: 3rem;
}

.timeline-item:nth-child(even) {
    margin-left: auto;
    padding-right: 0;
    padding-left: 3rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 2px solid var(--accent-secondary);
    transform: translateY(-50%);
    box-shadow: 0 0 10px var(--accent-secondary);
    z-index: 1;
}

.timeline-item:nth-child(even)::before {
    right: auto;
    left: -8px;
}

.timeline-content {
    padding: 1.5rem;
    border-radius: 16px;
    transition: var(--transition);
}

.timeline-content:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--accent-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timeline-title {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.timeline-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .timeline::before {
        left: 30px;
    }
    
    .timeline-item {
        width: 100%;
        padding-left: 80px;
        padding-right: 0;
    }
    
    .timeline-item:nth-child(even) {
        padding-left: 80px;
    }
    
    .timeline-item::before {
        left: 22px;
        right: auto;
    }
    
    .timeline-item:nth-child(even)::before {
        left: 22px;
    }
}

/* V4 OS Dashboard Updates */

/* Grid Background */
.grid-bg {
    background-color: var(--bg-color);
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -2;
}

/* Nav & Burger */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
}
.burger-menu {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    z-index: 101;
}
.burger-menu span {
    width: 25px;
    height: 2px;
    background-color: var(--text-main);
    transition: var(--transition);
}
@media (max-width: 768px) {
    .burger-menu {
        display: flex;
    }
    .nav-links {
        display: flex;
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background: rgba(3, 3, 5, 0.95);
        backdrop-filter: blur(15px);
        flex-direction: column;
        padding-top: 80px;
        align-items: center;
        transition: right 0.4s ease;
        border-left: 1px solid var(--border-color);
        gap: 1.5rem;
    }
    .nav-links.active {
        right: 0;
    }
}
.nav-links a.active {
    color: var(--accent-secondary);
    border-bottom: 2px solid var(--accent-secondary);
}

/* Hero Panel & Badge */
.pulse-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--accent-secondary);
    border: 1px solid rgba(6, 182, 212, 0.3);
    background: rgba(6, 182, 212, 0.05);
}
.status-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.metrics-overlay {
    position: absolute;
    top: 5rem;
    right: 1.5rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.metric {
    margin-bottom: 0.5rem;
}
.metric:last-child {
    margin-bottom: 0;
}
@media (max-width: 992px) {
    .metrics-overlay { display: none; }
}

/* Specialization */
.spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}
.spec-card {
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
}
.spec-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}
.spec-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.spec-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Project Filters & Mac Bar */
.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: var(--transition);
}
.filter-btn:hover, .filter-btn.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}
.project-card {
    padding: 0;
    overflow: hidden;
}
.mac-titlebar {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}
.mac-dots {
    display: flex;
    gap: 6px;
}
.mac-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.project-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Workflow */
.workflow-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.workflow .step {
    padding: 1.5rem;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}
.step-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.05);
    position: absolute;
    top: -5px;
    right: 10px;
}
.workflow .step h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Terminal Log Timeline */
.terminal-log .timeline-title {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-secondary);
}
.terminal-log .timeline-date {
    font-family: 'JetBrains Mono', monospace;
}

/* Testimonials Placeholder */
.testimonials-placeholder {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.testimonial-card {
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 3px solid var(--accent-primary);
}

/* Mobile-only nav controls (hidden on desktop) */
.mobile-nav-controls {
    display: none;
}

/* Navigation controls layout */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: 2rem;
}
.lang-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}
.lang-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    transition: var(--transition);
}
.lang-btn:hover, .lang-btn.active {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}
.theme-toggle,
#theme-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--accent-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.theme-toggle:hover,
#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

/* Light Theme Override — applied to both html and body */
html.light-theme,
body.light-theme {
    --bg-color: #f0f4f8;
    --surface-color: rgba(255, 255, 255, 0.75);
    --surface-hover: rgba(255, 255, 255, 0.98);
    --border-color: rgba(0, 0, 0, 0.1);
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent-primary: #7c3aed;
    --accent-secondary: #0284c7;
    --accent-tertiary: #db2777;
    background-color: var(--bg-color);
    color: var(--text-main);
}
body.light-theme .glass {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}
body.light-theme .glass-nav {
    background: rgba(248, 250, 252, 0.85);
}
body.light-theme .glow {
    opacity: 0.08; /* Less intense glow for light theme */
}
body.light-theme .grid-bg {
    background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
}
body.light-theme .tag {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}
body.light-theme .mac-titlebar {
    border-bottom: 1px solid var(--border-color);
    background: rgba(255,255,255,0.5);
}
body.light-theme .terminal-header {
    background: #e2e8f0;
    color: #475569;
}
body.light-theme .terminal-body {
    background: #f1f5f9;
}
body.light-theme .terminal-line {
    color: #334155;
}
body.light-theme .lang-switcher,
body.light-theme .theme-toggle,
body.light-theme #theme-toggle {
    background: rgba(0, 0, 0, 0.05);
}
body.light-theme .lang-btn:hover, body.light-theme .lang-btn.active {
    background: rgba(0, 0, 0, 0.1);
}
body.light-theme .pulse-badge {
    background: rgba(2, 132, 199, 0.1);
}
body.light-theme .skill-badge {
    background: rgba(0,0,0,0.03);
}

/* ==================== LIGHTBOX ==================== */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: lightbox-in 0.25s ease;
}

.lightbox-overlay.active {
    display: flex;
}

@keyframes lightbox-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-content {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 80px rgba(139, 92, 246, 0.3), 0 32px 64px rgba(0,0,0,0.8);
    border: 1px solid rgba(139, 92, 246, 0.3);
    cursor: default;
    animation: lightbox-scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightbox-scale {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.lightbox-content img,
.lightbox-content video {
    display: block;
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 1.75rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.4rem;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s, transform 0.2s;
    backdrop-filter: blur(8px);
}
.lightbox-close:hover {
    background: rgba(139, 92, 246, 0.5);
    transform: rotate(90deg) scale(1.1);
}

/* Подсказка "клик для увеличения" на главном медиа */
#mainMediaContainer {
    cursor: zoom-in;
}
#mainMediaContainer:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(139, 92, 246, 0.08);
    border-radius: inherit;
    pointer-events: none;
}

/* Services Section */
.srv-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .srv-grid {
        grid-template-columns: 1fr;
    }
}

.srv-card {
    padding: 2rem;
    border-radius: 16px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.srv-card:hover {
    transform: translateY(-4px);
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.srv-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.srv-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.srv-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}

.srv-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin: 0;
}

/* ==================== MOBILE STABILITY OVERRIDES ==================== */
img,
video,
svg {
    max-width: 100%;
}

.btn,
.filter-btn,
.lang-btn,
.github-link,
.status-badge,
.tag {
    max-width: 100%;
}

.project-title,
.srv-title,
.spec-title,
.timeline-title,
.info-value,
.readme-content,
.hero-subtitle,
.section-subtitle {
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    body {
        width: 100%;
    }

    .fade-in {
        opacity: 1;
        transform: none;
    }

    header {
        padding: 0.75rem 0;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .section-padding {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }

    .min-h-screen {
        min-height: auto;
    }

    .hero {
        min-height: 100svh;
        padding-top: 5rem;
        padding-bottom: 3rem;
    }

    .hero-content {
        width: 100%;
        max-width: 100%;
        padding-top: 2rem;
        gap: 1.25rem;
    }

    .hero-title {
        font-size: clamp(2rem, 11vw, 3rem);
        letter-spacing: 0;
    }

    .hero-subtitle,
    .section-subtitle {
        max-width: 100%;
    }

    .hero-actions,
    .contact-links {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
        min-height: 44px;
        padding: 0.8rem 1rem;
        white-space: normal;
        text-align: center;
    }

    .desktop-only {
        display: none !important;
    }

    .burger-menu {
        display: flex;
        z-index: 102;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        gap: 5px;
        margin-left: auto;
    }

    .burger-menu span {
        flex: 0 0 auto;
    }

    .burger-menu.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .burger-menu.active span:nth-child(2) {
        opacity: 0;
    }

    .burger-menu.active span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .nav-links {
        display: flex;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100dvh;
        padding: 5.5rem 1.25rem 2rem;
        background: rgba(3, 3, 5, 0.97);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        border-left: 0;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 1rem;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.28s ease;
        z-index: 101;
        right: auto;
        left: 0;
    }

    .nav-links.active {
        transform: translateX(0);
        right: auto;
    }

    .nav-links a {
        display: block;
        padding: 0.35rem 0;
        font-size: 1.15rem;
    }

    .nav-links a.active {
        border-bottom: 0;
    }

    .mobile-nav-controls {
        display: flex !important;
        width: 100%;
        max-width: 280px;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
        margin-top: 0.5rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }

    .mobile-nav-controls .lang-switcher {
        flex-wrap: wrap;
        justify-content: center;
    }

    .theme-toggle,
    #theme-toggle,
    #theme-toggle-mobile {
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .project-filters {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0.75rem !important;
    }

    .filter-btn {
        min-height: 42px;
        padding: 0.55rem 0.75rem;
        border-radius: 12px;
    }

    .projects-grid,
    .srv-grid,
    .workflow-steps {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .spec-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .project-card,
    .srv-card,
    .spec-card,
    .workflow .step,
    .timeline-content {
        border-radius: 14px;
    }

    .project-content,
    .srv-card,
    .spec-card,
    .workflow .step,
    .timeline-content {
        padding: 1.25rem;
    }

    .srv-card-header {
        align-items: flex-start;
    }

    .srv-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .srv-features {
        padding-left: 1.1rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-content,
    .about-content h3,
    .about-bio {
        text-align: center;
    }

    .about-photo-container {
        width: min(280px, 100%);
        aspect-ratio: 4 / 5;
        margin: 0 auto;
        border-radius: 18px;
    }

    .timeline {
        padding-top: 0;
        padding-bottom: 0;
    }

    .timeline::before {
        left: 16px;
    }

    .timeline-item,
    .timeline-item:nth-child(even) {
        width: 100%;
        margin-left: 0;
        padding-left: 42px;
        padding-right: 0;
        margin-bottom: 1.5rem;
    }

    .timeline-item::before,
    .timeline-item:nth-child(even)::before {
        left: 9px;
        right: auto;
    }

    main.container[style*="padding-top"] {
        padding-top: 6.5rem !important;
    }

    header nav:not(.nav-container) {
        gap: 0.75rem;
    }

    header nav:not(.nav-container) .logo {
        display: none;
    }

    header nav:not(.nav-container) > div:first-child {
        width: 100%;
        min-width: 0;
    }

    header nav:not(.nav-container) .btn {
        width: auto;
        max-width: 100%;
        min-height: 40px;
        padding: 0.55rem 0.8rem !important;
        font-size: 0.9rem;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .project-detail {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .steam-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 2rem;
    }

    .media-gallery {
        padding: 0.75rem;
        border-radius: 14px;
    }

    .main-media {
        border-radius: 12px;
        border-width: 1px;
    }

    .thumbnail-slider {
        gap: 0.5rem;
        padding-bottom: 0.35rem;
        scroll-snap-type: x proximity;
    }

    .thumbnail {
        width: 104px;
        height: 62px;
        border-radius: 8px;
        scroll-snap-align: start;
    }

    .steam-right .hero-title {
        font-size: clamp(2rem, 11vw, 2.5rem) !important;
        text-align: left;
    }

    .project-info-table {
        padding: 1rem;
    }

    .readme-content {
        font-size: 0.98rem;
        line-height: 1.7;
    }

    .readme-content h2 {
        font-size: 1.45rem;
        margin-top: 2rem;
    }

    .readme-content pre {
        padding: 1rem;
        font-size: 0.85rem;
    }

    .glass-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
    }

    .section-padding {
        padding-top: 3.25rem;
        padding-bottom: 3.25rem;
    }

    .section-header {
        margin-bottom: 2.5rem;
    }

    .section-title {
        font-size: 1.75rem;
        line-height: 1.15;
    }

    .badge,
    .pulse-badge {
        max-width: 100%;
        white-space: normal;
        text-align: left;
    }

    .spec-grid,
    .project-filters {
        grid-template-columns: 1fr;
    }

    .project-header {
        gap: 1rem;
    }

    .project-links {
        min-width: 0;
        text-align: right;
    }

    .project-tags {
        gap: 0.4rem;
    }

    .tag {
        border-radius: 12px;
    }

    .srv-card-header {
        flex-direction: column;
    }

    .lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 40px;
        height: 40px;
        line-height: 40px;
    }

    .lightbox-content,
    .lightbox-content img,
    .lightbox-content video {
        max-width: 94vw;
        max-height: 84vh;
    }
}

.srv-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: auto;
}

.srv-features li {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 1.1rem;
    position: relative;
}

.srv-features li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-secondary);
    font-size: 0.75rem;
    top: 1px;
}
