/* Design System & Variables */
:root {
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Elegant Color Palette */
    --color-bg: #ffffff;
    --color-text-main: #18181b;     /* Zinc 900 (Deep dark grey/black) */
    --color-text-muted: #52525b;    /* Zinc 600 (Soft charcoal) */
    --color-accent: #2563eb;        /* Royal Blue for interactive elements */
    --color-accent-hover: #1d4ed8;  /* Deeper blue */
    --color-border: #e4e4e7;        /* Zinc 200 (Clean divider lines) */
    --color-bg-badge: #f4f4f5;      /* Zinc 100 (Badge backgrounds) */
    
    /* Layout Variables (optimized for 1-page budget) */
    --container-width: 820px;
    --section-gap: 16px;
    --item-gap: 10px;
}

/* Global Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-primary);
    background-color: #fafafa;
    color: var(--color-text-main);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 40px 20px;
}

/* Main Container (A4 Proportions on Screen) */
.resume-container {
    background-color: var(--color-bg);
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 45px 50px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border);
    position: relative;
}

/* Typography styles */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

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

/* HEADER SECTION */
.resume-header {
    margin-bottom: 18px;
    text-align: center;
}

.resume-header .name {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--color-text-main);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.resume-header .subtitle {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.resume-header .subtitle .divider {
    color: var(--color-border);
}

.resume-header .contact-info {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.resume-header .contact-info a {
    font-weight: 400;
}

.resume-header .contact-info .dot {
    color: var(--color-border);
}

.resume-header .languages {
    font-size: 11.5px;
    color: var(--color-text-muted);
}

/* TECHNICAL SKILLS Section (Dense ATS Optimization) */
.skills-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 20px;
    margin-bottom: 2px;
}

.skills-category {
    font-size: 11.5px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

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

/* GENERAL SECTION STYLING */
.resume-section {
    margin-bottom: var(--section-gap);
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-main);
    border-bottom: 1.5px solid var(--color-text-main);
    padding-bottom: 2px;
    margin-bottom: 12px;
}

/* EXPERIENCE ITEMS */
.experience-item {
    margin-bottom: var(--item-gap);
}

.experience-item:last-child {
    margin-bottom: 0;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 600;
    font-size: 13.5px;
}

.item-company {
    color: var(--color-text-main);
}

.item-date {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 12px;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 1px;
    margin-bottom: 4px;
}

.item-role {
    font-style: italic;
    font-weight: 500;
}

.item-location {
    font-weight: 400;
}

.item-bullets {
    list-style-type: disc;
    margin-left: 15px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.item-bullets li {
    margin-bottom: 3px;
}

.item-bullets li:last-child {
    margin-bottom: 0;
}

/* Previous Experiences Row Optimization */
.previous-exp .item-meta {
    margin-bottom: 3px;
}

/* PROJECTS SECTION (2-Column Grid for density) */
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.project-item {
    padding: 0;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.project-name {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--color-text-main);
}

.project-link {
    font-size: 10.5px;
    font-weight: 500;
    color: var(--color-accent);
}

.project-desc {
    font-size: 11.5px;
    color: var(--color-text-muted);
    line-height: 1.35;
}

/* HONORS & ACHIEVEMENTS */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.achievement-badge {
    background-color: var(--color-bg-badge);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    font-size: 11px;
}

.achievement-badge strong {
    color: var(--color-text-main);
    font-weight: 600;
    margin-bottom: 1px;
}

.achievement-badge span {
    color: var(--color-text-muted);
}

/* EDUCATION / FOOTER */
.resume-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.footer-section {
    width: 100%;
}

.footer-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-main);
    border-bottom: 1.5px solid var(--color-text-main);
    padding-bottom: 2px;
    margin-bottom: 8px;
}

.education-item {
    font-size: 12px;
    color: var(--color-text-main);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.last-updated {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 12px;
    text-align: right;
    font-style: italic;
}

.education-item:last-child {
    margin-bottom: 0;
}

.education-item em {
    color: var(--color-text-muted);
    font-style: normal;
}

.footer-date {
    color: var(--color-text-muted);
    font-weight: 500;
}

/* FLOATING CONTROLS (INTERACTIVE WEB UTILITIES) */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.btn-print {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
}

.btn-print:hover {
    background-color: var(--color-text-main);
    color: #ffffff;
    border-color: var(--color-text-main);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.btn-print svg {
    transition: transform 0.2s ease;
}

.btn-print:hover svg {
    transform: rotate(-10deg);
}

/* RESPONSIVE LAYOUT (Web Viewport scaling) */
@media (max-width: 860px) {
    body {
        padding: 10px;
        background-color: var(--color-bg);
    }
    .resume-container {
        padding: 20px 15px;
        border: none;
        box-shadow: none;
    }
    .controls {
        position: static;
        display: flex;
        justify-content: center;
        margin-bottom: 20px;
    }
    .project-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .resume-header .name {
        font-size: 24px;
    }
    .resume-header .subtitle {
        flex-direction: column;
        gap: 4px;
    }
    .resume-header .subtitle .divider {
        display: none;
    }
    .item-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    .education-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* ==========================================================================
   PRINT MEDIA STYLESHEET (PIXEL-PERFECT ONE-PAGE A4/LETTER CONSTRAINTS)
   ========================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 15mm; /* Balanced print margins */
    }

    body {
        background-color: #ffffff;
        color: #000000;
        padding: 0;
        margin: 0;
        font-size: 11.5px; /* Slightly scaled down text to guarantee exactly 1-page fit */
        line-height: 1.35;
    }

    .resume-container {
        padding: 5px 10px; /* Internal breathing room padding during printing */
        border: none;
        box-shadow: none;
        max-width: 100%;
        margin: 0;
    }

    /* Hide web interactive controls */
    .no-print {
        display: none !important;
    }

    /* Print Color Adjustments (standard black-and-white print output) */
    a {
        color: #000000;
        text-decoration: underline;
    }

    /* Adjust sizes for printing to prevent overflow */
    .resume-header {
        margin-bottom: 12px;
    }

    .resume-header .name {
        font-size: 22px;
        margin-bottom: 2px;
    }

    .resume-header .subtitle {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .resume-header .contact-info {
        font-size: 10px;
        margin-bottom: 4px;
        gap: 6px;
    }

    .resume-header .languages {
        font-size: 9.5px;
    }

    /* Technical Skills Print Optimization */
    .skills-container {
        gap: 4px 16px;
        margin-bottom: 2px;
    }

    .skills-category {
        font-size: 9.5px;
        line-height: 1.3;
    }

    /* Sections */
    .resume-section {
        margin-bottom: 10px;
    }

    .section-title {
        font-size: 10.5px;
        margin-bottom: 8px;
        border-bottom-width: 1.2px;
    }

    /* Experiences */
    .experience-item {
        margin-bottom: 8px;
        page-break-inside: avoid;
    }

    .item-header {
        font-size: 11.5px;
    }

    .item-date {
        font-size: 10.5px;
    }

    .item-meta {
        font-size: 10.5px;
        margin-bottom: 2px;
    }

    .item-bullets {
        margin-left: 12px;
        font-size: 10.5px;
    }

    .item-bullets li {
        margin-bottom: 2px;
    }

    /* Projects Grid */
    .project-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px 16px !important;
        page-break-inside: avoid;
    }

    .project-name {
        font-size: 11px;
    }

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

    .project-desc {
        font-size: 10px;
        line-height: 1.3;
    }

    /* Achievements Badge Print Optimization */
    .achievements-grid {
        gap: 6px;
        page-break-inside: avoid;
    }

    .achievement-badge {
        padding: 4px 6px;
        font-size: 9.5px;
        border-color: #cccccc;
        background-color: #fafafa !important;
        -webkit-print-color-adjust: exact; /* Preserve light shading in PDF generation */
        print-color-adjust: exact;
    }

    /* Education footer */
    .resume-footer {
        page-break-inside: avoid;
    }

    .footer-title {
        font-size: 10.5px;
        margin-bottom: 6px;
        border-bottom-width: 1.2px;
    }

    .education-item {
        font-size: 10.5px;
        margin-bottom: 2px;
        display: flex !important;
        justify-content: space-between !important;
        align-items: baseline !important;
    }

    .footer-date {
        font-size: 10px;
    }

    .last-updated {
        font-size: 8px;
        margin-top: 6px;
    }
}
