/* =====================================================
   CV DYNAMIQUE — styles écran + impression
   Réutilise les tokens de styles.css (--encre, --creme, --ocre…)
   ===================================================== */

.cv-page {
    padding-top: 0;
    padding-bottom: 80px;
    min-height: 100vh;
}

.cv-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.cv-noscript {
    padding: 120px 24px 80px;
    max-width: 640px;
    margin: 0 auto;
    color: var(--text-secondary);
    line-height: 1.7;
}

.cv-container {
    max-width: 900px;
}

/* =====================================================
   HEADER
   ===================================================== */
.cv-header {
    padding: 100px 0 40px;
    border-bottom: 1px solid var(--border-color);
}

.cv-header-grid {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 28px;
    align-items: start;
}

.cv-photo-frame {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.cv-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-photo-frame::before {
    content: '';
    position: absolute;
    inset: -3px;
    border: 2px solid var(--accent-primary);
    border-radius: 15px;
    opacity: 0.5;
    pointer-events: none;
}

.cv-header-texte {
    min-width: 0;
}

.cv-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 600;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow-wrap: break-word;
}

.cv-sous-titre {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-size: 1rem;
    margin: 0 0 14px;
    letter-spacing: 0.02em;
}

.cv-accroche {
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 560px;
    margin: 0 0 18px;
}

.cv-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.cv-contact a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1px;
    transition: border-color 0.2s ease, color 0.2s ease;
    overflow-wrap: break-word;
    word-break: break-all;
}

.cv-contact a:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-primary);
}

.cv-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 10px 16px;
    min-height: 44px;
    border: 1px solid var(--accent-primary);
    color: var(--accent-secondary);
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cv-export-btn:hover {
    background: var(--accent-primary);
    color: var(--encre);
}

.cv-export-btn:focus-visible,
.cv-titre-btn:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* =====================================================
   SÉLECTEUR DE TITRES — intégré à la navbar fixe
   ===================================================== */
.cv-nav-titres {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
    margin: 0 24px;
}

.cv-nav-back {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.2s ease;
    /* Zone tactile portée à 44px sans agrandir le texte ni décaler la mise en page */
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.cv-nav-back:hover {
    color: var(--text-primary);
}

.cv-titres-selecteur {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.cv-titres-selecteur::-webkit-scrollbar {
    display: none;
}

.cv-titre-btn {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 8px 14px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cv-titre-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-color);
}

.cv-titre-btn.active {
    color: var(--encre);
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* =====================================================
   SECTIONS
   ===================================================== */
.cv-section {
    position: relative;
    margin-bottom: 56px;
    padding-left: 64px;
    padding-top: 0;
    border-top: none;
}

.cv-section::before {
    content: attr(data-num);
    position: absolute;
    left: 0;
    top: 2px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-primary);
    opacity: 0.8;
}

.cv-section::after {
    content: '';
    position: absolute;
    left: 28px;
    top: 28px;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-primary) 20%, var(--border-color) 80%);
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 500;
    margin: 0 0 28px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

/* =====================================================
   EXPÉRIENCES
   ===================================================== */
.cv-experiences-liste {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.cv-experience {
    position: relative;
    padding-left: 20px;
}

.cv-experience::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 7px;
    height: 7px;
    background: var(--accent-primary);
    border-radius: 50%;
}

.cv-experience-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.cv-experience-head h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

.cv-experience-periode {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    /* --text-secondary (= --gris-clair sur fond sombre, ~7:1) et non --text-muted
       (= --gris, ~3:1 sur les cartes sombres → échec WCAG AA sur ce petit texte). */
    color: var(--text-secondary);
    white-space: nowrap;
}

.cv-experience-entreprise {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-secondary);
    margin: 4px 0 8px;
}

.cv-experience-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* =====================================================
   COMPÉTENCES
   ===================================================== */
.cv-competences-grille {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px;
}

.cv-competence-categorie h3 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
}

.cv-competence-categorie ul {
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.cv-competence-categorie li {
    position: relative;
    padding-left: 14px;
}

.cv-competence-categorie li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--border-color);
}

/* =====================================================
   PROJETS
   ===================================================== */
.cv-projets-liste {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cv-projet {
    border-left: 2px solid var(--accent-primary);
    padding: 18px 20px;
    background: var(--bg-secondary);
    border-radius: 0 10px 10px 0;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.cv-projet:hover {
    transform: translateX(4px);
}

.cv-projet-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.cv-projet-head h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 500;
    margin: 0;
}

.cv-projet-head h3 a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.cv-projet-head h3 a:hover {
    color: var(--accent-secondary);
    border-color: var(--accent-primary);
}

.cv-projet-periode {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    /* cf. .cv-experience-periode : --text-secondary pour tenir WCAG AA sur fond sombre. */
    color: var(--text-secondary);
    white-space: nowrap;
}

.cv-projet-description {
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 12px;
}

.cv-projet-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cv-projet-stack li {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 3px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
}

.cv-projet-stack li.primary {
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
}

.cv-projets-note {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* =====================================================
   DIPLÔMES & INTÉRÊTS
   ===================================================== */
.cv-diplomes-liste,
.cv-interets-liste {
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--text-secondary);
    line-height: 1.7;
}

.cv-diplomes-liste li,
.cv-interets-liste li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 10px;
}

.cv-diplomes-liste li::before,
.cv-interets-liste li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 6px;
    height: 1px;
    background: var(--accent-primary);
}

.cv-langue {
    margin-top: 18px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* =====================================================
   THÈME CLAIR
   ===================================================== */
[data-theme="light"] .cv-sous-titre,
[data-theme="light"] .cv-experience-entreprise,
[data-theme="light"] .cv-competence-categorie h3,
[data-theme="light"] .cv-projet-stack li.primary {
    color: var(--terre);
}

[data-theme="light"] .cv-projet {
    background: rgba(28, 26, 23, 0.04);
}

[data-theme="light"] .cv-titre-btn.active {
    color: var(--creme);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .cv-page {
        padding-bottom: 48px;
    }

    .cv-header {
        padding-top: 128px;
        padding-bottom: 28px;
    }

    .cv-header-grid {
        grid-template-columns: 80px 1fr;
        gap: 20px;
    }

    .cv-photo-frame {
        width: 80px;
        height: 80px;
    }

    .cv-photo-frame::before {
        border-radius: 11px;
    }

    .cv-export-btn {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .cv-header h1 {
        font-size: 1.9rem;
    }

    /* Navbar du CV en mobile : retour + titres passent dans le menu burger (dropdown) */
    .cv-nav-titres {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        background: var(--bg-secondary);
        padding: 12px 20px 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .cv-nav-titres.active {
        display: flex;
    }

    .cv-nav-back {
        padding: 12px 0;
        border-bottom: 1px solid var(--border-color);
    }

    .cv-titres-selecteur {
        flex-direction: column;
        align-items: stretch;
        overflow-x: visible;
        gap: 4px;
        padding-top: 8px;
    }

    .cv-titre-btn {
        display: flex;
        align-items: center;
        border-radius: 8px;
        text-align: left;
        width: 100%;
    }

    .cv-section {
        padding-left: 36px;
        margin-bottom: 44px;
    }

    .cv-section::before {
        font-size: 0.75rem;
    }

    .cv-section::after {
        left: 18px;
    }

    .section-title {
        font-size: 1.2rem;
        margin-bottom: 22px;
    }

    .cv-competences-grille {
        grid-template-columns: 1fr;
        gap: 22px;
    }
}

/* =====================================================
   IMPRESSION — rendu clair/papier, indépendant du thème écran
   ===================================================== */
@media print {
    .navbar,
    .footer {
        display: none !important;
    }

    body,
    .cv-page {
        background: #FFFFFF !important;
        color: #1C1A17 !important;
        padding: 0 !important;
    }

    .cv-container {
        max-width: 100%;
    }

    .cv-header {
        padding-top: 0;
        border-bottom-color: #D4CFC6 !important;
    }

    .cv-photo-frame::before {
        border-color: #7A5C3E !important;
    }

    .cv-sous-titre,
    .cv-experience-entreprise,
    .cv-competence-categorie h3,
    .section-title,
    .cv-projet-stack li.primary {
        color: #7A5C3E !important;
    }

    .cv-accroche,
    .cv-experience-description,
    .cv-competence-categorie ul,
    .cv-diplomes-liste,
    .cv-interets-liste,
    .cv-langue,
    .cv-projet-description,
    .cv-projets-note,
    .cv-contact {
        color: #2E2B27 !important;
    }

    .cv-projet {
        background: transparent !important;
        border-left-color: #7A5C3E !important;
    }

    .cv-projet-stack li {
        background: transparent !important;
        border-color: #D4CFC6 !important;
    }

    .cv-section::after {
        background: linear-gradient(180deg, #7A5C3E 0%, #7A5C3E 20%, #D4CFC6 80%) !important;
    }

    .cv-diplomes-liste li::before,
    .cv-interets-liste li::before,
    .cv-experience::before {
        background: #7A5C3E !important;
    }

    .cv-section {
        padding-left: 48px;
    }

    .cv-experience,
    .cv-competence-categorie,
    .cv-projet {
        break-inside: avoid;
    }

    a {
        color: #1C1A17 !important;
        text-decoration: none !important;
    }

    .cv-projet-head h3 a::after,
    .cv-contact a[href^="https"]::after,
    .cv-contact a[href^="mailto"]::after {
        content: " (" attr(href) ")";
        font-size: 0.7em;
        color: #6B6560;
    }

    body::after {
        display: none !important;
    }
}
