/* ============================================================
   CV — Téléchargement PDF (bouton + modale)
   Animation futuriste « Matrix » : reveal gauche→droite + scan line
   ============================================================ */

/* ===== Bouton trigger ===== */
.cv-download {
    margin-top: 32px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cv-download-trigger {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.cv-download-trigger svg {
    flex-shrink: 0;
}

/* ============================================================
   MODALE — visibilité pilotée par classes (.is-opening / .is-open / .is-closing)
   ============================================================ */
.cv-download-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.cv-download-modal.is-opening,
.cv-download-modal.is-open,
.cv-download-modal.is-closing {
    display: flex;
}

/* ===== Backdrop ===== */
.cv-download-backdrop {
    position: absolute;
    inset: 0;
    background: var(--scrim);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    opacity: 0;
    transition: opacity 280ms ease-out;
}

.cv-download-modal.is-open .cv-download-backdrop {
    opacity: 1;
}

.cv-download-modal.is-closing .cv-download-backdrop {
    opacity: 0;
    transition-duration: 180ms;
}

/* ===== Panneau ===== */
.cv-download-panel {
    position: relative;
    width: min(620px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface-elevated);
    border: 0.5px solid var(--line-strong);
    border-radius: 20px;
    padding: 40px 32px 32px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgb(var(--tint) / 0.04) inset;
    /* État initial — masqué par clip-path à droite */
    clip-path: inset(0 100% 0 0);
    opacity: 0;
}

.cv-download-modal.is-open .cv-download-panel {
    animation:
        cv-dl-panel-reveal 600ms cubic-bezier(0.16, 1, 0.3, 1) forwards,
        cv-dl-border-flash 900ms ease-out 0ms forwards;
}

.cv-download-modal.is-closing .cv-download-panel {
    animation: cv-dl-panel-fade-out 180ms ease-in forwards;
}

@keyframes cv-dl-panel-reveal {
    0% {
        clip-path: inset(0 100% 0 0);
        opacity: 0;
    }
    8% {
        opacity: 1;
    }
    100% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
}

@keyframes cv-dl-panel-fade-out {
    to {
        opacity: 0;
        transform: scale(0.985);
    }
}

@keyframes cv-dl-border-flash {
    0%   { box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,113,227,0.6) inset, 0 0 40px rgba(0,113,227,0.4) inset; }
    50%  { box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,113,227,0.3) inset, 0 0 20px rgba(0,113,227,0.15) inset; }
    100% { box-shadow: 0 24px 80px rgba(0,0,0,0.6), 0 0 0 1px rgb(var(--tint) / 0.04) inset; }
}

/* ===== Scan line (pseudo-élément qui suit la frontière du clip-path) ===== */
.cv-download-panel::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent), 0 0 32px rgba(0, 113, 227, 0.6);
    opacity: 0;
    pointer-events: none;
}

.cv-download-modal.is-open .cv-download-panel::before {
    animation: cv-dl-scan 600ms linear forwards;
}

@keyframes cv-dl-scan {
    0%   { left: 0;    opacity: 1; }
    90%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* ===== Halo bleu derrière le panneau ===== */
.cv-download-halo {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%) scale(0.6);
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 113, 227, 0.45), transparent 70%);
    filter: blur(48px);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.cv-download-modal.is-open .cv-download-halo {
    animation: cv-dl-halo-pulse 800ms ease-out forwards;
}

@keyframes cv-dl-halo-pulse {
    0%   { opacity: 0; transform: translateX(-50%) scale(0.6); }
    60%  { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
    100% { opacity: 0.55; transform: translateX(-50%) scale(1); }
}

/* ===== Bouton fermeture ===== */
.cv-download-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgb(var(--tint) / 0.05);
    border: 0.5px solid var(--line);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 200ms ease;
    z-index: 2;
}

.cv-download-close:hover {
    background: rgb(var(--tint) / 0.1);
    color: var(--text);
    transform: rotate(90deg);
}

/* ===== En-tête modale ===== */
.cv-download-head {
    margin-bottom: 28px;
    text-align: center;
    position: relative;
}

.cv-download-title {
    font-family: var(--font-display, 'Instrument Serif', serif);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 400;
    margin: 8px 0 12px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.cv-download-modal.is-open .cv-download-title {
    animation: cv-dl-title-glitch 400ms steps(1, end) 300ms 1 both;
}

@keyframes cv-dl-title-glitch {
    0%   { text-shadow: 2px 0 0 rgba(255, 0, 80, 0.7), -2px 0 0 rgba(0, 200, 255, 0.7); transform: translateX(0); }
    20%  { text-shadow: -2px 0 0 rgba(255, 0, 80, 0.7), 2px 0 0 rgba(0, 200, 255, 0.7); transform: translateX(-1px); }
    40%  { text-shadow: 1px 0 0 rgba(255, 0, 80, 0.5), -1px 0 0 rgba(0, 200, 255, 0.5); transform: translateX(1px); }
    60%  { text-shadow: none; transform: translateX(0); }
    100% { text-shadow: none; transform: translateX(0); }
}

.cv-download-subtitle {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto;
}

/* ===== Pilules ===== */
.cv-pills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.cv-pills:has(.cv-pill:only-child) {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin-inline: auto;
}

.cv-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 28px 20px;
    border-radius: 18px;
    text-decoration: none;
    transition: transform 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
    border: 0.5px solid var(--line-strong);
    text-align: center;
    /* État initial (caché en attendant l'apparition cascade) */
    opacity: 0;
    transform: translateY(12px) scale(0.96);
}

.cv-download-modal.is-open .cv-pill {
    animation: cv-dl-pill-in 320ms ease-out forwards;
}

.cv-download-modal.is-open .cv-pill:nth-child(1) {
    animation-delay: 450ms;
}

.cv-download-modal.is-open .cv-pill:nth-child(2) {
    animation-delay: 550ms;
}

@keyframes cv-dl-pill-in {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cv-pill--light {
    background: linear-gradient(180deg, rgb(var(--tint) / 0.08), rgb(var(--tint) / 0.02));
    color: var(--text);
}

.cv-pill--light:hover {
    transform: translateY(-3px) scale(1);
    border-color: rgb(var(--tint) / 0.35);
    box-shadow: 0 12px 40px rgb(var(--tint) / 0.08);
}

.cv-pill--dark {
    /* Sémantique : représente le CV version sombre — reste visuellement sombre dans les 2 themes */
    background: linear-gradient(180deg, var(--black-3), var(--black-2));
    color: #fff;
}

.cv-pill--dark:hover {
    transform: translateY(-3px) scale(1);
    border-color: color-mix(in oklab, var(--accent) 60%, transparent);
    box-shadow: 0 12px 40px color-mix(in oklab, var(--accent) 25%, transparent);
}

.cv-pill-icon {
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgb(var(--tint) / 0.06);
    border: 0.5px solid var(--line);
}

.cv-pill--dark .cv-pill-icon {
    background: color-mix(in oklab, var(--accent) 15%, transparent);
    border-color: color-mix(in oklab, var(--accent) 40%, transparent);
    color: var(--accent);
}

.cv-pill-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cv-pill-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.cv-pill-desc {
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ===== Lock scroll body quand la modale est ouverte ===== */
body.cv-download-open {
    overflow: hidden;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .cv-download-panel {
        padding: 32px 20px 24px;
        border-radius: 16px;
    }

    .cv-download-halo {
        width: 280px;
        height: 280px;
        top: -60px;
    }

    .cv-pills {
        grid-template-columns: 1fr;
    }

    .cv-pills:has(.cv-pill:only-child) {
        max-width: none;
    }
}

/* ===== Accessibilité — prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
    .cv-download-panel,
    .cv-download-backdrop,
    .cv-download-halo,
    .cv-pill {
        animation: none !important;
        transition: opacity 150ms ease !important;
    }

    .cv-download-panel {
        clip-path: none;
        opacity: 0;
    }

    .cv-download-modal.is-open .cv-download-panel,
    .cv-download-modal.is-open .cv-download-halo {
        opacity: 1;
        clip-path: none;
        transform: translateX(-50%) scale(1);
    }

    .cv-download-modal.is-open .cv-download-halo {
        opacity: 0.55;
    }

    .cv-download-modal.is-open .cv-pill {
        opacity: 1;
        transform: none;
    }

    .cv-download-panel::before,
    .cv-download-modal.is-open .cv-download-title {
        animation: none !important;
    }
}
