/*
 * Curriculum template — canonical academic CV, year-gutter entries.
 * Shared by browser (edit) and mPDF (pdf). No flexbox, no CSS grid:
 * floats / tables / block layout only, so the two renderers agree.
 *
 * Every dated entry (education/custom items/experience) shares the same
 * fixed 64px left-hand "year gutter" table column — the classic academic-CV
 * date column. 12.5px body: density is expected in academic CVs, which
 * routinely run multiple pages; cv-yearitem gets page-break-inside: avoid
 * but nothing on the page has a fixed height, so mPDF paginates cleanly.
 */

/* ---- 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: #1a1a1a;
    font-family: 'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
    font-size: 12.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). 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-curriculum td {
    font-family: 'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
    font-size: 12.5px;
    line-height: 1.45;
    color: #1a1a1a;
}


/* ---- header ---------------------------------------------------------- */
.cv-header {
    text-align: center;
    border-bottom: 1px solid #1a1a1a;
    padding-bottom: 12px;
    margin-bottom: 18px;
}
.cv-name {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.3px;
    margin: 0 0 4px;
    line-height: 1.1;
}
.cv-jobtitle {
    font-size: 13px;
    font-style: italic;
    color: #444;
    margin-bottom: 6px;
}
.cv-contact {
    font-size: 11.5px;
    color: #333;
}
.cv-contact span {
    margin: 0 4px;
}

/* 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 (curriculum.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: 15px;
}
.cv-section-title {
    font-size: 12.5px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    border-bottom: 1px solid #999;
    padding-bottom: 3px;
    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;
}

/* ---- year-gutter entries -----------------------------------------------
 * Fixed 64px left cell for the year/date range, content flows in the right
 * cell. Used by education, every custom section's items, and experience —
 * one shared column so dates line up down the whole page.
 */
.cv-item {
    position: relative;
    margin-bottom: 11px;
}
.cv-item:last-child {
    margin-bottom: 0;
}
.cv-yearitem {
    page-break-inside: avoid;
}

.cv-yearrow {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.cv-yearrow td {
    vertical-align: top;
    padding: 0;
}
.resume-curriculum .cv-year {
    width: 64px;
    font-weight: bold;
    color: #444;
    font-variant-numeric: tabular-nums;
}
.cv-yearbody {
    text-align: left;
}

.cv-item-title {
    font-weight: bold;
}
.cv-item-org {
    font-style: italic;
    color: #333;
}
.cv-item-sep {
    color: #333;
    font-style: normal;
}
.cv-item-loc {
    font-style: italic;
    color: #444;
    font-size: 11.5px;
}
.cv-item-details {
    margin-top: 3px;
}

/* custom-section item body (publications/grants/teaching) */
.cv-item-heading {
    font-weight: bold;
}
.cv-item-sub {
    font-style: italic;
    color: #333;
    margin-top: 1px;
}
.cv-item-text {
    margin-top: 2px;
    text-align: left;
}

/* Bullets */
/* pdf-mode only: the entry body sits in normal flow beside the year gutter
   rather than inside the cv-yearrow cell, so its indent is a plain margin
   matching .cv-year's width. Block margins in normal flow are honoured by both
   renderers, which a block's geometry inside a <td> is not (skill §5). Edit
   mode keeps the body in the cell and never carries this class. */
.resume-curriculum .cv-item-body {
    margin-left: 64px;
}
.cv-bullets {
    margin: 5px 0 0;
    padding-left: 18px;
}
.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;
}
/* Browser only: pdf mode renders the certification line as the .cv-row table
   below, because mPDF ignores float:right on an inline span (skill §5). */
.cv-item-side {
    float: right;
    color: #444;
    font-size: 11.5px;
}
/* Two-cell date-column primitive, matching classic.css. This template had no
   .cv-row rules because nothing used one until the certification line moved
   off its float. */
.cv-row {
    width: 100%;
    border-collapse: collapse;
}
.cv-row td {
    vertical-align: top;
    padding: 0;
}
.cv-row-main {
    text-align: left;
}
.resume-curriculum .cv-row-side {
    text-align: right;
    white-space: nowrap;
    width: 30%;
    color: #444;
    font-size: 11.5px;
}
.cv-muted {
    color: #777;
}

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

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

[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;
}

.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: 12px;
    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: 11px;
    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;
}
