/* ==========================================================================
   cv-print.css — dedicated print document (approach B).

   Loaded with <link media="print">, so it NEVER touches screen rendering.
   The whole live site is hidden at print time and a clean, data-built CV
   document (#cv-print, generated by js/cv-print-doc.js from window.CV_DATA)
   is shown in its place — styled to match the Figtree single-column ATS CV
   (D:\...\html_style_pdf\cv_figtree_1colomn_photo.html).

   #cv-print is display:none on screen (see css/main.css); here it becomes the
   only visible thing. Colours are literal here on purpose: this is a paper
   document with its own identity, independent of the site theme tokens.
   ========================================================================== */

/* margin:0 removes the @page margin boxes where the browser would otherwise
   stamp URL / date / page number. NO `size` here on purpose: the real render is
   Puppeteer on the VPS (/pdf endpoint) called with width:794px/height:1123px in
   page.pdf() — that INTEGER page size is what removes the old right-edge white
   strip (root cause was server-side: page.pdf ignored width/height and used a
   fractional A4). So the HTML stays hack-free (no @page size, no bleed). */
@page { margin: 0; }

/* Hide the entire live site; reveal only the generated CV document. Force the
   page white so the site's dark body background never bleeds through on a
   partly-filled last page (printBackground prints it otherwise). margin/padding
   0 kills the browser's default ~8px body margin — in the STANDALONE HTML sent
   to Puppeteer main.css isn't present to reset it, so without this the CV had a
   white border all around the page. */
html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
body > *:not(#cv-print) { display: none !important; }
#cv-print { display: block !important; }

/* ---------------------------------------------------------------- doc base */
#cv-print {
  --cyan: #00B8D9;
  --dark: #14161D;
  --line: #E4E7EC;
  font-family: 'Figtree', Arial, sans-serif;
  font-size: 10.2pt;
  line-height: 1.5;
  color: #23262E;
  background: #fff;
  /* Force backgrounds/colours to print even when the browser's print dialog has
     "Background graphics" OFF (the default) — without this the dark header band,
     the cyan photo frame and the timeline accents vanish on paper. */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ISOLATE the print document from the site's stylesheet. main.css is media="all",
   so its transform / opacity / filter / will-change / backface-visibility /
   mix-blend rules leak onto matching elements here — and any of those puts the
   element on a COMPOSITED layer, which Chromium RASTERISES when printing, making
   that text non-selectable (only some blocks were affected → the reported bug:
   job descriptions, bullets, education, disclaimer not selectable). Neutralise
   them so every glyph stays real, selectable text. (The one intended transform —
   the photo zoom — is restored below.) */
#cv-print, #cv-print * {
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
  transform: none !important;
  filter: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  will-change: auto !important;
  backface-visibility: visible !important;
  mix-blend-mode: normal !important;
  opacity: 1 !important;
  text-shadow: none !important;
  clip-path: none !important;
  mask: none !important;
  animation: none !important;
  transition: none !important;
  -webkit-text-fill-color: currentColor !important;
}
#cv-print * { margin: 0; padding: 0; box-sizing: border-box; }

/* ---------------------------------------------------------------- header */
#cv-print .cvp-header {
  background: var(--dark);
  color: #eee;
  padding: 8mm 14mm;
  position: relative;
}
#cv-print .cvp-name {
  font-family: 'Poppins', sans-serif; font-weight: 700;
  font-size: 21pt; color: #fff; line-height: 1.15;
}
#cv-print .cvp-role {
  font-family: 'Poppins', sans-serif; font-size: 11pt;
  color: var(--cyan); margin-top: 1.5mm;
}
#cv-print .cvp-contact {
  font-family: 'IBM Plex Mono', monospace; font-size: 8.6pt;
  color: #dfe3e8; margin-top: 3mm; padding-top: 3mm;
  border-top: 1px solid rgba(255,255,255,.15);
}
#cv-print .cvp-contact__row { display: flex; align-items: center; gap: 3mm; margin-bottom: 1.4mm; }
#cv-print .cvp-contact__row svg { width: 3.6mm; height: 3.6mm; fill: var(--cyan); flex-shrink: 0; }
#cv-print .cvp-contact a { color: #dfe3e8; text-decoration: none; border-bottom: 1px solid rgba(0,184,217,.5); }

/* photo (optional) — frozen params from the Figtree master */
#cv-print .cvp-photo {
  position: absolute; top: 9mm; right: 12mm; width: 48mm; height: 48mm;
  border-radius: 12%; overflow: hidden; border: 2px solid var(--cyan);
  background: #22252e;
}
#cv-print .cvp-photo img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform-origin: center;
  transform: scale(1.05) !important; /* !important: survive the isolation reset above */
}
/* leave room for the photo so long names/roles don't slide under it */
#cv-print.has-photo .cvp-name,
#cv-print.has-photo .cvp-role,
#cv-print.has-photo .cvp-contact { padding-right: 56mm; }

/* ---------------------------------------------------------------- main */
#cv-print .cvp-main { padding: 7mm 14mm 1mm 14mm; }
#cv-print .cvp-section { margin-bottom: 4mm; }
#cv-print .cvp-main .cvp-section:last-child { margin-bottom: 0; }
#cv-print h2 {
  font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 13pt; color: #23262E;
  padding-bottom: 1.5mm; border-bottom: 2px solid var(--line); margin-bottom: 2.5mm;
  break-after: avoid; page-break-after: avoid; display: flex; align-items: center; gap: 3mm;
}
#cv-print h2::before { content: ''; width: 4mm; height: 3px; background: var(--cyan); display: inline-block; }

/* profile */
#cv-print .cvp-bio { font-size: 10.4pt; line-height: 1.5; color: #333; }

/* competenze (one paragraph per domain) */
#cv-print .cvp-skill {
  font-size: 9.8pt; line-height: 1.5; color: #444; margin-bottom: 2mm;
  break-inside: avoid; page-break-inside: avoid;
}
#cv-print .cvp-skill b { color: var(--dark); font-family: 'Poppins', sans-serif; font-weight: 600; }

/* experience timeline */
#cv-print .cvp-job { position: relative; padding-left: 9mm; margin-bottom: 3mm; }
#cv-print .cvp-job::before {
  content: ''; position: absolute; left: 0; top: 1.4mm; width: 3.2mm; height: 3.2mm;
  border-radius: 50%; background: #fff; border: 2px solid var(--cyan); z-index: 1;
}
#cv-print .cvp-job::after {
  content: ''; position: absolute; left: calc(1.6mm - 0.5px); top: 4.7mm; bottom: -3mm;
  width: 1px; background: #D5DAE2; z-index: 0;
}
#cv-print .cvp-job:last-child::after { display: none; }
#cv-print .cvp-job__title {
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 11pt; color: #23262E;
  break-after: avoid; page-break-after: avoid;
}
#cv-print .cvp-job__meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 8.2pt; color: var(--cyan);
  margin-top: 0.8mm; margin-bottom: 1.5mm; break-after: avoid; page-break-after: avoid;
}
#cv-print .cvp-job__hook {
  font-size: 9.6pt; line-height: 1.5; color: #444; margin-bottom: 1mm;
  break-after: avoid; page-break-after: avoid;
}
#cv-print .cvp-job ul { list-style: none; margin-top: 1.5mm; }
#cv-print .cvp-job li {
  font-size: 9.6pt; line-height: 1.5; margin-bottom: 0.8mm;
  break-inside: avoid; page-break-inside: avoid; padding-left: 4mm; position: relative; color: #2b2e35;
}
#cv-print .cvp-job li::before { content: '▸'; position: absolute; left: 0; color: var(--cyan); }
/* nested sub-role (project): a compact label + its own bullets */
#cv-print .cvp-role { margin-top: 1.5mm; }
#cv-print .cvp-role__head {
  font-size: 9.6pt; padding-left: 4mm; position: relative; color: #2b2e35;
  break-after: avoid; page-break-after: avoid;
}
#cv-print .cvp-role__head::before { content: '▸'; position: absolute; left: 0; color: var(--cyan); }
#cv-print .cvp-role__name { font-family: 'Poppins', sans-serif; font-weight: 600; color: #23262E; }
#cv-print .cvp-role__period { font-family: 'IBM Plex Mono', monospace; font-size: 8pt; color: #7a828f; }
#cv-print .cvp-role ul { margin-top: 0.5mm; }
#cv-print .cvp-role li { padding-left: 8mm; }
#cv-print .cvp-role li::before { left: 4mm; color: #9aa3b5; content: '·'; }
#cv-print .cvp-job a { color: #23262E; text-decoration: none; border-bottom: 1px solid rgba(0,184,217,.65); }

/* education + languages */
#cv-print .cvp-edu { font-size: 9.6pt; color: #444; margin-bottom: 1.2mm; break-inside: avoid; page-break-inside: avoid; }
#cv-print .cvp-edu b { color: #23262E; }
#cv-print .cvp-langs { font-size: 9.6pt; color: #444; margin-top: 1.5mm; }
#cv-print .cvp-langs b { color: #23262E; }

/* footer: GDPR consent (always) + the "Generated from…" note */
#cv-print .cvp-footer {
  text-align: center; padding: 3mm 14mm 4mm; border-top: 1px solid var(--line);
  margin-top: 4mm; break-inside: avoid;
}
#cv-print .cvp-gdpr { font-size: 7.6pt; color: #777; }
#cv-print .cvp-note { font-size: 7pt; color: #a3a3a3; margin-top: 1mm; }
