:root {
  --ink: #1b1f27;
  --ink-soft: #343a46;
  --muted: #5f6673;
  --faint: #8d939d;
  --line: #e6e2d9;
  --line-strong: #d5cfc2;
  --bg: #fbfaf6;
  --bg-soft: #f3f0e8;
  --surface: #ffffff;
  --accent: #1f4e79;
  --accent-hover: #163a5c;
  --accent-soft: #e7eef5;
  --warm: #b4532a;
  --radius: 12px;
  --radius-sm: 8px;
  --max: 840px;
  --shadow: 0 1px 2px rgba(27,31,39,.04), 0 10px 28px rgba(27,31,39,.07);
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece9e2;
    --ink-soft: #d3cfc6;
    --muted: #a6a9b0;
    --faint: #7c818a;
    --line: #2c313a;
    --line-strong: #3b414c;
    --bg: #15181e;
    --bg-soft: #1d2129;
    --surface: #1a1e25;
    --accent: #8db8e3;
    --accent-hover: #b3d0ee;
    --accent-soft: #1f2d3d;
    --warm: #e08a5f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }

::selection { background: var(--accent-soft); color: var(--ink); }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0 70%, var(--warm) 70% 100%);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--ink);
  font-size: 1.12rem;
  white-space: nowrap;
}
.brand:hover { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-links a {
  position: relative;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color .15s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .2s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { transform: scaleX(.5); }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { transform: scaleX(1); }

/* ---------- Layout ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 60px 20px 40px;
  animation: rise .5s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
  * { transition: none !important; }
}

h1.page-title {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.15;
  margin: 0 0 8px;
}
.page-intro {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.12rem;
  color: var(--muted);
  margin: 0 0 34px;
}

h2.section {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -.005em;
  color: var(--ink);
  margin: 52px 0 18px;
}
h2.section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
h2.section::before {
  content: "";
  width: 8px; height: 8px;
  flex-shrink: 0;
  background: var(--warm);
  transform: rotate(45deg);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: flex;
  gap: 36px;
  align-items: center;
  flex-wrap: wrap;
  padding: 8px 0 12px;
}
.hero-art {
  position: absolute;
  right: -40px;
  top: 50%;
  width: 340px;
  transform: translateY(-50%);
  color: var(--accent);
  opacity: .13;
  pointer-events: none;
  z-index: 0;
}
.hero > *:not(.hero-art) { position: relative; z-index: 1; }
.avatar-wrap { flex-shrink: 0; position: relative; }
.avatar-wrap::before {
  content: "";
  position: absolute;
  inset: 10px -10px -10px 10px;
  border: 1.5px solid var(--warm);
  border-radius: 16px;
  opacity: .55;
}
.avatar {
  position: relative;
  width: 176px;
  height: 176px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow);
  display: block;
}
.avatar-fallback {
  position: relative;
  width: 176px;
  height: 176px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 3.2rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #1f4e79, #2c3e66);
  box-shadow: var(--shadow);
}
.hero-body { flex: 1; min-width: 260px; }
.hero-name {
  font-family: var(--serif);
  font-size: 2.7rem;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 8px;
  line-height: 1.08;
}
.hero-role {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--warm);
  margin: 0 0 4px;
}
.hero-affil { font-family: var(--serif); color: var(--muted); margin: 0 0 18px; font-size: 1.05rem; }

.contacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.contacts a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 7px 14px;
  border-radius: 999px;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, color .15s ease;
}
.contacts a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.contacts a.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.contacts a.primary:hover { background: var(--accent-hover); color: var(--bg); }
.contacts svg { width: 15px; height: 15px; }

/* ---------- Prose ---------- */
.prose {
  font-family: var(--serif);
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
.prose p { margin: 0 0 16px; }
.prose em { color: var(--ink); }
.prose.lead > p:first-child::first-letter {
  float: left;
  font-size: 3.4em;
  line-height: .9;
  font-weight: 600;
  padding: 6px 8px 0 0;
  color: var(--accent);
}

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: .84rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 13px;
  border-radius: 999px;
}

/* ---------- Nav cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 8px;
  counter-reset: card;
}
.card {
  position: relative;
  display: block;
  padding: 20px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  counter-increment: card;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.card::before {
  content: "0" counter(card);
  position: absolute;
  top: 12px; right: 16px;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--line-strong);
  transition: color .2s ease;
}
.card::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.card:hover::before { color: var(--warm); }
.card:hover::after { transform: scaleX(1); }
.card-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.card-icon svg { width: 19px; height: 19px; }
.card h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.card p { margin: 0; font-size: .87rem; color: var(--muted); line-height: 1.5; }

/* ---------- Publication / list rows ---------- */
.pub {
  position: relative;
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  column-gap: 14px;
  padding: 14px 16px 14px 14px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}
.pub > :not(.pub-year) { grid-column: 2; }
.pub + .pub { border-top: 1px solid var(--line); }
.pub:hover { background: var(--bg-soft); border-left-color: var(--warm); }
.pub:hover + .pub { border-top-color: transparent; }
.pub-year {
  grid-column: 1;
  grid-row: 1 / span 2;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--faint);
  padding-top: 2px;
  font-variant-numeric: lining-nums tabular-nums;
}
.pub:hover .pub-year { color: var(--warm); }
.pub-title { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.4; color: var(--ink); }
.pub-title a { color: var(--ink); background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .25s ease, color .15s ease; }
.pub-title a:hover { color: var(--accent); background-size: 100% 1px; }
.pub-meta { display: block; color: var(--muted); font-size: .9rem; margin-top: 3px; }
.pub-meta .journal { font-family: var(--serif); font-style: italic; font-size: 1.05em; color: var(--ink-soft); }
.pub-extra { font-size: .86rem; }

/* Simple list */
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: background .15s ease;
}
.list li + li { border-top: 1px solid var(--line); }
.list li:hover { background: var(--bg-soft); }
.list li:hover + li { border-top-color: transparent; }
.list .lead { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; }
span.lead { color: var(--ink); }
.pill {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Activities */
.activity {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.activity + .activity { margin-top: 12px; }
.activity:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.activity .a-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}
.activity .a-icon svg { width: 18px; height: 18px; }
.activity .a-body { flex: 1; }
.activity .lead { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.4; }

/* ---------- CV ---------- */
.cv-actions { margin: 0 0 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .92rem;
  color: var(--bg);
  background: var(--accent);
  padding: 10px 18px;
  border-radius: 10px;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover { background: var(--accent-hover); color: var(--bg); transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; }
.cv-frame { width: 100%; height: 900px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* ---------- Footer ---------- */
footer {
  max-width: var(--max);
  margin: 48px auto 0;
  padding: 24px 20px 44px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: .84rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
footer a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  main { padding: 40px 16px 32px; }
  .nav-inner { height: auto; padding: 10px 16px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .nav-links { justify-content: flex-start; margin-left: -10px; }
  .hero { gap: 26px; }
  .hero-art { display: none; }
  .avatar, .avatar-fallback { width: 132px; height: 132px; border-radius: 14px; }
  .avatar-fallback { font-size: 2.4rem; }
  .hero-name { font-size: 2.1rem; }
  h1.page-title { font-size: 2rem; }
  .pub { grid-template-columns: 1fr; padding-left: 12px; }
  .pub > :not(.pub-year) { grid-column: 1; }
  .pub-year { grid-row: auto; font-size: .85rem; padding: 0; }
  footer { padding-left: 16px; padding-right: 16px; }
}
