:root {
  --text: #222;
  --muted: #666;
  --border: #e6e6e6;
  --link: #1666c5;
  --max-width: 930px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }

.wrap {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.name {
  color: var(--text);
  font-weight: 650;
  white-space: nowrap;
}

nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
nav a { color: #444; font-size: 14px; }

main { padding: 58px 0 24px; }
section { margin: 0 0 52px; scroll-margin-top: 82px; }

.profile {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 42px;
  align-items: center;
  margin-bottom: 56px;
}

.avatar {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 50%;
}

h1 {
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 8px;
  font-weight: 650;
}

.role {
  margin: 0;
  font-size: 19px;
  color: #333;
}

.focus {
  margin: 3px 0 0;
  color: #444;
}

.affiliation {
  margin: 4px 0 0;
  color: var(--muted);
}

.links {
  margin-top: 14px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

h2 {
  font-size: 24px;
  margin: 0 0 18px;
  font-weight: 650;
  border-bottom: 1px solid var(--border);
  padding-bottom: 7px;
}

h3 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
}

p { margin: 0 0 12px; }
.lead { font-size: 17px; }
.section-intro { color: #444; margin-bottom: 24px; }

.item {
  padding: 0 0 24px;
  margin: 0 0 24px;
  border-bottom: 1px solid #f0f0f0;
}
.item:last-child { border-bottom: 0; margin-bottom: 0; }
.item.compact { padding-bottom: 18px; margin-bottom: 18px; }

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 8px;
}

.sub {
  color: var(--muted);
  margin: 2px 0 0;
}

.date {
  color: var(--muted);
  white-space: nowrap;
  font-size: 14px;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

.item-links {
  font-size: 14px;
  margin-top: 8px;
}

.stack-grid,
.background-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 36px;
}

.stack-group h3,
.background-grid h3 { margin-bottom: 5px; }
.stack-group p,
.background-grid p { color: #444; }

ul {
  margin: 10px 0 0;
  padding-left: 22px;
}
li { margin-bottom: 5px; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
  padding: 24px 0 42px;
  border-top: 1px solid var(--border);
}

/* CV page */
.cv-page {
  --max-width: 900px;
  line-height: 1.48;
}

.cv-topbar { border-bottom: 1px solid var(--border); }

.cv-nav {
  min-height: 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.cv { padding: 38px 0 20px; }

.cv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid #222;
}

.cv-header h1 {
  font-size: 31px;
  margin-bottom: 3px;
}

.cv-role {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.cv-location {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.cv-contact {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 13px;
  line-height: 1.45;
}

.cv-section { margin: 24px 0 0; }

.cv-section h2 {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: .035em;
  margin-bottom: 12px;
  padding-bottom: 4px;
}

.cv-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 185px;
  gap: 24px;
  margin-bottom: 14px;
}

.cv-row > div:last-child {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.cv-row span { color: #444; }
.cv-row small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.cv-row-block ul { margin-top: 6px; }
.cv-row-block li { margin-bottom: 3px; }

.cv-project {
  position: relative;
  padding-right: 130px;
  margin-bottom: 11px;
}

.cv-project > span {
  position: absolute;
  right: 0;
  top: 1px;
  color: var(--muted);
  font-size: 13px;
}

.cv-project p {
  margin: 3px 0 0;
  color: #444;
}

.cv-skills p,
.cv-additional p { margin-bottom: 5px; }

.cv-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding: 18px 0 36px;
  font-size: 14px;
}

@media (max-width: 720px) {
  .wrap { width: min(calc(100% - 28px), var(--max-width)); }
  .nav { align-items: flex-start; flex-direction: column; padding: 13px 0; gap: 8px; }
  nav { gap: 8px 14px; justify-content: flex-start; }
  main { padding-top: 38px; }
  section { scroll-margin-top: 128px; }
  .profile { grid-template-columns: 1fr; gap: 22px; }
  .avatar { width: 145px; height: 145px; }
  .item-head { flex-direction: column; gap: 4px; }
  .date { white-space: normal; }
  .stack-grid,
  .background-grid { grid-template-columns: 1fr; gap: 12px; }
  .footer { flex-direction: column; }

  .cv-header { flex-direction: column; gap: 14px; }
  .cv-contact { align-items: flex-start; }
  .cv-row { grid-template-columns: 1fr; gap: 3px; }
  .cv-row > div:last-child { text-align: left; }
  .cv-project { padding-right: 0; }
  .cv-project > span { position: static; display: block; margin-top: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  @page { size: A4; margin: 7mm 9mm; }
  html, body { background: #fff; }
  body { font-size: 9pt; line-height: 1.29; }
  .no-print, .skip-link, .topbar, .footer, .cv-topbar, .cv-footer { display: none !important; }
  .wrap { width: 100%; max-width: none; }
  main, .cv { padding: 0; }

  .cv-header { gap: 18px; padding-bottom: 8px; }
  .cv-header h1 { font-size: 21pt; }
  .cv-role { font-size: 9.8pt; }
  .cv-location, .cv-contact, .cv-row > div:last-child, .cv-project > span { font-size: 8.1pt; }
  .cv-contact { gap: 0; }

  .cv-section { margin-top: 8px; break-inside: auto; }
  .cv-section h2 { font-size: 10.2pt; margin-bottom: 4px; padding-bottom: 1px; }
  .cv-row { grid-template-columns: minmax(0, 1fr) 39mm; gap: 12px; margin-bottom: 4px; break-inside: avoid; }
  .cv-row small { font-size: 7.8pt; }
  .cv-row-block ul { margin: 3px 0 0; padding-left: 14px; }
  .cv-row-block li { margin-bottom: 1px; }
  .cv-project { padding-right: 30mm; margin-bottom: 3px; break-inside: avoid; }
  .cv-project p { margin-top: 1px; }
  .cv-skills p, .cv-additional p { margin-bottom: 2px; }
  a { color: inherit; text-decoration: none; }
}
