/* Основа */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent: #667eea;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.fullscreen-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

/* Герой */
#hero {
    background: linear-gradient(rgba(0,0,0,0.8), rgba(0,0,0,0.9));
}

.avatar-container {
    margin: 0 auto 2rem;
    width: 100px;
    height: 100px;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.1);
    transition: border-color 0.3s ease;
}

.avatar:hover {
    border-color: rgba(255,255,255,0.3);
}

.title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.tagline {
    font-size: 1.2rem;
    font-style: italic;
    opacity: 0.6;
    margin-bottom: 3rem;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.arrow {
    width: 2px;
    height: 20px;
    background: var(--text-secondary);
    margin: 0.5rem auto 0;
    position: relative;
}

.arrow::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: -3px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
}

/* Таймлайн */
#timeline {
    position: relative;
    padding: 10rem 0;
    background: var(--bg-secondary);
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-gradient);
    transform: translateX(-50%);
}

.timeline-item {
    position: relative;
    margin-bottom: 6rem;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-content {
    width: 45%;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.timeline-content.left {
    margin-left: 0;
    margin-right: auto;
}

.timeline-content.right {
    margin-left: auto;
    margin-right: 0;
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 2rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-gradient);
}

.timeline-content.left::before {
    right: -60px;
}

.timeline-content.right::before {
    left: -60px;
}

.year {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.timeline-content h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.timeline-content p {
    opacity: 0.8;
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.timeline-content em {
    color: var(--accent);
    font-style: italic;
}

/* Ключевые проекты */
#key-projects {
    padding: 8rem 0;
    background: var(--bg-primary);
}

#key-projects h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    font-weight: 300;
}

#key-projects .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

#key-projects .project-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#key-projects .project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0.1;
    transition: left 0.3s ease;
}

#key-projects .project-card:hover::before {
    left: 0;
}

#key-projects .project-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.2);
}

#key-projects .project-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--accent);
    position: relative;
    z-index: 1;
}

#key-projects .project-card p {
    opacity: 0.8;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* Секция Навыки и Образование */
#skills-edu {
    padding: 6rem 0;
    background: var(--bg-secondary);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
}

.skills-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.skills-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.skill-category h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    font-weight: 500;
}

.skill-category p {
    opacity: 0.7;
    line-height: 1.5;
}

/* Цитата */
#quote {
    background: linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.8));
}

.quote-text {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-style: italic;
    font-weight: 300;
    line-height: 1.4;
    max-width: 800px;
    opacity: 0.9;
}

/* Проекты в работе */
#projects {
    padding: 8rem 0;
    background: var(--bg-primary);
}

#projects h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 4rem;
    font-weight: 300;
}

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

#projects .project-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

#projects .project-card:hover {
    transform: translateY(-5px);
}

#projects .project-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

/* Секция О себе */
#about {
    padding: 6rem 0;
    background: var(--bg-secondary);
    text-align: center;
}

#about h2 {
    font-size: 2.5rem;
    margin-bottom: 4rem;
    font-weight: 300;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.about-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
}

.about-item:hover {
    transform: translateY(-5px);
}

.about-item h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.about-item p {
    opacity: 0.8;
    line-height: 1.5;
}

/* Контакты */
#contacts {
    padding: 6rem 0;
    text-align: center;
    background: var(--bg-primary);
}

#contacts h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 300;
}

#contacts > .container > p {
    opacity: 0.7;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.social-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.social-link:hover {
    background: var(--accent-gradient);
    border-color: transparent;
}

.footer-note {
    opacity: 0.4;
    font-size: 0.9rem;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 1s ease-out forwards;
}


/* Поэтическое форматирование */
.poetic-block {
    margin: 1.5rem 0;
    text-align: center;
}

.poetic-line {
    line-height: 1.8;
    opacity: 0.9;
    margin-bottom: 0.3rem;
    font-weight: 300;
}

.timeline-content .poetic-line {
    opacity: 0.8;
}

.project-card .poetic-line,
.about-item .poetic-line,
.skills-card .poetic-line {
    opacity: 0.7;
}


/* AI Chat Widget */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

#chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    color: white;
    border: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#chat-button:hover, #chat-button:active {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
}

#chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 15px;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 10001;
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
}

.chat-header {
    background: #2a2a2a;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

#close-chat {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.3s ease;
}

#close-chat:hover, #close-chat:active {
    color: white;
}

#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #667eea #2a2a2a;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    animation: messageSlide 0.3s ease;
    word-wrap: break-word;
    font-size: 14px;
    transform: translateZ(0);
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background: #667eea;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background: #2a2a2a;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    border: 1px solid #333;
}

.typing-indicator {
    align-self: flex-start;
    background: #2a2a2a;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    display: flex;
    gap: 4px;
    border: 1px solid #333;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.chat-input-container {
    display: flex;
    padding: 15px 20px;
    gap: 10px;
    border-top: 1px solid #333;
    flex-shrink: 0;
    background: #1a1a1a;
    border-radius: 0 0 15px 15px;
}

#chat-input {
    flex: 1;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 12px 16px;
    color: white;
    outline: none;
    font-size: 14px;
    -webkit-appearance: none;
    transition: border-color 0.3s ease;
}

#chat-input:focus {
    border-color: #667eea;
}

#send-message {
    background: #667eea;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.3s ease;
    font-size: 16px;
}

#send-message:hover, #send-message:active {
    background: #5a6fd8;
    transform: scale(1.05);
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .timeline-line {
        left: 30px;
    }

    .timeline-content {
        width: calc(100% - 80px);
        margin-left: 80px !important;
        margin-right: 0 !important;
    }

    .timeline-content::before {
        left: -50px !important;
        right: auto !important;
    }

    .social-links {
        flex-direction: column;
        align-items: center;
    }

    .skills-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .skills-card {
        padding: 1.5rem;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
    }
    
    .about-item {
        padding: 1.5rem;
    }

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

    /* Мобильный чат */
    #chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    #chat-button {
        width: 55px;
        height: 55px;
    }
    
    #chat-window {
        bottom: 75px;
        right: 10px;
        left: 10px;
        width: calc(100vw - 20px);
        height: 60vh;
        max-height: 500px;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 90%;
        font-size: 13px;
    }
    
    .social-links {
        gap: 1rem;
    }
    
    .social-link {
        padding: 0.7rem 1.2rem;
        font-size: 0.85rem;
    }
    
    #key-projects .project-card,
    #projects .project-card {
        padding: 1.5rem;
    }
    
    .timeline-content {
        padding: 1.5rem;
    }
    
    .skills-card {
        padding: 1.25rem;
    }
    
    #chat-window {
        height: 65vh;
    }
}
