/* ============================================================
   Персональный научный сайт — современный минимализм
   Светлая / тёмная тема, адаптив.
   ============================================================ */
: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;
  }
}

@media (max-width: 720px) {
  .brand {
    gap: 10px;
  }

  .brand-logo {
    height: 30px;
  }

  /* На телефоне плашку «Прикладная математика и механика…» над именем не
     показываем: на узком экране она занимала три строки (Рустам, 16.09.2026) */
  .hero .eyebrow {
    display: none;
  }
}

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

.narrow {
  max-width: 760px;
}

/* ---------- Варианты фона экрана (меню настроек) ---------- */
:root[data-bg="plain"] .bg-decor {
  display: none;
}

:root[data-bg="photo"] .bg-orb,
:root[data-bg="photo"] .bg-grid {
  display: none;
}

:root[data-bg="photo"] .bg-decor {
  background-image: url("../img/site_bg_light.webp");
  background-size: cover;
  background-position: center;
  opacity: .30;
}

:root[data-theme="dark"][data-bg="photo"] .bg-decor {
  background-image: url("../img/site_bg.webp");
  opacity: .38;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-bg="photo"] .bg-decor {
    background-image: url("../img/site_bg.webp");
    opacity: .38;
  }
}

/* Фон из набора приложения IlmNur: картинку (--bg-image) ставит скрипт в
   <head> и settings.js, отдаёт служба IlmNur (/backgrounds/<имя>). Как в
   приложении — картинка под всем экраном; приглушена, чтобы текст читался */
:root[data-bg="img"] .bg-orb,
:root[data-bg="img"] .bg-grid {
  display: none;
}

:root[data-bg="img"] .bg-decor {
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  opacity: .42;
}

:root[data-theme="dark"][data-bg="img"] .bg-decor {
  opacity: .5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-bg="img"] .bg-decor {
    opacity: .5;
  }
}

/* ---------- 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;
  gap: 24px;
  height: 66px;
}

/* В меню девять пунктов с «Приложениями» — в 1080px они не помещались и
   ломались на две строки. Шапке — шире основного текста */
.site-header .container {
  max-width: 1240px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  color: var(--text);
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: none;
  object-fit: contain;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-nav a {
  white-space: nowrap;
}

.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;
}

.settings {
  position: relative;
  margin-inline-start: 6px;
}

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--text-soft);
  transition: color .15s, transform .2s;
}

.settings-btn:hover {
  color: var(--text);
}

.settings-btn[aria-expanded="true"] {
  color: var(--text);
}

.settings-btn[aria-expanded="true"] svg {
  transform: rotate(60deg);
}

.settings-btn svg {
  transition: transform .3s;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: 280px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 60;
}

/* Класс .settings-menu перебивает браузерное [hidden]{display:none},
   поэтому прячем меню явно — иначе оно всегда видно в шапке. */
.settings-menu[hidden] {
  display: none;
}

/* Меню настроек — как в приложении IlmNur: строки со значком в начале
   (для арабского, фарси и иврита — справа: стороны логические, inline)
   (флаг языка, солнце/луна, картинка), язык и фон — своими панелями */
.set-panel {
  display: grid;
  gap: 2px;
}

.set-panel[hidden] {
  display: none;
}

.set-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  text-align: start;
  cursor: pointer;
  transition: background .15s;
}

.set-item:hover {
  background: var(--bg-soft);
}

.set-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.set-icon {
  flex: none;
  width: 24px;
  height: 24px;
}

.set-flag {
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--border);
}

/* Солнце — днём, луна — ночью: какой значок виден, решает settings.js */
.set-moon {
  display: none;
}

#set-theme.is-night .set-sun {
  display: none;
}

#set-theme.is-night .set-moon {
  display: block;
}

.set-back {
  justify-self: start;
  margin: 0 0 4px;
  padding: 6px 10px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--text-soft);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}

.set-back:hover {
  color: var(--text);
  background: var(--bg-soft);
}

/* Языков 20, как в приложении: список прокручивается внутри меню */
.set-panel[data-panel="lang"] {
  max-height: 380px;
  overflow-y: auto;
}

/* Сетка фонов — три столбца, как в приложении. Высота строк задана прямо:
   aspect-ratio у кнопок в прокручиваемой сетке не держался, и плитки
   сплющивались в полоски */
.set-bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 84px;
  gap: 6px;
  max-height: 330px;
  overflow-y: auto;
  padding: 2px;
}

.set-bg-tile {
  position: relative;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--bg-soft);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.set-bg-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.set-bg-tile.active {
  border-color: var(--accent);
}

.set-bg-tile span {
  position: absolute;
  inset: auto 0 6px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.set-bg-glow {
  background: radial-gradient(circle at 30% 30%, var(--accent-soft), transparent 70%),
    radial-gradient(circle at 75% 70%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%),
    var(--bg);
}

.set-bg-plain {
  background: var(--bg);
  border-color: var(--border);
}

.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;
}

/* Раскрывающееся меню «Научная династия» */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .93rem;
  color: var(--text-soft);
  font-weight: 500;
  cursor: pointer;
  transition: color .15s;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.active .nav-dropdown-toggle,
.nav-dropdown:hover .nav-dropdown-toggle {
  color: var(--text);
}

.nav-dropdown .caret {
  font-size: .7em;
  transition: transform .18s;
}

.nav-dropdown:hover .caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  margin-top: 10px;
  min-width: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 60;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .16s, transform .16s, visibility .16s;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: .9rem;
  color: var(--text-soft);
  font-weight: 500;
  transition: background .12s, color .12s;
}

.nav-dropdown-menu a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

/* ---------- 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-inline-start: 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;
}

/* Стрелки «→ дальше» и «← назад» — в своём span: у письма справа налево
   (ar, fa, he) «вперёд» смотрит влево, поэтому стрелку зеркалим */
.arrow {
  display: inline-block;
}

[dir="rtl"] .arrow {
  transform: scaleX(-1);
}

/* Не видно на экране, но есть для поисковиков и программ чтения с экрана */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Страница без крупного заголовка на экране («Приложения», «О себе»):
   раздел и так подсвечен в меню — содержимое ближе к шапке */
.section-no-title {
  padding-top: 24px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.pub-list {
  display: grid;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub-item {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pub-year {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}

.pub-body {
  display: grid;
  gap: 16px;
}

.pub-top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
}

.pub-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

.pub-authors,
.pub-journal,
.pub-abstract,
.pub-cite {
  margin: 0;
  color: var(--text-soft);
}

.pub-abstract {
  color: var(--text);
}

.pub-cite {
  color: var(--text);
  font-style: italic;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: .92rem;
}

.pub-link {
  color: var(--accent);
  font-weight: 600;
}

.pub-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.pub-figure {
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: var(--bg-soft);
}

.pub-figure img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

@media (max-width: 720px) {
  .pub-item {
    padding: 20px;
  }
}

.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-inline-start: 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);
}

/* ---------- Аккордеон рубрик династии ---------- */
.acc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  margin: 0 0 18px;
  overflow: hidden;
  scroll-margin-top: 84px;
}

.acc>summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 26px;
}

.acc>summary::-webkit-details-marker {
  display: none;
}

.acc>summary::marker {
  content: "";
}

.acc-title {
  font-family: "Source Serif 4", serif;
  font-size: clamp(1.15rem, 2.5vw, 1.55rem);
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--text);
}

.acc-icon {
  margin-inline-start: auto;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--accent);
  background: var(--bg-soft);
  transition: transform .22s ease, background .22s;
}

.acc[open] .acc-icon {
  transform: rotate(45deg);
  background: var(--accent-soft);
}

.acc>summary:hover .acc-icon {
  border-color: var(--accent);
}

.acc-body {
  padding: 4px 26px 26px;
}

.acc-body .heritage-figure {
  margin-top: 4px;
}

.heritage-figure--portrait {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Story «История одного спасения» ---------- */
.story-subtitle {
  font-family: "Source Serif 4", serif;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text-soft);
  margin: 0 0 26px;
}

/* ---------- Reviews «Отзывы читателей» ---------- */
.reviews-subtitle {
  font-family: "Source Serif 4", serif;
  font-style: italic;
  font-size: 1.12rem;
  line-height: 1.5;
  color: var(--text-soft);
  margin: -4px 0 32px;
}

.about-assessment {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px 30px;
  margin: 0 0 34px;
}

.assessment-intro {
  margin: 0 0 14px;
  font-size: 1.08rem;
  line-height: 1.65;
}

.assessment-lead {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--text);
}

.assessment-factors {
  margin: 0 0 18px;
  padding-inline-start: 22px;
  display: grid;
  gap: 12px;
}

.assessment-factors li {
  line-height: 1.65;
  color: var(--text-soft);
}

.assessment-factors li strong {
  color: var(--text);
}

.assessment-verdict {
  margin: 0;
  padding: 16px 20px;
  border-inline-start: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  line-height: 1.65;
  color: var(--text);
}

.assessment-verdict strong {
  color: var(--accent);
}

.reviews {
  display: grid;
  gap: 20px;
}

.review-card {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}

.review-text {
  margin: 0 0 18px;
}

.review-text p {
  margin: 0 0 10px;
  font-family: "Source Serif 4", serif;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--text);
}

.review-text p:last-child {
  margin-bottom: 0;
}

.review-author {
  display: flex;
  align-items: center;
  gap: 14px;
}

.review-avatar {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #9b6dff);
}

.review-name {
  font-weight: 600;
  color: var(--text);
}

.story-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin: 0 0 32px;
}

.story-figure {
  margin: 0;
}

.story-figure img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: block;
}

.story-figure figcaption {
  margin-top: 10px;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--text-soft);
  text-align: center;
}

@media (max-width: 640px) {
  .story-gallery {
    grid-template-columns: 1fr;
    gap: 26px;
  }
}

.story-figure--single {
  max-width: 300px;
  margin: 0 0 26px;
}

/* ---------- 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-inline-start: 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);
}

.accordion-list {
  display: grid;
  gap: 18px;
}

.acc-body.essay {
  max-width: none;
}

.essay-subhead {
  font-family: "Source Serif 4", serif;
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  letter-spacing: -.01em;
  color: var(--text);
  margin: 28px 0 12px;
}

.essay-subhead2 {
  font-family: "Source Serif 4", serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-soft);
  margin: 22px 0 10px;
}

.essay-factors,
.essay-list {
  margin: 4px 0 18px;
  padding-inline-start: 24px;
  display: grid;
  gap: 14px;
}

.essay-bullets li {
  color: var(--text);
}

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  font-size: .92rem;
  color: var(--text-soft);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.article-page {
  max-width: 760px;
}

.article-page .essay-title {
  margin-bottom: 12px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text-soft);
}

.pub-readmore {
  font-weight: 600;
}

.essay-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin: 20px 0 26px;
}

.essay-figure {
  margin: 0;
}

.essay-figure img {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.essay-figure figcaption {
  margin-top: 9px;
  font-size: .85rem;
  line-height: 1.45;
  color: var(--text-soft);
  text-align: center;
}

.essay-factors li,
.essay-list li {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-soft);
}

.essay-factors li strong,
.essay-list li strong {
  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;
}

a.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-abstract {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: .92rem;
  line-height: 1.6;
  max-width: 68ch;
}

.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;
}

/* ---------- Приложения ---------- */
.app-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;
}

.app-name {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.app-desc {
  margin: 0 0 20px;
  color: var(--text-soft);
}

.app-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.app-head > div {
  flex: 1;
  min-width: 220px;
}

.app-head .app-desc {
  margin-bottom: 0;
}

.app-hint {
  margin: 8px 0 0;
  font-size: .88rem;
  color: var(--text-soft);
}

/* Способы — друг под другом на всю ширину: рядом QR и текст теснились,
   кнопка «Скачать для Android» ломалась на две строки */
.app-ways {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.app-way {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Текст — рядом с QR, пока хватает места; на узком экране уходит под него */
.app-way > div {
  flex: 1;
  min-width: 200px;
}

.app-way h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.app-way p {
  margin: 0 0 14px;
  font-size: .92rem;
  color: var(--text-soft);
}

/* QR — тёмный на белом в любой теме (белый фон — в самом SVG),
   иначе камера телефона его не прочтёт */
.app-qr {
  flex: none;
  width: 120px;
  height: 120px;
  border-radius: 8px;
  /* Белое поле вокруг кода — не украшение: сканеру нужно, за что зацепиться,
     а на тёмной теме без подложки кода было не видно вовсе (16.09.2026) */
  background: #fff;
  padding: 6px;
  box-sizing: border-box;
}

/* На самом телефоне наводить камеру не на что — остаётся кнопка */
@media (pointer: coarse) {

  .app-qr,
  .app-scan {
    display: none;
  }
}

.app-login {
  margin: 18px 0 0;
  font-size: .88rem;
  color: var(--text-soft);
}

/* ---------- 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-inline-start: 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) {
  /* Фото здесь первым, над текстом — пустые 72px над ним были лишними:
     поднимаем его к шапке (Рустам, 16.09.2026) */
  .hero {
    padding-top: 20px;
  }

  .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);
  }
}

/* «О себе» и «Публикаций» в меню нет — ни на компьютере, ни в занавеске
   телефона (Рустам, 16.09.2026): на главной они и так крупными кнопками,
   «Публикации →» и «Обо мне». Сами страницы на месте */
.nav-about,
.nav-pubs,
.nav-home {
  /* «Главной» тоже нет — и на компьютере, как на телефоне: на главную
     ведёт сам логотип (Рустам, 16.09.2026) */
  display: none;
}

/* Шапка на компьютере — соразмерная (Рустам, 16.09.2026: «логотип, научная
   династия, приложения и так далее сделай пропорционально»). Раньше логотип
   был мелким, а шесть пунктов жались к правому краю, оставляя посередине
   пустоту. Теперь логотип крупнее, и пункты делят всю ширину шапки поровну */
@media (min-width: 1181px) {
  .header-inner {
    height: 78px;
  }

  .brand-logo {
    height: 58px;
  }

  .site-nav {
    flex: 1;
    justify-content: space-between;
    margin-inline-start: 56px;
  }

  .site-nav>a,
  .nav-dropdown-toggle {
    font-size: 1.02rem;
  }
}

/* Меню — в кнопку раньше остального: девять пунктов в строку не помещаются
   уже на ноутбуке поуже 1180px */
@media (max-width: 1180px) {
  .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);
  }

  .settings {
    margin-inline-start: 0;
    width: 100%;
  }

  .settings-menu {
    position: static;
    min-width: 0;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  /* В занавеске — по одному пункту на раздел (Рустам, 16.09.2026): Научная
     династия, Приложения, Размышления, CV, Отзывы, Контакты («О себе» и
     «Публикации» убраны отовсюду, см. выше). «Главной» нет — на неё ведёт логотип;
     подпунктов династии тоже нет — нажал «Научная династия», и открылся
     раздел, а в нём уже дед, мама, род, спасение и учителя */
  .nav-dropdown .caret,
  .nav-dropdown-menu {
    display: none;
  }
}

@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);
  }
}