/* ═══════════════════════════════════════════════════════════
   Ilia Usatov — Universal CV CSS
   Aesthetic: Clean / Readable / High Contrast (Light)
   Optimized for both screen reading and perfect A4 PDF export
   ═══════════════════════════════════════════════════════════ */

:root {
    --cv-bg: #ffffff;
    --cv-text-main: #111827;
    --cv-text-muted: #4b5563;
    --cv-text-light: #6b7280;
    --cv-accent: #2563eb;
    --cv-border: #e5e7eb;

    --cv-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ─── Base Reset for Resume Page ─── */
body {
    background-color: #f3f4f6;
    /* Soft gray behind the white A4 sheet */
    color: var(--cv-text-main);
    font-family: var(--cv-font-sans);
    line-height: 1.5;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─── Top Controls (Screen Only) ─── */
.nav-container {
    width: 100%;
    max-width: 900px;
    /* Matched to A4 width roughly */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.back-link {
    color: var(--cv-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--cv-text-main);
}

.resume-controls {
    display: flex;
    gap: 12px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--cv-font-sans);
    border: 1px solid var(--cv-border);
    background: #fff;
    color: var(--cv-text-main);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-small:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-primary {
    background: var(--cv-text-main);
    color: #fff;
    border-color: var(--cv-text-main);
}

.btn-primary:hover {
    background: #1f2937;
    border-color: #1f2937;
    color: #fff;
}

/* ─── A4 Container ─── */
.resume-container {
    width: 100%;
    max-width: 900px;
    background: var(--cv-bg);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 60px 60px;
    /* Standard A4 margins */
    box-sizing: border-box;
}

.cv-document {
    display: none;
    /* Handled by JS (.active) */
}

.cv-document.active {
    display: block;
}

/* ─── Header ─── */
.cv-header {
    border-bottom: 2px solid var(--cv-text-main);
    padding-bottom: 24px;
    margin-bottom: 32px;
}

.cv-name {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 4px 0;
    line-height: 1.1;
    color: var(--cv-text-main);
}

.cv-role {
    font-size: 1.25rem;
    color: var(--cv-text-muted);
    font-weight: 400;
}

/* ─── 2-Column Grid ─── */
.cv-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 48px;
}

/* ─── Shared Section Styles ─── */
.cv-section {
    margin-bottom: 32px;
}

.cv-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cv-text-main);
    border-bottom: 1px solid var(--cv-border);
    padding-bottom: 8px;
    margin-top: 0;
    margin-bottom: 16px;
    page-break-after: avoid;
    break-after: avoid;
}

/* ─── Sidebar (Left) ─── */
.cv-sidebar {
    font-size: 0.9rem;
}

.cv-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
    color: var(--cv-text-main);
}

.cv-contact-list li {
    margin-bottom: 10px;
    line-height: 1.4;
}

.cv-contact-list a {
    color: var(--cv-text-main);
    text-decoration: none;
    transition: color 0.2s;
}

.cv-contact-list a:hover {
    text-decoration: underline;
}

.cv-skills-block {
    color: var(--cv-text-muted);
    line-height: 1.6;
}

.cv-skills-block strong {
    color: var(--cv-text-main);
    font-weight: 600;
}

.cv-education-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cv-education-list li {
    margin-bottom: 16px;
    color: var(--cv-text-muted);
    line-height: 1.4;
}

.cv-education-list strong {
    color: var(--cv-text-main);
    display: block;
    margin-bottom: 2px;
}

/* ─── Main Content (Right) ─── */
.cv-main {
    font-size: 0.95rem;
}

.cv-main p {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--cv-text-main);
}

/* List Styling */
.cv-list {
    margin: 0;
    padding-left: 18px;
    color: var(--cv-text-muted);
}

.cv-list li {
    margin-bottom: 8px;
}

.cv-list strong {
    color: var(--cv-text-main);
    font-weight: 600;
}

.cv-sublist {
    margin-top: 4px;
    margin-bottom: 8px;
    padding-left: 20px;
}

.cv-sublist li {
    margin-bottom: 4px;
}

/* Jobs */
.cv-job {
    margin-bottom: 28px;
    page-break-inside: avoid;
    break-inside: avoid;
    /* Prevent awkward splits in PDF */
}

.cv-job.allow-break {
    page-break-inside: auto;
    break-inside: auto;
}

.cv-job-part {
    page-break-inside: avoid;
    break-inside: avoid;
}

.cv-job:last-child {
    margin-bottom: 0;
}

.cv-job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.cv-job-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: var(--cv-text-main);
}

.cv-job-date {
    font-size: 0.9rem;
    color: var(--cv-text-light);
    font-feature-settings: "tnum";
    white-space: nowrap;
}

.cv-job-company {
    font-weight: 500;
    color: var(--cv-text-muted);
    margin-bottom: 12px;
}

.cv-role-subtitle {
    display: block;
    font-size: 0.95rem;
    color: var(--cv-text-main);
    margin-top: 16px;
    margin-bottom: 8px;
}

.highlight {
    background-color: #fef08a;
    /* Subtle yellow highlight */
    color: #854d0e;
    padding: 0px 4px;
    border-radius: 2px;
    font-weight: 500;
}

a {
    color: var(--cv-text-main);
}

/* Utilities */
.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 12px;
}

.mb-4 {
    margin-bottom: 16px;
}

/* ─── Responsive (Mobile View) ─── */
@media (max-width: 768px) {
    body {
        padding: 20px 16px;
    }

    .resume-container {
        padding: 32px 24px;
    }

    .cv-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cv-job-header {
        flex-direction: column;
    }

    .cv-job-date {
        margin-top: 4px;
        font-size: 0.85rem;
    }
}

/* ─── Print Styles (Perfect A4 PDF) ─── */
@media print {
    @page {
        margin: 15mm 15mm;
        /* Standard A4 printable margins */
        size: A4 portrait;
    }

    body {
        margin: 0;
        padding: 0;
        background: #fff;
    }

    .no-print {
        display: none !important;
    }

    .resume-container {
        box-shadow: none;
        padding: 0;
        margin: 0;
        max-width: none;
        border-radius: 0;
    }

    /* Adjust sizing slightly for print density */
    .cv-name {
        font-size: 24pt;
    }

    .cv-role {
        font-size: 14pt;
    }

    .cv-layout {
        grid-template-columns: 220px 1fr;
        gap: 32px;
    }

    .cv-sidebar,
    .cv-main {
        font-size: 10pt;
        /* Optimal print reading size */
    }

    .cv-section-title {
        font-size: 11pt;
    }

    .cv-job-title {
        font-size: 12pt;
    }

    /* Ensure colors are pure black and white for sharp printing */
    :root {
        --cv-text-main: #000;
        --cv-text-muted: #333;
        --cv-text-light: #555;
        --cv-border: #ddd;
    }

    .highlight {
        background-color: transparent;
        border: 1px solid #ccc;
        /* borders print better than light backgrounds */
        color: #000;
    }

    /* Force link URLs to not print automatically if browser tries (handled by exact text styling) */
    a[href]:after {
        content: none !important;
    }
}