/* CV specific styles */
.cv-page {
    /* Override global body if needed, but keeping consistent is good */
    height: auto;
    min-height: 100vh;
    padding: 100px 20px 40px 20px; /* Added top padding for fixed header */
    display: flex;
    flex-direction: column; /* Stack controls and page */
    align-items: center;    /* Center the A4 page */
    background-color: var(--bg-color); /* Default dark */
    color: var(--text-primary);
}

@media print {
    #header {
        display: none !important;
    }
    .cv-page {
        padding: 0;
        display: block;
        background: white !important; /* Force white for print usually */
        color: black !important;
    }
    /* We want to respect the user's choice though? 
       Actually, standard print is usually white. 
       Let's use print-color-adjust to respect the theme if they want dark.
    */
}

/* A4 Container */
.a4-page {
    width: 210mm;
    min-height: 297mm;
    background: rgba(255, 255, 255, 0.03); /* Subtle glass for screen */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 15mm; /* Margins */
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden; /* Clip blobs */
    display: flex;
    flex-direction: column;
    gap: 10mm;
}

/* Header */
.cv-header {
    position: relative; /* Override global header fixed position */
    height: auto;       /* Override global header height */
    left: auto; top: auto; right: auto; /* Reset fixed props */
    width: 100%;
    
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: none;
    padding-bottom: 0px; 
    margin-bottom: 10px; 
}

.header-left {
    padding-left: 0; /* Aligned with 'Profile' label */
}

.header-left h1 {
    font-size: 64px; 
    line-height: 0.8;
    letter-spacing: -0.04em;
    margin-bottom: 12px;
}

/* Specific override for the name 'archer' in the header */
.header-left h1 .text-brand {
    color: var(--brand-blue-new);
}

.role-title {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--brand-orange-new);
    font-weight: 600;
}

.header-right {
    text-align: right;
}

.contact-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
    color: var(--text-secondary);
}

.contact-link {
    font-weight: 600;
    color: var(--text-primary);
}

.contact-link span {
    font-weight: 400;
}


.cv-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px; /* Increased from 20px per request */
    grid-template-areas: 
        "profile profile"
        "roles projects"
        "skills tech"
        "education funfacts"
        "references references";
    align-items: start;
}
/* Assign Areas */
.section-profile { grid-area: profile; }
.section-roles { grid-area: roles; }
.section-projects { grid-area: projects; }
.section-skills { grid-area: skills; }
.section-tech { grid-area: tech; }
.section-education { grid-area: education; }
.section-funfacts { grid-area: funfacts; }
.section-references { grid-area: references; }

/* Section Styling: Standard Block */
.section-profile, 
.section-projects, 
.section-education, 
.section-skills,
.section-roles,
.section-tech,
.section-funfacts,
.section-references {
    display: block; 
    margin-bottom: 0; /* Let grid gap handle spacing */
    padding: 0;      /* Override global section padding */
}

.section-references {
    padding-bottom: 159px; /* Breathing room at bottom */
}

/* Ensure no indentation on content */
.cv-grid p, .cv-grid .cv-item, .cv-grid ul {
    margin-left: 0;
}
/* Header Styling - Consistent across all */
h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    margin-bottom: 10px; /* Reduced from 20px */
    width: 100%;
}

/* ... */

/* Projects & Roles */
.cv-item {
    margin-bottom: 12px;
}

.cv-item h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cv-item .company {
    color: var(--text-secondary);
    font-weight: 400;
}

.role-meta {
    font-size: 13px;
    color: var(--brand-blue-new);
    font-weight: 600;
    margin-bottom: 2px;
}

.role-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Inline list for Role Skills to avoid chip overload */
.role-skill-list {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.role-skill-item {
    display: inline;
}

.role-skill-item:not(:last-child)::after {
    content: "•";
    margin: 0 6px;
    color: var(--brand-orange-new);
    font-weight: bold;
}

.project-desc {
    font-size: 14px; /* Split difference: 14px */
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}

.project-company {
    font-size: 13px;
    color: var(--brand-orange-new);
    font-weight: 600;
    margin-bottom: 4px;
}

.project-detail {
    font-size: 13px; /* Split difference: 13px */
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Skills */
.skills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-pill {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
}



/* Tech Section */
.tech-group {
    margin-bottom: 24px;
}

.tech-group h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--brand-blue-new);
}

.section-skills .tech-group h4 {
    color: var(--brand-orange-new);
}



/* Fun Facts (Note Style) */
.glass-note {
    background: rgba(255, 221, 87, 0.1); /* Subtle yellow tint */
    border: 1px solid rgba(255, 221, 87, 0.3);
    padding: 20px;
    border-radius: 4px;
    transform: rotate(2deg);
    margin-top: 20px;
    margin-bottom: 30px;
}

.glass-note h4 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-family: 'Inter', sans-serif; /* Keep clean */
}

.glass-note ul {
    list-style: disc;
    padding-left: 20px;
    font-size: 13px;
}

.glass-note li {
    margin-bottom: 6px;
}

/* Light Mode Overrides */
body.light-mode {
    --bg-color: #f5f5f5;
    --a4-bg: #ffffff;
    --text-primary: #111111;
    --text-secondary: #555555;
    --border-color: #e0e0e0;
    --surface-color: rgba(0, 0, 0, 0.03);
    
    /* Branding adjustments for light mode contrast */
    --brand-orange-new: #d65a00; /* Slightly darker for contrast on white */
    --brand-blue-new: #2364AA; /* Keep the deep blue */
    
    /* Blobs need to be softer in light mode */
    --blob-1-color: rgba(234, 115, 25, 0.15);
    --blob-2-color: rgba(35, 100, 170, 0.15);
}

/* Header Text - Light Mode Inversion */
body.light-mode #header .logo-main,
body.light-mode #header .text-white {
    color: var(--text-primary) !important; /* Forces Black */
}

body.light-mode #header .logo-subtitle {
    color: var(--text-secondary) !important; /* Forces Grey */
}

body.light-mode #header.scrolled {
    background: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 1px solid var(--border-color);
}

body.light-mode .a4-page {
    background: var(--a4-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

body.light-mode .glass-note {
    background: #fffae0; /* Post-it yellow */
    border-color: #e6dbb0;
    color: #333;
}

/* Fix toggle alignment */
#theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .cv-page {
        padding: 80px 10px 40px 10px;
    }

    #header .logo-subtitle {
        display: none;
    }

    #header .header-controls {
        gap: 8px !important;
    }

    #header .cta-button span {
        display: none;
    }

    #header .cta-button {
        padding: 8px !important;
        width: 36px;
        height: 36px;
        justify-content: center;
    }

    .a4-page {
        width: 100%;
        min-height: auto;
        padding: 20px;
        border: none;
        box-shadow: none;
        gap: 20px;
    }

    .header-left h1 {
        font-size: 40px;
    }

    .cv-grid {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "profile"
            "roles"
            "projects"
            "skills"
            "tech"
            "education"
            "funfacts"
            "references";
    }

    .section-references {
        padding-bottom: 40px;
    }
}

/* Print Specifics */
@media print {
    @page {
        size: A4;
        margin: 0;
    }
    
    /* Reset Flow Backgrounds */
    html, body, .a4-page {
        background: transparent !important;
        margin: 0;
        padding: 0;
    }

    /* Force Grid Layout for Print */
    .cv-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 30px !important;
        grid-template-areas: 
            "profile profile"
            "roles projects"
            "skills tech"
            "education funfacts"
            "references references" !important;
        align-items: start !important;
    }

    /* 1. FIXED Page Background (Repeats on every page) */
    body::before {
        content: "";
        position: fixed;
        /* Aggressive bleed (-10px) to absolutely guarantee coverage */
        top: -10px; left: -10px; right: -10px; bottom: -10px;
        z-index: -10;
        background-color: #111; /* Default Dark for print */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.light-mode::before {
        background-color: white;
    }

    /* 2. FIXED Blobs (Repeats on every page) */
    .a4-page .hero-background {
        position: fixed !important; /* Fixed to viewport = repeats on every printed page */
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        z-index: -5;
        overflow: hidden;
    }

    /* 3. Text & Content Colors - 1:1 Matching with Screen */
    
    /* Baseline: Main Text is WHITE */
    body {
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    /* GREY Text (Secondary) */
    body:not(.light-mode) .text-secondary,
    body:not(.light-mode) .contact-group,
    body:not(.light-mode) .role-date,
    body:not(.light-mode) .role-skill-list,
    body:not(.light-mode) .project-detail,
    body:not(.light-mode) .cv-item .company,
    body:not(.light-mode) h3 /* Section Headers */ {
        color: rgba(255, 255, 255, 0.6) !important;
        -webkit-text-fill-color: rgba(255, 255, 255, 0.6) !important;
    }

    /* BLUE Text */
    body:not(.light-mode) .header-left h1 .text-brand,
    body:not(.light-mode) .role-meta, /* Job Titles */
    body:not(.light-mode) .tech-group h4 /* Standard Categories */ {
        color: var(--brand-blue-new) !important;
        -webkit-text-fill-color: var(--brand-blue-new) !important;
    }

    /* ORANGE Text */
    body:not(.light-mode) .role-title,
    body:not(.light-mode) .project-company,
    body:not(.light-mode) .section-skills .tech-group h4, /* Skills Sub-headers */
    body:not(.light-mode) .role-skill-item:not(:last-child)::after,
    body:not(.light-mode) .skill-pill::after {
        color: var(--brand-orange-new) !important;
        -webkit-text-fill-color: var(--brand-orange-new) !important;
    }

    /* WHITE Text (Explicit overrides if needed) */
    body:not(.light-mode) h1,
    body:not(.light-mode) h2,
    body:not(.light-mode) .cv-item h4, /* Role/Project Names */
    body:not(.light-mode) .project-desc,
    body:not(.light-mode) .contact-link,
    body:not(.light-mode) .glass-note h4,
    body:not(.light-mode) .glass-note li,
    body:not(.light-mode) .section-profile p {
        color: white !important;
        -webkit-text-fill-color: white !important;
    }

    /* Light Mode Overrides */
    body.light-mode {
        color: black !important;
    }

    body:not(.light-mode) .role-skill-item:not(:last-child)::after {
        color: var(--brand-orange-new) !important;
    }

    body:not(.light-mode) .text-secondary {
        color: rgba(255, 255, 255, 0.7) !important;
    }

    /* 4. Layout Container */
    .a4-page {
        width: 100%;
        min-height: 100vh;
        padding: 15mm;
        box-sizing: border-box;
        border: none !important;      /* Remove 1px border */
        box-shadow: none !important;  /* Ensure no shadow */
    }

    /* Page Break Logic */
    h3, h4, .cv-item, .tech-group, .product-pill, .skill-pill, .role-skill-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .section-profile, .section-education {
        break-inside: avoid;
    }

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

    /* Force Page 2 Start with Breathing Room */
    .section-skills, .section-tech {
        break-before: page;
        padding-top: 20mm;
    }
}

/* Static Blobs for CV (Screen & Print) */
.a4-page .hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Behind content */
    overflow: hidden;
    pointer-events: none;
}

.a4-page .hero-blob,
.a4-page .hero-blob-2 {
    animation: none !important; /* Static */
    opacity: 0.3; /* Subtle */
}

.a4-page .hero-blob {
    top: -200px;
    left: -200px;
    width: 700px;
    height: 700px;
}

.a4-page .hero-blob-2 {
    top: auto;
    left: auto;
    bottom: -250px;
    right: -250px;
    width: 800px;
    height: 800px;
}
