/**
 * Основные стили сайта
 * Сброс, базовые элементы, layout
 */

/* === Сброс стилей === */
*,
*::before,
*::after {
    /*box-sizing: border-box;*/
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

html {
    overflow-x: hidden;
}

/* === Фон с частицами === */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-particles);
    pointer-events: none;
}

/* === Навигация === */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border-color);
    z-index: var(--z-navbar);
    transition: all var(--transition-base);
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* === Логотип === */
.logo {
    position: relative;
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    min-width: 143px;
    line-height: 1;
}

.logo-base {
    display: inline-block;
    transition: opacity var(--transition-slow), filter var(--transition-slow);
}

.logo-s,
.logo-u {
    position: absolute;
    top: 0;
    transition: transform var(--transition-slower) ease-in-out;
}

.logo-ystem,
.logo-nited {
    position: absolute;
    top: 5px;
    font-size: 1rem;
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transition: opacity var(--transition-base), clip-path var(--transition-slower) ease-in-out;
}

/* Цвета S и U в зависимости от темы */
.logo-s,
.logo-u {
    color: var(--color-primary);
}

/* Состояние логотипа при активации (скролл) */
.logo.active .logo-base {
    opacity: 0;
    filter: blur(2px);
}

.logo.active .logo-ystem,
.logo.active .logo-nited {
    opacity: 1;
}

/* === Мобильное меню === */
.navbar-toggle {
    /* Бургер виден всегда, независимо от ширины экрана */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.navbar-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* === Меню навигации === */
.navbar-menu {
    /* Меню всегда в режиме "гамбургера" */
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    display: flex;
    align-items: stretch;
    gap: 8px;
    background: var(--bg-navbar);
    backdrop-filter: blur(var(--glass-blur));
    padding: 20px;
    flex-direction: column;
    border-bottom: 1px solid var(--border-color);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    max-height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    transition: all var(--transition-base);
}

.navbar-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    justify-content: flex-start;
}

.nav-link:hover {
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-bg);
}

.nav-icon {
    font-size: 1.1rem;
}

.nav-link-small {
    font-size: 0.85rem;
    padding: 6px 12px;
}

.nav-divider {
    width: 100%;
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.nav-user {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
}

.nav-user-name {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* === Переключатель темы === */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.theme-icon {
    position: absolute;
    font-size: 1.2rem;
    transition: all var(--transition-base);
}

.theme-icon-light {
    opacity: 1;
    transform: translateY(0);
}

.theme-icon-dark {
    opacity: 0;
    transform: translateY(20px);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: translateY(-20px);
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: translateY(0);
}

/* === Основной контент === */
.main-content {
    min-height: calc(100vh - var(--navbar-height));
    padding-top: var(--navbar-height);
    position: relative;
    z-index: var(--z-content);
}

/* === Контейнер === */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* === Секции === */
.section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* === Hero секция === */
.hero {
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.hero-content {
    text-align: center;
    max-width: 800px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.hero-title-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.7;
}

/* === Футер === */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px 0;
}

.footer-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-base);
}

.footer-link:hover {
    color: var(--color-primary);
}

/* === Параллакс элементы === */
.parallax-elements {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: var(--z-parallax);
    overflow: hidden;
    max-width: 100vw;
}

.parallax-tag {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--border-color);
    opacity: 0.4;
    transition: transform 0.1s linear;
}

.parallax-tag:nth-child(1) { top: 15%; left: 5%; }
.parallax-tag:nth-child(2) { top: 35%; right: 8%; }
.parallax-tag:nth-child(3) { top: 60%; left: 10%; }
.parallax-tag:nth-child(4) { top: 80%; right: 12%; }
.parallax-tag:nth-child(5) { top: 25%; left: 80%; }

/* === Контейнер для предотвращения overflow === */
.main-content,
.section,
.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* === Плейсхолдеры для изображений === */
.image-placeholder {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--gradient-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.image-placeholder-square {
    aspect-ratio: 1/1;
}

.image-placeholder-portrait {
    aspect-ratio: 3/4;
}

/* === Адаптивность === */
@media (max-width: 1024px) {
    .section {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 20px 16px;
    }
    
    .section {
        padding: 40px 0;
    }
    
    .section-header {
        margin-bottom: 40px;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
}

/* === Утилиты === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mt-5 { margin-top: 48px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mb-5 { margin-bottom: 48px; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
