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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'SF Pro Display', sans-serif;
    line-height: 1.5;
    color: #1a1a1a;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 235, 59, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 75% 75%, rgba(255, 193, 7, 0.08) 0%, transparent 30%),
        linear-gradient(135deg, #fff8e1 0%, #fff3c4 50%, #ffecb3 100%);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(30deg, rgba(255, 193, 7, 0.02) 1px, transparent 1px),
        linear-gradient(120deg, rgba(255, 193, 7, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -1;
}

/* Container */
.cv-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    opacity: 0;
    animation: fadeInContainer 1s ease-out 0.3s forwards;
}

/* Entrance Animations */
@keyframes fadeInContainer {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.cv-header {
    background: linear-gradient(135deg, #ffd700 0%, #ffeb3b 30%, #ffc107 100%);
    color: #2d3748;
    padding: 50px 60px;
    position: relative;
    overflow: hidden;
}

.cv-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(45deg, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(-45deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
}

.cv-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20px;
    background: white;
    border-radius: 20px 20px 0 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: none;
    margin: 0;
}

.contact-info h1 {
    font-size: 3.236rem; /* Base * φ² (golden ratio squared) */
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    color: #1a202c;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.contact-item {
    color: #4a5568;
    text-decoration: none;
    font-size: 1.1rem; /* Slightly larger than base */
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    padding: 8px 12px;
}

.contact-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 193, 7, 0.3);
    transition: all 0.5s ease;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.contact-item:hover {
    color: #2d3748;
    transform: translateX(4px);
}

.contact-item:active::after {
    width: 200px;
    height: 200px;
}

.title-section {
    text-align: right;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 40px;
}

.title-section h2 {
    font-size: 2rem; /* Base * φ (golden ratio) */
    font-weight: 600;
    margin-bottom: 20px;
    opacity: 1;
    line-height: 1.3;
    color: #2d3748;
}

.expertise {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.expertise-tag {
    background: rgba(45, 55, 72, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(45, 55, 72, 1);
    font-size: 0.9rem; /* More readable size */
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.expertise-tag:hover {
    background: rgba(26, 32, 44, 0.95);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Content Layout */
.cv-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    padding: 40px;
}

.left-column {
    opacity: 0;
    animation: slideInLeft 0.8s ease-out 0.6s forwards;
}

.right-column {
    opacity: 0;
    animation: slideInRight 0.8s ease-out 0.8s forwards;
}

/* Sections */
section {
    margin-bottom: 32px;
}

h3 {
    color: #1a1a1a;
    font-size: 1.618rem; /* φ (golden ratio) */
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 12px;
}

h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    border-radius: 2px;
}

h4 {
    color: #2d3748;
    font-size: 1.25rem; /* Base * φ^0.5 */
    font-weight: 600;
    margin-bottom: 8px;
}

p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #4a5568;
    font-size: 1rem; /* Base size */
}

ul {
    margin-left: 0;
    margin-bottom: 16px;
    list-style: none;
}

li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
    line-height: 1.6;
    color: #4a5568;
}

li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #ff8f00;
    font-weight: bold;
}

a {
    color: #ff8f00;
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: #f57c00;
    text-decoration: underline;
}

/* Skills Section */
.skill-category {
    margin-bottom: 24px;
    background: #fffde7;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
}

.skill-category h4 {
    color: #ff8f00;
    margin-bottom: 12px;
    font-weight: 600;
}

.skill-category ul {
    margin-left: 0;
    list-style: none;
}

.skill-category li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
}

.skill-category li::before {
    content: '✓';
    color: #ff8f00;
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* Skill Level Indicators */
.skill-level {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    position: relative;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border: 1px solid #e2e8f0;
}

.skill-level.expert {
    background: linear-gradient(135deg, #ffd700, #ffeb3b);
    color: #1a202c;
    border-color: #ffc107;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.3);
}

.skill-level.advanced {
    background: linear-gradient(135deg, #ff8f00, #f57c00);
    color: white;
    border-color: #ef6c00;
    box-shadow: 0 2px 4px rgba(255, 143, 0, 0.3);
}

.skill-level.intermediate {
    background: linear-gradient(135deg, #38a169, #48bb78);
    color: white;
    border-color: #2f855a;
    box-shadow: 0 2px 4px rgba(56, 161, 105, 0.3);
}

/* Progressive Disclosure for Mobile */
@media screen and (max-width: 768px) {
    .expandable-header {
        cursor: pointer;
        user-select: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        transition: color 0.3s ease;
    }
    
    .expandable-header:hover {
        color: #ffc107;
    }
    
    .toggle-icon {
        transition: transform 0.3s ease;
        font-size: 0.8em;
        color: #ff8f00;
    }
    
    .expandable-header.expanded .toggle-icon {
        transform: rotate(180deg);
    }
    
    .expandable-content {
        max-height: 1000px;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
    }
    
    .expandable-content.collapsed {
        max-height: 0;
    }
    
    /* Hide toggle icons on desktop */
    @media screen and (min-width: 769px) {
        .toggle-icon {
            display: none;
        }
        
        .expandable-content {
            max-height: none;
        }
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .cv-container {
        opacity: 1;
        animation: none;
    }
    
    .left-column, .right-column {
        opacity: 1;
        animation: none;
    }
}

/* Focus indicators for keyboard navigation */
.contact-item:focus,
.expandable-header:focus {
    outline: 2px solid #ffc107;
    outline-offset: 2px;
}

a:focus {
    outline: 2px solid #ff8f00;
    outline-offset: 2px;
    text-decoration: underline;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .expertise-tag {
        border: 2px solid currentColor;
    }
    
    .skill-level {
        border: 2px solid currentColor;
    }
    
    .experience-item, .education-item {
        border: 2px solid #000;
    }
}

/* Experience & Education Items */
.experience-item, .education-item {
    margin-bottom: 28px;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
}

.current-job {
    background: #fffde7;
    border: 2px solid #ffc107;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.2);
}

.experience-item:hover, .education-item:hover {
    border-color: #ffc107;
    box-shadow: 0 8px 25px rgba(255, 193, 7, 0.2);
    transform: translateY(-4px) rotateX(2deg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media screen and (min-width: 769px) {
    .experience-item, .education-item {
        perspective: 1000px;
        transform-style: preserve-3d;
    }
}

.job-details, .education-details {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.company, .institution {
    font-weight: 600;
    color: #ff8f00;
    font-size: 0.9rem;
}

.period {
    color: #718096;
    font-size: 0.85rem;
    background: #f7fafc;
    padding: 4px 8px;
    border-radius: 6px;
}

.status {
    color: #38a169;
    font-weight: 600;
    font-size: 0.85rem;
}

.gpa {
    color: #d69e2e;
    font-weight: 600;
    font-size: 0.85rem;
}

.job-description, .education-description {
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.6;
}

.volunteer-item {
    margin-bottom: 20px;
    padding: 20px;
    background: #fffde7;
    border-radius: 12px;
    border-left: 4px solid #ffc107;
}

/* Mobile Responsive Design */
@media screen and (max-width: 768px) {
    body {
        background: #fff;
    }
    
    .cv-container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .cv-header {
        padding: 40px 24px;
        border-radius: 0;
    }
    
    .cv-header::after {
        display: none;
    }
    
    .header-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }
    
    .title-section {
        text-align: center;
        padding-left: 0;
    }
    
    .contact-info h1 {
        font-size: 2.2rem;
    }
    
    .title-section h2 {
        font-size: 1.5rem;
    }
    
    .expertise {
        justify-content: center;
    }
    
    .expertise-tag {
        font-size: 0.8rem;
    }
    
    .cv-content {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 32px 24px;
    }
    
    .job-details, .education-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .skill-category {
        padding: 16px;
    }
    
    .experience-item, .education-item {
        padding: 20px;
    }
    
    h3 {
        font-size: 1.4rem;
    }
}

@media screen and (max-width: 480px) {
    .cv-header {
        padding: 32px 20px;
    }
    
    .contact-info h1 {
        font-size: 2.2rem; /* Much larger for readability */
    }
    
    .title-section h2 {
        font-size: 1.414rem; /* √2 ratio for balance */
    }
    
    .expertise-tag {
        font-size: 0.9rem; /* More readable */
        padding: 8px 14px;
    }
    
    .cv-content {
        padding: 24px 20px;
    }
    
    h3 {
        font-size: 1.414rem; /* Much larger section headers */
    }
    
    h4 {
        font-size: 1.2rem; /* Bigger job titles */
    }
    
    p {
        font-size: 1.05rem; /* Larger body text */
    }
    
    .contact-item {
        font-size: 1.1rem; /* More readable contact info */
    }
    
    .job-details, .education-details {
        font-size: 0.95rem; /* Readable details */
    }
}

/* A4 Print Styles - SINGLE PAGE CONSTRAINT */
@media print {
    @page {
        size: A4;
        margin: 0.4in;
    }
    
    * {
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
        print-color-adjust: exact;
    }
    
    html, body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
        font-size: 11px;
        line-height: 1.3;
        color: #000;
        background: white;
        margin: 0;
        padding: 0;
        width: 100%;
        height: auto;
    }
    
    body::before {
        display: none;
    }
    
    .cv-container {
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
        background: white;
        height: auto;
        transform: none;
        animation: none;
        opacity: 1;
    }
    
    .cv-header {
        background: #f5f5f5;
        color: #000;
        padding: 12px 0;
        margin-bottom: 8px;
        border-bottom: 1px solid #000;
    }
    
    .cv-header::before,
    .cv-header::after {
        display: none;
    }
    
    .header-content {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 20px;
    }
    
    .contact-info h1 {
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 6px;
        color: #000;
    }
    
    .contact-details {
        gap: 3px;
        display: flex;
        flex-direction: column;
    }
    
    .contact-item {
        font-size: 10px;
        color: #000;
        text-decoration: none;
        display: block;
    }
    
    .contact-item::after {
        content: " (" attr(href) ")";
        font-size: 9px;
        color: #666;
    }
    
    .contact-item svg {
        display: none;
    }
    
    .title-section {
        text-align: right;
    }
    
    .title-section h2 {
        font-size: 14px;
        margin-bottom: 6px;
        color: #000;
        font-weight: bold;
    }
    
    .expertise {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }
    
    .expertise-tag {
        background: #333;
        color: white;
        padding: 3px 8px;
        border-radius: 3px;
        font-size: 9px;
        font-weight: bold;
        text-transform: uppercase;
    }
    
    .cv-content {
        display: grid;
        grid-template-columns: 35% 65%;
        gap: 15px;
        padding: 0;
        font-size: 10px;
    }
    
    .left-column, .right-column {
        opacity: 1;
        animation: none;
        transform: none;
    }
    
    section {
        margin-bottom: 12px;
        page-break-inside: avoid;
    }
    
    h3 {
        font-size: 12px;
        font-weight: bold;
        margin-bottom: 6px;
        color: #000;
        border-bottom: 1px solid #000;
        padding-bottom: 2px;
    }
    
    h3::after {
        display: none;
    }
    
    h4 {
        font-size: 11px;
        font-weight: bold;
        margin-bottom: 3px;
        color: #000;
    }
    
    p {
        margin-bottom: 4px;
        font-size: 10px;
        line-height: 1.2;
        color: #000;
    }
    
    ul {
        margin: 0 0 4px 0;
        padding-left: 8px;
    }
    
    li {
        margin-bottom: 2px;
        font-size: 10px;
        line-height: 1.2;
        padding-left: 0;
        color: #000;
        list-style: disc;
    }
    
    li::before {
        display: none;
    }
    
    .skill-category {
        margin-bottom: 8px;
        background: none;
        padding: 0;
        border: none;
    }
    
    .skill-level {
        display: inline;
        background: #f0f0f0;
        color: #000;
        padding: 1px 4px;
        border: 1px solid #ccc;
        border-radius: 2px;
        font-size: 8px;
        font-weight: bold;
        text-transform: uppercase;
        margin-left: 4px;
    }
    
    .expandable-header .toggle-icon {
        display: none;
    }
    
    .expandable-content {
        max-height: none;
        overflow: visible;
    }
    
    .experience-item, .education-item {
        margin-bottom: 10px;
        padding: 0;
        background: none;
        border: none;
        box-shadow: none;
        border-bottom: 1px solid #ddd;
        padding-bottom: 6px;
    }
    
    .experience-item:hover, .education-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    .job-details, .education-details {
        display: flex;
        justify-content: space-between;
        margin-bottom: 3px;
        font-size: 10px;
        flex-wrap: nowrap;
    }
    
    .company, .institution {
        font-weight: bold;
        color: #000;
    }
    
    .period, .status, .gpa {
        font-size: 9px;
        color: #000;
        background: none;
        padding: 0;
    }
    
    .job-description, .education-description {
        font-size: 10px;
        line-height: 1.2;
        color: #000;
    }
    
    .volunteer-item {
        margin-bottom: 8px;
        background: none;
        padding: 0;
        border: none;
    }
    
    a {
        color: #000;
        text-decoration: none;
        font-weight: 500;
    }
    
    a[href]:not(.contact-item)::after {
        content: " (" attr(href) ")";
        font-size: 8px;
        color: #666;
        font-weight: 400;
    }
    
    /* Prevent page breaks */
    .cv-container, .cv-content {
        page-break-inside: avoid;
    }
    
    .experience-item:last-child, .education-item:last-child {
        border-bottom: none;
        margin-bottom: 2px;
    }
}

/* Mobile Contact Layout Fix */
@media screen and (max-width: 768px) {
    .contact-details {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
        margin-top: 16px !important;
        max-width: 300px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .contact-item {
        flex: 0 0 calc(50% - 5px) !important;
        text-align: center !important;
        font-size: 0.85rem !important;
        padding: 8px 6px !important;
        background: rgba(45, 55, 72, 0.1) !important;
        border-radius: 8px !important;
        transition: all 0.3s ease !important;
    }
    
    .contact-item:hover {
        background: rgba(45, 55, 72, 0.2) !important;
        transform: translateY(-1px) !important;
    }
    
    .contact-item svg {
        width: 14px !important;
        height: 14px !important;
        margin-right: 3px !important;
    }
}
