:root {
  --bg: #ffffff;
  --ink: #1c2430;
  --muted: #5b6573;
  --accent: #1f4e79;
  --rule: #d6dde6;
  --tint: #f3f6f9;
  --code: #f4f6f9;
  --warn: #b54708;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d;
    --ink: #e3e8ee;
    --muted: #9aa6b4;
    --accent: #7fb2e5;
    --rule: #2a3440;
    --tint: #171e27;
    --code: #19212b;
    --warn: #f79009;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); padding: 4px 8px; z-index: 1; }

header.site, main, footer.site { max-width: 760px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
header.site nav {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 20px;
  padding: 22px 0 16px; border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.links a { margin-left: 18px; color: var(--muted); text-decoration: none; }
.links a:hover { color: var(--accent); }
main { padding-top: 28px; padding-bottom: 40px; }

h1 { font-size: 2.05rem; line-height: 1.2; margin: 0.15em 0 0.3em; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 2em 0 0.6em; }
h3 { font-size: 1.1rem; margin: 1.6em 0 0.4em; }
.subtitle { font-size: 1.15rem; color: var(--muted); margin: 0 0 0.5em; }
.kicker { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 600; color: var(--accent); margin: 0; }
.meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 2em; }
.badge {
  display: inline-block; background: var(--warn); color: #fff; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; vertical-align: 2px;
}

pre { background: var(--code); padding: 14px 16px; overflow-x: auto; border-radius: 6px; font-size: 0.84rem; line-height: 1.45; }
code { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 0.9em; }
p code, li code, td code { background: var(--code); padding: 1px 4px; border-radius: 3px; }
.table-wrap { overflow-x: auto; margin: 1em 0 1.4em; }
table { border-collapse: collapse; font-size: 0.9rem; min-width: 100%; }
th, td { border-bottom: 1px solid var(--rule); padding: 6px 10px; text-align: left; vertical-align: top; }
th { font-weight: 600; }
blockquote { border-left: 3px solid var(--accent); margin: 1em 0; padding: 0.2em 1em; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0 1.2em; }
li { margin: 0.25em 0; }

.hero h1 { font-size: 2.4rem; margin-bottom: 0.1em; }
.hero h1 + p { color: var(--muted); margin-top: 0; }
.hero ul { padding-left: 1.2em; }
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.6em 0 0.5em; }
.door {
  position: relative; margin: 0; padding: 14px 16px; border-radius: 8px; border: 1px solid var(--rule);
  color: var(--muted); font-size: 0.92rem; line-height: 1.45;
}
.door:first-child { background: var(--tint); }
.door a { display: block; font-weight: 600; font-size: 1.02rem; text-decoration: none; }
/* The link covers the whole box. */
.door a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }
.door:hover, .door:focus-within, .card:hover, .card:focus-within { border-color: var(--accent); }
@media (max-width: 560px) { .doors { grid-template-columns: 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { position: relative; padding: 16px 18px; border: 1px solid var(--rule); border-radius: 8px; background: var(--tint); }
.card h3 { margin: 0 0 0.4em; font-size: 1.05rem; line-height: 1.35; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card p { margin: 0; color: var(--muted); font-size: 0.94rem; line-height: 1.5; }
.notes { list-style: none; padding: 0; }
.notes li { margin: 0 0 1.1em; }
.notes p { margin: 0.2em 0 0; color: var(--muted); font-size: 0.94rem; }

/* CV: always light, a sheet laid out like the one-page profile. */
body.cv-page {
  color-scheme: light;
  --bg: #eef1f5; --ink: #1c2430; --muted: #5b6573; --accent: #1f4e79; --rule: #d6dde6; --tint: #f3f6f9; --code: #f4f6f9;
}
body.cv-page header.site, body.cv-page footer.site, main.cv { max-width: 940px; }
.cv-tools { margin: 0 0 10px; text-align: right; font-size: 0.9rem; color: var(--muted); }
.sheet {
  background: #fff; padding: 44px 52px 40px; border-radius: 3px; font-size: 15px; line-height: 1.5;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 28px rgba(16, 24, 40, 0.08);
}
.cv-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 24px;
  border-bottom: 2px solid var(--accent); padding-bottom: 12px;
}
.cv-head h1 { font-size: 2.15rem; line-height: 1.05; margin: 0; letter-spacing: -0.01em; }
.cv-head .role { margin: 6px 0 0; color: var(--accent); font-weight: 600; font-size: 1.05rem; }
.cv-head .contacts { margin: 0; text-align: right; color: var(--muted); font-size: 0.86rem; line-height: 1.55; }
.cv-head .contacts a { color: inherit; text-decoration: none; }
.cv-head .contacts a:hover { color: var(--accent); text-decoration: underline; }
.cv-head .contacts strong { color: var(--ink); font-weight: 600; }
.print-only { display: none; }
.sheet h2 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--accent);
  border-bottom: 1px solid var(--rule); padding-bottom: 3px; margin: 1.6em 0 0.6em;
}
.sheet h3, .role-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; }
.sheet h3 { font-size: 1rem; margin: 1.1em 0 0.1em; }
.role-line { margin: 0.15em 0 0.3em; }
.sheet h3 .place, .role-line .dates { color: var(--muted); font-weight: 400; font-size: 0.88rem; white-space: nowrap; }
.sheet p { margin: 0.35em 0; }
.sheet ul { margin: 0.3em 0 0.6em; padding-left: 1.15em; }
.sheet li { margin: 0.18em 0; }
@media screen and (max-width: 940px) {
  .cv-head { display: block; }
  .cv-head .contacts { text-align: left; margin-top: 10px; }
}

footer.site { border-top: 1px solid var(--rule); padding-top: 18px; padding-bottom: 40px; color: var(--muted); font-size: 0.9rem; }
footer.site p { margin: 0.3em 0; }
.muted { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  h1, .hero h1 { font-size: 1.75rem; }
  .links a { margin: 0 14px 0 0; }
  .sheet { padding: 22px 18px; font-size: 14.5px; }
  .cv-head h1 { font-size: 1.8rem; }
}

@media print {
  @page { size: A4; margin: 13mm 15mm; }
  :root { --bg: #fff; --ink: #1c2430; --muted: #5b6573; --accent: #1f4e79; --rule: #d6dde6; }
  body { font-size: 9.4pt; line-height: 1.38; background: #fff; color: var(--ink); }
  header.site, footer.site, .skip, .no-print { display: none !important; }
  main { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  h1 { font-size: 19pt; margin: 0 0 0.1em; }
  h2 { font-size: 10pt; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); border-bottom: 1px solid var(--rule); margin: 1em 0 0.4em; }
  h3 { font-size: 10pt; margin: 0.8em 0 0.15em; break-after: avoid; }
  p { margin: 0.25em 0; }
  ul { margin: 0.2em 0; padding-left: 1.2em; }
  li { margin: 0.08em 0; }
  .print-only { display: inline; }
  @page cv { size: A4; margin: 10mm 12mm; }
  .sheet { page: cv; box-shadow: none; border-radius: 0; padding: 0; font-size: 9.2pt; line-height: 1.34; }
  .cv-head { padding-bottom: 3mm; gap: 2mm 6mm; }
  .cv-head h1 { font-size: 21pt; }
  .cv-head .role { font-size: 11pt; margin-top: 1.2mm; }
  .cv-head .contacts { font-size: 8.4pt; line-height: 1.5; }
  .sheet h2 { font-size: 8.2pt; letter-spacing: 1.1px; margin: 3.2mm 0 1.2mm; padding-bottom: 0.8mm; break-after: avoid; }
  .sheet h3 { font-size: 9.8pt; margin: 2mm 0 0.3mm; break-after: avoid; }
  .sheet h3 .place, .role-line .dates { font-size: 8.6pt; }
  .role-line, .role-line + p { margin: 0.4mm 0 0.6mm; break-after: avoid; }
  .sheet p { margin: 0.7mm 0; }
  .sheet ul { margin: 0.6mm 0 0.9mm; padding-left: 4.2mm; }
  .sheet li { margin: 0.15mm 0; break-inside: avoid; }
}
