:root {
  --paper: #f4f1ea;
  --card: #fbfaf7;
  --ink: #1c2421;
  --muted: #64706b;
  --line: #d9d5cc;
  --accent: #0f766e;
  --accent-soft: #dcece8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.page {
  position: relative;
  width: min(1080px, calc(100% - 40px));
  margin: 40px auto;
  padding: 56px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.hero {
  padding-bottom: 32px;
  border-bottom: 2px solid var(--ink);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.intro {
  max-width: 640px;
  margin: 20px 0 0;
  color: #3d4844;
  font-size: 16px;
  line-height: 1.65;
}

.contact { display: grid; gap: 2px; margin-bottom: 12px; font-size: 14px; }
.contact span, .contact a { color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.links a:hover { background: var(--accent-soft); text-decoration: none; }
.print {
  position: absolute;
  top: 24px;
  right: 24px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
  border-radius: 8px;
  padding: 8px 13px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.print:hover { background: #34413b; }

.layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 56px;
  padding-top: 36px;
}

aside { display: flex; flex-direction: column; gap: 32px; }
.content { display: flex; flex-direction: column; gap: 34px; }

section h2 {
  margin: 0 0 14px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.skills { display: grid; gap: 12px; margin: 0; }
.skills dt { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.skills dd { margin: 2px 0 0; font-size: 13.5px; line-height: 1.5; }

.cert { display: grid; gap: 1px; margin-bottom: 14px; }
.cert strong { font-size: 13.5px; font-weight: 600; }
.cert span { color: var(--muted); font-size: 12.5px; }

.job { margin-bottom: 26px; }
.job:last-child { margin-bottom: 0; }
.job-head { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; margin-bottom: 8px; }
.job-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.job-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.dates { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

ul { margin: 0; padding-left: 18px; }
li { margin-bottom: 5px; font-size: 14px; line-height: 1.55; }
li::marker { color: var(--accent); }

.stack {
  margin: 9px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.5;
}

.project {
  padding: 18px 20px;
  background: #f1f5f2;
  border: 1px solid #cfe0da;
  border-radius: 12px;
}
.project p { margin: 0; color: #3d4844; font-size: 14px; }
.project-links { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; font-weight: 600; }
.plain { margin: 0; font-size: 14px; color: #3d4844; }

@media (max-width: 840px) {
  .page { width: min(100% - 20px, 720px); margin: 10px auto; padding: 52px 22px 28px; }
  .print { top: 12px; right: 12px; padding: 6px 10px; }
  .hero { padding-bottom: 24px; }
  .layout { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  aside { gap: 24px; }
  .job-head { flex-direction: column; gap: 2px; }
}

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

  html, body {
    background: #fff;
    color: #111;
    font-size: 9.5pt;
    line-height: 1.42;
  }

  .page {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
  }

  .print { display: none; }

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

  /* A single content column paginates reliably; the sidebar becomes a
     compact band above the experience. */
  .hero {
    padding-bottom: 14px;
  }

  h1 {
    font-size: 25pt;
    line-height: 1;
    letter-spacing: -0.04em;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 7.5pt;
  }

  .intro {
    margin-top: 10px;
    font-size: 9.5pt;
    line-height: 1.45;
  }

  .contact {
    gap: 0;
    font-size: 8.5pt;
  }

  .links {
    gap: 5px;
  }

  .links a {
    padding: 2px 6px;
    font-size: 7.5pt;
  }

  .layout {
    display: block;
    padding-top: 14px;
  }

  aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-bottom: 18px;
  }

  aside section {
    margin: 0;
  }

  aside section:first-child {
    grid-column: 1 / -1;
  }

  aside section:first-child .contact {
    display: flex;
    flex-wrap: wrap;
    gap: 0 18px;
  }

  .content {
    display: block;
  }

  .content > section {
    margin-bottom: 16px;
  }

  section h2 {
    margin: 0 0 7px;
    padding-bottom: 4px;
    font-size: 8pt;
    letter-spacing: 0.08em;
    break-after: avoid;
  }

  .skills {
    gap: 6px;
  }

  .skills dt {
    font-size: 7pt;
  }

  .skills dd {
    font-size: 8.5pt;
    line-height: 1.35;
  }

  .cert {
    margin-bottom: 8px;
  }

  .cert strong { font-size: 8.5pt; }
  .cert span { font-size: 8pt; }

  .job {
    margin-bottom: 13px;
    break-inside: avoid;
  }

  .job-head {
    gap: 12px;
    margin-bottom: 4px;
  }

  .job-head h3 { font-size: 10pt; }
  .job-head p { font-size: 8.5pt; }
  .dates { font-size: 7.5pt; }

  ul {
    padding-left: 14px;
  }

  li {
    margin-bottom: 2px;
    font-size: 9pt;
    line-height: 1.38;
  }

  .stack {
    margin-top: 4px;
    font-size: 7.5pt;
    line-height: 1.35;
  }

  .project {
    padding: 10px 12px;
    border-radius: 0;
    background: #fff;
    break-inside: avoid;
  }

  .project p,
  .plain {
    font-size: 9pt;
    line-height: 1.4;
  }

  .project-links {
    margin-top: 6px;
    font-size: 8pt;
  }

  .job:last-child,
  .content > section:last-child {
    margin-bottom: 0;
  }
}
