/* ──────────────────────────────────────────────────────────────────────
   SciLib — главный стилевой файл.
   Палитра, типографика, базовая сетка. Ручной CSS, без Tailwind.
   ────────────────────────────────────────────────────────────────────── */

:root {
  /* палитра */
  --paper:        #f6f3ec;
  --paper-warm:   #efe9da;
  --ink:          #1a1c1e;
  --ink-soft:     #3a3c40;
  --ink-muted:    #6b6e72;
  --rule:         #d8d2c4;
  --rule-soft:    #ece7d6;
  --surface:      #ffffff;
  --primary:      #2563a3;
  --primary-soft: #d6e4f1;
  --integral:     #b54a2c;
  --integral-soft:#f3dfd5;
  --verify:       #4f7d3e;
  --verify-soft:  #d9e6cf;
  --error:        #9a2727;

  /* типографика */
  --font-sans:  "Inter", "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", "Georgia", serif;
  --font-mono:  "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --font-math:  "STIX Two Math", "Latin Modern Math", "Cambria Math", serif;

  /* размеры */
  --container:   1180px;
  --content:     760px;
}

/* ──────────────────────────────────────────────────────────────────────
   Reset (минимальный)
   ────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img, svg { max-width: 100%; display: block; }

button, input, textarea, select {
  font-family: inherit; font-size: inherit; color: inherit;
}

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

/* ──────────────────────────────────────────────────────────────────────
   Контейнеры и сетка
   ────────────────────────────────────────────────────────────────────── */

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

.content {
  max-width: var(--content);
  margin: 0 auto;
}

.row { display: flex; gap: 24px; flex-wrap: wrap; }
.row > * { min-width: 0; }

.grid-2 { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Каталоги артефактов: 3 крупные карточки в ряд на десктопе. */
.grid-artifacts {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}
@media (min-width: 1080px) {
  .grid-artifacts { grid-template-columns: repeat(3, 1fr); }
}

/* ──────────────────────────────────────────────────────────────────────
   Шапка
   ────────────────────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 50;
}

.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  max-width: var(--container);
  margin: 0 auto;
  gap: 24px;
}

.logo {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: 0;
}

.logo .logo-int {
  color: var(--integral);
  font-family: var(--font-math);
  font-style: italic;
  font-size: 1.5em;
  line-height: 0.9;
  margin: 0 4px;
  position: relative;
  top: 4px;
}

/* SVG-логотип в шапке (заменяет текстовый Sci∫Lib). */
.logo--svg img { height: 36px; width: auto; display: block; }
@media (max-width: 720px) {
  .logo--svg img { height: 30px; }
}

/* Логотип в подвале — крупнее, чем в шапке, для визуального якоря. */
.footer-logo img { height: 48px; }

.nav { display: flex; gap: 22px; align-items: center; }
.nav a {
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover, .nav a.active { color: var(--ink); border-bottom-color: var(--ink); }

.lang-switcher {
  display: inline-flex; gap: 0; font-size: 13px;
  border: 1px solid var(--rule); border-radius: 0; overflow: hidden;
}
.lang-btn {
  padding: 4px 10px; background: var(--paper); color: var(--ink-muted);
  border: none; cursor: pointer; font-family: inherit; font-size: 13px;
  letter-spacing: 0.04em; transition: all .15s;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { background: var(--ink); color: var(--paper); }

/* ──────────────────────────────────────────────────────────────────────
   Hero
   ────────────────────────────────────────────────────────────────────── */

.hero {
  padding: 96px 0 64px;
  border-bottom: 1px solid var(--rule);
}

.hero__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(56px, 9vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  margin: 0 0 24px;
  color: var(--ink);
}

.hero__title .integral {
  color: var(--integral);
  font-family: var(--font-math);
  font-style: italic;
  font-size: 1.15em;
  margin: 0 0.06em;
  vertical-align: -0.05em;
}

/* Крупный SVG-логотип в hero — заменяет текстовое Sci ∫ Lib.
   Главная страница центрирована, логотип по центру (−30% от изначального). */
.hero__logo {
  display: block;
  width: 100%;
  max-width: 390px;
  height: auto;
  margin: 0 auto 28px;
}
@media (max-width: 720px) { .hero__logo { max-width: 240px; } }

/* Центрированный контент главной. */
.hero--centered { text-align: center; }
.hero--centered .hero__lead { margin-left: auto; margin-right: auto; }
.hero--centered .hero__search { margin-left: auto; margin-right: auto; }

.hero__lead {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-soft);
  margin: 0 0 40px;
  max-width: 720px;
}

.hero__search {
  display: flex; align-items: stretch;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  max-width: 720px;
  margin-bottom: 32px;
}
.hero__search input {
  flex: 1;
  border: none;
  outline: none;
  padding: 18px 20px;
  font-size: 17px;
  background: transparent;
}
.hero__search button {
  border: none;
  background: var(--ink);
  color: var(--paper);
  padding: 0 28px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  transition: background .15s;
}
.hero__search button:hover { background: var(--integral); }

.hero__stats {
  display: grid; gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 1000px;
  margin-top: 40px;
}
.hero__stat { display: flex; align-items: baseline; gap: 14px; }
.hero__stat-symbol {
  color: var(--integral);
  font-family: var(--font-math); font-style: italic;
  font-size: 36px; line-height: 1; flex-shrink: 0;
}
/* Все символы — коричневые. Цветовые модификаторы оставлены без эффекта (на случай старых данных). */
.hero__stat--blue   .hero__stat-symbol,
.hero__stat--verify .hero__stat-symbol,
.hero__stat--ink    .hero__stat-symbol,
.hero__stat--integral .hero__stat-symbol { color: var(--integral); }
.hero__stat-value {
  font-family: var(--font-serif);
  font-weight: 600; font-size: 24px; letter-spacing: -0.01em;
  color: var(--ink);
}
.hero__stat-caption {
  display: block; font-size: 13px; color: var(--ink-muted);
  margin-top: 4px;
}

/* ──────────────────────────────────────────────────────────────────────
   Секции
   ────────────────────────────────────────────────────────────────────── */

.section {
  padding: 80px 0;
  border-bottom: 1px solid var(--rule);
}
.section:last-child { border-bottom: none; }

.section__eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-muted);
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 10px;
}
.section__eyebrow::before {
  content: "∫";
  color: var(--integral);
  font-family: var(--font-math); font-style: italic;
  font-size: 18px; margin-top: -4px;
}
/* Все eyebrow — коричневые, цветные модификаторы выключены. */
.section__eyebrow--blue,
.section__eyebrow--blue::before { color: var(--integral); }

/* Подзаголовки секций с акцентом — нейтральный тёмный. */
.section__title--accent { color: var(--ink); }

.section__title {
  font-family: var(--font-serif);
  font-size: 36px; line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 28px;
  color: var(--ink);
}

.section__lead {
  font-family: var(--font-serif);
  font-size: 19px; line-height: 1.55; color: var(--ink-soft);
  max-width: 720px;
  margin: 0 0 36px;
}

/* ──────────────────────────────────────────────────────────────────────
   Карточки
   ────────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 28px;
  transition: border-color .15s;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: var(--ink); }

.card__symbol {
  font-family: var(--font-math); font-style: italic;
  color: var(--integral);
  font-size: 28px; line-height: 1;
}

.card__title {
  font-family: var(--font-serif);
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

.card__desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

.card__cta {
  font-size: 13px; font-weight: 500;
  color: var(--ink); display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding-bottom: 1px;
  border-bottom: 1px solid var(--ink);
  align-self: flex-start;
}
.card__cta:hover { color: var(--integral); border-bottom-color: var(--integral); }

/* типографские карточки (модели и датасеты) */
.artifact-card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 28px 28px 24px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 260px;
  transition: border-color .15s;
}
.artifact-card:hover { border-color: var(--ink); }

.artifact-card__formula {
  /* Декоративный фоновый знак — один короткий символ, ненавязчиво.
     Не теснит контент: вынесен в правый верхний угол, фиксированный
     размер, ограниченный max-height в одну строку. */
  position: absolute;
  right: 18px; top: 14px;
  font-family: var(--font-math); font-style: italic;
  font-size: 36px; line-height: 1;
  color: var(--rule);
  opacity: 0.85;
  pointer-events: none; user-select: none;
  letter-spacing: -0.04em;
  z-index: 0;
  white-space: nowrap;
  max-width: 80px; overflow: hidden;
}

/* Карточка — единая высота через выравнивание контента. Абстракт
   ограничен 3 строками, чтобы все плитки совпадали по визуальной массе. */
.artifact-card { min-height: 240px; }
.artifact-card__abstract {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.artifact-card > * { position: relative; z-index: 1; }

.artifact-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.artifact-card__slug {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-muted); letter-spacing: 0.05em; text-transform: uppercase;
}
.artifact-card__version {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink); padding: 2px 6px;
  border: 1px solid var(--rule);
}

.artifact-card__title {
  font-family: var(--font-serif);
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0; color: var(--ink);
}

.artifact-card__abstract {
  font-size: 14px; line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  flex: 1;
}

.artifact-card__meta {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-size: 12px; color: var(--ink-muted);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin-top: 4px;
}

/* акцент по цвету */
.artifact-card--primary  { border-top: 3px solid var(--primary); }
.artifact-card--primary .artifact-card__formula  { color: var(--primary-soft); }

.artifact-card--integral { border-top: 3px solid var(--integral); }
.artifact-card--integral .artifact-card__formula { color: var(--integral-soft); }

.artifact-card--verify   { border-top: 3px solid var(--verify); }
.artifact-card--verify .artifact-card__formula   { color: var(--verify-soft); }

.artifact-card--ink      { border-top: 3px solid var(--ink); }
.artifact-card--ink .artifact-card__formula      { color: var(--rule); }

.artifact-card--muted    { border-top: 3px solid var(--rule); }
.artifact-card--muted .artifact-card__formula    { color: var(--rule-soft); }

/* ──────────────────────────────────────────────────────────────────────
   Кнопки
   ────────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.btn:hover { background: var(--ink); color: var(--paper); }

.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--integral); border-color: var(--integral); color: var(--paper); }

/* Синяя CTA-кнопка для ключевых действий (поиск, сотрудничество). */
.btn--accent { background: var(--primary); color: var(--paper); border-color: var(--primary); }
.btn--accent:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.btn--ghost { border-color: var(--rule); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--ink); background: transparent; color: var(--ink); }

.btn--small { padding: 6px 12px; font-size: 13px; }

/* ──────────────────────────────────────────────────────────────────────
   Тексты, длинные блоки
   ────────────────────────────────────────────────────────────────────── */

.prose {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: var(--content);
}
.prose h2 {
  font-family: var(--font-serif);
  font-size: 28px; line-height: 1.2;
  margin: 40px 0 16px;
  color: var(--ink);
}
.prose h3 {
  font-size: 22px; margin: 32px 0 12px;
  color: var(--ink);
}
.prose p { margin: 0 0 18px; }
.prose blockquote {
  border-left: 3px solid var(--integral);
  padding: 4px 0 4px 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--ink);
}
.prose code, pre code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--rule-soft);
  padding: 2px 6px;
}
.prose pre {
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  padding: 16px 20px; overflow-x: auto; font-size: 14px;
}
.prose pre code { background: transparent; padding: 0; }

.muted { color: var(--ink-muted); }
.eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-muted);
}

/* ──────────────────────────────────────────────────────────────────────
   Списки публикаций / постов
   ────────────────────────────────────────────────────────────────────── */

.entry {
  display: grid; grid-template-columns: 100px 1fr; gap: 28px;
  padding: 24px 0; border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.entry:last-child { border-bottom: none; }
.entry__date {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
.entry__title {
  font-family: var(--font-serif);
  font-size: 22px; line-height: 1.3;
  margin: 0 0 8px;
  color: var(--ink);
}
.entry__title a { color: var(--ink); }
.entry__title a:hover { color: var(--integral); }

/* ──────────────────────────────────────────────────────────────────────
   Раскрывающийся список (полный список публикаций и др.)
   ────────────────────────────────────────────────────────────────────── */

details.collapsible {
  margin-top: 32px;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}
details.collapsible > summary {
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 500;
  color: var(--ink);
  list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
details.collapsible > summary::-webkit-details-marker { display: none; }
details.collapsible > summary::before {
  content: "+";
  font-family: var(--font-math); font-style: italic;
  font-size: 20px; line-height: 0; color: var(--integral);
  display: inline-block; width: 14px;
}
details.collapsible[open] > summary::before { content: "−"; }
details.collapsible > summary:hover { border-bottom-color: var(--ink); }

.publication-list {
  list-style: none; padding: 0; margin: 16px 0 0;
  font-family: var(--font-serif); font-size: 15px; line-height: 1.55;
}
.publication-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink-soft);
}
.publication-list li:last-child { border-bottom: none; }
.publication-list .pub-year {
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-right: 10px;
}
.publication-list .pub-authors {
  color: var(--ink); font-weight: 500;
}
.publication-list .pub-venue {
  font-style: italic; color: var(--ink-muted);
}
.publication-list .pub-doi { color: var(--integral); font-family: var(--font-mono); font-size: 12px; }
.entry__meta {
  font-size: 13px; color: var(--ink-muted);
  display: flex; gap: 16px; flex-wrap: wrap;
}
.entry__excerpt { font-size: 15px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.6; }

/* ──────────────────────────────────────────────────────────────────────
   Подвал
   ────────────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--paper-warm);
  border-top: 1px solid var(--rule);
  padding: 56px 0 36px;
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 80px;
}
.site-footer__inner {
  max-width: var(--container); margin: 0 auto;
  padding: 0 24px;
  display: grid; gap: 40px;
  grid-template-columns: 1.4fr 1fr 1.6fr;
  align-items: start;
}
.footer-block__title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--ink-muted);
  margin: 0 0 12px;
}
.footer-block ul { list-style: none; padding: 0; margin: 0; }
.footer-block li { margin: 6px 0; }
.footer-block a { color: var(--ink-soft); }
.footer-block a:hover { color: var(--ink); }

.footer-affiliation {
  display: flex; gap: 14px; align-items: flex-start;
}
.footer-affiliation img {
  width: 64px; height: 64px; object-fit: contain;
  background: var(--surface);
  padding: 6px;
  border: 1px solid var(--rule);
  flex-shrink: 0;
}
.footer-affiliation .text { font-size: 13px; line-height: 1.45; }
.footer-affiliation .text strong { color: var(--ink); display: block; margin-bottom: 4px; }

.site-footer__bottom {
  max-width: var(--container); margin: 32px auto 0; padding: 24px 24px 0;
  border-top: 1px solid var(--rule);
  font-size: 12px; color: var(--ink-muted);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ──────────────────────────────────────────────────────────────────────
   Утилиты
   ────────────────────────────────────────────────────────────────────── */

.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.flex { display: flex; } .gap-2 { gap: 16px; } .gap-3 { gap: 24px; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }

/* ──────────────────────────────────────────────────────────────────────
   Mobile
   ────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .nav { display: none; }
  .site-header__inner { padding: 12px 16px; }
  .container { padding: 0 16px; }
  .hero { padding: 56px 0 36px; }
  .hero__title { font-size: 56px; }
  .hero__lead { font-size: 18px; }
  .section { padding: 56px 0; }
  .section__title { font-size: 26px; }
  .site-footer__inner { grid-template-columns: 1fr; gap: 28px; }
  .entry { grid-template-columns: 1fr; gap: 8px; }
  .artifact-card__formula { font-size: 120px; }
}
