/* ==========================================================================
   1. Переменные
   ========================================================================== */

:root {
    --ink: #0f172a;
    --ink-soft: #334155;
    --ink-muted: #475569;
    --ink-faint: #64748b;
    --ink-ghost: #94a3b8;

    --line: #cbd5e1;
    --line-soft: #e2e8f0;
    --surface: #f8fafc;
    --surface-alt: #e2e8f0;
    --accent: #0284c7;

    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
}

/* ==========================================================================
   2. База
   ========================================================================== */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background-color: #ffffff;
    padding: 40px 20px;
}

.container {
    max-width: 860px;
    margin: 0 auto;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ==========================================================================
   3. Ссылки
   ========================================================================== */

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

a:hover {
    opacity: 0.7;
}

a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 3px;
}

/* ==========================================================================
   4. Шапка
   ========================================================================== */

.header-section {
    display: flex;
    align-items: flex-start;
    gap: 40px;
    padding-bottom: 60px;
    border-bottom: 1px solid var(--line);
}

.avatar-box {
    flex-shrink: 0;
    width: 240px;
    height: 240px;
    background-color: var(--surface-alt);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.avatar {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    flex: 1;
    min-width: 0;
    min-height: 240px;
}

.bio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.name {
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--ink);
}

.role {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--ink);
}

.contacts-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    font-size: 15px;
}

.contact-item > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.contact-item--location {
    color: var(--ink-soft);
}

.contact-icon {
    display: block;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.relocation-note {
    font-size: 13px;
    color: var(--ink-faint);
}

/* ==========================================================================
   5. Секции и заголовки
   ========================================================================== */

.about-section,
.skills-section,
.projects-section,
.experience-section,
.courses-section,
.education-section {
    padding-top: 48px;
}

.section-title {
    margin-bottom: 16px;
    font-size: 25px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

/* ==========================================================================
   6. Карточки (общая основа)
   ========================================================================== */

.project-card,
.course-card,
.education-card {
    display: flex;
    background-color: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
}

.project-card,
.course-card {
    flex-direction: column;
}

.project-card {
    gap: 16px;
    padding: 24px;
}

.course-card {
    gap: 12px;
    padding: 18px 20px;
}

.education-card {
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
}

/* ==========================================================================
   7. Описания и списки (общие)
   ========================================================================== */

.about-content p,
.project-desc {
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-soft);
}

.project-features,
.experience-features,
.course-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
}

.project-features li,
.experience-features li,
.course-list li {
    position: relative;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.project-features li::before,
.experience-features li::before,
.course-list li::before {
    content: "•";
    position: absolute;
    left: 4px;
    font-weight: 700;
    color: var(--accent);
}

/* ==========================================================================
   8. Теги
   ========================================================================== */

.project-tags,
.experience-tags,
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tags,
.experience-tags {
    padding-top: 4px;
}

.tag {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-soft);
    background-color: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

/* ==========================================================================
   9. О себе
   ========================================================================== */

.about-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ==========================================================================
   10. Навыки
   ========================================================================== */

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.skill-group {
    display: flex;
    align-items: stretch;
    gap: 20px;
}

.skill-group-title {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 150px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--ink);
    text-align: right;
}

.skill-tags {
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   11. Проекты
   ========================================================================== */

.project-card + .project-card {
    margin-top: 28px;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.project-title-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.project-title {
    min-width: 0;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
}

.project-links {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
}

.project-icon {
    display: block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   12. Превью сертификатов
   ========================================================================== */

.certificate-preview {
    display: block;
    flex: 0 0 90px;
    width: 90px;
    max-width: 100%;
    margin-left: auto;
    line-height: 0;
}

.certificate-preview img {
    display: block;
    width: 100%;
    height: auto;
}

/* ==========================================================================
   13. Опыт
   ========================================================================== */

.experience-item {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.experience-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.experience-company {
    font-size: 18px;
    line-height: 1.3;
    font-weight: 700;
}

.experience-role {
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
    color: var(--ink);
}

.experience-period,
.project-period {
    font-size: 14px;
    color: var(--ink-faint);
}

/* ==========================================================================
   14. Курсы
   ========================================================================== */

.courses-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.course-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.course-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.course-title {
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
}

.course-year {
    font-size: 13px;
    color: var(--ink-faint);
}

/* ==========================================================================
   15. Образование
   ========================================================================== */

.education-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.education-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.education-institution {
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
}

.education-faculty {
    font-size: 14px;
    color: var(--ink-muted);
}

.education-year {
    font-size: 13px;
    color: var(--ink-faint);
}

.education-badge {
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-faint);
    white-space: nowrap;
    background-color: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
}

/* ==========================================================================
   16. Футер
   ========================================================================== */

.footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--line-soft);
    text-align: center;
}

.footer p {
    font-size: 13px;
    color: var(--ink-ghost);
}

/* ==========================================================================
   17. Адаптив: планшет
   ========================================================================== */

@media screen and (max-width: 850px) {
    .header-section {
        flex-direction: column;
        align-items: center;
        gap: 24px;
        text-align: center;
    }

    .avatar-box {
        width: 180px;
        height: 180px;
    }

    .header-info {
        align-items: center;
        flex: none;
        max-width: 100%;
        min-height: 0;
        gap: 24px;
    }

    .contacts-list {
        text-align: left;
    }
}

/* ==========================================================================
   18. Адаптив: мобильные
   ========================================================================== */

@media screen and (max-width: 700px) {
    .project-header,
    .course-card-top,
    .education-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .project-links {
        flex-wrap: wrap;
        gap: 12px;
    }

    .education-badge {
        align-self: flex-start;
    }

    .skill-group {
        flex-direction: column;
        gap: 10px;
    }

    .skill-group-title {
        justify-content: flex-start;
        flex: none;
        padding-bottom: 8px;
        text-align: left;
        border-bottom: 1px solid var(--line);
    }
}

/* ==========================================================================
   19. Печать: страница
   ========================================================================== */

@page {
    size: A4;
    margin: 15mm;
}

/* ==========================================================================
   20. Печать
   ========================================================================== */

@media print {
    /* База */
    body {
        padding: 0;
        font-size: 10pt;
        line-height: 1.4;
        color: #000000;
        background-color: #ffffff;
    }

    .container {
        width: 100%;
        max-width: none;
        margin: 0;
    }

    a {
        color: inherit !important;
        text-decoration: none;
    }

    /* Шапка */
    .header-section {
        gap: 24px;
        padding-bottom: 20px;
        break-inside: avoid;
    }

    .avatar-box {
        width: 140px;
        height: 140px;
    }

    .header-info {
        gap: 12px;
        min-height: 140px;
    }

    .name {
        font-size: 22pt;
    }

    .role {
        font-size: 13pt;
    }

    .contacts-list {
        gap: 4px;
    }

    .contact-item {
        gap: 8px;
        font-size: 10pt;
    }

    .contact-icon {
        width: 14px;
        height: 14px;
    }

    .relocation-note {
        font-size: 9pt;
    }

    /* Секции */
    .about-section,
    .skills-section,
    .projects-section,
    .experience-section,
    .courses-section,
    .education-section {
        padding-top: 20px;
    }

    .section-title {
        margin-bottom: 10px;
        font-size: 16pt;
        break-after: avoid;
    }

    /* Текст */
    .about-content {
        gap: 8px;
    }

    .about-content p,
    .project-desc {
        font-size: 10pt;
        line-height: 1.4;
    }

    /* Блочный поток для постраничной разбивки */
    .project-card,
    .experience-item,
    .courses-list,
    .course-card,
    .education-list,
    .project-features,
    .experience-features,
    .course-list {
        display: block;
    }

    /* Карточки */
    .project-card,
    .course-card,
    .education-card {
        padding: 12px;
        background-color: #ffffff;
        border-color: var(--line);
    }

    .project-card > * + *,
    .experience-item > * + *,
    .course-card > * + * {
        margin-top: 8px;
    }

    .project-card + .project-card,
    .course-card + .course-card,
    .education-card + .education-card {
        margin-top: 14px;
    }

    /* Шапки элементов */
    .project-header,
    .course-card-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        break-inside: avoid;
        break-after: avoid;
    }

    /* Навыки */
    .skills-list {
        gap: 14px;
    }

    .skill-group {
        gap: 12px;
        break-inside: avoid;
    }

    .skill-group-title {
        flex: 0 0 110px;
        font-size: 10pt;
    }

    /* Ссылки */
    .project-links {
        flex-wrap: wrap;
        gap: 12px;
    }

    .project-link {
        font-size: 9pt;
    }

    /* Заголовки и метаданные */
    .project-title,
    .experience-company {
        font-size: 12pt;
    }

    .experience-role,
    .course-title,
    .education-institution {
        font-size: 10.5pt;
    }

    .experience-period,
    .project-period,
    .course-year,
    .education-year,
    .education-faculty,
    .education-badge {
        font-size: 9pt;
    }

    /* Списки */
    .project-features li,
    .experience-features li,
    .course-list li {
        font-size: 9.5pt;
        line-height: 1.4;
        break-inside: avoid;
    }

    .project-features li + li,
    .experience-features li + li,
    .course-list li + li {
        margin-top: 4pt;
    }

    /* Теги */
    .project-tags,
    .experience-tags,
    .skill-tags {
        gap: 5px;
        break-inside: avoid;
    }

    .tag {
        padding: 2px 6px;
        font-size: 8pt;
        break-inside: avoid;
    }

    /* Постраничная разбивка */
    .course-card,
    .education-card {
        break-inside: avoid;
    }

    p {
        orphans: 3;
        widows: 3;
    }

    /* Скрыто при печати */
    .certificate-preview,
    .footer {
        display: none;
    }
}