/*
 * Pulse template — single continuous accentColor rail, clinical two-column
 * layout for healthcare/science roles.
 * 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: 48px 0 48px 0;
}
@page :first {
    margin-top: 0;
}

.resume-page {
    width: 794px;              /* A4 @ 96dpi -> fills A4 width in mPDF */
    box-sizing: border-box;
    /* Bottom padding is 0 on purpose: it is real trailing space, so content
       ending near the boundary makes mPDF open a further page and paint
       nothing. The bottom gap on every page comes from @page's margin-bottom
       (48px, above) instead, which does not add to the flow. */
    padding: 48px 56px 0;
    background: #ffffff;
    color: #1f2937;
    font-family: 'DejaVu Sans', Arial, Helvetica, 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). The entry title/date rows are still two-cell tables,
   so the font must be declared at td level too. No-op in the browser. */
.resume-pulse td {
    font-family: 'DejaVu Sans', Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
}


/* ---- rail blocks ------------------------------------------------------
 * Plain block flow: the header, then one block per rendered section, each
 * carrying the accentColor rail as its own border-left. mPDF re-paints that
 * border on every page a block flows onto, so the rail is unbroken across
 * page breaks (verified on a real export, top to bottom of every page).
 *
 * Inter-section spacing is padding-TOP on the second and later blocks, never
 * margin: a margin between two blocks would leave a gap with no border in it
 * and visibly break the rail. It is applied through a class pulse.php adds to
 * every block but the first, NOT through a `+` sibling rule — mPDF ignores the
 * sibling combinator entirely (proved by raising such a rule to 100px and
 * watching the export not move a pixel). No block ever carries a competing
 * value either way, which is what §5's avoid-estimator trap forbids.
 *
 * This replaced a page-spanning <table> with a rail cell per row. Do not go
 * back: that shape put every block inside a <td>, where mPDF silently drops
 * CSS block margins, and the export came out ~190px tighter than the canvas.  */
.cv-railblock {
    border-left: 3px solid #0d9488; /* overridden inline per-resume accentColor */
    margin-left: 24px;
    padding-left: 16px;
}
.cv-railblock--gap {
    /* 4px here + the dot's own 2px margin-top and 10px height = the 16px
       gap the table layout used to get from a margin. The dot stays in normal
       flow because a negative margin-bottom to cancel its height makes mPDF
       drop it entirely (measured: dots vanish from every page). */
    padding-top: 4px;
}
/* Section marker sitting ON the rail. A single-cell table with a coloured
   <td>, NOT a styled div: mPDF drops a content-less decorative div here
   entirely (measured with a background, with a border, and with an &nbsp;
   inside — absent from every page of the export while the browser drew it),
   which is §5's empty-decorative-element trap. A table-cell background is the
   rectangle primitive §5 documents as reliable, and it paints on every page.
   It renders SQUARE: border-radius reaches only mPDF's block stack, which a
   <td> never enters, so there is no way to round this one.
   margin-left pulls it back over the rail (the block's padding box starts past
   its own left border). It stays in normal flow and takes 12px of height, which
   .cv-railblock--gap's padding-top is reduced to account for — a negative
   margin-bottom to cancel that height makes mPDF drop the marker again. */
.cv-rail-dot {
    width: 10px;
    margin: 2px 0 0 -22px;
    border-collapse: collapse;
}
/* Scoped to .resume-pulse so it OUTRANKS `.resume-pulse td` (0,2,1 against
   0,1,1) instead of tying it. At equal specificity Chrome takes the later rule
   and mPDF may take the earlier one (skill §5), and losing this one would give
   the marker cell a 14px/1.5 line box — a 21px tall marker instead of 10px. */
.resume-pulse .cv-rail-dot td {
    width: 10px;
    height: 10px;
    padding: 0;
    font-size: 1px;
    line-height: 1px;
}

/* ---- header ------------------------------------------------------------ */
.cv-header {
    padding-bottom: 14px;
    margin-bottom: 4px;
}
.cv-name {
    font-size: 24px;
    font-weight: bold;
    margin: 0 0 3px;
    line-height: 1.2;
}
.cv-jobtitle {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 8px;
}
.cv-contact {
    font-size: 12.5px;
    color: #4b5563;
}
.cv-contact span {
    margin-right: 4px;
}

/* ---- sections ------------------------------------------------------------ */
/* No margin: the gap between sections is .cv-railblock's padding-top, which
   sits inside the rail's border and so keeps it unbroken. */
.cv-section {
    margin: 0;
}
/* Orphan protection (skill §7). page-break-after on the heading alone is not
   reliable in mPDF, so the heading and its FIRST entry share one
   page-break-inside:avoid wrapper and move to the next page together.
   pulse used to be exempt because its whole section sat in a single <tr> of
   the page-spanning rail table; now that sections are ordinary block flow the
   wrapper is load-bearing, not just a semantic hint. */
.cv-section-head-group {
    page-break-inside: avoid;
}
.cv-section-title {
    font-size: 14px;
    font-weight: bold;
    color: #0d9488; /* overridden inline per-resume accentColor */
    margin: 0 0 8px;
    page-break-after: avoid;
}
.cv-summary {
    text-align: left;
}

/* ---- items --------------------------------------------------------------- */
/* One entry = one <div class="cv-item"> holding a two-cell title/dates table
 * and its bullet list — the same shape classic.php uses. The nested
 * <table class="cv-items-table"> that used to carry a whole section is gone
 * along with the outer rail table it was nested in; with the entries now in
 * ordinary block flow they break individually and their margins are honoured
 * by both renderers. */
.cv-item {
    position: relative;
    page-break-inside: avoid;
}
/* Inter-entry spacing is margin-TOP on a server-added class (see .cv-railblock
   above for why not a `+` rule), never margin-bottom (skill §5): margin-bottom
   on a page-break-inside:avoid block repeated many times double-counts in
   mPDF's own pagination-height estimate and can open an entirely blank extra
   page. The first entry of a section simply does not carry the class, so no
   element ever holds a competing value — which is what the skill's warning
   about .is-first-style overrides is really about. */
.cv-item--gap {
    margin-top: 12px;
}
.cv-row {
    width: 100%;
    border-collapse: collapse;
}
.cv-row td {
    vertical-align: top;
    padding: 0;
}
.cv-row-main {
    position: relative;
    text-align: left;
}
/* No `white-space: nowrap` here on purpose, and it must not come back. With
   it, a date range wider than this 30% column made mPDF scale the ENTIRE
   enclosing table down to fit — body type rendered at 9.6pt against a declared
   10.5pt (91%), uniformly on every page, which is the "pulse is compressed"
   defect parity-audit reported as font_shrink. Deleting this one declaration
   restored 10.5pt with the page count unchanged. Chrome instead widens the
   column past 30% to honour nowrap, so keeping it also put the two renderers
   on different column widths. */
.resume-pulse .cv-row-side {
    position: relative;
    text-align: right;
    width: 30%;
    color: #4b5563;
    font-size: 12.5px;
}
.cv-item-title {
    font-weight: bold;
}
.cv-item-org {
    color: #374151;
}
.cv-item-sep {
    color: #374151;
}
.cv-item-loc {
    color: #374151;
}
.cv-dates {
    font-weight: bold;
    color: #374151;
}
.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 / certs */
.cv-skills-line {
    line-height: 1.6;
}
/* Languages / certifications rows — name, issuer and date stay together.
   margin-TOP on a server-added class, for the same reason as .cv-item above:
   no trailing margin on the last row, and no element ever carries a competing
   override. */
.cv-inline-item {
    position: relative;
    page-break-inside: avoid;
}
.cv-inline-item--gap {
    margin-top: 3px;
}
.cv-item-side {
    float: right;
    width: 100px;
    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 6px;
    background: #f0fdfa;
    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 #ccfbf1;
}
[contenteditable]:focus {
    box-shadow: 0 0 0 2px #0d9488;
    background: #f0fdfa;
}
.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: #0d9488;
    border-color: #0d9488;
    color: #fff;
}

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