/*
 * Safran template — navy corporate header band (circular photo, saffron title,
 * one-line contact right), a 3px saffron signature rule under the band, a
 * single-column body, and skills + languages paired side by side. Shared by
 * browser (edit) and mPDF (pdf). No flexbox, no CSS grid, no transforms:
 * floats, tables, and block layout only, so the two renderers agree. The band
 * background and its saffron rule live on <td>s, not <div>s (mPDF paints a div
 * background per text line, a cell background full width — skill §5).
 */

/* ---- 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 40px 0;
}
@page :first {
    margin-top: 0;
}

.resume-page.resume-safran {
    width: 794px;               /* A4 @ 96dpi -> fills A4 width in mPDF */
    box-sizing: border-box;
    background: #ffffff;
    color: #1a1a1a;
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
}

/* 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, skill
   §5). This template's band, entry rows and skills/languages block are all
   tables, so the font must be declared at td level too. No-op in-browser.
   Band cells override size + color below (rules ordered after this). */
.resume-safran td {
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
    color: #1a1a1a;
}

/* ---- header band (full width, navy, ~120px) ----------------------------- */
.cv-band {
    width: 100%;
    background: #1e293b;
}
.cv-band-table {
    width: 100%;
    background: #1e293b;
    border-collapse: collapse;
}
/* The 3px saffron signature rule is a collapsed border-bottom on the band
   cells: with border-collapse it paints one continuous line spanning the whole
   band width (a plain <div> border would break per text line in mPDF). */
.resume-safran .cv-band-table td {
    background: #1e293b;
    height: 120px;
    vertical-align: middle;
    color: #ffffff;
    border-bottom: 3px solid #b45309;
}
.cv-band-photo {
    width: 148px;
    padding: 0 0 0 40px;
    text-align: center;
}
.cv-band-photo .cv-photo {
    display: inline-block;
}
.cv-band-id {
    padding: 0 16px;
    text-align: left;
}
.cv-band .cv-name {
    font-size: 27px;
    font-weight: bold;
    letter-spacing: 0.3px;
    margin: 0;
    line-height: 1.15;
    color: #ffffff;
}
.cv-band .cv-jobtitle {
    font-size: 13.5px;
    margin-top: 5px;
    color: #f59e0b;
}

/* In-band contact: small white text, right-aligned, one line (wraps if long).
   Inline editable spans in edit mode carry a small gap so they don't glue
   together; pdf mode joins them with a literal &middot;. */
.cv-band-contact {
    width: 40%;
    padding: 0 34px 0 10px;
    text-align: right;
    vertical-align: middle;
}
.cv-band-contact .cv-contact {
    font-size: 11px;
    line-height: 1.7;
    color: #ffffff;
}
.cv-band-contact .cv-contact span {
    color: #ffffff;
    margin-left: 6px;
}

/* ---- body --------------------------------------------------------------- */
/* Zero bottom: @page margin-bottom already reserves 40px on every page,
   including the last. Reserving another 28px here left the FR sample's final
   section short of the space it needed and opened a blank final page. */
.cv-body {
    padding: 22px 48px 0;
}

.cv-section {
    margin-bottom: 14px;
}
/* mPDF ignores :last-child for margins, so the last-rendered section carries a
   server-added .is-last instead (skill §5). DELIBERATELY left at this specificity: it ties
   .cv-section / .cv-inline-item at (0,1,0) and wins only on source order.
   Raising it (scoping to .resume-X, or class-doubling) makes it also 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). Keep after
   .cv-section; do not "fix" the specificity tie. */
/* 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;
}

.cv-section-title {
    font-size: 13px;
    font-weight: bold;
    color: #1e293b;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #b45309;
    /* Short 20px saffron underline, not a full-width rule. */
    width: 20px;
    page-break-after: avoid;
}
/* page-break-after:avoid on the title alone is unreliable in mPDF — wrap the
   title and its first entry in a page-break-inside:avoid group so they move to
   the next page as a unit instead of orphaning the header (skill §7). */
.cv-section-head-group {
    page-break-inside: avoid;
}
.cv-summary {
    text-align: left;
}

/* ---- entry items -------------------------------------------------------- */
.cv-item {
    position: relative;
    page-break-inside: avoid;
}
/* Inter-item spacing is margin-TOP via additive sibling selectors, never
   margin-bottom: margin-bottom on a repeated page-break-inside:avoid block
   double-counts in mPDF's pagination-height estimate and opens a blank
   trailing page (skill §5, toolbox bug class). */
.cv-section-head-group + .cv-item,
.cv-item + .cv-item {
    margin-top: 12px;
}

/* 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;
}
.resume-safran .cv-row-side {
    text-align: right;
    white-space: nowrap;
    width: 30%;
    color: #64748b;
    font-size: 12.5px;
}
.cv-item-title {
    font-weight: bold;
}
.cv-item-org {
    color: #334155;
}
.cv-item-sep {
    color: #333;
}
.cv-item-loc {
    color: #64748b;
}
.cv-dates {
    font-weight: bold;
    color: #64748b;
}
.cv-item-details {
    margin-top: 3px;
}

/* Bullets */
.cv-bullets {
    margin: 5px 0 0;
    padding-left: 20px;
}
.cv-bullets li {
    margin-bottom: 2px;
    position: relative;
}

/* ---- skills + languages side-by-side block ------------------------------ */
.cv-sl-table {
    width: 100%;
    border-collapse: collapse;
}
.cv-sl-col {
    vertical-align: top;
    padding-right: 24px;
}
.cv-sl-table td.cv-sl-col:last-child {
    padding-right: 0;
    padding-left: 24px;
}
/* Column heading with a short saffron underline. The border sits directly on
   the heading (not a separate rule element): inside a <td>, mPDF shrinks a
   block's border-bottom to its text width, so the underline hugs the label —
   and it avoids the extra empty rule-table that mPDF gives a full line-box of
   height, which would inflate the export past one page (boundary-test
   regression). */
.cv-sl-heading {
    display: inline-block; /* underline hugs the label in-browser too, matching
                              mPDF's text-width border inside the cell */
    font-size: 13px;
    font-weight: bold;
    color: #1e293b;
    padding-bottom: 5px;
    margin-bottom: 8px;
    border-bottom: 2px solid #b45309;
}
.cv-sl-list {
    margin: 0;
}
.cv-sl-item {
    position: relative;
    margin-top: 3px;
}
.cv-sl-lang-name {
    font-weight: bold;
}
.cv-sl-lang .cv-level {
    margin-left: 4px;
    white-space: nowrap;
}

/* Dot glyphs (languages). Filled dots take the saffron accent via inline style
   from tpl_dots(); empty dots are a light gray. */
.cv-dot {
    font-size: 10px;
    letter-spacing: 1px;
}
.cv-dot-off {
    color: #cbd5e1;
}

/* ---- languages / certifications (inline single-line rows) --------------- */
.cv-inline-item {
    position: relative;
    page-break-inside: avoid;
}
.cv-section-head-group + .cv-inline-item,
.cv-inline-item + .cv-inline-item {
    margin-top: 3px;
}
.cv-item-side {
    float: right;
    color: #64748b;
    font-size: 12.5px;
}
.cv-muted {
    color: #777;
}

/* =====================================================================
 * Edit-mode affordances (browser only — these elements are never emitted
 * in pdf mode, so none of this reaches mPDF).
 * ===================================================================== */

/* contenteditable placeholders */
[contenteditable][data-ph]:empty:before {
    content: attr(data-ph);
    color: #b7b7b7;
    font-style: italic;
    pointer-events: none;
}
.cv-band [contenteditable][data-ph]:empty:before {
    color: rgba(255, 255, 255, 0.7);
}
[contenteditable] {
    outline: none;
    border-radius: 2px;
    transition: box-shadow 0.12s ease, background 0.12s ease;
}
[contenteditable]:hover {
    box-shadow: 0 0 0 1px #f5d9b8;
}
[contenteditable]:focus {
    box-shadow: 0 0 0 2px #b45309;
    background: #fff8f0;
}
.cv-band [contenteditable]:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}
.cv-band [contenteditable]:focus {
    box-shadow: 0 0 0 2px #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

/* level dot buttons + toggle (languages) */
.cv-level {
    white-space: nowrap;
}
.cv-dot-btn {
    background: none;
    border: none;
    padding: 0 1px;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    color: #cbd5e1;
}
.cv-dot-btn.cv-dot-on {
    color: #b45309;
}
.cv-level-toggle {
    font-family: inherit;
    font-size: 10px;
    line-height: 1;
    margin-left: 4px;
    padding: 1px 3px;
    border: 1px solid #ccc;
    background: #fff;
    color: #555;
    border-radius: 3px;
    cursor: pointer;
}
.cv-level-text {
    color: #444;
}

/* add / remove / reorder controls */
.edit-controls {
    position: absolute;
    top: -2px;
    right: -44px;
    opacity: 0;
    transition: opacity 0.12s ease;
    white-space: nowrap;
    z-index: 5;
}
.edit-controls--inline {
    position: absolute;
    left: -24px;
    right: auto;
    top: 0;
}
.cv-item:hover > .edit-controls,
.cv-inline-item:hover > .edit-controls,
.cv-sl-item:hover > .edit-controls,
.cv-bullets li:hover > .edit-controls,
.edit-controls:hover {
    opacity: 1;
}
.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;
}
.edit-controls button:hover {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

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

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