/*
 * print.css: the recruiter print / Save-as-PDF layout. A4, the same gold theme as the screen, two columns
 * (main and sidebar), text that ATS parsers read in a logical order (main column first, then the sidebar).
 * Linked with media="print"; the "Print view" button switches it to media="all" so the same rules show on screen.
 * No colour or font values here: every one comes from a variable in theme.css.
 */
@page { size: A4; margin: 12mm; }

/* ---------- Everything that only makes sense online ---------- */
.topbar, .statusbar, .error-banner, .proof-row, .badge, .note, .chevron, .hl-filter, dialog.popup { display: none !important; }
.ed-ctl, .ed-add { display: none !important; }
body.editing .ed { outline: none !important; background: none !important; }

/* ---------- Page ---------- */
body { background: var(--color-paper); font-size: 9.5pt; line-height: 1.37; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
a { color: inherit; text-decoration: none; }
.page { max-width: none; margin: 0; padding: 0; }
.sheet { box-shadow: none; padding: 0; }

/* ---------- Header ---------- */
.contact-line { font-size: 8pt; gap: 2pt 12pt; margin-bottom: 5pt; }
.contact-item svg { width: 9pt; height: 9pt; }
.hero-name { padding: 9pt 0 8pt; }
.hero h1 { font-size: 25pt; border-bottom-width: 3pt; padding-bottom: 3pt; }
.hero .headline { font-size: 9pt; margin-top: 5pt; }
.hero-quote { padding: 8pt 0; }
.hero-quote blockquote { font-size: 13pt; }
.hero-quote figcaption { font-size: 8.5pt; margin-top: 3pt; }
.hero-strip { padding: 5pt 0; font-size: 8.5pt; gap: 2pt 12pt; }
.hero-strip li { padding-left: 10pt; }
.hero-strip li::before { width: 4pt; height: 4pt; top: 0.5em; }

/* ---------- Columns and sections ---------- */
.columns { grid-template-columns: minmax(0, 1fr) 56mm; gap: 0 5mm; margin-top: 10pt; }
.col-side { padding-left: 4mm; }
.sec { margin-bottom: 9pt; }
.section-head { margin-bottom: 5pt; padding: 1.5pt 6pt; break-after: avoid; }
.section-head h2 { font-size: 10pt; }
.summary p { margin: 0 0 4pt; }
.sheet .sec ul.ach-list > li { margin-bottom: 3pt; }
.sheet ul:not(.hero-strip) > li { padding-left: 10pt; margin-bottom: 2.5pt; }
.sheet ul:not(.hero-strip) > li::before { width: 3.5pt; height: 3.5pt; left: 1pt; top: 0.55em; }
li, .edu-item, .skill-group, .details { break-inside: avoid; }

/* ---------- Experience ---------- */
.role { padding: 2pt 0 8pt; }
.role + .role { border-top-width: 1pt; padding-top: 7pt; }
.role-logo { height: 7.5mm; margin-right: -1pt; }
.role-logo img { max-width: 24mm; }
.role-logo-initial span { width: 7.5mm; height: 7.5mm; font-size: 10pt; border-radius: 2pt; }
/* The company box and the title under it stay together, and stay with what follows */
.role-head { break-inside: avoid; break-after: avoid; }
.role-box { font-size: 10pt; padding: 2.5pt 7pt; }
.role-dates { font-size: 7.5pt; }
.role-title-line { font-size: 9.5pt; margin-top: 2pt; }
.role-summary { margin: 3pt 0 0; }
.role-main > div > ul { margin-top: 3pt; }
.role.compact { padding: 0 0 3pt; }
.role.compact .role-box { font-size: 9.5pt; }
.projects { margin-top: 5pt; gap: 6pt; }
.project-toggle { padding: 0; border-radius: 0; break-after: avoid; }
.project-name { font-size: 9.5pt; }
.project-meta { display: inline; font-size: 8.5pt; margin-top: 0; }
.project-meta::before { content: " · "; }
.project-body { display: block !important; padding: 1pt 0 0; }
.project.hl-dim, .role-main.hl-dim { opacity: 1; }

/* Highlights print as small chips, like the screen: tick, text, thin rounded gold border */
.highlights { display: flex; flex-wrap: wrap; gap: 2pt 3pt; margin-top: 2pt; }
.hl, .hl.hl-on {
  display: inline-flex; gap: 1.5pt; padding: 0 3.5pt 0 3pt; font-size: 7.5pt; line-height: 1.35; white-space: nowrap;
  border: 0.6pt solid var(--color-highlight-border); border-radius: 999px;
  background: var(--color-highlight-bg); color: var(--color-highlight-text);
}
.hl.hl-on .hl-tick { color: var(--color-highlight-tick); }

/* Achievement badge ("✓ Live"): keeps its thin rounded gold border, small enough not to add line height */
.ach-chip {
  gap: 1.5pt; padding: 0 3pt 0 2.5pt; font-size: 7pt; line-height: 1.25; vertical-align: 0.5pt;
  border-width: 0.6pt; background: none;
}
.ach-chip-off { display: none; }

/* Stack tags in the main column print as a text line: "Stack: Python, Django, ..." */
.tags { display: block; margin-top: 2pt; font-size: 8.5pt; color: var(--color-text-muted); }
.tags::before { content: "Stack: "; font-weight: 600; }
.tag { display: inline; padding: 0; border-radius: 0; background: none; font-size: inherit; color: inherit; }
.tag + .tag::before { content: ", "; }

/* ---------- Sidebar ---------- */
.col-side .sec { font-size: 8.5pt; line-height: 1.35; }
.skill-group { padding: 0 0 4pt 9pt; }
.skill-group::before { width: 3.5pt; height: 3.5pt; }
.skill-line { margin-top: 1pt; break-inside: avoid; }
.skill-group .tags { display: inline; font-size: inherit; color: var(--color-text); }
.skill-group .tags::before { content: none; }
.edu-item { padding: 0 0 4pt; }
.edu-item .sub, .col-side .sub { font-size: 8pt; }
.edu-link { font-size: 8pt; }
.edu-link svg { display: none; }
/* "View certificate" stays whole; only the URL after it may break anywhere */
.edu-link a { display: inline; }
.edu-link a::after { content: ": " attr(data-url); word-break: break-all; }
.details { gap: 1.5pt 6pt; }

/* ---------- Footer bar (end of the resume) ---------- */
/* One line, like the header contact line: same 8 pt size, items never split */
.sheet-foot { margin: 6pt 0 0; padding: 6pt 6pt; font-size: 8pt; gap: 2pt 11pt; break-inside: avoid; }
.sheet-foot .contact-item { white-space: nowrap; gap: 3pt; }
.sheet-foot svg { width: 9pt; height: 9pt; }

/* ---------- On screen only: the Print view shows an A4-wide sheet with a line at each estimated page break ---------- */
@media screen {
  body.print-preview { background: var(--color-page); }
  body.print-preview .topbar { display: block !important; }
  body.print-preview .page {
    width: 210mm; max-width: calc(100% - 16px); margin: 16px auto 48px; padding: 12mm;
    background-color: var(--color-paper); box-shadow: 0 2px 10px var(--color-paper-shadow);
    /* A line every printable page height (297 mm minus the two 12 mm margins). The line is an estimate:
       the browser may move a block to the next page earlier to keep it whole. */
    background-image: linear-gradient(to bottom, transparent calc(100% - 1px), var(--color-page-break) calc(100% - 1px));
    background-size: 100% 273mm; background-repeat: repeat-y; background-origin: content-box; background-clip: content-box;
  }
  body.print-preview .sheet { background: transparent; }
  body.print-preview .project-toggle { cursor: default; }
  body.print-preview .project-toggle:hover { background: none; }
}
@media screen and (max-width: 640px) {
  body.print-preview .page { padding: 12px; background-image: none; }
  body.print-preview .columns { grid-template-columns: 1fr; }
  body.print-preview .col-side { border-left: 0; padding-left: 0; }
}

/* Dates in running text may wrap in print, so they never push a word onto an extra line */
.date-inline { white-space: normal; }

/* Section icons stay on the gold bars in print, sized to the 10 pt titles */
.sec-icon svg { width: 9pt; height: 9pt; }

/* Real printing / PDF only (not Print view on screen): the footer bar is fixed to the bottom of the page, so the
   browser prints it at the foot of every page. The sheet's content is a real table whose <tfoot> is an empty
   band of the footer's height; the browser repeats a <tfoot> on every page, so no text runs under the bar. */
@media print {
  .sheet-flow { display: table; width: 100%; border-collapse: collapse; border-spacing: 0; }
  .sheet-flow > tbody { display: table-row-group; }
  .sheet-flow > tbody > tr { display: table-row; }
  .sheet-flow > tbody > tr > td { display: table-cell; padding: 0; }
  .sheet-flow > tfoot { display: table-footer-group; }
  .sheet-flow > tfoot td { padding: 0; }
  .print-foot-space { height: 13mm; }
  .sheet-foot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
}
