/*
 * Capitale template — French corporate classic: navy-disciplined single
 * column with a square photo top-right. Shared by browser (edit) and mPDF
 * (pdf). No flexbox, no CSS grid: floats / tables / block layout only, so the
 * two renderers agree.
 */

/* ---- page margins (multi-page) ---------------------------------------- *
 * PdfService gives mPDF margin_* = 0, so a PDF's only vertical margin is
 * this wrapper's own padding — and a wrapper's padding-top lands on page 1
 * alone, leaving every later page hard against the sheet edge.
 *
 * @page restores an identical margin on every page; `@page :first` zeroes
 * the top one so page 1 keeps using the wrapper padding it always had and
 * its output is unchanged. Left/right stay 0 — the wrapper's horizontal
 * padding already applies to every page. Inert in the browser (@page is
 * print-only), and builder.js reads these same values back out of CSSOM
 * so its page-count model matches what mPDF actually does. */
@page {
    margin: 40px 0 30px 0;
}
@page :first {
    margin-top: 0;
}

.resume-page.resume-capitale {
    width: 794px;               /* A4 @ 96dpi -> fills A4 width in mPDF */
    box-sizing: border-box;
    padding: 40px 54px 0;      /* zero bottom: @page margin-bottom now supplies the last page's trailing space on every page; keeping both reserved ~70px and opened a blank final page */
    background: #ffffff;
    color: #1f2937;
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.42;
}

/* mPDF does NOT inherit font-family/size into table cells — anything inside a
   <td> silently falls back to the serif document default (in-td trap class,
   2026-07 slate rework). The header, the entry rows and the skills/languages
   grids are all tables, so the font must be declared at td level too. No-op in
   the browser. */
.resume-capitale td {
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.32;
    color: #1f2937;
}

/* ---- header (two-cell: name/title/contact left, square photo right) ----- */
.cv-header {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
    border-bottom: 2px solid #1e3a8a;
}
.cv-head-main {
    vertical-align: top;
    padding: 0 0 14px;
}
.cv-head-side {
    width: 100px;
    vertical-align: top;
    text-align: right;
    padding: 0 0 14px;
}
.cv-photo,
.cv-photo-initials {
    display: inline-block;
}
.cv-name {
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 0.3px;
    margin: 0 0 3px;
    line-height: 1.12;
    color: #111827;
}
.cv-jobtitle {
    font-size: 14.5px;
    font-weight: bold;
    margin-bottom: 8px;
}
.cv-contact {
    font-size: 12px;
    color: #374151;
}
/* Each contact item is separated by its own left margin in the browser; in
   mPDF inline margins inside a <td> are unreliable, so the icon helper's
   trailing &nbsp; plus this gap keep items apart. The literal glyphs come from
   tpl_icon (real HTML text, never CSS content:). */
.cv-contact-item {
    white-space: nowrap;
}
/* Literal middot between contact items (pdf mode) — the only reliable
   inter-item gap inside the header <td>, where mPDF drops inline margins. */
.cv-contact-sep {
    color: #9ca3af;
}
/* Edit mode shows all five contact fields; space them with a margin there
   (browser only, so mPDF's in-td margin drop is irrelevant). */
.resume-capitale .cv-contact [contenteditable] {
    margin-right: 8px;
}
.resume-capitale .cv-icon {
    display: inline-block;
    margin-right: 3px;
}
.resume-capitale .cv-icon.cv-icon-linkedin {
    display: inline-block;
    width: 12px;
    height: 12px;
    line-height: 12px;
    font-size: 8px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    border-radius: 2px;
    margin-right: 3px;
}

/* ---- sections -------------------------------------------------------- */
.cv-section {
    margin-bottom: 11px;
}
.cv-section:last-child {
    margin-bottom: 0;
}
/* pdf mode: mPDF doesn't reliably honor :last-child, so the server marks
 * whichever section/item actually renders last with this plain class instead
 * (capitale.php). Unscoped on purpose — applies to whichever element carries
 * it (section, item, or inline-item). */
/* DO NOT raise this selector's specificity. It ties .cv-section /
   .cv-inline-item at (0,1,0) and wins only on source order — but scoping it to
   .resume-X, or class-doubling it, also makes it override the margin on
   page-break-inside:avoid entries, which reintroduces the blank trailing page
   it exists to prevent (measured on classic, metric, ledger, sapphire,
   curriculum, host; skill §5 avoid-estimator trap). */
.is-last {
    margin-bottom: 0;
}
/* Full-width navy bottom rule under each section title. The h2 is a block
   directly under .resume-page (not inside a <td>), so the border spans the
   full content width — the accent color is set inline per-element so it
   tracks settings.accentColor. */
.cv-section-title {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #1e3a8a;
    border-bottom: 1.5px solid #1e3a8a;
    padding-bottom: 2px;
    margin: 0 0 6px;
    page-break-after: avoid;
}
/* page-break-after:avoid on the title alone is not reliable in mPDF — pair it
 * with a page-break-inside:avoid group wrapping the title and its first entry
 * so the two move to the next page as a unit instead of orphaning the header. */
.cv-section-head-group {
    page-break-inside: avoid;
}
.cv-summary {
    text-align: left;
}

/* ---- items ----------------------------------------------------------- */
/* Inter-entry spacing is margin-TOP on a class every entry but the first
 * carries (capitale.php adds it server-side; edit mode binds the same class
 * with :class), not margin-bottom + :last-child and NOT a `+` sibling rule.
 *
 * Both of the obvious forms are broken here, in opposite directions:
 *   - margin-bottom + `.cv-item:last-child { margin-bottom: 0 }` — the first
 *     entry of every section is the last child of .cv-section-head-group, so
 *     Chrome zeroed its margin and glued entry 1 to entry 2 while mPDF, which
 *     does not honour :last-child, kept the 9px. +9px of export-only height
 *     per section, and what failed scripts/boundary-test.php.
 *   - `.cv-item + .cv-item { margin-top: 9px }` — mPDF ignores the sibling
 *     combinator outright (proved by raising such a rule to 100px and watching
 *     the export not move a pixel), so the canvas got the gap and the export
 *     did not.
 * A plain class keeps both renderers identical and still never puts a
 * competing value on any element, which is what §5's avoid-estimator trap
 * actually forbids — an entry with no class simply has no top margin. */
.cv-item {
    position: relative;
    page-break-inside: avoid;
}
.cv-item--gap {
    margin-top: 9px;
}

/* Two-column "title left / dates right" via table (mPDF-safe). */
.cv-row {
    width: 100%;
    border-collapse: collapse;
}
.cv-row td {
    vertical-align: top;
    padding: 0;
}
.cv-row-main {
    text-align: left;
}
/* No `white-space: nowrap` here on purpose. With it, Chrome's auto table
   layout widens this column past its declared 30% to keep a long date range
   on one line (measured 205.8px -> 229.5px on "septembre 2013 – décembre
   2018"), while mPDF holds the column at 30% and wraps — so the export gained
   a whole extra line, ~16px, that the canvas never showed. Accumulated over a
   page that is what made mPDF render capitale ~39px taller than the browser
   and fail scripts/boundary-test.php at only 7 filler characters. Letting both
   renderers wrap at the same width is what keeps them in step; the column is
   wide enough that a normal date range still fits on one line. */
.resume-capitale .cv-row-side {
    text-align: right;
    width: 30%;
    color: #6b7280;
    font-size: 12px;
}
.cv-item-title {
    font-weight: bold;
}
.cv-item-org {
    color: #374151;
}
.cv-item-sep {
    color: #374151;
}
.cv-item-field {
    color: #374151;
}
.cv-item-loc {
    font-style: italic;
    color: #6b7280;
}
.cv-dates {
    font-weight: bold;
    color: #6b7280;
}
.cv-item-details {
    margin-top: 3px;
}

/* Bullets (single-column body, not inside a td -> a real <ul> works). */
.cv-bullets {
    margin: 5px 0 0;
    padding-left: 20px;
}
.cv-bullets li {
    margin-bottom: 2px;
    position: relative;
}

/* ---- skills / languages two-column grid (pdf mode) ------------------- */
.cv-grid {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2px;
}
.resume-capitale .cv-grid-col {
    width: 50%;
    vertical-align: top;
    padding: 0 12px 2px 0;
    font-size: 13px;
}
.cv-grid-mk {
    color: #1e3a8a;
    font-size: 11px;
}
.cv-lang-name {
    font-weight: bold;
}
/* Language proficiency: text (CECRL) is the norm for this template, so it
   reads at body-ish size rather than the tiny letter-spaced dot style. When
   a level is numeric, tpl_dots still emits dot glyphs inside this span. */
.cv-lang-level {
    font-size: 11.5px;
    color: #6b7280;
}

/* ---- certifications / inline items ----------------------------------- */
/* margin-TOP on a server-added class, for the same reason as .cv-item above. */
.cv-inline-item {
    position: relative;
    page-break-inside: avoid;
}
.cv-inline-item--gap {
    margin-top: 4px;
}
.cv-item-side {
    float: right;
    width: 70px;
    color: #6b7280;
    font-size: 12px;
}
.cv-muted {
    color: #6b7280;
}

/* Skill/language level dots (tpl_dots) */
.cv-level {
    font-size: 10px;
    letter-spacing: 1px;
    margin-left: 4px;
}
.cv-dot-on {
    color: #1e3a8a;
}
.cv-dot-off {
    color: #d1d5db;
}

/* =====================================================================
 * Edit-mode affordances (browser only — these elements are never emitted in
 * pdf mode, so none of this reaches mPDF). Skills/languages render as a
 * taglist / inline list here for easy editing; pdf mode uses the two-column
 * grid above.
 * ===================================================================== */

.cv-taglist {
    line-height: 2;
}
.cv-tag {
    position: relative;
    display: inline-block;
    margin: 0 6px 4px 0;
    padding: 2px 8px;
    background: #eef2ff;
    border-radius: 3px;
}

.resume-capitale [contenteditable][data-ph]:empty:before {
    content: attr(data-ph);
    color: #b7b7b7;
    font-style: italic;
    pointer-events: none;
}
.resume-capitale [contenteditable] {
    outline: none;
    border-radius: 2px;
    transition: box-shadow 0.12s ease, background 0.12s ease;
}
.resume-capitale [contenteditable]:hover {
    box-shadow: 0 0 0 1px #d6e2ff;
}
.resume-capitale [contenteditable]:focus {
    box-shadow: 0 0 0 2px #1e3a8a;
    background: #f5f8ff;
}
.resume-capitale .cv-contact [contenteditable] {
    display: inline-block;
    min-width: 40px;
}

.resume-capitale .edit-controls {
    position: absolute;
    top: -2px;
    right: -44px;
    opacity: 0;
    transition: opacity 0.12s ease;
    white-space: nowrap;
    z-index: 5;
}
.resume-capitale .edit-controls--inline {
    position: absolute;
    left: -26px;
    right: auto;
    top: 0;
}
.resume-capitale .cv-item:hover > .edit-controls,
.resume-capitale .cv-inline-item:hover > .edit-controls,
.resume-capitale .cv-bullets li:hover > .edit-controls,
.resume-capitale .edit-controls:hover {
    opacity: 1;
}
.resume-capitale .edit-controls button {
    font-family: inherit;
    font-size: 13px;
    line-height: 1;
    width: 20px;
    height: 20px;
    margin-left: 2px;
    padding: 0;
    border: 1px solid #ccc;
    background: #fff;
    color: #444;
    border-radius: 3px;
    cursor: pointer;
}
.resume-capitale .edit-controls button:hover {
    background: #1e3a8a;
    border-color: #1e3a8a;
    color: #fff;
}

.resume-capitale .cv-add {
    font-family: inherit;
    font-size: 12.5px;
    margin-top: 6px;
    padding: 4px 10px;
    border: 1px dashed #b7c4e0;
    background: #fff;
    color: #1e3a8a;
    border-radius: 4px;
    cursor: pointer;
}
.resume-capitale .cv-add:hover {
    background: #f5f8ff;
    border-color: #1e3a8a;
}
.resume-capitale .cv-add--sm {
    font-size: 11.5px;
    padding: 2px 8px;
}

.resume-capitale .cv-current {
    display: block;
    font-family: inherit;
    font-size: 11px;
    font-weight: normal;
    color: #777;
    margin-top: 2px;
    white-space: nowrap;
    cursor: pointer;
}
.resume-capitale .cv-current input {
    vertical-align: middle;
}

.resume-capitale .cv-tag-x {
    font-family: inherit;
    border: none;
    background: none;
    color: #b00;
    cursor: pointer;
    padding: 0 0 0 4px;
    opacity: 0;
    font-size: 13px;
}
.resume-capitale .cv-tag:hover .cv-tag-x {
    opacity: 1;
}

/* Level dot editor (skills/languages) */
.resume-capitale .cv-level {
    white-space: nowrap;
}
.resume-capitale .cv-dot-btn {
    font-family: inherit;
    font-size: 10px;
    line-height: 1;
    width: 12px;
    height: 12px;
    padding: 0;
    margin: 0 1px;
    border: none;
    background: none;
    cursor: pointer;
}
.resume-capitale .cv-dot-btn.cv-dot-on {
    color: #1e3a8a;
}
.resume-capitale .cv-dot-btn.cv-dot-off {
    color: #d1d5db;
}
.resume-capitale .cv-level-toggle {
    font-family: inherit;
    font-size: 9px;
    line-height: 1;
    padding: 1px 3px;
    margin-left: 3px;
    border: 1px solid #ccc;
    background: #fff;
    color: #777;
    border-radius: 2px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease;
}
.resume-capitale .cv-tag:hover .cv-level-toggle,
.resume-capitale .cv-inline-item:hover .cv-level-toggle {
    opacity: 1;
}
.resume-capitale .cv-level-text {
    display: inline-block;
    min-width: 20px;
}
