/* ============================================================
   Advoke CV — Print / PDF output
   Used by all 60 templates in the resume editor.
   ============================================================ */

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  html,
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide site chrome, editor UI, ad slots */
  .site-header,
  .site-footer,
  .editor-toolbar,
  .editor-sidebar,
  .editor-tabs,
  .editor-help,
  .save-status,
  .ad-slot,
  .skip-link,
  .no-print,
  .breadcrumb,
  .cta-final,
  .related-templates,
  .category-hero,
  .editor-toast {
    display: none !important;
  }

  /* Reset layout wrappers so the CV flows naturally */
  .editor-layout,
  .editor-workspace,
  .editor-main,
  .editor-preview,
  .preview-scroll,
  .preview-frame {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #FFFFFF !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    zoom: 1 !important;
    position: static !important;
  }

  /* The CV itself */
  .cv {
    box-shadow: none !important;
    border-radius: 0 !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
    color: var(--cv-ink, #1A1A1A) !important;
    font-size: 10.5pt !important;
    line-height: 1.45 !important;
  }

  .cv-body,
  .cv-header {
    padding: 0 0 10pt 0 !important;
  }

  .cv-header {
    margin-bottom: 10pt !important;
  }

  /* Prevent splits inside single items */
  .cv-exp,
  .cv-edu,
  .cv-project {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .cv-h2 {
    page-break-after: avoid;
    break-after: avoid;
    margin-top: 12pt !important;
  }

  .cv-name {
    font-size: 22pt !important;
    page-break-after: avoid;
  }

  .cv-title {
    font-size: 12pt !important;
    page-break-after: avoid;
  }

  h1, h2, h3, h4 {
    page-break-after: avoid;
    break-after: avoid;
  }

  /* Preserve brand colours */
  .cv-header-banner,
  .cv-sidebar,
  .cv-pill,
  .cv-deco,
  .cv-deco-top-rule,
  .cv-deco-side-rule,
  .cv-deco-banner,
  .cv-deco-corner,
  .cv-deco-double span,
  .cv-timeline-dot,
  .badge,
  .badge-primary {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Sidebar layouts must remain side-by-side for print */
  .cv-layout-sidebar-left,
  .cv-layout-sidebar-right {
    display: grid !important;
    min-height: auto !important;
    grid-template-columns: 200pt 1fr !important;
    gap: 0 !important;
  }

  .cv-layout-sidebar-right {
    grid-template-columns: 1fr 200pt !important;
  }

  .cv-layout-sidebar-left .cv-sidebar,
  .cv-layout-sidebar-right .cv-sidebar {
    padding: 10pt 12pt !important;
    background: var(--cv-soft, #F5F5F5) !important;
  }

  .cv-main-col {
    padding: 0 12pt !important;
  }

  /* Remove shadows on decorative elements */
  .cv-pill {
    background: var(--cv-soft, #FFF4CC) !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Table rows shouldn't split */
  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Allow long sections to flow naturally across pages */
  .cv-section {
    page-break-inside: auto;
    break-inside: auto;
  }

  /* Remove background on the editor preview panel so pages stay clean */
  .editor-preview {
    background: transparent !important;
  }

  /* Force new page before custom sections with substantial content */
  .cv-section-custom {
    page-break-inside: auto;
  }

  /* Hide print button itself in print mode */
  #btn-print,
  [data-print] {
    display: none !important;
  }

  /* Links — show URL only if helpful, but avoid clutter */
  a {
    color: inherit !important;
    text-decoration: none !important;
  }

  /* Ensure text remains black for readability */
  .cv-summary,
  .cv-bullets,
  .cv-list,
  .cv-skills-inline {
    color: #1A1A1A !important;
  }

  /* Sidebar CV contact details readable */
  .cv-lbl {
    color: var(--cv-accent, #FFC629) !important;
  }
}

/* Print hidden elements when body is in print mode via JS toggle */
body.is-printing .site-header,
body.is-printing .site-footer,
body.is-printing .editor-toolbar,
body.is-printing .editor-sidebar,
body.is-printing .editor-tabs,
body.is-printing .editor-help,
body.is-printing .ad-slot {
  display: none !important;
}