:root {
    --primary-color: #395a86;
    --accent-color: #5b90d4;
    --accent-dark: #2d4870;
    --bg-light: #f0f4f8;
    --bg-white: #ffffff;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --radius: 10px;
    --transition: 0.2s ease;
    --text-light: #fff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

/* --- Header & Navigation (masqué) --- */
header { display: none; }

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.05em;
}

.header-right {
    display: flex;
    align-items: center;
}

nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    margin-left: 24px;
    font-weight: 600;
    font-size: 0.88rem;
    position: relative;
    padding-bottom: 4px;
    transition: color var(--transition);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width var(--transition);
}

nav a:hover { color: var(--text-light); }
nav a:hover::after { width: 100%; }

.pdf-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-left: 24px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: background var(--transition), transform var(--transition);
    white-space: nowrap;
}

.pdf-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

/* --- Hero Section --- */
.hero {
    min-height: 58vh;
    background: linear-gradient(135deg, #1e3050 0%, #2d4870 40%, #395a86 70%, #4a6fa5 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-light);
    padding: 40px 20px;
    margin-top: 0;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 3px solid rgba(255,255,255,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    margin-bottom: 20px;
}

.hero h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 14px;
}

.hero-tagline {
    font-size: 1rem;
    max-width: 680px;
    color: rgba(255,255,255,0.8);
    line-height: 1.7;
}

/* --- Main Content --- */
.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    align-items: start;
}

aside {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    order: -1;
}

section {
    background: var(--bg-white);
    padding: 28px;
    margin-bottom: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition), transform var(--transition);
}

section:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

h2 i {
    color: var(--accent-color);
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
}

/* --- Profil --- */
#profil p {
    color: var(--text-dark);
    font-size: 0.95rem;
    line-height: 1.75;
}

/* --- Timeline (Expériences & Formation) --- */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-color), var(--border-light));
}

.job, .edu {
    position: relative;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-light);
}

.job:last-child, .edu:last-child {
    border: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    border: 2px solid var(--bg-white);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.date {
    display: inline-block;
    background: rgba(91, 144, 212, 0.1);
    color: var(--accent-color);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 20px;
    margin-bottom: 5px;
}

.job-title {
    font-weight: 700;
    font-size: 1rem;
    display: block;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.company {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 6px;
}

.job p, .edu p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Sidebar name card --- */
.sidebar-name {
    background: linear-gradient(160deg, #1e3050 0%, #2d4870 50%, #395a86 100%);
    color: white;
    padding: 34px 22px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-name-avatar {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 3px solid rgba(255,255,255,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: white;
    margin-bottom: 6px;
}

.sidebar-name-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}

.sidebar-name-sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    letter-spacing: 0.05em;
    line-height: 1.5;
    text-transform: uppercase;
}

.sidebar-name .pdf-btn {
    margin-top: 10px;
    margin-left: 0;
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
    padding: 8px 14px;
}

/* --- Sidebar middle --- */
.sidebar-middle {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    margin-top: 8px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* --- Sidebar items --- */
.sidebar-item {
    flex: 1;
    background: transparent;
    padding: 24px 22px;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.sidebar-item:last-child { border-bottom: none; }

.sidebar-item:hover { background: var(--bg-light); }

/* --- Contact --- */
.contact-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 0.92rem;
    color: var(--text-dark);
}

.contact-row:last-child { margin-bottom: 0; }

.contact-row i {
    color: var(--accent-color);
    width: 16px;
    text-align: center;
    margin-top: 3px;
    flex-shrink: 0;
}

.contact-row a {
    color: var(--text-dark);
    text-decoration: none;
    border-bottom: 1px dotted var(--border-light);
    transition: color var(--transition);
}

.contact-row a:hover { color: var(--accent-color); }

/* --- Skills / Interests Pills --- */
.skills-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill {
    background: rgba(91, 144, 212, 0.08);
    color: var(--accent-dark);
    border: 1px solid rgba(91, 144, 212, 0.22);
    padding: 7px 15px;
    border-radius: 20px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: default;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.pill:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.pill i { margin-right: 5px; }

/* --- Languages --- */
.lang-item { margin-bottom: 22px; }
.lang-item:last-child { margin-bottom: 0; }

.lang-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.lang-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.lang-level {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.lang-bar {
    height: 5px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}

.lang-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), var(--accent-dark));
    border-radius: 3px;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 28px 20px;
    background: var(--primary-color);
    color: rgba(255,255,255,0.65);
    margin-top: 20px;
    font-size: 0.85rem;
    border-top: 3px solid var(--accent-color);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .container { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2rem; }
    .hero-subtitle { font-size: 0.85rem; }
    nav { display: none; }
    .pdf-btn { margin-left: auto; font-size: 0.8rem; padding: 7px 12px; }
}

/* --- Print / PDF Export --- */
@media print {
    @page {
        size: A4;
        margin: 10mm 12mm;
    }

    header, #pdf-btn, footer, .hero { display: none !important; }

    body { background: white; margin: 0; font-size: 9pt; line-height: 1.38; }

    /* Hero : bandeau compact horizontal, sans avatar ni tagline */
    .hero {
        margin-top: 0;
        min-height: auto;
        height: auto;
        padding: 9px 16px;
        background: var(--primary-color) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        gap: 16px;
        page-break-after: avoid;
    }

    .hero::before {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .hero-content {
        flex-direction: row;
        align-items: center;
        gap: 14px;
    }

    .hero-avatar { display: none; }
    .hero-tagline { display: none; }

    .hero h1 { font-size: 15pt; margin-bottom: 0; }
    .hero-subtitle { font-size: 7.5pt; margin-bottom: 0; letter-spacing: 0.08em; }

    .container {
        display: grid;
        grid-template-columns: 1fr 2fr;
        gap: 14px;
        margin: 0;
        max-width: 100%;
        padding: 0;
        height: calc(297mm - 20mm);
        align-items: stretch;
    }

    /* Colonne principale : pas de boîtes, séparateurs horizontaux */
    section {
        box-shadow: none !important;
        border: none;
        border-bottom: 1px solid #dde3ea;
        border-radius: 0;
        background: transparent;
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 0;
        transform: none !important;
        padding: 9px 4px;
    }

    section:last-child { border-bottom: none; }

    /* Sidebar : panneau continu sans boîtes individuelles */
    .sidebar-item {
        box-shadow: none !important;
        border: none;
        /*border-bottom: 1px solid rgba(44, 62, 80, 0.1);*/
        border-radius: 0;
        background: transparent;
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 0;
        transform: none !important;
        padding: 0 12px;
    }

    .sidebar-item:last-child { border-bottom: none; }

    h2 {
        font-size: 6.5pt;
        margin-bottom: 5px;
        padding-bottom: 4px;
    }

    #profil p { font-size: 8.5pt; line-height: 1.4; }

    .timeline { padding-left: 18px; }
    .timeline::before { left: 6px; }
    .timeline-dot { left: -20px; width: 10px; height: 10px; top: 4px; }

    .job, .edu { margin-bottom: 6px; padding-bottom: 6px; }

    .date { font-size: 6.5pt; margin-bottom: 2px; padding: 1px 7px; }
    .job-title { font-size: 9pt; }
    .company { font-size: 8pt; margin-bottom: 1px; }
    .job p, .edu p { font-size: 7.5pt; margin-top: 1px; }

    .contact-row { margin-bottom: 0; font-size: 8.5pt; gap: 9px; }

    .lang-item { margin-bottom: 0; }
    .lang-name { font-size: 8.5pt; }
    .lang-level { font-size: 7.5pt; }
    .lang-bar { height: 4px; margin-top: 4px; }

    /* Compétences & Intérêts */
    .pill { font-size: 7.5pt; padding: 3px 9px; }
    .skills-pills { gap: 5px; margin-top: 4px; }

    .pill, .timeline-dot, .date, .lang-fill, .lang-bar {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Sidebar en impression : panneau continu, pas de sticky */
    aside {
        position: static;
        height: auto;
        overflow: hidden;
        background: #f0f4f8;
        border-radius: 6px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar-name {
        padding: 18px 12px 14px;
        gap: 6px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border-radius: 6px 6px 0 0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar-name-avatar {
        display: flex;
        width: 48px;
        height: 48px;
        font-size: 1rem;
        margin-bottom: 2px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .sidebar-name-text { font-size: 10pt; }
    .sidebar-name-sub { font-size: 7pt; }

    .sidebar-middle {
        flex: 1;
        justify-content: flex-start;
        gap: 0;
        padding-top: 0;
    }

    .sidebar-item {
        flex: none !important;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }

    .sidebar-item h2 { margin-bottom: 0; }

    a[href]::after { content: none; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
