/*
 * Trame template — corporate minimalism on one strict alignment grid.
 * Shared by browser (edit) and mPDF (pdf). No flexbox, no CSS grid: tables /
 * block layout only, so the two renderers agree.
 *
 * Single-accent discipline (template-specs/trame.yaml): .cv-namebar under the
 * name is the ONLY colored element on the page. Everything else is near-black
 * (#111827) on white with two gray steps (#374151 secondary, #6b7280 muted).
 * Adding a second colored element is off-spec.
 *
 * Vertical rhythm is expressed with margin-TOP only, and always as a single
 * unconditional value per element — never a margin-bottom, and never an
 * override that zeroes the first element. margin-bottom on a repeated
 * page-break-inside:avoid block double-counts in mPDF's pagination estimate
 * and can open a blank trailing page (cvg-template skill §5); an override to
 * zero a first-child's margin reintroduces the same bug inside nested avoid
 * blocks. The skill suggests additive sibling combinators for this, but
 * verified against a real mPDF export: mPDF drops `+` sibling rules entirely
 * (sections rendered flush against the preceding section's last line), so the
 * margin has to be unconditional. Spacing therefore hangs off the section
 * title (24px above every section) and off each item/summary/grid (10px),
 * with no first/last special cases anywhere.
 */

/* ---- 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.resume-trame {
    width: 794px;               /* A4 @ 96dpi -> fills A4 width in mPDF */
    box-sizing: border-box;
    /* No bottom padding: on a multipage export it is real trailing space after
       the last line, and when content ends near the page boundary mPDF opens
       an extra page to place it — a blank final page with nothing painted on
       it (confirmed on _long.json: 3 pages, page 3 empty, all content already
       complete on page 2). Nothing is visible below the last line anyway. */
    padding: 48px 56px 0;
    background: #ffffff;
    color: #111827;
    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 class,
   2026-07 slate rework). Every dated entry row and both two-column grids are
   tables here, so the font must be declared at td level too. No-op in the
   browser. */
.resume-trame td {
    font-family: 'DejaVu Sans', Helvetica, Arial, sans-serif;
    font-size: 13.5px;
    line-height: 1.4;
    color: #111827;
}

/* ---- header (two-cell table: name/title/contact left, square photo right) --
 * No bottom margin: the first section title's own 24px top margin supplies
 * the gap, so header->section and section->section spacing are one value. */
.cv-header {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}
.cv-head-main {
    vertical-align: top;
    padding: 0;
}
/* Fixed cell so the photo's left edge is a grid position, not a function of
   how long the name happens to be. */
.cv-head-side {
    width: 100px;
    vertical-align: top;
    text-align: right;
    padding: 0;
}
.cv-photo,
.cv-photo-initials {
    display: inline-block;
}
/* Header text lives inside a <td>, where mPDF neither inherits the document
   font nor honors numeric weights — size/weight/color are therefore declared
   explicitly on each element rather than left to inherit. */
.cv-name {
    font-size: 26px;
    font-weight: bold;          /* keyword only — mPDF ignores numeric weights */
    letter-spacing: 0.2px;
    line-height: 1.1;
    margin: 0;
    color: #111827;
}
/* The one colored element on the page: a short accent bar under the name.
   A nested single-cell table, NOT a div: this sits inside the header <td>,
   and mPDF collapses a block div's width/height inside a cell (it would
   export shrink-to-content, i.e. invisible). A table keeps its declared
   geometry and paints its cell background as one contiguous rect in both
   renderers. Color is set inline per-resume from settings.accentColor.
   The margins are on the table itself — a nested table's margin-top/bottom
   is the one reliable vertical-gap primitive inside a cell.
   The cell carries a literal &nbsp; (trame.php) because mPDF drops a
   genuinely empty cell: with no content the bar exported as nothing at all,
   confirmed by a real export. The 1px font keeps that space from adding any
   height of its own, so the bar stays the 3px the height declares. */
table.cv-namebar {
    width: 60px;
    border-collapse: collapse;
    margin: 9px 0 11px;
}
table.cv-namebar td {
    height: 3px;
    line-height: 3px;
    font-size: 1px;
    padding: 0;
    background: #1d4ed8;
}
.cv-jobtitle {
    font-size: 14px;
    color: #111827;
    margin-bottom: 5px;
}
.cv-contact {
    font-size: 11.5px;
    color: #374151;
    letter-spacing: 0.2px;
}

/* ---- sections (uppercase titles, no rules — whitespace does the work) --
 * The 24px that separates sections lives here, on the title, because it is the
 * one element every section starts with in both modes. Unconditional, so mPDF
 * honors it (a `.cv-section + .cv-section` rule does not survive export) and
 * no first-section override is needed. */
.cv-section-title {
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.6px;
    color: #111827;
    margin: 24px 0 0;
    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 {
    margin-top: 10px;
    text-align: left;           /* never justify — mPDF spacing artifacts */
}

/* ---- items ------------------------------------------------------------
 * Two-cell "content left / date right" table (mPDF-safe, no float). The side
 * cell is a fixed 120px in every dated section — experience, education,
 * certifications and custom — so every date on the page lands on one vertical
 * grid line, not just within a section.
 */
.cv-item {
    position: relative;
    margin-top: 10px;
    page-break-inside: avoid;
}
/* mPDF doesn't reliably honor :last-child for margin purposes, so the server
 * marks whichever section/item renders last with this plain class instead
 * (trame.php). Unscoped on purpose — it applies to whichever element carries
 * it. Nothing in this file sets a bottom margin, so it's a safety net rather
 * than load-bearing. */
/* 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-row {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.cv-row td {
    vertical-align: top;
    padding: 0;
}
.cv-row-main {
    text-align: left;
}
.resume-trame .cv-row-side {
    width: 120px;
    text-align: right;
    white-space: nowrap;
    color: #374151;
    font-size: 12.5px;
}
.cv-item-title {
    font-weight: bold;
}
.cv-item-org {
    color: #111827;
}
.cv-item-sep {
    color: #6b7280;
}
.cv-item-field {
    color: #374151;
}
.cv-item-loc {
    color: #6b7280;
    font-size: 11.5px;
}
.cv-dates {
    color: #374151;
}
.cv-item-details {
    margin-top: 3px;
    color: #374151;
}

/* Bullets: list-style is off and the dash marker is a real HTML span in the
   markup (CSS generated content never renders in mPDF). The hanging indent
   comes from padding-left + negative text-indent, which both renderers agree
   on for a list outside a table cell. */
.cv-bullets {
    list-style: none;
    margin: 6px 0 0;
    padding-left: 0;
}
.cv-bullets li {
    position: relative;
    padding-left: 14px;
    text-indent: -14px;
    margin-bottom: 2px;
}
.cv-bullet-mk {
    color: #6b7280;
}

/* ---- skills / languages two-column grid (pdf mode) -------------------- */
.cv-grid {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin-top: 10px;
}
.resume-trame .cv-grid-col {
    width: 50%;
    vertical-align: top;
    padding: 0 14px 3px 0;
    font-size: 13px;
}
.cv-lang-name {
    font-weight: bold;
}
.cv-lang-level {
    color: #374151;
}
.cv-inline-item {
    position: relative;
    page-break-inside: avoid;
}
.cv-muted {
    color: #6b7280;
}

/* Skill/language level dots (tpl_dots). Rendered without an accent color so
   the name bar stays the page's only colored element. */
.cv-level {
    font-size: 10px;
    letter-spacing: 1px;
    margin-left: 4px;
}
.cv-dot-on {
    color: #111827;
}
.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: #f3f4f6;
    border-radius: 2px;
}

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

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

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

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

.resume-trame .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-trame .cv-tag:hover .cv-tag-x {
    opacity: 1;
}

/* Level dot editor (skills/languages) */
.resume-trame .cv-level {
    white-space: nowrap;
}
.resume-trame .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-trame .cv-dot-btn.cv-dot-on {
    color: #111827;
}
.resume-trame .cv-dot-btn.cv-dot-off {
    color: #d1d5db;
}
.resume-trame .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-trame .cv-tag:hover .cv-level-toggle,
.resume-trame .cv-inline-item:hover .cv-level-toggle {
    opacity: 1;
}
.resume-trame .cv-level-text {
    display: inline-block;
    min-width: 20px;
}

/* Edit-mode language rows need their own spacing (pdf mode uses the grid). */
.resume-trame .cv-inline-item {
    margin-top: 4px;
}
/* Edit mode only: the "School , Field" comma sits on its own source line, so
   the HTML newline before it renders as a leading space. pdf mode emits the
   comma glued to the school text instead (trame.php), and this pulls the edit
   view back into line with it. Never seen by mPDF. */
.resume-trame .cv-sep-comma {
    margin-left: -4px;
}
