/*
 * Metric template — clean single column, sans-serif.
 * Shared by browser (edit) and mPDF (pdf). No flexbox, no CSS grid:
 * floats / tables / block layout only, so the two renderers agree.
 *
 * The job title picks up data.settings.accentColor via an inline style set
 * in the template file. Bullets stay plain — the number-first convention
 * lives in the sample data copy, not in CSS (::first-line is unreliable
 * in mPDF).
 */

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

.resume-page {
    width: 794px;              /* A4 @ 96dpi -> fills A4 width in mPDF */
    box-sizing: border-box;
    padding: 48px 56px;
    background: #ffffff;
    color: #111827;
    font-family: 'DejaVu Sans', Arial, Helvetica, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* 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). This template's row/column/band layout uses tables,
   so the font must be declared at td level too. No-op in the browser. */
.resume-metric td {
    font-family: 'DejaVu Sans', Arial, Helvetica, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #111827;
}


/* ---- header ---------------------------------------------------------- */
.cv-header {
    border-bottom: 2px solid #111827;
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.cv-name {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 4px;
    line-height: 1.15;
}
.cv-jobtitle {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #2563eb; /* overridden inline per-resume accentColor */
}
.cv-contact {
    font-size: 12.5px;
    color: #4b5563;
}
.cv-contact span {
    margin-right: 10px;
}
.cv-contact span:last-child {
    margin-right: 0;
}

/* mPDF doesn't honor :last-child for margin purposes (cvg-template skill
 * §5) — the section/entry that will actually render last gets an explicit
 * server-added .is-last class instead (metric.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;
}

/* ---- sections -------------------------------------------------------- */
.cv-section {
    margin-bottom: 16px;
}
.cv-section-title {
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #111827;
    padding-bottom: 4px;
    margin: 0 0 8px;
    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;
    margin-bottom: 12px;
    page-break-inside: avoid;
}
.cv-item:last-child {
    margin-bottom: 0;
}

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

/* Bullets — plain, no visual bold-lead trick (mPDF ::first-line is unreliable). */
.cv-bullets {
    margin: 5px 0 0;
    padding-left: 20px;
}
.cv-bullets li {
    margin-bottom: 2px;
    position: relative;
}

/* Skills / languages / certs */
.cv-skills-line {
    line-height: 1.6;
}
.cv-inline-item {
    position: relative;
    margin-bottom: 3px;
    page-break-inside: avoid;
}
.cv-item-side {
    float: right;
    color: #4b5563;
    font-size: 12.5px;
}
.cv-muted {
    color: #6b7280;
}

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

/* =====================================================================
 * 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;
}
[contenteditable] {
    outline: none;
    border-radius: 2px;
    transition: box-shadow 0.12s ease, background 0.12s ease;
}
[contenteditable]:hover {
    box-shadow: 0 0 0 1px #d6e2ff;
}
[contenteditable]:focus {
    box-shadow: 0 0 0 2px #2563eb;
    background: #f5f9ff;
}
.cv-contact [contenteditable] {
    display: inline-block;
    min-width: 40px;
}

/* 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: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.cv-add {
    font-family: inherit;
    font-size: 12.5px;
    margin-top: 6px;
    padding: 4px 10px;
    border: 1px dashed #b7c4e0;
    background: #fff;
    color: #2563eb;
    border-radius: 4px;
    cursor: pointer;
}
.cv-add:hover {
    background: #f5f9ff;
    border-color: #2563eb;
}
.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;
}

.cv-tag {
    position: relative;
}
.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;
}
