/* ---- CV page: a fixed A4 sheet ----
   Type scale (pt):   10 body + h4 / 12 h3 / 14 h2 / 24 h1 + role
   Spacing scale (em, relative to 10pt body): 1 = 0.25em, 2 = 0.5em, 3 = 1em, 4 = 1.5em
   Rules: entry title sits flush on its date line; date to list, h2 to body and bullet to bullet use
   scale 2; skills row to row uses scale 1; entry to entry uses scale 3; header to body uses scale 4; sections
   carry no padding, the flex column spaces them. */

@page {
    size: A4 portrait;
    margin: 0;
}

.cv-page {
    --cv-space-1: 0.25em;
    --cv-space-2: 0.5em;
    --cv-space-3: 1em;
    --cv-space-4: 1.5em;

    font-family: var(--font-sans);
    font-size: 10pt;
    line-height: 1.45;
    color: var(--fg);
    background: var(--surface);
    width: 210mm;
    min-height: 297mm;
    max-height: 297mm;
    overflow: visible;
    padding: 1.5cm;
    margin: 0 0 1.5rem 0;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.cv-wrapper {
    overflow-x: auto;
}

/* ---- header: name and role on the left, a contact link beside each on the right ---- */

.cv-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 2em;
    font-family: var(--font-title);
    line-height: 1.1;
    margin: 0 0 var(--cv-space-4) 0;
}

.cv-page h1,
.cv-role {
    letter-spacing: 0.01em;
}

.cv-page h1 {
    font-size: 24pt;
    font-weight: 700;
    margin: 0;
}

.cv-role {
    display: block;
    margin-top: var(--cv-space-1);
    font-size: 14pt;
    font-weight: 300;
}

.cv-links {
    display: flex;
    flex-direction: column;
    gap: var(--cv-space-2);
}

.cv-header a {
    font-size: 10pt;
    font-family: var(--font-sans);
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.cv-header a svg {
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.6ch;
    flex-shrink: 0;
}

.cv-page .summary {
    margin: 0;
}

/* code on paper is a monospaced word with a hairline underneath: no chip */
.cv-page code {
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 1px 0;
    color: inherit;
    font-size: inherit;
}

/* ---- body: first section hugs the summary, last hugs the bottom margin, the rest of the
   sheet is split between sections so each reads as its own block ---- */

.cv-page .cv-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cv-page .cv-body section {
    margin: 0;
}

/* ---- headings ---- */

.cv-page h2 {
    font-family: var(--font-title);
    font-size: 14pt;
    font-weight: 700;
    line-height: 1.2;
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--cv-space-1);
    margin: 0 0 var(--cv-space-2) 0;
}

.cv-page h3 {
    font-family: var(--font-title);
    font-size: 12pt;
    font-weight: 400;
    line-height: 1.2;
    margin: 0;
}

/* entry title and its meta line, with a little breathing room before the entry */
.cv-page hgroup {
    padding-bottom: var(--cv-space-1);
    margin: var(--cv-space-3) 0 0 0;
}

.cv-page hgroup .meta {
    margin: 0;
}

/* indented behind a quote bar, like a markdown blockquote */
.cv-page .entry {
    margin: 0;
    border-left: 2px solid var(--border);
    padding-left: 1.2ch;
}

/* bullet titles: body face at body weight, so they read as part of the line */
.cv-page h4 {
    font-family: var(--font-sans);
    font-size: inherit;
    font-weight: 400;
}

.cv-page li h4 {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* skills labels stay bold: that table is its own format */
.cv-page .cv-skills-table h4 {
    font-weight: 700;
}

.cv-page .meta {
    font-size: 1em;
    margin: 0 0 var(--cv-space-2) 0;
}

/* ---- lists ---- */

.cv-page ul {
    list-style: "• " outside;
    padding-left: 1.2ch;
    margin: 0;
}

.cv-page li {
    margin: 0 0 var(--cv-space-2) 0;
}

.cv-page li:last-child {
    margin-bottom: 0;
}

/* ---- skills grid: label := { values }, two pairs per row ---- */

.cv-skills-table {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
    row-gap: var(--cv-space-1);
}

.cv-skills-table .label {
    padding-right: 1ch;
}

.cv-skills-table .gap {
    padding-left: 3ch;
}

/* ---- on-screen chrome, hidden in print ---- */

.cv-hint {
    color: var(--fg-muted);
    font-size: 0.9em;
    margin-bottom: 1rem;
}

.cv-hint button {
    font: inherit;
    font-family: var(--font-mono);
    color: var(--link);
    background: none;
    border: none;
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
}

/* ---- print ---- */

@media print {
    body {
        background: #fff;
        color: #1a1a1a;
        padding: 0;
        margin: 0;
        max-width: none;
    }

    nav,
    .cv-hint,
    .page-header {
        display: none;
    }

    .cv-wrapper {
        overflow: visible;
    }

    .cv-page {
        color: #1a1a1a;
        background: #fff;
        border: none;
        box-shadow: none;
        margin: 0;
        width: auto;
    }

    .cv-page h2,
    .cv-page code {
        border-bottom-color: #ccc;
    }

    .cv-page .entry {
        border-left-color: #ccc;
    }
}
