/* ==========================================================
   Base commune à tous les styles de CV
   Les couleurs (--accent, --accent-dark, --accent-soft, --accent-tint,
   --on-accent) sont calculées en JS à partir de la couleur choisie.
   ========================================================== */
.cv {
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --ink-body: #1a212c; /* texte des missions : presque noir */
  --ink-mute: #6b7280;
  --rule: #e5e7eb;
  /* Espace répété en haut / en bas de chaque page quand le CV en fait plusieurs.
     Chaque style le règle ; app.js le lit pour placer les repères « Page 2 ». */
  --break-top: 0mm;
  --break-bottom: 0mm;

  position: relative;
  width: 210mm;
  min-height: calc(var(--pages, 1) * 297mm);
  color: var(--ink);
  line-height: 1.4;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.cv *, .cv *::before, .cv *::after { box-sizing: border-box; }
.cv h1, .cv h2, .cv h3, .cv p, .cv ul { margin: 0; padding: 0; }
.cv ul { list-style: none; }
.cv a { color: inherit; text-decoration: none; }
.cv .is-placeholder { opacity: .3; }

/* Icônes */
.cv-ico {
  flex: none;
  width: 1.05em; height: 1.05em;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* Photo : un cadre (forme + bordure) avec l'image cadrée dedans.
   Taille = --photo-size (prévue par chaque style) × --photo-scale (curseur « Taille »).
   Les bordures sont proportionnelles à la taille ; leur couleur est --frame. */
.cv-photo {
  --photo-w: calc(var(--photo-size, 30mm) * var(--photo-scale, 1));
  flex: none;
  width: var(--photo-w); height: var(--photo-w);
}
.cv-photo__crop { width: 100%; height: 100%; overflow: hidden; border-radius: inherit; }
.cv-photo__crop img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cv-photo--initials .cv-photo__crop {
  display: grid; place-items: center;
  font-size: calc(var(--photo-w) * .23); font-weight: 700; letter-spacing: .02em;
}

.cv-photo--round { border-radius: 50%; }
.cv-photo--rounded { border-radius: 14%; }
.cv-photo--square { border-radius: 0; }

.cv-photo--frame-thin { border: calc(var(--photo-w) * .016) solid var(--frame); }
.cv-photo--frame-thick { border: calc(var(--photo-w) * .035) solid var(--frame); }
.cv-photo--frame-ring { padding: calc(var(--photo-w) * .026); border: calc(var(--photo-w) * .013) solid var(--frame); }
.cv-photo--frame-double { border: calc(var(--photo-w) * .048) double var(--frame); }
.cv-photo--frame-dashed { padding: calc(var(--photo-w) * .026); border: calc(var(--photo-w) * .016) dashed var(--frame); }
.cv-photo--frame-shadow {
  border: calc(var(--photo-w) * .026) solid var(--frame);
  box-shadow: 0 calc(var(--photo-w) * .035) calc(var(--photo-w) * .1) rgba(0, 0, 0, .16);
}
.cv-photo--frame-offset { box-shadow: calc(var(--photo-w) * .065) calc(var(--photo-w) * .065) 0 var(--frame); }
.cv-photo--frame-gradient {
  border: calc(var(--photo-w) * .04) solid transparent;
  background: linear-gradient(135deg, var(--frame), color-mix(in srgb, var(--frame) 35%, #fff)) border-box;
}

/* Prénom et nom : sur une ligne, ou le prénom au-dessus du nom */
.cv-name--stacked .cv-name__first,
.cv-name--stacked .cv-name__last { display: block; }

/* Coordonnées */
.cv-contact { display: flex; flex-direction: column; gap: 6px; }
.cv-contact__item { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }

/* Texte libre et puces */
.cv-text { white-space: pre-line; }
.cv-bullets li { position: relative; padding-left: 12px; }
.cv-bullets li + li { margin-top: 1px; }
.cv-bullets li::before {
  content: ''; position: absolute; left: 1px; top: .62em;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}

/* Mise en forme des missions, choisie avec les boutons du formulaire :
   sous-titres (cv-sub) et lignes décalées d'un ou deux crans (cv-lv-1, cv-lv-2).
   (« .cv » devant : passe avant les puces propres à chaque style de CV) */
.cv .cv-bullets li.cv-sub { padding-left: 0; }
.cv .cv-bullets li.cv-sub::before { content: none; }
.cv .cv-bullets li.cv-sub:not(:first-child) { margin-top: 1.6mm; }
.cv .cv-bullets li.cv-lv-1 { margin-left: 4mm; }
.cv .cv-bullets li.cv-lv-2 { margin-left: 8mm; }

/* Les 6 styles de sous-titres (réglage « Style des sous-titres ») */
/* Majuscules colorées */
.cv--sub-caps .cv-bullets li.cv-sub { color: var(--accent-ink); font-size: .8em; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.cv--sub-caps .cv-bullets li.cv-sub:is(.cv-lv-1, .cv-lv-2) { color: var(--ink); font-size: .78em; letter-spacing: .07em; }
/* Gras, puces creuses pour les lignes décalées */
.cv--sub-bold .cv-bullets li.cv-sub { color: var(--ink); font-weight: 700; }
.cv--sub-bold .cv-bullets li.cv-sub:is(.cv-lv-1, .cv-lv-2) { font-weight: 600; }
.cv--sub-bold .cv-bullets li:is(.cv-lv-1, .cv-lv-2)::before { background: transparent; box-shadow: inset 0 0 0 1.2px var(--accent); }
/* Chevron devant le sous-titre, tirets pour les lignes décalées */
.cv--sub-chevron .cv-bullets li.cv-sub { color: var(--ink); font-weight: 600; }
.cv--sub-chevron .cv-bullets li.cv-sub::before {
  content: '›'; position: static; display: inline-block;
  width: auto; height: auto; margin-right: 1.6mm;
  border-radius: 0; background: none; color: var(--accent); font-weight: 800;
}
.cv--sub-chevron .cv-bullets li:is(.cv-lv-1, .cv-lv-2):not(.cv-sub)::before { top: .68em; width: 5px; height: 1.5px; border-radius: 1px; }
/* Filet vertical le long des lignes décalées */
.cv--sub-bar .cv-bullets li.cv-sub { color: var(--ink); font-weight: 700; }
.cv--sub-bar .cv-bullets li:is(.cv-lv-1, .cv-lv-2) { margin-left: 1.2mm; border-left: 1.5px solid var(--accent-tint); }
.cv--sub-bar .cv-bullets li:is(.cv-lv-1, .cv-lv-2):not(.cv-sub) { margin-top: 0; padding-top: 1px; }
.cv--sub-bar .cv-bullets li.cv-lv-1 { padding-left: calc(3mm + 12px); }
.cv--sub-bar .cv-bullets li.cv-lv-2 { padding-left: calc(6mm + 12px); }
.cv--sub-bar .cv-bullets li.cv-lv-1::before { left: calc(3mm + 1px); }
.cv--sub-bar .cv-bullets li.cv-lv-2::before { left: calc(6mm + 1px); }
.cv--sub-bar .cv-bullets li.cv-sub.cv-lv-1 { padding-left: 3mm; font-weight: 600; }
.cv--sub-bar .cv-bullets li.cv-sub.cv-lv-2 { padding-left: 6mm; font-weight: 600; }
/* Pastille */
.cv--sub-pill .cv-bullets li.cv-sub {
  display: table; padding: .2mm 2.2mm; border-radius: 1.2mm;
  background: var(--accent-soft); color: var(--accent-dark); font-size: .92em; font-weight: 600;
}
.cv--sub-pill .cv-bullets li.cv-sub:is(.cv-lv-1, .cv-lv-2) { background: transparent; box-shadow: inset 0 0 0 1px var(--accent-tint); }
/* Titre + filet jusqu'au bord */
.cv--sub-line .cv-bullets li.cv-sub { display: flex; align-items: center; gap: 2.4mm; color: var(--ink); font-weight: 600; }
.cv--sub-line .cv-bullets li.cv-sub::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.cv--sub-line .cv-bullets li.cv-sub:is(.cv-lv-1, .cv-lv-2) { color: var(--ink-soft); font-weight: 500; }
.cv--sub-line .cv-bullets li.cv-sub:is(.cv-lv-1, .cv-lv-2)::after { background: linear-gradient(to right, var(--rule) 50%, transparent 0) 0 0 / 5px 1px; }

/* Entrées (expériences, formations, projets) */
.cv-entries { display: flex; flex-direction: column; }
/* Saut de page : une longue entrée peut continuer sur la page suivante
   (sinon elle part en entier et laisse un grand vide), mais on ne laisse
   jamais le titre seul en bas de page, ni une puce seule en haut. */
.cv-entry__head, .cv-entry__sub, .cv-bullets li { break-inside: avoid; }
.cv-entry__head:not(:last-child),
.cv-entry__sub:not(:last-child),
.cv-bullets li:first-child,
.cv-bullets li:nth-last-child(2),
.cv-bullets li.cv-sub { break-after: avoid; } /* un sous-titre reste avec son 1er point */

/* Stack technique en bas d'une expérience : encadré doux (reste collé aux dernières puces) */
.cv-stack {
  margin-top: 2.2mm; padding: 1.8mm 2.8mm 2mm;
  border-radius: 2mm;
  background: var(--accent-soft);
  break-before: avoid; break-inside: avoid;
}
.cv-stack__label {
  display: block; margin-bottom: .8mm;
  color: var(--accent-ink);
  font-size: .75em; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.cv-stack__list { color: var(--ink); font-size: .93em; font-weight: 500; line-height: 1.5; }
.cv-stack__list li { display: inline; white-space: nowrap; }
.cv-stack__list li:not(:last-child)::after { content: '·'; margin: 0 .45em; color: var(--accent); font-weight: 700; }
.cv-entry__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cv-entry__date { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cv-entry__body { margin-top: 4px; }

/* Logos des entreprises */
.cv-entry.has-logo { display: grid; grid-template-columns: 8mm 1fr; align-items: start; column-gap: 2.5mm; }
.cv-entry__main { min-width: 0; }
.cv-logo {
  display: grid; place-items: center;
  width: 8mm; height: 8mm;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--rule); border-radius: 2mm;
}
.cv-logo img { width: 78%; height: 78%; object-fit: contain; }
.cv-logo__letter { display: none; color: var(--accent-dark); font-size: 9pt; font-weight: 700; }
.cv-logo.is-fallback { background: var(--accent-soft); border-color: transparent; }
.cv-logo.is-fallback img { display: none; }
.cv-logo.is-fallback .cv-logo__letter { display: block; }
.cv-tag-kind {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: .78em; font-weight: 600; vertical-align: 1px;
}

/* Jauges (barres) */
.cv-meter { display: block; height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.cv-meter__fill { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

/* Jauges (points) */
.cv-dots { display: inline-flex; gap: 4px; flex: none; }
.cv-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
.cv-dots i.on { background: var(--accent); }

/* Pastilles */
.cv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cv-chip { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 500; }

/* Technos sous une compétence : petits tags */
.cv-tags { display: flex; flex-wrap: wrap; gap: 1mm; margin-top: 1.4mm; }
.cv-tag {
  padding: .2mm 1.6mm;
  border-radius: 1mm;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: 7pt; font-weight: 500; line-height: 1.5;
}

/* Liste en ligne : « a · b · c » */
.cv-inline { display: flex; flex-wrap: wrap; }
.cv-inline li:not(:last-child)::after { content: '·'; margin: 0 .5em; color: var(--ink-mute); }

/* Compétences et langues */
.cv-skill, .cv-lang { break-inside: avoid; }
.cv-h { break-after: avoid; break-inside: avoid; }

/* ==========================================================
   Carte « Apparence » du formulaire : police, en-tête, icônes des titres.
   Sans choix, chaque style garde les siens. (« .cv » répété ou ajouté
   devant : passe avant les règles propres à chaque style de CV.)
   ========================================================== */

/* Police : texte, nom + titres des expériences, titres de section + poste */
.cv--font-sobre { --font-body: 'Inter', sans-serif; --font-display: 'Inter', sans-serif; --font-label: 'Inter', sans-serif; }
.cv--font-elegante { --font-body: 'Source Sans 3', sans-serif; --font-display: 'Playfair Display', Georgia, serif; --font-label: 'Source Sans 3', sans-serif; }
.cv--font-tech { --font-body: 'Inter', sans-serif; --font-display: 'Space Grotesk', sans-serif; --font-label: 'Space Grotesk', sans-serif; }
.cv--font-ronde { --font-body: 'Poppins', sans-serif; --font-display: 'Poppins', sans-serif; --font-label: 'Poppins', sans-serif; }
.cv--font-magazine { --font-body: 'DM Sans', sans-serif; --font-display: 'DM Serif Display', Georgia, serif; --font-label: 'DM Sans', sans-serif; }
.cv.cv[class*="cv--font-"] { font-family: var(--font-body); }
.cv[class*="cv--font-"] :is(.cv-name, .cv-entry__title, .cv-photo--initials) { font-family: var(--font-display); }
.cv[class*="cv--font-"] :is(.cv-h, .cv-title) { font-family: var(--font-label); }
.cv.cv--font-magazine :is(.cv-name span, .cv-entry__title) { font-weight: 400; } /* une seule graisse */

/* Icônes devant les titres de section */
.cv-h__ico { display: none; }
.cv[class*="cv--ico-"] .cv-sec .cv-h { display: flex; align-items: center; gap: 2mm; }
.cv[class*="cv--ico-"] .cv-h__ico { display: grid; flex: none; place-items: center; }
.cv[class*="cv--ico-"] .cv-h__ico .cv-ico { width: 3.7mm; height: 3.7mm; }
.cv--ico-simple .cv-h__ico { color: var(--accent); }
.cv:is(.cv--ico-round, .cv--ico-soft, .cv--ico-square) .cv-h__ico { width: 6.2mm; height: 6.2mm; }
.cv:is(.cv--ico-round, .cv--ico-soft, .cv--ico-square) .cv-h__ico .cv-ico { width: 3.3mm; height: 3.3mm; }
.cv--ico-round .cv-h__ico { border-radius: 50%; background: var(--accent); color: var(--on-accent); }
.cv--ico-soft .cv-h__ico { border-radius: 50%; background: var(--accent-tint); color: var(--accent-dark); }
.cv--ico-square .cv-h__ico { border: 1.3px solid var(--accent); border-radius: 1.6mm; color: var(--accent); }
/* Pastille : tout le titre dans une pastille de couleur */
.cv.cv--ico-pill .cv-sec .cv-h {
  width: fit-content; max-width: 100%;
  padding: 1.1mm 3.2mm 1.1mm 2.4mm;
  border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
}
.cv.cv--ico-pill .cv-sec .cv-h::after { display: none; }

/* En-tête : un fond derrière l'en-tête (.cv-head) jusqu'aux bords de la page
   (bandeau, dégradé, bloc foncé), un motif dans le coin, ou les initiales en filigrane.
   Chaque style donne la distance entre son en-tête et les bords de la page :
   --head-top, --head-left, --head-right. Le fond passe derrière le texte (isolation). */
.cv[class*="cv--head-"] { isolation: isolate; }
.cv[class*="cv--head-"] .cv-head { position: relative; }
.cv--head-band { --head-bg: var(--accent); --head-ink: var(--on-accent); }
.cv--head-gradient {
  --head-bg:
    radial-gradient(circle at 90% 18%, rgba(255, 255, 255, .13) 0 17mm, transparent 17.3mm),
    radial-gradient(circle at 74% 120%, rgba(255, 255, 255, .09) 0 28mm, transparent 28.3mm),
    linear-gradient(115deg, var(--accent) 10%, var(--accent-dark) 95%);
  --head-ink: var(--on-accent);
}
.cv--head-dark { --head-bg: #1f2937; --head-ink: #ffffff; }
.cv:is(.cv--head-band, .cv--head-gradient, .cv--head-dark) .cv-head::before {
  content: ''; position: absolute; z-index: -1;
  top: calc(-1 * var(--head-top, 0mm)); bottom: 0;
  left: calc(-1 * var(--head-left, 0mm)); right: calc(-1 * var(--head-right, 0mm));
  background: var(--head-bg);
}
.cv:is(.cv--head-band, .cv--head-gradient, .cv--head-dark) .cv-head :is(.cv-name, .cv-name > *, .cv-title, .cv-contact, .cv-contact .cv-ico) { color: var(--head-ink); }
.cv:is(.cv--head-band, .cv--head-gradient):not(.cv--tendance) .cv-photo--initials .cv-photo__crop { background: #fff; color: var(--accent); }
.cv.cv--head-dark .cv-head .cv-title { color: color-mix(in srgb, var(--accent) 45%, #fff); }
.cv.cv--head-dark .cv-head .cv-title::after { content: ''; display: block; width: 14mm; height: 1mm; margin-top: 3mm; border-radius: 1mm; background: var(--accent); }
/* Motif : ronds et points pâles en haut à droite de la page */
.cv--head-motif .cv-head::after {
  content: ''; position: absolute; z-index: -1;
  top: calc(-1 * var(--head-top, 0mm)); right: calc(-1 * var(--head-right, 0mm));
  width: 78mm; height: 62mm;
  background:
    radial-gradient(circle at 100% 0, var(--accent-tint) 0 19mm, transparent 19.3mm),
    radial-gradient(circle at 100% 0, transparent 0 26mm, var(--accent-tint) 26.3mm 27mm, transparent 27.3mm),
    radial-gradient(circle, var(--accent-tint) .45mm, transparent .55mm) 0 0 / 3.6mm 3.6mm;
  -webkit-mask: linear-gradient(225deg, #000 25%, transparent 68%);
  mask: linear-gradient(225deg, #000 25%, transparent 68%);
}
/* Initiales en filigrane (texte de --ini, voir templates.js) + barre de couleur tout en haut */
.cv--head-initials .cv-head::before {
  content: ''; position: absolute; z-index: -1;
  top: calc(-1 * var(--head-top, 0mm)); height: 3mm;
  left: calc(-1 * var(--head-left, 0mm)); right: calc(-1 * var(--head-right, 0mm));
  background: var(--accent);
}
.cv--head-initials .cv-head::after {
  content: var(--ini, ''); position: absolute; z-index: -1;
  top: calc(5mm - var(--head-top, 0mm)); right: calc(9mm - var(--head-right, 0mm));
  color: var(--accent-soft);
  font-size: 118pt; font-weight: 800; line-height: 1; letter-spacing: -.05em;
}

/* Repère de saut de page (visible seulement dans l'aperçu) */
.cv-break {
  position: absolute; left: 0; right: 0; z-index: 5;
  height: 0;
  border-top: 2px dashed rgba(220, 38, 38, .55);
  pointer-events: none;
}
.cv-break span {
  position: absolute; right: 8px; top: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: #fee2e2; color: #b91c1c;
  font: 600 11px/1.4 'Inter', sans-serif;
}

@media print {
  .cv-break { display: none; }
  /* À l'impression, le CV prend juste la place de son contenu : jamais de page
     blanche en trop. (Le fond des pages est blanc ; le style Moderne peint
     sa colonne colorée lui-même, voir tpl-moderne.css.) */
  .cv { min-height: 0; }
}
