/* ==========================================================================
   Unified Design System - 3 Font Sizes Only
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=PT+Mono&display=swap');

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

:root {
    --bg: #ffffff;
    --bg-alt: #f6f8fa;
    --text: #24292f;
    --text-secondary: #57606a;
    --border: #d0d7de;
    --accent: #0366d6;

    --font-mono: 'PT Mono', monospace;
    --font-text: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Only 3 font sizes */
    --text-lg: 1.05rem;   /* Titles */
    --text-md: 0.91rem;   /* Body */
    --text-sm: 0.79rem;   /* Meta */

    --space: 1rem;
    --radius: 6px;
}

html {
    scroll-behavior: smooth;
    font-size: 110%;
}

body {
    font-family: var(--font-text);
    font-size: var(--text-md);
    color: var(--text);
    line-height: 1.5;
    background: var(--bg);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

/* ==========================================================================
   Layout
   ========================================================================== */

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

section {
    padding: calc(var(--space) * 3) 0;
    overflow: visible;
}

section:nth-child(even) {
    background: var(--bg-alt);
}

.section-title {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 400;
    margin-bottom: calc(var(--space) * 1.5);
    padding-bottom: var(--space);
    border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: var(--space);
}

.navbar .container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
}

.nav-menu {
    display: flex;
    gap: calc(var(--space) * 1.5);
    align-items: center;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-toggle { display: none; }

/* ==========================================================================
   Language Switcher
   ========================================================================== */

.lang-switcher {
    display: flex;
    gap: 4px;
    margin-left: calc(var(--space) * 1.5);
    padding-left: calc(var(--space) * 1.5);
    border-left: 1px solid var(--border);
}

.lang-btn {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: var(--text);
    background: var(--bg-alt);
}

.lang-btn.active {
    color: var(--accent);
    background: rgba(3, 102, 214, 0.1);
    border-color: var(--accent);
}

/* ==========================================================================
   Floating Section Nav
   ========================================================================== */

.section-nav {
    position: fixed;
    left: var(--space);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    padding: var(--space);
}

.section-nav-item {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: opacity 0.3s ease;
}

.section-nav-item:hover {
    opacity: 1 !important;
    text-decoration: none;
}

.section-nav-item.active {
    color: var(--accent);
    opacity: 1 !important;
}

@media (max-width: 1200px) {
    .section-nav { display: none; }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
    padding-top: calc(var(--space) * 6);
    padding-bottom: calc(var(--space) * 3);
    text-align: center;
}

.hero-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin-bottom: var(--space);
}

.hero-title {
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    font-weight: 400;
    margin-bottom: 4px;
}

.hero-subtitle,
.hero-location {
    font-size: var(--text-md);
    color: var(--text-secondary);
}

.hero-actions {
    margin-top: calc(var(--space) * 1.5);
    display: flex;
    gap: var(--space);
    justify-content: center;
    flex-wrap: wrap;
}

.cta-button {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}

.cta-button:hover {
    border-color: var(--text);
    text-decoration: none;
}

.cta-button.cta-primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

/* ==========================================================================
   Unified Card System
   ========================================================================== */

.card {
    padding: var(--space);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    margin: 0;
}

.card + .card {
    margin-top: 0;
}

/* Stacked cards (not in grid) */
.publications-content .card + .card,
#experienceTimeline .card + .card,
#educationGrid .card + .card {
    margin-top: var(--space);
}

.card-horizontal {
    display: flex;
    gap: var(--space);
    align-items: center;
}

.card-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.card-logo-link {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.card-logo-link:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

.card-body {
    flex: 1;
    min-width: 0;
}

.card-title {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    line-height: 1.3;
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.card-date {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.card-text {
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.4;
}

.card-quote {
    font-size: var(--text-sm);
    font-style: italic;
    color: var(--text-secondary);
    margin: 4px 0;
}

.card-image {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 8px;
}

/* Card Grids */
.position-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space);
    align-items: stretch;
}

.position-grid .card {
    height: 80px;
    display: flex;
    align-items: center;
    margin: 0;
}

.values-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space);
    align-items: stretch;
}

.values-content .card {
    height: 210px;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space);
}

.card-achievement {
    text-align: center;
    padding: 8px;
}

.card-achievement .card-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin: 0 auto 6px;
}

.card-achievement .card-title {
    font-size: var(--text-sm);
    margin-bottom: 2px;
}

.card-achievement .card-text {
    font-size: var(--text-sm);
}

/* ==========================================================================
   Skills
   ========================================================================== */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: calc(var(--space) * 2);
    overflow: visible;
}

.skill-category {
    overflow: visible;
}

.skill-category h3 {
    font-family: var(--font-mono);
    font-size: var(--text-md);
    margin-bottom: var(--space);
    font-weight: 400;
}

.skills-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
}

.skill-bar-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.skill-bar-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.skill-name { color: var(--text); }
.skill-value { color: var(--text-secondary); }

.skill-bar-wrapper {
    height: 6px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    background: var(--text);
    width: 0;
    transition: width 1s ease-out;
}

.skill-bar-fill.animated {
    width: var(--skill-width);
}

/* Radar Chart */
.radar-chart-container {
    display: flex;
    justify-content: center;
    padding: var(--space);
    overflow: visible;
}

.radar-chart {
    overflow: visible;
}

.radar-chart { max-width: 100%; }
.radar-level { fill: none; stroke: var(--border); stroke-width: 1; }
.radar-axis { stroke: var(--border); stroke-width: 1; }
.radar-label { fill: var(--text); font-size: var(--text-sm); font-family: var(--font-mono); }
.radar-area { fill: var(--text); fill-opacity: 0.15; stroke: var(--text); stroke-width: 2; }
.radar-point { fill: var(--text); }

/* ==========================================================================
   Videos
   ========================================================================== */

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space);
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin-bottom: 8px;
    border-radius: var(--radius);
    overflow: hidden;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ==========================================================================
   Publications
   ========================================================================== */

.publications-header {
    margin-bottom: var(--space);
    font-size: var(--text-md);
}

.publications-content .card {
    border-left: 3px solid var(--border);
}

/* ==========================================================================
   Principles & About
   ========================================================================== */

.about-content {
    max-width: 100%;
}

.about-content p {
    margin-bottom: var(--space);
    font-size: var(--text-md);
    line-height: 1.6;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: calc(var(--space) / 2);
}

.chip {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 4px 12px;
    background: rgba(3, 102, 214, 0.1);
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
}

.principles-content {
    max-width: 100%;
}

.principles-section {
    margin-bottom: var(--space);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.principles-section:last-child {
    margin-bottom: 0;
}

.principles-header {
    display: flex;
    align-items: center;
    padding: var(--space);
    cursor: pointer;
    transition: background 0.2s ease;
}

.principles-header:hover {
    background: var(--bg-alt);
}

.principles-subtitle {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 400;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    white-space: nowrap;
    transition: all 0.4s ease;
}

.principles-section.open .principles-subtitle {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

.principles-toggle {
    margin-left: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.principles-section.open .principles-toggle {
    transform: rotate(180deg);
}

.principles-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease;
}

.principles-section.open .principles-body {
    grid-template-rows: 1fr;
}

.principles-body-inner {
    overflow: hidden;
}

.principles-section.open {
    display: flex;
}

.principles-section.open .principles-header {
    width: 60px;
    flex-shrink: 0;
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--space);
}

.principles-section.open .principles-toggle {
    display: none;
}

.principles-section.open .principles-body {
    flex: 1;
    display: block;
    padding: var(--space);
    padding-left: 0;
}

.principles-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space);
}

.principles-list .card {
    border-left: 3px solid var(--border);
}

.principles-list .card + .card {
    margin-top: var(--space);
}

.principles-list .card-title {
    font-size: var(--text-sm);
    font-family: var(--font-text);
    font-weight: 400;
}

@media (max-width: 768px) {
    .principles-section.open {
        flex-direction: column;
    }

    .principles-section.open .principles-header {
        width: auto;
        flex-direction: row;
    }

    .principles-section.open .principles-subtitle {
        writing-mode: horizontal-tb;
        transform: none;
    }

    .principles-section.open .principles-body {
        padding: var(--space);
        padding-top: 0;
    }
}

/* ==========================================================================
   Contacts
   ========================================================================== */

#contacts {
    padding-bottom: 50vh;
}

.contacts-grid {
    display: flex;
    gap: var(--space);
    flex-wrap: wrap;
}

.contact-link {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.contact-link svg {
    flex-shrink: 0;
}

.contact-link:hover {
    border-color: var(--accent);
    text-decoration: none;
}

.email-text {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.copy-btn.copied {
    border-color: #2da44e;
    color: #2da44e;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
    background: var(--bg-alt);
    padding: calc(var(--space) * 2) 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* ==========================================================================
   Loading
   ========================================================================== */

.loading {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner::before {
    content: 'Загрузка...';
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Videos */
.videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space);
}

.video-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-card .card-title {
    padding: 8px var(--space);
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
    }

    .nav-toggle span {
        width: 20px;
        height: 2px;
        background: var(--text);
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: var(--space);
        border-bottom: 1px solid var(--border);
    }

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

    .lang-switcher {
        margin-left: auto;
        padding-left: 0;
        border-left: none;
    }

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

    .values-content {
        grid-template-columns: 1fr;
    }

    .achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 480px) {
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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