/* ZST CV Builder v9.7: shared print geometry for 8 layout families.
   Applies to printed PDF and paper. Browser print-dialog choices are not programmable. */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body, main, .wrap, .zst-tpl-wrap { margin: 0 !important; padding: 0 !important; }
  .zst-tpl-wrap { width: 210mm !important; max-width: none !important; }
  .zst-cv-sheet, .zst-cv-sheet * { box-sizing: border-box !important; }
  .zst-cv-sheet {
    width: 210mm !important; max-width: 210mm !important;
    min-height: 297mm !important; height: auto !important;
    margin: 0 !important; padding: 0 !important;
    box-shadow: none !important; border-radius: 0 !important;
    -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
    overflow: visible !important;
  }
  .zst-cv-sheet .cv-side, .zst-cv-sheet .cv-main { min-width: 0 !important; }
  .zst-cv-sheet h1 { font-size: 19pt !important; line-height: 1.15 !important; margin: 0 0 2mm !important; }
  .zst-cv-sheet h2 { font-size: 10pt !important; line-height: 1.2 !important; margin: 3.2mm 0 1.5mm !important; padding-bottom: 1mm !important; break-after: avoid !important; }
  .zst-cv-sheet p { font-size: 9pt !important; line-height: 1.35 !important; margin: 1.5mm 0 2.5mm !important; }
  .zst-cv-sheet .zst-cv-section { break-inside: auto !important; }
  .zst-cv-sheet .cv-main { padding: 8mm 10mm !important; }
  .zst-cv-sheet .cv-side { padding: 9mm 8mm !important; }
  /* Sidebars extend the full A4 height for short CVs. */
  .zst-cv-sheet.layout-2 .cv-side, .zst-cv-sheet.layout-6 .cv-side { grid-column: 2 !important; grid-row: 1 !important; }
  .zst-cv-sheet.layout-2 .cv-main, .zst-cv-sheet.layout-6 .cv-main { grid-column: 1 !important; grid-row: 1 !important; }
  /* Header variants: compact banner, remaining space reserved for content. */
  .zst-cv-sheet.layout-3, .zst-cv-sheet.layout-7 { display: flex !important; flex-direction: column !important; }
  .zst-cv-sheet.layout-3 .cv-side, .zst-cv-sheet.layout-7 .cv-side {
    flex: 0 0 auto !important; height: auto !important; min-height: 0 !important;
    padding: 6mm 11mm !important;
  }
  .zst-cv-sheet.layout-3 .cv-main, .zst-cv-sheet.layout-7 .cv-main {
    flex: 1 0 auto !important; height: auto !important; min-height: 0 !important;
    padding: 7mm 11mm !important;
  }
  .zst-cv-sheet.layout-3 .cv-side h2, .zst-cv-sheet.layout-7 .cv-side h2 { margin-top: 2mm !important; }
  /* Long CVs may need additional pages; never crop text to force one page. */
  .zst-print-locked .zst-cv-sheet { display: none !important; }
}

/* v9.9 print-safe correction (appended after the proven v9.7 rules).
   v9.6 set align-content:start, making grid rows only as tall as the CV
   contents and leaving the lower part of A4 white. Stretch rows again.
   Do not alter banner-style designs (3, 7, 10, 15) or text sizing.
   This applies to all known sidebar-based layout families (0..17). */
@media print {
  .zst-cv-sheet:is(.layout-0,.layout-2,.layout-4,.layout-6,.layout-8,.layout-9,.layout-11,.layout-12,.layout-13,.layout-14,.layout-16,.layout-17) {
    align-content: stretch !important;
    align-items: stretch !important;
    grid-template-rows: auto !important;
  }
  .zst-cv-sheet:is(.layout-0,.layout-2,.layout-4,.layout-6,.layout-8,.layout-9,.layout-11,.layout-12,.layout-13,.layout-14,.layout-16,.layout-17) > .cv-side {
    align-self: stretch !important;
    height: auto !important;
  }
  /* The earliest layout-0 was also used for new template slugs, so leave
     unspecified grid-based families consistent. Explicit banner layouts are
     excluded, preserving compact Fresh Green / Creative Amber headers. */
  .zst-cv-sheet:not(.layout-1):not(.layout-3):not(.layout-5):not(.layout-7):not(.layout-10):not(.layout-15) {
    align-content: stretch !important;
  }
}
/*
 * ZST CV Builder — Modern Blue replacement design (v10.0)
 * CSS-only patch: no PHP, SQL, CV data, entitlement, or other templates are changed.
 * Only catalog Modern Blue uses BOTH layout-0 and accent #1463b8.
 * Keep this override AFTER the existing v9.7/v9.9 rules in their current file.
 */

/* New concept: blue top rule + white/light-blue editorial header + clean body.
   No tall sidebar, so print and browser preview use the SAME structure. */
article.zst-cv-sheet.layout-0[style*="#1463b8"] {
  display: block !important;
  width: 210mm;
  max-width: 100%;
  min-height: 297mm;
  height: auto !important;
  grid-template-columns: none !important;
  grid-template-rows: none !important;
  align-content: normal !important;
  overflow: visible !important;
  background: #fff !important;
  color: #203149 !important;
  font-family: Arial, "Noto Sans Arabic", sans-serif;
  border: 0 !important;
  box-shadow: 0 12px 35px rgba(25,48,83,.15);
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side {
  display: block !important;
  position: relative !important;
  grid-area: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 12mm 17mm 8mm 17mm !important;
  background: #edf4fc !important;
  border-top: 6mm solid #1463b8 !important;
  border-bottom: .4mm solid #bdd0e8 !important;
  color: #182e4b !important;
  overflow: visible !important;
  break-inside: avoid-page;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side > h1 {
  color: #1463b8 !important;
  font-size: 24pt !important;
  line-height: 1.12 !important;
  margin: 0 0 2mm !important;
  overflow-wrap: anywhere;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side > p {
  font-size: 9.5pt !important;
  color: #34465f !important;
  line-height: 1.45 !important;
  margin: 1.1mm 0 2mm !important;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side > h2 {
  display: block !important;
  font-size: 9.5pt !important;
  line-height: 1.2 !important;
  color: #1463b8 !important;
  border: 0 !important;
  margin: 3mm 0 1.5mm !important;
  padding: 0 !important;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side .zst-cv-photo {
  display: block !important;
  position: absolute !important;
  top: 9mm !important;
  right: 16mm !important;
  width: 26mm !important;
  height: 26mm !important;
  max-width: 26mm !important;
  max-height: 26mm !important;
  border: 1mm solid #fff !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  box-shadow: 0 2px 6px rgba(10,44,95,.15) !important;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side:has(.zst-cv-photo) > h1,
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side:has(.zst-cv-photo) > p:first-of-type {
  max-width: calc(100% - 35mm) !important;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-main {
  display: block !important;
  grid-area: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  box-sizing: border-box !important;
  padding: 8mm 17mm 12mm 17mm !important;
  margin: 0 !important;
  background: #fff !important;
  color: #203149 !important;
  overflow: visible !important;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-main h2 {
  color: #1463b8 !important;
  font-size: 10.5pt !important;
  letter-spacing: .15px !important;
  line-height: 1.25 !important;
  margin: 3.2mm 0 1.6mm !important;
  padding: 0 0 1.4mm !important;
  border-bottom: 1px solid #d2e0ee !important;
  break-after: avoid-page !important;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-main p {
  color: #26364d !important;
  font-size: 9.5pt !important;
  line-height: 1.45 !important;
  white-space: pre-line !important;
  overflow-wrap: anywhere !important;
  margin: 0 0 3.2mm !important;
  orphans: 2;
  widows: 2;
}
article.zst-cv-sheet.layout-0[style*="#1463b8"] .zst-cv-section {
  break-inside: auto !important;
  page-break-inside: auto !important;
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  article.zst-cv-sheet.layout-0[style*="#1463b8"] {
    display: block !important;
    width: 210mm !important;
    max-width: 210mm !important;
    min-height: 297mm !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    break-inside: auto !important;
    page-break-inside: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-side {
    min-height: 0 !important;
    height: auto !important;
    break-inside: avoid-page !important;
  }
  article.zst-cv-sheet.layout-0[style*="#1463b8"] > .cv-main {
    min-height: 0 !important;
    height: auto !important;
    break-inside: auto !important;
  }
}
