:root {
  --bg: #1f2229;
  --bg-soft: #292d36;
  --card: #303542;
  --card-hover: #383e4d;
  --text: #f2f3f7;
  --muted: #b6bdca;
  --muted-2: #8e96a6;
  --purple: #9b5cff;
  --purple-soft: rgba(155, 92, 255, 0.18);
  --green: #39d98a;
  --green-soft: rgba(57, 217, 138, 0.14);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  --radius: 22px;
  --menu-width: 380px;
  --topbar-height: 86px;
  --page-transition: 420ms cubic-bezier(.2, .8, .2, 1);
}

body.light {
  --bg: #f3f4f8;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-hover: #f2ecff;
  --text: #1f2430;
  --muted: #555f70;
  --muted-2: #6f7888;
  --border: rgba(33, 39, 54, 0.14);
  --shadow: 0 20px 55px rgba(42, 30, 92, 0.14);
  --purple-soft: rgba(155, 92, 255, 0.14);
  --green-soft: rgba(57, 217, 138, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 10%, rgba(155, 92, 255, 0.22), transparent 30%),
    radial-gradient(circle at 85% 85%, rgba(57, 217, 138, 0.13), transparent 28%),
    var(--bg);
  transition:
    background var(--page-transition),
    color var(--page-transition),
    opacity 220ms ease,
    transform 220ms ease;
  overflow-x: hidden;
}

body.page-leave {
  opacity: 0;
  transform: translateX(-18px);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Шапка сайта */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(31, 34, 41, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  transition:
    background var(--page-transition),
    border-color var(--page-transition);
}

body.light .topbar {
  background: rgba(243, 244, 248, 0.92);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--purple), #6f48ff 55%, var(--green));
  box-shadow: 0 12px 32px rgba(155, 92, 255, 0.28);
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-size: 13px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-title {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: clamp(17px, 2vw, 23px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  color: var(--muted-2);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-button,
.theme-toggle,
.back-button {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg-soft);
  border-radius: 15px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.icon-button:hover,
.theme-toggle:hover,
.back-button:hover,
.project-card:hover,
.menu-link:hover,
.media-tile:hover,
.logo-box:hover {
  transform: translateY(-3px) scale(1.025);
  border-color: var(--purple);
  box-shadow: 0 14px 34px rgba(155, 92, 255, 0.18);
}

.theme-toggle {
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
}

.dots {
  display: grid;
  gap: 4px;
}

.dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  display: block;
}

/* Основное содержимое */
.page-shell {
  min-height: 100vh;
  padding:
    calc(var(--topbar-height) + clamp(28px, 5vw, 72px))
    clamp(18px, 5vw, 74px)
    clamp(28px, 5vw, 72px);
  transition:
    margin-right var(--page-transition),
    transform var(--page-transition),
    opacity var(--page-transition),
    filter var(--page-transition);
}

body.menu-open .page-shell {
  margin-right: var(--menu-width);
  transform: translateX(-16px);
  opacity: 0.62;
  filter: saturate(0.78);
}

/* Правая менюшка */
/* Главное исправление: меню теперь идёт от самого верха экрана,
   а не начинается отдельно под шапкой. Поэтому визуально оно больше
   не выглядит оторванным при прокрутке. */
.side-menu {
  position: fixed;
  z-index: 45;
  top: 0;
  right: 0;
  width: var(--menu-width);
  height: 100dvh;
  border-left: 1px solid var(--border);
  background: rgba(41, 45, 54, 0.94);
  backdrop-filter: blur(18px);
  transform: translateX(100%);
  transition:
    transform var(--page-transition),
    background var(--page-transition),
    border-color var(--page-transition);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.side-menu::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body.light .side-menu {
  background: rgba(255, 255, 255, 0.94);
}

body.menu-open .side-menu {
  transform: translateX(0);
}

.side-menu-inner {
  min-height: 100%;
  padding: calc(var(--topbar-height) + 26px) 26px 26px;
}

.side-menu h2 {
  margin: 0 0 16px;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.menu-link {
  display: block;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.menu-link strong {
  display: block;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}

.menu-link span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Главная */
.hero {
  max-width: 980px;
  margin: 0 auto 42px;
  text-align: center;
  animation: pageIn 440ms cubic-bezier(.2, .8, .2, 1) both;
}

.hero h1,
.project-hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.065em;
  overflow-wrap: anywhere;
}

.hero p,
.project-hero p {
  margin: 22px auto 0;
  max-width: 820px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.65;
}

.accent {
  color: var(--purple);
}

.projects-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  max-width: 1080px;
  margin: 0 auto;
  animation: pageIn 520ms cubic-bezier(.2, .8, .2, 1) both;
}

.project-card {
  min-height: 230px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(155, 92, 255, 0.1), transparent 42%),
    var(--card);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition:
    transform 200ms ease,
    border-color 200ms ease,
    background 200ms ease,
    box-shadow 200ms ease;
  overflow: hidden;
  position: relative;
}

.project-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  right: -60px;
  top: -60px;
  background: var(--purple-soft);
  transition: transform 220ms ease;
}

.project-card:hover::after {
  transform: scale(1.3);
}

.project-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 800;
  position: relative;
  z-index: 1;
}

.project-card h2 {
  margin: 28px 0 18px;
  max-width: 980px;
  font-size: clamp(23px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
}

.project-card .go {
  margin-top: 20px;
  color: var(--green);
  font-weight: 700;
  position: relative;
  z-index: 1;
}

/* Контакты и блок поддержки */
.fund-section {
  max-width: 1080px;
  margin: 34px auto 0;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 18px;
  align-items: stretch;
  animation: pageIn 580ms cubic-bezier(.2, .8, .2, 1) both;
}

.fund-card,
.contacts-card,
.article-card {
  border: 1px solid var(--border);
  background: rgba(48, 53, 66, 0.78);
  border-radius: var(--radius);
  padding: 24px;
  transition:
    background var(--page-transition),
    border-color var(--page-transition);
}

.fund-card,
.contacts-card {
  box-shadow: var(--shadow);
}

body.light .fund-card,
body.light .contacts-card,
body.light .article-card {
  background: rgba(255, 255, 255, 0.78);
}

.logo-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.logo-box {
  min-height: 112px;
  border-radius: 17px;
  border: 1px solid var(--border);
  background: #ffffff;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 14px;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.logo-box img {
  display: block;
  max-width: 100%;
  max-height: 82px;
  object-fit: contain;
}

.logo-fallback {
  display: none;
  color: #303542;
  font-weight: 800;
  line-height: 1.2;
}

.fund-card p,
.contacts-card p,
.article-card p,
.article-card li {
  color: var(--muted);
  line-height: 1.65;
}

.company-name {
  color: var(--text) !important;
  font-weight: 800;
}

.fund-card h2,
.contacts-card h2,
.article-card h2 {
  margin-top: 0;
  letter-spacing: -0.035em;
}

.article-card {
  box-shadow: none;
}

/* Страница проекта */
.project-page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  animation: pageIn 460ms cubic-bezier(.2, .8, .2, 1) both;
}

.project-header-line {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.back-button {
  min-height: 48px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.arrow-left {
  width: 18px;
  height: 18px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.project-hero {
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 15% 10%, rgba(155, 92, 255, 0.25), transparent 30%),
    linear-gradient(135deg, var(--purple-soft), transparent 55%),
    var(--card);
  border-radius: 30px;
  padding: clamp(24px, 5vw, 52px);
  margin-bottom: 18px;
  overflow: hidden;
}

.project-hero h1 {
  font-size: clamp(30px, 5vw, 56px);
}

.project-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.article-card h2:not(:first-child) {
  margin-top: 34px;
}

.article-card h3 {
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.feature-list,
.advantage-list {
  display: grid;
  gap: 12px;
}

.feature-item,
.advantage-item {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(155, 92, 255, 0.07);
}

.feature-item p,
.advantage-item p {
  margin: 0;
}

.project-aside {
  display: grid;
  gap: 18px;
}

.sticky-card {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

.media-grid {
  display: grid;
  gap: 14px;
}

.media-tile {
  min-height: 170px;
  border: 1px dashed rgba(155, 92, 255, 0.55);
  background:
    linear-gradient(135deg, rgba(155, 92, 255, 0.18), rgba(57, 217, 138, 0.09)),
    var(--card);
  border-radius: 20px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  color: var(--muted);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.media-tile strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.pill-list li {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  border: 1px solid rgba(57, 217, 138, 0.22);
  color: var(--text);
  line-height: 1.3;
}

footer {
  max-width: 1080px;
  margin: 30px auto 0;
  color: var(--muted-2);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Адаптив */
@media (max-width: 1060px) {
  body.menu-open .page-shell {
    margin-right: 0;
    transform: none;
  }

  .side-menu {
    width: min(88vw, var(--menu-width));
    box-shadow: var(--shadow);
  }
}

@media (max-width: 900px) {
  .fund-section,
  .project-body-grid {
    grid-template-columns: 1fr;
  }

  .sticky-card {
    position: static;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-height: 76px;
    --menu-width: 340px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .brand-subtitle,
  .theme-toggle span:last-child {
    display: none;
  }

  .page-shell {
    padding: calc(var(--topbar-height) + 24px) 14px 24px;
  }

  .logo-row {
    grid-template-columns: 1fr;
  }

  .brand-title {
    max-width: 52vw;
  }

  .side-menu-inner {
    padding: calc(var(--topbar-height) + 22px) 18px 22px;
  }
}
.logo-box {
  padding: 8px 10px;
  overflow: hidden;
}

.logo-box img {
  display: block;
  max-width: 100%;
  max-height: 96px;
  width: auto;
  object-fit: contain;
  margin: 0 auto;
}

/* отдельно увеличиваем правый логотип */
.logo-row .logo-box:last-child img {
  max-height: 110px;
  transform: scale(1.22);
  transform-origin: center;
}

/* Демонстрационные видео и GIF-анимация на странице проекта */
.project-media-section {
  margin-top: 34px;
}

.project-media-heading {
  margin-bottom: 18px;
}

.project-media-heading h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.04em;
}

.project-media-heading p {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.project-video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project-media-card {
  margin: 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  transition:
    transform 200ms ease,
    border-color 200ms ease,
    box-shadow 200ms ease,
    background var(--page-transition);
}

.project-media-card:hover {
  transform: translateY(-3px);
  border-color: var(--purple);
  box-shadow: 0 14px 34px rgba(155, 92, 255, 0.18);
}

.project-video,
.project-animation {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: #111318;
  object-fit: contain;
}

.project-video {
  aspect-ratio: 16 / 9;
}

.project-animation-card {
  margin-top: 18px;
}

.project-animation {
  max-height: 680px;
}

.project-media-card figcaption {
  padding: 13px 6px 5px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

@media (max-width: 800px) {
  .project-video-grid {
    grid-template-columns: 1fr;
  }

  .project-animation {
    max-height: none;
  }
}

/* Широкая раскладка описания проекта без пустой правой колонки */
.project-body-grid-full {
  grid-template-columns: minmax(0, 1fr);
}

.key-elements-card {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}

.key-elements-card h2 {
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

.key-elements-card .pill-list {
  margin: 0;
}

@media (max-width: 760px) {
  .key-elements-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .key-elements-card h2 {
    white-space: normal;
  }
}

