/* ============================================================
   Персональный научный сайт — современный минимализм
   Светлая / тёмная тема, адаптив.
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --surface: #ffffff;
  --text: #16181d;
  --text-soft: #5b6472;
  --border: #e6e8ec;
  --accent: #2f5eff;
  --accent-soft: #eaf0ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --radius: 14px;
  --maxw: 1080px;
}
:root[data-theme="dark"] {
  --bg: #0d1017;
  --bg-soft: #131722;
  --surface: #161b26;
  --text: #eef1f6;
  --text-soft: #9aa4b2;
  --border: #232a38;
  --accent: #6d8bff;
  --accent-soft: #1a2440;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Animated background ---------- */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .55;
  will-change: transform;
}
.bg-orb-1 {
  width: 46vw; height: 46vw; min-width: 340px; min-height: 340px;
  top: -12vw; left: -8vw;
  background: radial-gradient(circle at 30% 30%, #4f7bff, transparent 68%);
  animation: orbFloat1 22s ease-in-out infinite;
}
.bg-orb-2 {
  width: 40vw; height: 40vw; min-width: 300px; min-height: 300px;
  top: 8vw; right: -12vw;
  background: radial-gradient(circle at 60% 40%, #9b6dff, transparent 68%);
  animation: orbFloat2 26s ease-in-out infinite;
}
.bg-orb-3 {
  width: 42vw; height: 42vw; min-width: 320px; min-height: 320px;
  bottom: -16vw; left: 22vw;
  background: radial-gradient(circle at 50% 50%, #22d3ee, transparent 66%);
  opacity: .38;
  animation: orbFloat3 30s ease-in-out infinite;
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--text) 5%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 20%, #000 40%, transparent 100%);
}
:root[data-theme="dark"] .bg-orb { opacity: .40; }
:root[data-theme="dark"] .bg-orb-3 { opacity: .28; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bg-orb { opacity: .40; }
  :root:not([data-theme="light"]) .bg-orb-3 { opacity: .28; }
}

@keyframes orbFloat1 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(6vw, 5vw) scale(1.12); }
}
@keyframes orbFloat2 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(-5vw, 7vw) scale(1.08); }
}
@keyframes orbFloat3 {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(4vw, -6vw) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .bg-orb { animation: none !important; }
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav > a { font-size: .93rem; color: var(--text-soft); font-weight: 500; transition: color .15s; }
.site-nav > a:hover, .site-nav > a.active { color: var(--text); }
.site-nav > a.active { position: relative; }

.lang-switch { display: flex; gap: 2px; margin-left: 6px; background: var(--bg-soft); border-radius: 8px; padding: 3px; }
.lang-switch a { font-size: .78rem; font-weight: 600; padding: 3px 8px; border-radius: 6px; color: var(--text-soft); }
.lang-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; color: var(--text-soft); font-size: 1rem; }
.theme-toggle:hover { color: var(--text); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-block; color: var(--accent); font-weight: 600; font-size: .82rem; letter-spacing: .02em; margin: 0 0 16px; padding: 5px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.hero h1 { font-family: "Source Serif 4", Georgia, serif; font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -.02em; margin: 0 0 18px;
  background: linear-gradient(120deg, var(--text) 30%, var(--accent) 130%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lead { font-size: 1.12rem; color: var(--text-soft); margin: 0 0 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: .95rem; transition: transform .12s, background .15s; border: 1px solid transparent; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn-ghost { background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-color: var(--border); color: var(--text); }
.btn-sm { padding: 9px 14px; font-size: .86rem; }
.filters .btn-sm { margin-left: auto; }

.hero-photo { position: relative; }
.hero-photo::before {
  content: ""; position: absolute; inset: -14px; border-radius: calc(var(--radius) + 10px);
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%);
  filter: blur(24px); opacity: .7; z-index: -1;
}
.hero-photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.photo-fallback { background: linear-gradient(135deg, var(--accent-soft), var(--bg-soft)); min-height: 320px; border-radius: var(--radius); }
.about-photo .photo-fallback { min-height: 260px; }

/* ---------- Stats ---------- */
.stats { padding: 24px 0 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: color-mix(in srgb, var(--surface) 62%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-radius: var(--radius); padding: 22px; text-align: center; transition: transform .16s, border-color .16s; }
.stat:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.stat-num { display: block; font-family: "Source Serif 4", serif; font-size: 2rem; font-weight: 600; color: var(--accent); }
.stat-label { color: var(--text-soft); font-size: .88rem; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.page-title { font-family: "Source Serif 4", serif; font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: -.02em; margin: 0 0 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.section-head h2 { font-family: "Source Serif 4", serif; font-size: 1.6rem; margin: 0; }
.link-more { color: var(--accent); font-weight: 600; font-size: .92rem; }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }
.about-photo img { border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 4/5; object-fit: cover; }
.about-text p { margin: 0 0 16px; font-size: 1.05rem; }

/* ---------- Heritage ---------- */
.heritage { margin-top: 48px; padding-top: 36px; border-top: 1px solid var(--border); }
.heritage-title { font-family: "Source Serif 4", serif; font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.01em; margin: 0 0 20px; }
.heritage-figure { margin: 0 0 28px; }
.heritage-figure img { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }
.heritage-text p { margin: 0 0 16px; font-size: 1.05rem; line-height: 1.7; color: var(--text); }
.heritage-motto {
  margin: 28px 0 0; padding: 20px 26px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0;
  font-family: "Source Serif 4", serif; font-size: 1.15rem; line-height: 1.55;
  font-style: italic; color: var(--text);
}

/* ---------- Essay / Reflections ---------- */
.essay { max-width: 720px; }
.essay-title { font-family: "Source Serif 4", serif; font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 20px; }
.essay-epigraph { font-family: "Source Serif 4", serif; font-style: italic; font-size: 1.15rem; line-height: 1.55; color: var(--text-soft); margin: 0 0 28px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.essay p { margin: 0 0 18px; font-size: 1.07rem; line-height: 1.75; }
.essay-closing {
  margin: 32px 0 0; padding: 20px 26px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0;
  font-family: "Source Serif 4", serif; font-size: 1.18rem; line-height: 1.5;
  font-style: italic; color: var(--text);
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 28px; }
.filter-search { flex: 1 1 240px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: .95rem; }
.filter-select { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-size: .92rem; }
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); border-radius: 999px; font-size: .86rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.chip:hover { color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Publications list ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub-item { display: grid; grid-template-columns: 64px 1fr; gap: 18px; padding: 22px 0; border-top: 1px solid var(--border); }
.pub-item:first-child { border-top: 0; }
.pub-year { font-family: "Source Serif 4", serif; font-weight: 600; color: var(--accent); font-size: 1.05rem; padding-top: 1px; }
.pub-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pub-title { font-weight: 600; font-size: 1.05rem; line-height: 1.4; }
.pub-title:hover { color: var(--accent); }
.pub-authors { margin: 6px 0 0; color: var(--text-soft); font-size: .9rem; }
.pub-journal { margin: 5px 0 0; font-size: .92rem; font-weight: 500; }
.pub-journal a { color: var(--text); border-bottom: 1px solid var(--border); }
.pub-journal a:hover { color: var(--accent); border-color: var(--accent); }
.pub-cite { margin: 4px 0 0; color: var(--text-soft); font-size: .85rem; font-style: italic; }
.pub-source { font-weight: 700; }
.pub-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.pub-type { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--text-soft); background: var(--bg-soft); padding: 3px 9px; border-radius: 6px; }
.pub-link { color: var(--accent); font-size: .86rem; font-weight: 600; }
.badge { font-size: .72rem; font-weight: 700; color: #a9791f; background: #fff6e2; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
:root[data-theme="dark"] .badge { color: #f0c36b; background: #2c2411; }
.empty-state { text-align: center; color: var(--text-soft); padding: 40px 0; }

/* ---------- CV ---------- */
.cv-block { margin-bottom: 36px; }
.cv-block h2 { font-family: "Source Serif 4", serif; font-size: 1.35rem; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.cv-row { display: grid; grid-template-columns: 120px 1fr; gap: 16px; margin-bottom: 12px; }
.cv-period { font-weight: 600; color: var(--accent); }
.cv-row p { margin: 0; }
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tag { background: var(--accent-soft); color: var(--accent); padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 500; }
:root[data-theme="dark"] .tag { color: var(--text); }
.bullet-list { margin: 0; padding-left: 20px; }
.bullet-list li { margin-bottom: 8px; }

/* ---------- Contacts ---------- */
.contact-card { background: color-mix(in srgb, var(--surface) 62%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-radius: var(--radius); padding: 28px; margin-bottom: 36px; }
.contact-label { display: block; color: var(--text-soft); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.contact-email { font-family: "Source Serif 4", serif; font-size: 1.5rem; color: var(--accent); font-weight: 600; }
.sub-head { font-family: "Source Serif 4", serif; font-size: 1.3rem; margin: 0 0 18px; }
.profile-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.profile-link { display: flex; flex-direction: column; gap: 4px; padding: 20px; border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 62%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .12s, border-color .15s, box-shadow .15s; }
.profile-link:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 22%, transparent); }
.pl-name { font-weight: 700; font-size: 1.05rem; }
.pl-id { color: var(--text-soft); font-size: .85rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; margin-top: 40px; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: var(--text-soft); font-size: .9rem; }
.site-footer a { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-photo { order: -1; max-width: 260px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo { max-width: 220px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed; inset: 66px 0 auto 0; flex-direction: column; align-items: flex-start;
    gap: 14px; padding: 20px 24px; background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-120%); transition: transform .22s; box-shadow: var(--shadow);
  }
  body.nav-open .site-nav { transform: translateY(0); }
  .lang-switch { margin-left: 0; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .pub-item { grid-template-columns: 1fr; gap: 6px; }
  .cv-row { grid-template-columns: 1fr; gap: 4px; }
}

/* prefers dark for first visit without stored theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017; --bg-soft: #131722; --surface: #161b26; --text: #eef1f6;
    --text-soft: #9aa4b2; --border: #232a38; --accent: #6d8bff; --accent-soft: #1a2440;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
  }
}

/* ---------- CV header with download button ---------- */
.cv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cv-head .page-title { margin-bottom: 0; }
