/* CSS Variables for consistent theming */
:root {
    --primary-color: #1144cc;
    --secondary-color: #1144aa;
    --accent-color: #374ba4;
    --light-accent: #AAAACC;
    --text-color: #333;
    --light-bg: #f4f4f4;
    --lighter-bg: #f8f8f8;
    --border-color: #e0e0e0;
    --print-border: #ccc;
    --print-light-bg: #f0f0f0;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
}

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

body {
    background-color: #EEECEE;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    max-width: 1000px;
    margin: 0 auto;
    padding: 0.5rem;
}

.resume-container {
    background-color: #FFFFFF;
    margin: 1rem auto;
    padding: 1.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: "Helvetica", "Arial", sans-serif;
    font-weight: bold;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.1rem;
}

h2 {
    font-size: 1.4rem;
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.25rem;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
}

h3 {
    font-size: 1.2rem;
}

h4 {
    font-size: 0.95rem;
}

strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Header Layout */
.resume-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.resume-name {
    margin-bottom: 0.25rem;
}

@media (min-width: 768px) {
    .resume-header {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.resume-title {
    color: var(--secondary-color);
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 0.25rem;
}

.contact-info {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .contact-info {
        text-align: right;
    }
}

/* Professional Summary */
.summary-section {
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
}

.professional-summary {
    line-height: 1.5;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.skillset {
    margin-bottom: 0.5rem;
}

.skillset strong {
    display: inline;
}

/* Proficiency level badge */
.skill-level {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    background: #e8e8e8;
    color: #555;
    font-weight: normal;
}

/* Keyword tags container */
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.2rem;
}

/* Individual keyword pill */
.skill-tag {
    display: inline-block;
    background: #f0f4f8;
    border: 1px solid #d0d7de;
    padding: 0.1rem 0.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* ATS-friendly skill list format (single column, comma-separated) */
.skillset-list {
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.skillset-list strong {
    display: inline;
}

/* Work Experience */
.jobs-list {
    margin-top: 0.5rem;
}

.job {
    margin-bottom: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.job:first-of-type {
    border-top: none;
    padding-top: 0;
}

.job-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}

@media (min-width: 768px) {
    .job-header {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
}

.job-position {
    color: var(--accent-color);
    margin: 0;
    font-size: 1.1rem;
}

.job-company {
    display: block;
    font-size: 0.95rem;
    margin-top: 0.1rem;
}

.job-company a {
    color: var(--text-color);
    text-decoration: none;
}

.job-company a:hover {
    text-decoration: underline;
}

.job-date {
    color: var(--light-accent);
    font-weight: 600;
    font-size: 0.85rem;
    display: block;
    margin-top: 0.1rem;
}

.job-summary {
    background-color: transparent;
    padding: 0.25rem 0;
    border-radius: 4px;
    font-size: 0.95rem;
    margin: 0.25rem 0;
}

.job-highlights ul {
    margin-left: 1.25rem;
    padding: 0.25rem 0;
    margin-bottom: 0.25rem;
}

.job-highlights li {
    margin-bottom: 0.2rem;
}

/* Earlier Experience Section (condensed older jobs, expandable) */
.earlier-section {
    margin-top: 0.5rem;
}

.earlier-jobs-list {
    margin-top: 0.25rem;
}

.earlier-job {
    padding: 0.4rem 0 0.4rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.earlier-job:hover {
    background-color: var(--lighter-bg);
}

.earlier-job:last-child {
    border-bottom: none;
}

.earlier-job-header {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 500px) {
    .earlier-job-header {
        display: block;
    }

    .earlier-position,
    .earlier-company,
    .earlier-dates {
        display: block;
    }
}

.earlier-expand-icon {
    display: inline-block;
    width: 1.25rem;
    margin-left: -1.25rem;
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
}

.earlier-position {
    font-weight: 600;
    color: var(--accent-color);
}

.earlier-company {
    font-style: italic;
}

.earlier-dates {
    color: var(--light-accent);
    font-size: 0.9rem;
}

/* Hidden details by default - with slide animation */
.earlier-job-details {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    font-size: 0.9rem;
    opacity: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease-out;
}

.earlier-job.expanded .earlier-job-details {
    max-height: 500px;
    opacity: 1;
    padding: 0.5rem 0 0.25rem 0;
}

.earlier-summary {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.earlier-highlights ul {
    margin-left: 1rem;
    padding: 0;
}

.earlier-highlights li {
    margin-bottom: 0.2rem;
}

/* Education Grid */
.education-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

@media (min-width: 768px) {
    .education-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.institution {
    margin-bottom: 0.25rem;
}

.school-title {
    font-weight: bold;
    margin-bottom: 0.1rem;
}

.institution dd {
    margin-left: 1rem;
    color: #555;
}

.school-dates {
    white-space: nowrap;
    color: var(--light-accent);
    font-size: 0.9rem;
}

/* Downloads */
.download-section {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.download-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.download-links li {
    display: inline;
}

.download-links a {
    text-decoration: none;
    color: var(--primary-color);
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.download-links a:hover {
    background-color: var(--light-bg);
}

/* Print Styles - ATS-optimized for PDF parsing */
@media print {
    @page {
        margin: 0.5in;
    }

    /* Force all text to black for ATS readability */
    * {
        color: black !important;
    }

    body {
        background-color: white;
        max-width: none;
        margin: 0;
        font-size: 10pt;
        line-height: 1.2;
        color: black;
        padding: 0;
    }

    .resume-container {
        background-color: white;
        margin: 0;
        padding: 0;
        box-shadow: none;
        width: 100%;
        max-width: none;
    }

    h1 {
        font-size: 16pt;
        margin-bottom: 2pt;
    }

    .resume-title {
        font-size: 12pt;
        margin-bottom: 0;
    }

    h2 {
        font-size: 12pt;
        page-break-after: avoid;
        border-bottom: 1px solid var(--print-border);
        text-align: left !important;
        margin: 10pt 0 6pt;
        padding-bottom: 2pt;
    }

    h3 {
        page-break-after: avoid;
        margin: 0;
    }

    /* ATS: Force single-column layout for correct reading order */
    .resume-header,
    .skills-grid,
    .education-grid,
    .job-header {
        display: block !important;
        grid-template-columns: 1fr !important;
    }

    /* Header spacing */
    .resume-header {
        margin-bottom: 6pt;
    }

    /* ATS: Left-align contact info (moves below name/title) */
    .contact-info {
        text-align: left !important;
        margin-top: 4pt;
        line-height: 1.3;
    }

    /* Summary section */
    .summary-section {
        margin-bottom: 6pt;
    }

    .professional-summary {
        line-height: 1.3;
    }

    /* Job header - tighter spacing */
    .job-header {
        margin-bottom: 4pt;
    }

    .job-position {
        font-size: 11pt;
        margin: 0;
    }

    .job-company {
        font-size: 10pt;
        margin-top: 1pt;
    }

    .job-date {
        font-size: 9pt;
        margin-top: 1pt;
    }

    /* Job content */
    .job {
        margin-bottom: 10pt;
        padding-top: 8pt;
    }

    .job:first-of-type {
        border-top: none;
        padding-top: 0;
    }

    .job-summary {
        background-color: transparent !important;
        border: none !important;
        padding: 4pt 0;
        margin: 0;
        font-size: 10pt;
        page-break-inside: auto;
    }

    .job-highlights {
        margin: 0;
    }

    ul {
        margin: 0 0 4pt 0;
        padding: 2pt 0 0 16pt;
    }

    li {
        font-size: 10pt;
        margin-bottom: 2pt;
    }

    /* ATS: Convert skill pills to comma-separated inline text */
    .skill-tags {
        display: inline;
    }

    .skill-tag {
        display: inline;
        background: none !important;
        border: none !important;
        padding: 0;
        font-size: 10pt;
    }

    .skill-tag::after {
        content: ", ";
    }

    .skill-tag:last-child::after {
        content: "";
    }

    /* Skill category formatting */
    .skillset {
        page-break-inside: avoid;
        margin-bottom: 4pt;
    }

    .skill-level {
        background: none !important;
        border: none !important;
        font-size: 9pt;
    }

    /* ATS-friendly skill list for print */
    .skillset-list {
        margin-bottom: 3pt;
        font-size: 10pt;
    }

    strong {
        font-weight: bold;
    }

    /* Earlier experience for print */
    .earlier-section {
        margin-top: 0;
    }

    .earlier-section h2 {
        font-size: 12pt;
        margin-top: 10pt;
    }

    .earlier-jobs-list {
        margin-top: 4pt;
    }

    .earlier-job {
        font-size: 10pt;
        padding: 1pt 0;
        border-bottom: none;
        cursor: default;
    }

    .earlier-job:hover {
        background-color: transparent;
    }

    .earlier-expand-icon {
        display: none;
    }

    .earlier-job-details {
        display: none !important;
    }

    /* Education */
    .education-grid {
        margin-top: 4pt;
    }

    .institution {
        margin-bottom: 4pt;
    }

    /* Remove link styling for print */
    a {
        text-decoration: none;
    }

    /* Hide download info and show URL instead */
    .download-section {
        display: none;
    }

    /* Add URL at bottom of last page only */
    .resume-container::after {
        content: "Online version: https://johnesco.github.io/resume";
        display: block;
        text-align: center;
        font-size: 9pt;
        border-top: 1px solid var(--print-border);
        padding-top: 8pt;
        margin-top: 12pt;
    }
}