:root {
  --text: #1d2125;
  --muted: #5b6570;
  --accent: #2f5d8a;
  --rule: #dde2e7;
  --tag-bg: #eef3f8;
  --tag-border: #cfdbe7;
}

* { box-sizing: border-box; }

html { background: #f2f4f6; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 10.5pt;
  line-height: 1.5;
  color: var(--text);
}

.page {
  max-width: 210mm;
  margin: 24px auto;
  padding: 18mm 18mm 16mm;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Language and PDF links above the page (screen only) */
.doc-nav {
  max-width: 210mm;
  margin: 16px auto -8px;
  padding: 0 4px;
  text-align: right;
  font-size: 9.5pt;
  color: var(--muted);
}

/* ---------- Header ---------- */
header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6mm;
  align-items: center;
  padding-bottom: 5mm;
  border-bottom: 2px solid var(--accent);
}
header h1 {
  margin: 0;
  font-size: 24pt;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.role {
  margin: 2px 0 10px;
  font-size: 12pt;
  color: var(--accent);
  font-weight: 600;
}
.contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: start;
  column-gap: 8mm;
  row-gap: 1px;
  font-size: 9.5pt;
  color: var(--muted);
}
.contact a { color: var(--muted); }
.portrait {
  width: 32mm;
  height: 32mm;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.summary {
  margin: 5mm 0 0;
  font-size: 10.5pt;
}

/* ---------- Sections ---------- */
section { margin-top: 6mm; }
section > h2 {
  margin: 0 0 3mm;
  font-size: 10pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1mm;
}

.entry { margin-bottom: 4.5mm; break-inside: avoid; }
.entry:last-child { margin-bottom: 0; }
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4mm;
  flex-wrap: wrap;
}
.entry h3 {
  margin: 0;
  font-size: 11pt;
  font-weight: 650;
}
.entry h3 .org { font-weight: 400; color: var(--muted); }
.meta {
  font-size: 9.5pt;
  color: var(--muted);
  white-space: nowrap;
}
.about {
  margin: 1mm 0 1.5mm;
  font-style: italic;
  color: var(--muted);
  font-size: 9.5pt;
}
.entry ul {
  margin: 1mm 0 0;
  padding-left: 4.5mm;
}
.entry li { margin: .6mm 0; }
.entry p { margin: 1mm 0 0; }

.tags {
  list-style: none;
  margin: 2mm 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5mm;
}
.tags li {
  font-size: 8.5pt;
  padding: .3mm 2mm;
  border: 1px solid var(--tag-border);
  background: var(--tag-bg);
  border-radius: 3px;
  color: #2b3a48;
}

.compact .entry { margin-bottom: 3mm; }

.skills {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 5mm;
  row-gap: 1mm;
}
.skills dt { font-weight: 600; }
.skills dd { margin: 0; }

.reference p { margin: 0; }

/* Screen vs. print variants */
.print-only { display: none; }

/* ---------- Print / PDF ---------- */
@page { size: A4; margin: 14mm 15mm; }

@media print {
  html { background: none; }
  body { font-size: 10pt; }
  .page {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }
  .screen-only { display: none; }
  .print-only { display: block; }
  a { color: inherit; }
  .tags li { background: none; }
  section > h2 { break-after: avoid; }
  /* Long entries may span pages, but never split a heading from its first lines or a single bullet */
  .entry { break-inside: auto; }
  .entry-head, .about { break-after: avoid; }
  .entry li, .tags { break-inside: avoid; }
  .compact .entry { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Narrow screens ---------- */
@media screen and (max-width: 640px) {
  .page { margin: 0; padding: 20px; box-shadow: none; }
  .doc-nav { margin: 0; padding: 10px 20px 0; background: #fff; }
  header { grid-template-columns: 1fr; }
  .portrait { grid-row: 1; width: 96px; height: 96px; }
  .contact { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; }
  .skills dd { margin-bottom: 2mm; }
}
