/*
 * Encre template — full-width ink-dark header band with a square photo on the
 * right, single column below. Shared by browser (edit) and mPDF (pdf). No
 * flexbox, no CSS grid: floats, tables, and block layout only, so the two
 * renderers agree. Senior/legal gravitas: zero color beyond the band.
 */

/* ---- 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-encre {
    width: 794px;               /* A4 @ 96dpi -> fills A4 width in mPDF */
    box-sizing: border-box;
    padding: 0;                 /* header band is full-bleed */
    background: #ffffff;
    color: #1c1917;
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
}

/* mPDF does NOT inherit font-family/size/color into table cells — anything
   inside a <td> silently falls back to the serif document default (in-td trap
   class, 2026-07 slate rework). This template's band/row/column layout uses
   tables, so the font must be declared at td level too. No-op in the browser. */
.resume-encre td {
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.45;
    color: #1c1917;
}

/* ---- header band (full width, ink-dark, ~140px tall) -------------------- */
.cv-header-band {
    box-sizing: border-box;
    width: 100%;
    height: 140px;
    padding: 0 56px;
    background: #1c1917;
    color: #ffffff;
}
.cv-header-table {
    width: 100%;
    height: 140px;
    border-collapse: collapse;
}
.resume-encre .cv-header-table td {
    vertical-align: middle;
    padding: 0;
    color: #ffffff;
}
.cv-header-main {
    text-align: left;
}
/* Fixed 110px right cell; padding-left pushes the 95px photo flush to the
   band's right margin (a block <img> can't be right-aligned in mPDF). */
.cv-header-photo {
    width: 110px;
    padding-left: 15px;
}
.cv-header-band .cv-name {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 0.3px;
    margin: 0;
    line-height: 1.15;
    color: #ffffff;
}
.cv-header-band .cv-jobtitle {
    font-size: 14px;
    margin-top: 5px;
    color: #a8a29e;
}
.cv-header-band .cv-contact {
    font-size: 11.5px;
    margin-top: 9px;
    color: #e7e5e4;
}
.cv-header-band .cv-contact span {
    margin-right: 4px;
}

/* ---- body ---------------------------------------------------------------- */
/* Bottom padding is 0 on purpose (the pulse/sapphire/trajectory/chalkboard
   rule): trailing wrapper padding is real space in the flow, so content
   ending near the boundary makes mPDF open a further page and paint
   nothing on it. Measured here as a genuinely blank trailing page on the
   en-us route, which this fixes. The bottom gap on every page comes from
   @page's margin-bottom instead, which does not add to the flow.

   A ~6px gap remains between the editor's measured height and the page-1
   capacity on the en-us sample (1089px measured vs 1083px capacity, with
   .is-last correctly zeroing the true last section's margin) — within the
   skill's documented ~15-20px cross-renderer text-layout noise band.
   Deliberately not chased further with another CSS tweak. */
.cv-body {
    padding: 34px 56px 0;
}

.cv-section {
    margin-bottom: 20px;
}
.cv-section:last-child {
    margin-bottom: 0;
}
/* pdf mode: mPDF doesn't reliably honor :last-child, so the server marks
 * whichever section actually renders last with this plain class instead
 * (encre.php). Unscoped on purpose. */
/* 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: 14px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #1c1917;
    border-bottom: 2px solid #0c0a09;
    padding-bottom: 4px;
    margin: 0 0 10px;
    page-break-after: avoid;
}
/* page-break-after:avoid on the title alone is not reliable in mPDF — a
 * header can still land as the last line on a page with its first entry
 * pushed to the next one. Wrapping the title together with its first entry
 * in a page-break-inside:avoid group moves the pair to the next page as a
 * unit. */
.cv-section-head-group {
    page-break-inside: avoid;
}
.cv-summary {
    text-align: left;
}

/* ---- 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 (cvg-template skill §5, toolbox bug class). */
.cv-section-head-group + .cv-item,
.cv-item + .cv-item {
    margin-top: 14px;
}

/* 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-encre .cv-row-side {
    text-align: right;
    white-space: nowrap;
    width: 28%;
    color: #57534e;
    font-size: 12.5px;
}
.cv-item-title {
    font-weight: bold;
}
.cv-item-org {
    color: #292524;
}
.cv-item-sep {
    color: #57534e;
}
.cv-item-field {
    color: #292524;
}
.cv-item-loc {
    color: #57534e;
    font-size: 12.5px;
}
.cv-dates {
    font-weight: bold;
    color: #1c1917;
}
.cv-item-details {
    margin-top: 3px;
    color: #292524;
}

/* Bullets — first bullet of each entry is emphasized. */
.cv-bullets {
    margin: 6px 0 0;
    padding-left: 20px;
}
.cv-bullets li {
    margin-bottom: 3px;
    position: relative;
}
/* Lead-bullet emphasis carried by an explicit class in both modes (pdf adds
   it server-side, edit binds it via Alpine :class) — never :first-child,
   which is unreliable in mPDF (skill §5). */
.cv-bullet-lead {
    font-weight: bold;
}

/* Skills — quiet middot-separated line, no color or dots. */
.cv-skills-line {
    line-height: 1.7;
    color: #292524;
}

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

/* =====================================================================
 * 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-header-band [contenteditable][data-ph]:empty:before {
    color: rgba(255, 255, 255, 0.6);
}
[contenteditable] {
    outline: none;
    border-radius: 2px;
    transition: box-shadow 0.12s ease, background 0.12s ease;
}
[contenteditable]:hover {
    box-shadow: 0 0 0 1px #d6d3d1;
}
[contenteditable]:focus {
    box-shadow: 0 0 0 2px #0c0a09;
    background: #fafaf9;
}
.cv-contact [contenteditable] {
    display: inline-block;
    min-width: 40px;
}
.cv-header-band [contenteditable]:hover {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.cv-header-band [contenteditable]:focus {
    box-shadow: 0 0 0 2px #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

/* 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: -26px;
    right: auto;
    top: 0;
}
.cv-item:hover > .edit-controls,
.cv-inline-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: #0c0a09;
    border-color: #0c0a09;
    color: #fff;
}

.cv-add {
    font-family: inherit;
    font-size: 12.5px;
    margin-top: 8px;
    padding: 4px 10px;
    border: 1px dashed #a8a29e;
    background: #fff;
    color: #292524;
    border-radius: 4px;
    cursor: pointer;
}
.cv-add:hover {
    background: #f5f5f4;
    border-color: #0c0a09;
}
.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;
}

/* Skills tags (edit only) */
.cv-taglist {
    line-height: 2;
}
.cv-tag {
    position: relative;
    display: inline-block;
    margin: 0 6px 4px 0;
    padding: 2px 8px;
    background: #f5f5f4;
    border-radius: 3px;
}
.cv-tag-x {
    font-family: inherit;
    border: none;
    background: none;
    color: #b00;
    cursor: pointer;
    padding: 0 0 0 4px;
    opacity: 0;
    font-size: 13px;
}
.cv-tag:hover .cv-tag-x {
    opacity: 1;
}
