/* CSS Variables for consistent theming - Gray Color Palette */
:root {
    /* Background colors - from lightest to darkest */
    --primary-bg: #F8F9FA;      /* Very light gray for main background */
    --secondary-bg: #E9ECEF;    /* Light gray for header */
    --card-bg: #FFFFFF;         /* Pure white for cards */
    --card-hover-bg: #F1F3F4;   /* Subtle gray hover state */

    /* Text colors - hierarchical gray scale */
    --text-primary: #1A1A1A;    /* Almost black for headings */
    --text-secondary: #5F6368;  /* Medium gray for body text */
    --text-muted: #9AA0A6;      /* Light gray for muted text */

    /* Accent colors - subtle gray variations */
    --accent-color: #2563EB;    /* Calm blue accent for links and key details */
    --accent-hover: #1D4ED8;    /* Stronger accent for hover states */

    /* Border colors */
    --border-color: #DADCE0;    /* Light gray borders */
    --border-hover: #BDC1C6;    /* Slightly darker for hover */

    /* Shadow colors */
    --shadow: rgba(60, 64, 67, 0.08);     /* Subtle gray shadows */
    --shadow-hover: rgba(60, 64, 67, 0.15); /* Stronger gray shadows */
    --profile-shadow: rgba(60, 64, 67, 0.3); /* Profile photo shadow */

    /* Skill tag colors */
    --skill-bg: #F1F3F4;        /* Light gray for skill tags */
    --skill-text: #3C4043;      /* Dark gray text */
    --skill-hover-bg: #E8EAED;  /* Slightly darker hover */

    /* Typography */
    --font-family: 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Layout */
    --container-max-width: 1200px;
    --border-radius: 8px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Header Section */
.header {
    background: var(--secondary-bg);
    padding: 36px 0;
    border-bottom: 1px solid #B8B8B8;
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    align-items: flex-start;
    gap: 28px 32px;
    flex-wrap: wrap;
    position: relative;
}

.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #cccccc;
    box-shadow: 0 4px 15px var(--profile-shadow);
    object-fit: cover;
}

.header-text {
    flex: 1;
    min-width: min(100%, 280px);
    text-align: left;
}

.name {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #1F2937;
}

.role-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px 20px;
    margin-top: 14px;
    max-width: 720px;
    font-style: normal;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    text-underline-offset: 3px;
}

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

.contact-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.header-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent-color);
    color: #ffffff;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    border: 1px solid var(--accent-color);
}

.btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--accent-color);
}

.btn-outline:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--accent-hover);
}

.language-switcher {
    position: absolute;
    top: 40px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.lang-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #cccccc;
    border-radius: 20px;
    color: #cccccc;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.lang-btn:hover,
.lang-btn.active {
    background: #cccccc;
    color: #1a1a1a;
}

/* Section Cards */
.section {
    margin-bottom: 32px;
}

.section-card {
    padding: 0;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.section-subtitle {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

/* Professional Summary */
        .summary-text {
            font-size: 16px;
            line-height: 1.7;
            color: var(--text-secondary);
            margin-bottom: 20px;
        }

.summary-bullets {
    list-style: none;
    padding: 0;
}

.summary-bullets li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-bullets li::before {
    content: "•";
    color: var(--text-muted);
    position: absolute;
    left: 0;
}

/* Skills Sections */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.skill-category {
    margin-bottom: 25px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

        .skill-tag {
            background: var(--skill-bg);
            color: var(--skill-text);
            padding: 8px 16px;
            border-radius: 20px;
            font-size: 14px;
            font-weight: 500;
            border: 1px solid var(--border-color);
            transition: var(--transition);
        }

        .skill-tag:hover {
            background: var(--skill-hover-bg);
            border-color: var(--border-hover);
            transform: translateY(-1px);
        }

/* Soft Skills */
.soft-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.soft-skill-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    box-shadow: 0 2px 8px var(--shadow);
}

.soft-skill-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--border-hover);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

        .soft-skill-title {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--text-primary);
        }

.soft-skill-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Projects */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.project-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 22px 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 8px var(--shadow);
    transition: var(--transition);
}

.project-card header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 560px) {
    .project-card header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        column-gap: 16px;
        row-gap: 10px;
        align-items: start;
    }

    .project-title {
        grid-column: 1;
        grid-row: 1;
    }

    .project-timeline {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        padding-top: 3px;
    }

    .project-tech {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.project-card:hover {
    background: var(--card-hover-bg);
    border-color: var(--border-hover);
    box-shadow: 0 3px 16px var(--shadow-hover);
}

        .project-title {
            font-size: 22px;
            font-weight: 600;
            margin-bottom: 0;
            color: var(--text-primary);
        }

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

        .tech-tag {
            background: var(--skill-bg);
            color: var(--skill-text);
            padding: 3px 8px;
            border-radius: 10px;
            font-size: 11px;
            font-weight: 500;
            border: 1px solid rgba(218, 220, 224, 0.9);
        }

        .project-timeline {
            font-size: 13px;
            color: var(--text-muted);
            font-weight: 600;
            letter-spacing: 0.02em;
            margin-top: 0;
            margin-bottom: 0;
        }

.project-role {
    display: block;
    color: #6B7280; /* Светлее серый для хорошей видимости */
    font-weight: 500;
    font-size: 15px;
    margin-top: 4px;
    line-height: 1.35;
}

        .project-desc {
            font-size: 15px;
            color: var(--text-secondary);
            line-height: 1.6;
            margin-bottom: 0;
            margin-top: 12px;
        }

/* Education */
        .education-content {
            font-size: 16px;
            color: var(--text-secondary);
            line-height: 1.7;
        }

        .education-degree {
            font-weight: 600;
            margin-bottom: 15px;
            color: var(--text-primary);
        }

.coursework-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

        .course-tag {
            background: var(--skill-bg);
            color: var(--skill-text);
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 13px;
            border: 1px solid var(--border-color);
        }

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .header-text {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .contact-info {
        grid-template-columns: 1fr;
        justify-items: center;
        max-width: 100%;
    }

    .contact-item {
        justify-content: center;
    }

    .name {
        font-size: 28px;
    }

    .profile-photo {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }

    .section-title {
        font-size: 24px;
    }

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

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

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .header {
        padding: 30px 0;
    }

    .name {
        font-size: 24px;
    }

    .profile-photo {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }

    .project-card {
        padding: 20px;
    }
}

/* Achievements Gallery */
.achievements-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.achievement-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.achievement-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px var(--shadow-hover);
}

.achievement-img {
    width: 100%;
    height: 280px; /* A4 aspect ratio (1:1.414) - approximately 200px width would be ~283px height */
    object-fit: contain;
    background: #F8F9FA;
    display: block;
    transition: var(--transition);
}

.achievement-item:hover .achievement-img {
    transform: scale(1.01);
}

.achievement-content {
    padding: 15px;
}

.achievement-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.achievement-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
}

.modal-caption {
    margin-top: 15px;
    color: #f1f1f1;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
}

/* Responsive Design for Achievements */
@media (max-width: 768px) {
    .achievements-gallery {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .achievement-img {
        height: 210px; /* Maintain A4 aspect ratio for tablets */
    }

    .achievement-content {
        padding: 12px;
    }

    .achievement-title {
        font-size: 16px;
    }

    .achievement-desc {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .achievements-gallery {
        gap: 10px;
    }

    .achievement-img {
        height: 170px; /* Maintain A4 aspect ratio for mobile */
    }

    .achievement-content {
        padding: 10px;
    }

    .modal-close {
        right: 20px;
        font-size: 30px;
    }

    .modal-caption {
        font-size: 16px;
        margin-top: 10px;
    }
}

/* PDF / print export (Chrome headless --print-to-pdf; browser Print → Save as PDF) */
@media print {
    body {
        background: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .language-switcher,
    .header-actions {
        display: none !important;
    }

    .header {
        padding: 18px 0;
        margin-bottom: 14px;
        border-bottom: 1px solid #ccc;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .header-content {
        flex-direction: row !important;
        align-items: flex-start !important;
        flex-wrap: nowrap !important;
        gap: 18px !important;
        text-align: left !important;
    }

    .header-text {
        text-align: left !important;
        align-items: flex-start !important;
        display: block !important;
    }

    .contact-info {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: none;
        gap: 6px 12px;
        margin-top: 8px;
    }

    .profile-photo {
        width: 96px;
        height: 96px;
        flex-shrink: 0;
    }

    .section {
        margin-bottom: 14px;
    }

    .section-title {
        font-size: 22px;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }

    .section-subtitle {
        margin-bottom: 8px;
        font-size: 15px;
    }

    /* Flex/grid can prevent break-inside from applying in Chrome print; use block flow */
    .projects-list,
    .soft-skills-grid,
    .skills-grid,
    .achievements-gallery {
        display: block;
    }

    .project-card,
    .soft-skill-card,
    .skill-category,
    .achievement-item {
        break-inside: avoid;
        page-break-inside: avoid;
        -webkit-column-break-inside: avoid;
        margin-bottom: 10px;
    }

    .projects-list .project-card:last-child,
    .soft-skills-grid .soft-skill-card:last-child,
    .skills-grid .skill-category:last-child,
    .achievements-gallery .achievement-item:last-child {
        margin-bottom: 0;
    }

    .project-card {
        padding: 12px 14px;
        box-shadow: none !important;
    }

    .achievement-item {
        box-shadow: none !important;
    }

    .project-desc,
    .soft-skill-desc {
        orphans: 3;
        widows: 3;
    }

    .achievements-gallery {
        margin-top: 10px;
    }

    h2,
    h3.section-title {
        break-after: avoid;
    }
}
