:root {
  --page-bg: #f3f4f6;
  --paper: #ffffff;
  --ink: #111827;
  --muted: #4b5563;
  --soft: #6b7280;
  --line: #e5e7eb;
  --panel: #f8fafc;
  --accent: #0f766e;
  --accent-strong: #134e4a;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page-bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.4;
}

body {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

.document {
  display: grid;
  gap: 28px;
  margin: 32px auto;
  width: 210mm;
}

.page {
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  height: 297mm;
  overflow: hidden;
  padding: 13mm 14mm;
  width: 210mm;
}

.header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10mm;
  grid-template-columns: 1fr 62mm;
  padding-bottom: 5mm;
}

.role-label {
  color: var(--accent-strong);
  font-size: 8pt;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  font-size: 31pt;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 2mm;
}

.tagline {
  color: var(--muted);
  font-size: 10pt;
  line-height: 1.45;
  margin-top: 3mm;
  max-width: 125mm;
}

.contact {
  color: var(--muted);
  display: grid;
  font-size: 7.5pt;
  font-style: normal;
  gap: 1.1mm;
  justify-items: end;
  line-height: 1.35;
  text-align: right;
}

.section {
  margin-top: 4.25mm;
}

.section.first {
  margin-top: 0;
}

.section h2 {
  align-items: center;
  color: var(--accent-strong);
  display: flex;
  font-size: 7.7pt;
  font-weight: 850;
  gap: 3mm;
  letter-spacing: 0.13em;
  margin-bottom: 2.4mm;
  text-transform: uppercase;
}

.section h2::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

.section > p {
  color: var(--muted);
  font-size: 8.55pt;
  line-height: 1.45;
}

.pill-grid {
  display: grid;
  gap: 1.7mm;
  grid-template-columns: repeat(4, 1fr);
}

.pill-grid span {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2mm;
  font-size: 7pt;
  font-weight: 650;
  line-height: 1.25;
  padding: 1.7mm 2mm;
}

.skills {
  display: grid;
  gap: 2.2mm 3.2mm;
  grid-template-columns: repeat(2, 1fr);
}

.skills div {
  border-left: 2px solid var(--line);
  padding-left: 2.5mm;
}

.skills .wide {
  grid-column: 1 / -1;
}

h3 {
  font-size: 8.25pt;
  line-height: 1.25;
}

.skills p,
.projects p,
.credential p,
.certs p {
  color: var(--muted);
  font-size: 7.15pt;
  line-height: 1.34;
  margin-top: 0.7mm;
}

.compact,
.job ul {
  color: var(--muted);
  font-size: 7.35pt;
  line-height: 1.31;
  margin: 0;
  padding-left: 4.4mm;
}

.compact li,
.job li {
  margin-bottom: 1mm;
  padding-left: 0.5mm;
}

.job {
  break-inside: avoid;
  margin-top: 3.2mm;
}

.job:first-of-type {
  margin-top: 0;
}

.job-head {
  align-items: start;
  display: grid;
  gap: 5mm;
  grid-template-columns: 1fr auto;
  margin-bottom: 1.7mm;
}

.job-head p:not(.dates) {
  color: var(--muted);
  font-size: 7.5pt;
  margin-top: 0.5mm;
}

.dates {
  color: var(--soft);
  font-size: 7pt;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.dates.left {
  text-align: left;
}

.projects {
  display: grid;
  gap: 2.5mm;
  grid-template-columns: repeat(3, 1fr);
}

.projects article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2mm;
  padding: 2.6mm;
}

.bottom-grid {
  display: grid;
  gap: 6mm;
  grid-template-columns: 1.45fr 1fr;
}

.bottom-grid h2 {
  margin-bottom: 2.3mm;
}

.credential {
  break-inside: avoid;
  margin-top: 2.6mm;
}

.credential:first-of-type {
  margin-top: 0;
}

.certs {
  display: grid;
  gap: 2.2mm;
}

.certs p {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2mm;
  color: var(--ink);
  font-weight: 650;
  padding: 2mm 2.5mm;
}

@page {
  size: A4;
  margin: 0;
}

@media print {
  html,
  body {
    background: #ffffff;
    margin: 0;
    padding: 0;
  }

  .document {
    display: block;
    margin: 0;
    width: 210mm;
  }

  .page {
    box-shadow: none;
    height: 297mm;
    page-break-after: always;
    page-break-inside: avoid;
    width: 210mm;
  }

  .page:last-child {
    page-break-after: auto;
  }
}

@media screen and (max-width: 820px) {
  .document {
    margin: 0;
    width: 100%;
  }

  .page {
    height: auto;
    min-height: 0;
    padding: 24px;
    width: 100%;
  }

  .header,
  .job-head,
  .skills,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .contact,
  .dates {
    justify-items: start;
    text-align: left;
  }

  .pill-grid,
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 520px) {
  .pill-grid,
  .projects {
    grid-template-columns: 1fr;
  }
}
