:root {
    /* Color Palette - "Stormy morning" */
    --color-bg: #eceff1;
    --color-sidebar-bg: #384959;
    /* Stormy dark */
    --color-sidebar-text: #ffffff;
    --color-sidebar-text-muted: #BDDDFC;

    --color-main-bg: #ffffff;
    --color-main-text: #384959;
    --color-main-heading: #263442;

    --color-accent: #88BDF2;
    /* Stormy light blue */
    --color-accent-dark: #6A89A7;
    --color-border: #e2e8f0;

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    font-family: var(--font-body);
    color: var(--color-main-text);
    display: flex;
    justify-content: center;
    padding: 20px 10px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Print UI Controls */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.btn-print {
    background-color: var(--color-accent);
    color: white;
    border: none;
    padding: 10px 20px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-print:hover {
    background-color: var(--color-accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Master Carousel Viewport */
.cv-carousel-viewport {
    width: 210mm;
    height: 297mm;
    /* Strictly A4 Size */
    position: relative;
    overflow: hidden;
    background: var(--color-main-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* Master Carousel Track */
.cv-carousel-track {
    display: flex;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* A4 Page (Slide) Container */
.document.a4.cv-page {
    flex: 0 0 100%;
    width: 210mm;
    height: 297mm;
    background: var(--color-main-bg);
    display: grid;
    grid-template-columns: 72mm 138mm;
    overflow: hidden;
    position: relative;
}

/* Carousel Nav Buttons */
.cv-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-main-heading);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: background 0.2s, transform 0.2s;
    font-size: 18px;
}

.cv-nav-btn:hover {
    background: var(--color-accent);
    transform: translateY(-50%) scale(1.1);
}

.cv-prev-btn {
    left: calc(50% - 105mm - 80px);
}

.cv-next-btn {
    right: calc(50% - 105mm - 80px);
}

/* ==================
   SIDEBAR STYLES
   ================== */
.sidebar {
    background-color: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    padding: 41px 25px;
    /* Reduced from 40px 30px */
    display: flex;
    flex-direction: column;
    gap: 22px;
    /* Reduced from 30px */
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 5px;
}

.initials-logo {
    width: 75px;
    /* Reduced from 90 */
    height: 75px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 32px;
    /* Reduced from 38 */
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-section h3 {
    font-family: var(--font-body);
    font-size: 14px;
    /* Reduced from 15 */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-sidebar-text);
    margin-bottom: 6px;
}

.sidebar-section .divider {
    height: 2px;
    width: 25px;
    /* Reduced */
    background-color: var(--color-accent);
    margin-bottom: 12px;
}

.sidebar-section ul {
    list-style: none;
    font-size: 11.5px;
    /* Reduced from 12.5 */
    line-height: 1.5;
    color: var(--color-sidebar-text-muted);
}

.sidebar-section ul li {
    margin-bottom: 8px;
    /* Reduced from 10 */
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.sidebar-section ul li i {
    color: var(--color-accent);
    font-size: 12px;
    margin-top: 3px;
    width: 12px;
    text-align: center;
}

.sidebar-section ul li strong {
    color: var(--color-sidebar-text);
    font-weight: 600;
}

.bullet-list li {
    padding-left: 18px;
    position: relative;
}

.bullet-list li::before {
    content: "■";
    color: var(--color-accent);
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 7px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    /* Reduced */
}

.skill-tags .tag {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-sidebar-text);
    padding: 4px 8px;
    /* Reduced */
    border-radius: 4px;
    font-size: 10.5px;
    /* Reduced from 11 */
    font-weight: 500;
}

/* ==================
   MAIN STYLES
   ================== */
.main-content {
    padding: 35px 35px;
    /* Reduced from 50px 45px */
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Reduced from 30px */
}

.main-header {
    margin-bottom: 0px;
}

.main-header h1 {
    font-family: var(--font-heading);
    font-size: 26px;
    /* Reduced from 40 */
    color: var(--color-main-heading);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 6px;
}

.main-header h1 span {
    color: var(--color-accent);
}

.main-header h1 .academic-title {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 18px;
    font-weight: 500;
    color: #d97706;
    /* Sharp gold for distinction */
    display: inline-block;
    vertical-align: baseline;
    margin-right: 5px;
    margin-left: 2px;
}

.main-header h2 {
    font-family: var(--font-body);
    font-size: 14.5px;
    /* Reduced from 16 */
    font-weight: 500;
    color: var(--color-accent-dark);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    /* Reduced from 20 */
    text-transform: uppercase;
}

.header-line {
    width: 50px;
    /* Reduced */
    height: 3px;
    background-color: var(--color-accent);
    margin-bottom: 12px;
    /* Reduced from 20 */
}

.summary {
    font-size: 12.5px;
    /* Reduced from 13.5 */
    line-height: 1.5;
    color: var(--color-main-text);
}

.content-section {
    margin-bottom: 0px;
}

/* Stunning Achievement Block (Ultra-Integrated / Professional) */
.achievement {
    margin-top: 5px;
    padding-left: 14px;
    position: relative;
    transition: transform 0.2s ease;
}

.achievement:hover {
    transform: translateX(2px);
}

.achievement::before {
    content: '\f105';
    /* FontAwesome angle-right */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--color-accent);
    font-size: 11px;
}

.achievement-title {
    font-family: var(--font-body);
    font-size: 11.5px;
    color: var(--color-accent-dark);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
    display: inline-block;
}

.achievement-desc {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--color-main-heading);
    /* Darker text for stronger emphasis */
    font-weight: 500;
    display: inline;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 19px;
    /* Reduced from 22 */
    color: var(--color-main-heading);
    border-bottom: 2px solid var(--color-border);
    padding-bottom: 6px;
    margin-bottom: 12px;
    /* Reduced from 20 */
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    color: var(--color-accent);
    font-size: 16px;
    /* Reduced from 18 */
}

/* TIMELINE */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Reduced from 20 */
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 85px;
    /* Reduced from 110 */
    top: 5px;
    bottom: 0px;
    /* Stop before padding bottom */
    width: 1px;
    /* Thinner line */
    background-color: var(--color-border);
}

.timeline-item {
    display: flex;
    position: relative;
    gap: 12px;
    /* Reduced from 15 */
}

.timeline-date {
    width: 75px;
    /* Reduced from 100 */
    flex-shrink: 0;
    text-align: right;
    padding-right: 12px;
    /* Reduced from 15 */
}

.timeline-date .date {
    font-size: 10.5px;
    /* Reduced from 11.5 */
    font-weight: 600;
    color: var(--color-main-heading);
    opacity: 0.8;
}

.timeline-content {
    flex-grow: 1;
    padding-bottom: 0px;
    position: relative;
    padding-left: 12px;
    /* Aligns next to the dot */
}

.timeline-content::before {
    content: '';
    position: absolute;
    left: -16px;
    /* Reduced to align perfectly on line */
    top: 5px;
    width: 6px;
    /* Reduced from 8 */
    height: 6px;
    /* Reduced from 8 */
    border-radius: 50%;
    background-color: white;
    border: 2px solid var(--color-accent);
    z-index: 1;
}

.timeline-item.highlight .timeline-content::before {
    background-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.timeline-content h4 {
    font-family: var(--font-body);
    font-size: 13.5px;
    /* Reduced from 15 */
    color: var(--color-main-heading);
    margin-bottom: 1px;
}

.timeline-content .role {
    font-size: 12px;
    /* Reduced from 13.5 */
    font-weight: 500;
    color: var(--color-accent-dark);
    display: block;
    margin-bottom: 2px;
}

.timeline-content .tech-stack {
    font-size: 11px;
    /* Reduced from 12 */
    color: var(--color-main-text);
    font-weight: 500;
    background: #f1f5f9;
    display: inline-block;
    padding: 2px 6px;
    /* Reduced */
    border-radius: 4px;
    margin-top: 3px;
}

.timeline-content .description {
    font-size: 12px;
    /* Reduced from 13 */
    line-height: 1.4;
    color: var(--color-main-text);
    margin-top: 2px;
}

.distinction {
    font-style: italic;
    color: #d97706;
    /* Sharper gold/orange */
    font-weight: 500;
}

/* SKILLS GRID (Main Area) */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    /* Reduced from 16px 24px */
}

.skill-category h5 {
    font-size: 12.5px;
    /* Reduced from 13.5 */
    color: var(--color-main-heading);
    margin-bottom: 2px;
    position: relative;
    display: inline-block;
}

.skill-category p {
    font-size: 11.5px;
    /* Reduced from 12.5 */
    line-height: 1.4;
    color: var(--color-main-text);
}


/* ==================
   PAGES (INNER SLIDES)
   ================== */
.page-header h2 {
    font-size: 24px;
    color: var(--color-main-heading);
    margin-bottom: 10px;
}

.page-header .header-line {
    width: 80px;
}

.page-two-header h2 {
    font-size: 24px;
    color: var(--color-main-heading);
    margin-bottom: 10px;
}

.page-two-header .header-line {
    width: 80px;
}




/* ==================
   MOBILE / RESPONSIVE STYLES
   ================== */
@media screen and (max-width: 900px) {

    html,
    body {
        overflow-x: hidden;
        /* Prevent horizontal scroll from unscaled bounding box */
    }

    body {
        padding: 10px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* 1. Lock core layout to exact A4 pixels to prevent the grid from collapsing */
    .cv-carousel-viewport,
    .document.a4.cv-page {
        width: 794px !important;
        height: 1123px !important;
    }

    .document.a4.cv-page {
        display: grid !important;
        grid-template-columns: 272px 522px !important;
        overflow: hidden !important;
    }

    .cv-carousel-viewport {
        transform-origin: top center;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        border-radius: 4px;
        overflow: hidden;
    }

    /* --- Revert internal UI elements so they look correct before scaling --- */
    .main-content {
        padding: 35px 35px !important;
    }

    .sidebar {
        padding: 41px 25px !important;
        gap: 22px !important;
    }

    .main-header h1 {
        font-size: 26px !important;
    }

    .main-header h1 .academic-title {
        font-size: 18px !important;
    }

    .skills-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .timeline::before {
        left: 85px !important;
    }

    .timeline-date {
        width: 75px !important;
        padding-right: 12px !important;
    }

    /* Nav Buttons (Kept unscaled for touch access) */
    .cv-nav-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
        top: auto;
        bottom: 20px;
        transform: none;
        position: fixed;
    }

    .cv-prev-btn {
        left: 20px;
    }

    .cv-next-btn {
        right: 20px;
    }
}

/* 2. The Brute-Force Stepped Scale */
/* Guarantees shrinkage on smaller screens without JS or invalid math */
@media screen and (max-width: 920px) {
    body {
        padding: 30px 0;
    }

    .cv-carousel-viewport {
        transform: scale(0.95);
    }

    .controls {
        top: auto;
        bottom: 25px;
        /* Aligns nicely with your 20px bottom nav buttons */
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        display: flex;
        justify-content: center;
    }
}

@media screen and (max-width: 820px) {
    .cv-carousel-viewport {
        transform: scale(0.85);
    }
}

@media screen and (max-width: 750px) {
    .cv-carousel-viewport {
        transform: scale(0.80);
    }
}

@media screen and (max-width: 650px) {
    .cv-carousel-viewport {
        transform: scale(0.70);
    }
}

@media screen and (max-width: 550px) {
    .cv-carousel-viewport {
        transform: scale(0.60);
    }
}

@media screen and (max-width: 480px) {
    .cv-carousel-viewport {
        transform: scale(0.53);
    }
}

@media screen and (max-width: 420px) {
    .cv-carousel-viewport {
        transform: scale(0.50);
    }
}

@media screen and (max-width: 380px) {
    .cv-carousel-viewport {
        transform: scale(0.48);
    }
}

@media screen and (max-width: 340px) {
    .cv-carousel-viewport {
        transform: scale(0.40);
    }
}

/* ==================
   PRINT STYLES
   ================== */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
        display: block;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print {
        display: none !important;
    }

    /* Print Breakout Box */
    .cv-carousel-viewport {
        box-shadow: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
        width: auto !important;
        height: auto !important;
        transform: none !important;
    }

    /* Enable vertical stacking for print instead of horizontal slider */
    .cv-carousel-track {
        display: block;
        transform: none !important;
    }

    .document.a4.cv-page {
        width: 210mm !important;
        height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        page-break-after: always;
        page-break-inside: avoid;
        display: grid !important;
        grid-template-columns: 72mm 138mm !important;
        overflow: hidden !important;
    }

    .document.a4.cv-page:last-child {
        page-break-after: auto !important;
    }
}