:root {
  --forest: #1a5c54;
  --copper: #b86a45;
  --sidebar: #eef3f1;
  --ink: #1d1a1b;
  --soft: #6b6264;
  --rule: #dbe5e2;
  --white: #ffffff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: #dfe7e4;
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
}

.doc-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--rule);
}

.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 2px;
  background: var(--forest);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  text-decoration: none;
}
.button.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.letter-page,
.cv-sheet {
  width: 210mm;
  margin: 1.25rem auto;
  background: var(--white);
  box-shadow: 0 18px 50px rgba(26, 26, 26, 0.12);
}

.letter-page {
  display: grid;
  grid-template-columns: 64mm 1fr;
  min-height: 297mm;
  grid-template-rows: 1fr auto;
  overflow: hidden;
}

/* Screen: one continuous CV sheet */
.cv-sheet {
  display: grid;
  grid-template-columns: 64mm 1fr;
  min-height: 297mm;
}
.role--compact { margin-bottom: 3.5mm; }

.letter-filmstrip {
  grid-column: 1 / -1;
  height: 12mm;
  margin: 0;
  background-color: #0a0a0a;
  background-image: url("../img/filmstrip-tile.svg");
  background-repeat: repeat-x;
  background-position: center bottom;
  background-size: auto 100%;
  pointer-events: none;
}

.doc-sidebar {
  background: var(--sidebar);
  padding: 12mm 8mm;
}

.doc-logo {
  width: 42mm;
  max-height: 42mm;
  height: auto;
  object-fit: cover;
  object-position: center top;
  margin-bottom: 10mm;
  display: block;
}

.side-block { margin-bottom: 8mm; }
.side-block h3 {
  margin: 0 0 3mm;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--forest);
  font-weight: 700;
}
.side-block p {
  margin: 0 0 1.2mm;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--ink);
}
.skill-group {
  margin-top: 3.5mm !important;
  font-weight: 700 !important;
}

.doc-main { padding: 12mm 11mm 12mm 10mm; }

.doc-header h1 {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.doc-subtitle {
  margin: 2mm 0 0;
  color: var(--soft);
  font-size: 0.92rem;
}
.doc-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 7mm;
  padding-bottom: 3mm;
  border-bottom: 1px solid var(--rule);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest);
  font-weight: 700;
}

.letter-body {
  margin-top: 7mm;
  font-size: 0.8rem;
  line-height: 1.32rem;
}
.letter-body p { margin: 0 0 3.2mm; }
.letter-page.compact .letter-body {
  font-size: 0.74rem;
  line-height: 1.2rem;
}
.signature {
  margin-top: 7mm !important;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 1.05rem !important;
  font-weight: 600;
}

.cv-section { margin-top: 7mm; }
.cv-section h2 {
  margin: 0 0 3.5mm;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--forest);
  display: flex;
  align-items: center;
  gap: 3mm;
}
.cv-section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.cv-section > p {
  margin: 0 0 2mm;
  font-size: 0.8rem;
  line-height: 1.35;
}

.role {
  display: grid;
  grid-template-columns: 22mm 1fr;
  gap: 3mm;
  margin-bottom: 4.5mm;
  break-inside: avoid;
}
.role-period {
  font-size: 0.72rem;
  color: var(--soft);
  line-height: 1.3;
}
.role-body h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}
.role-org {
  margin: 0.8mm 0 1.5mm !important;
  color: var(--forest) !important;
  font-size: 0.78rem !important;
  font-weight: 600;
}
.role-body p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
}
.role-body ul {
  margin: 2mm 0 0;
  padding-left: 4mm;
}
.role-body li {
  margin-bottom: 1mm;
  font-size: 0.76rem;
  line-height: 1.3;
}
.role-body li::marker { color: var(--copper); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5mm;
  margin-top: 2.5mm;
}
.tags span {
  border: 1px solid var(--rule);
  padding: 0.6mm 2mm;
  font-size: 0.68rem;
  color: var(--soft);
}

.keep-together { break-inside: avoid; }

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

  html, body {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .noprint { display: none !important; }

  .letter-page,
  .cv-sheet {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  /* Page 1 = letter */
  .letter-page {
    height: auto;
    min-height: 0;
    break-after: page;
    page-break-after: always;
    display: grid !important;
    grid-template-columns: 52mm 1fr !important;
  }

  .letter-filmstrip {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Page 2 = full CV on one A4 */
  .cv-sheet {
    display: grid !important;
    grid-template-columns: 46mm 1fr !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    background: var(--white) !important;
    break-before: auto;
    page-break-before: auto;
    break-after: avoid;
    page-break-after: avoid;
  }

  .cv-sheet .doc-sidebar {
    background: var(--sidebar) !important;
    border-right: 0.35mm solid #c5d0cc;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 4mm 3.5mm !important;
  }

  .cv-sheet .doc-main {
    padding: 4mm 4mm 4mm 5mm !important;
  }

  .letter-page .doc-sidebar {
    background: var(--sidebar) !important;
    border-right: 0.35mm solid #c5d0cc;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    padding: 8mm 6mm !important;
  }

  .letter-page .doc-main {
    padding: 8mm 8mm 8mm 9mm !important;
  }

  .tags span {
    background: #f3f1ec !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .cv-sheet .doc-logo {
    width: 16mm;
    max-height: 16mm;
    object-fit: cover;
    margin-bottom: 2.5mm;
  }

  .letter-page .doc-logo {
    width: 28mm;
    max-height: 28mm;
    object-fit: cover;
    margin-bottom: 6mm;
  }

  .cv-sheet .doc-header h1 { font-size: 1.1rem; }
  .cv-sheet .doc-subtitle { font-size: 0.66rem; margin-top: 1mm; }
  .cv-sheet .cv-section { margin-top: 2.2mm; }
  .cv-sheet .cv-section h2 { margin-bottom: 1.2mm; font-size: 0.55rem; }
  .cv-sheet .cv-section > p { margin-bottom: 0.6mm; }
  .cv-sheet .role {
    grid-template-columns: 16mm 1fr;
    gap: 1.5mm;
    margin-bottom: 1.6mm;
    break-inside: auto;
    page-break-inside: auto;
  }
  .cv-sheet .role--compact { margin-bottom: 1.3mm; }
  .cv-sheet .role-body h3 { font-size: 0.7rem; }
  .cv-sheet .role-org { margin: 0.2mm 0 0.5mm !important; font-size: 0.62rem !important; }
  .cv-sheet .role-body ul { margin-top: 0.6mm; padding-left: 3mm; }
  .cv-sheet .role-body li { margin-bottom: 0.25mm; }
  .cv-sheet .tags { margin-top: 0.6mm; gap: 0.8mm; }
  .cv-sheet .tags span { padding: 0.2mm 1.1mm; font-size: 0.52rem; }
  .cv-sheet .cv-section > p,
  .cv-sheet .role-body p,
  .cv-sheet .role-body li,
  .cv-sheet .side-block p {
    font-size: 0.58rem !important;
    line-height: 1.18 !important;
  }
  .cv-sheet .side-block { margin-bottom: 2.5mm; }
  .cv-sheet .side-block h3 { margin-bottom: 1mm; font-size: 0.52rem; }
  .cv-sheet .skill-group { margin-top: 1.4mm !important; }

  .letter-page .doc-header h1 { font-size: 1.45rem; }
  .letter-page .letter-body,
  .letter-page .side-block p {
    font-size: 0.74rem !important;
    line-height: 1.3 !important;
  }
  .letter-page .side-block { margin-bottom: 6mm; }
}

@media screen and (max-width: 900px) {
  .letter-page,
  .cv-sheet {
    width: min(210mm, 100%);
    grid-template-columns: 1fr;
  }
  .doc-sidebar { padding-bottom: 4mm; }
}

/* Embedded inside livecast.nl/cv.php — keep sidebar beside main column */
html:has(body.embed),
body.embed {
  background: transparent;
  height: auto;
  min-height: 0;
  overflow: hidden;
}
body.embed {
  padding: 1.25rem 0 0;
}
body.embed .cv-sheet {
  width: min(100%, 980px);
  min-height: 0;
  height: auto;
  margin: 0 auto;
  box-shadow: 0 12px 36px rgba(26, 26, 26, 0.1);
  grid-template-columns: 240px 1fr;
}
@media screen and (max-width: 900px) {
  body.embed .cv-sheet {
    width: 100%;
    grid-template-columns: 220px 1fr;
  }
}
@media screen and (max-width: 560px) {
  body.embed .cv-sheet {
    grid-template-columns: 1fr;
  }
}
