/* ===== Шрифты ===== */
@font-face {
  font-family: 'Ubuntu';
  src: url('fonts/ubuntu.woff2') format('woff2');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('fonts/open-sans.woff2') format('woff2');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

/* ===== View Transitions (современные переходы) ===== */
@view-transition {
  navigation: auto;
}

/* ===== Переменные ===== */
:root {
  --color-primary: #a3c2f1;
  --color-dark: #111;
  --color-light: #fff;
  --color-gray-light: #f5f5f5;
  --color-text: #111;
  --color-text-muted: rgba(17, 17, 17, 0.7);
  --font-title: 'Ubuntu', sans-serif;
  --font-text: 'Open Sans', sans-serif;
  --container-width: 1200px;
  --spacing-section: 72px;
  --border-radius-btn: 100px;
  --transition: 0.2s ease;
  color-scheme: light;
}

/* ===== Базовые стили ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Корректная работа атрибута hidden — компенсируем авторский display: block */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-text);
  color: var(--color-text);
  line-height: 1.5;
  background-color: var(--color-light);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

picture {
  display: contents;
}

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

.container--narrow {
  max-width: 800px;
}

/* Sticky header */
.sticky-header {
  position: sticky;
  top: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 1000;
  padding: 12px 0;
  transition: 0.3s;
}
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.header-logo {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-dark);
}
.header-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.header-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.header-nav a.is-active {
  color: var(--color-primary);
  position: relative;
}
.header-nav a.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}

.header-nav a:hover {
  color: var(--color-primary);
}

/* ===== Бургер-меню ===== */
.burger {
  display: none;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 10px;
  border-radius: 12px;
  transition: background var(--transition);
}
.burger:hover { background: rgba(163, 194, 241, 0.2); }

.burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.burger span + span { margin-top: 6px; }

.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Мобильная версия */
@media (max-width: 900px) {
  .burger { display: block; }

  .header-nav {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px 24px;
    background: var(--color-light);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 999;
  }
  .header-nav.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .header-nav a {
    font-size: 1.05rem;
    padding: 12px 8px;
    border-radius: 10px;
    transition: background var(--transition);
  }
  .header-nav a:hover { background: rgba(163, 194, 241, 0.18); }

  .dark-mode .header-nav {
    background: #1a1a1a;
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  body.nav-open { overflow: hidden; }
}


/* ===== Кнопки ===== */
.button {
  display: inline-block;
  padding: 12px 32px;
  border-radius: var(--border-radius-btn);
  font-family: var(--font-title);
  font-weight: 600;
  text-align: center;
  transition: opacity var(--transition), transform var(--transition);
  cursor: pointer;
}

.button--primary {
  background-color: var(--color-dark);
  color: var(--color-light);
}

.button--primary:hover {
  opacity: 0.85;
}

.button--center {
  display: table;
  margin-left: auto;
  margin-right: auto;
}

.theme-toggle {
  min-width: 160px;
  text-align: center;
  white-space: nowrap;
  background: var(--color-primary);
  border: none;
  border-radius: 100px;
  padding: 8px 20px;
  font-family: var(--font-title);
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  color: var(--color-dark);
}
.theme-toggle:hover {
  opacity: 0.85;
  transform: scale(0.97);
}
@media (max-width: 768px) {
  .theme-toggle {
    margin-top: 8px;
  }
}

/* ===== Секции ===== */
section {
  padding: var(--spacing-section) 0;
}

.section-title {
  font-size: clamp(1.75rem, 3vw + 0.5rem, 2.75rem);
  margin-bottom: 2rem;
  position: relative;
  text-align: left;
}

.section-title--center {
  text-align: center;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 66vh;         /* было 100vh — уменьшили на треть */
  min-height: 66svh;        /* было 100svh — то же для мобильных */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  padding: 80px 0 60px;     /* было 120px 0 80px — уменьшили пропорционально */
  background: linear-gradient(0deg, rgba(163, 194, 241, 0.15), var(--color-light));
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: auto;       /* пропускаем drag к модели */
}

.hero__bg model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background: transparent;
}

/* Мягкая вуаль для читаемости текста, не перекрывающая модель по краям */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%,
              rgba(255, 255, 255, 0.88) 0%,
              rgba(255, 255, 255, 0.6)  35%,
              rgba(255, 255, 255, 0.15) 65%,
              transparent 90%);
}

.dark-mode .hero::after {
  background: radial-gradient(ellipse at 50% 50%,
              rgba(18, 18, 18, 0.88) 0%,
              rgba(18, 18, 18, 0.6)  35%,
              rgba(18, 18, 18, 0.15) 65%,
              transparent 90%);
}

.hero__inner {
  position: relative;
  z-index: 1;
  pointer-events: none;       /* клики/драги проходят к модели */
}

.hero__content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;            /* кнопка и текст по центру */
  gap: 1.5rem;
}

.hero__content .button {
  pointer-events: auto;       /* но кнопка кликабельна */
}

.hero__title {
  font-size: clamp(3rem, 6vw + 1rem, 5rem);   /* было 2.5–4.5rem → стало 3–5rem */
  font-weight: 800;
  margin-bottom: 0;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero__subtitle {
  font-size: clamp(1.25rem, 2vw + 0.5rem, 1.75rem);  /* было 1.1–1.5rem → стало 1.25–1.75rem */
  margin-bottom: 0;
  font-weight: 300;
}

.dark-mode .hero__title,
.dark-mode .hero__subtitle {
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.85),
               0 1px 4px  rgba(0, 0, 0, 0.6);
}

/* Фолбэк на время загрузки / если модель не загрузится */
.hero__viewer-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  font-family: var(--font-title);
  color: var(--color-text-muted);
  font-size: 1.1rem;
}
.hero__viewer-fallback span { font-size: 3rem; }

/* ===== About ===== */
.about__content p {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  color: var(--color-text-muted);
}

/* Научные публикации: название и ссылка идут вплотную,
   отступ остаётся только после ссылки */
.about__content .pub-title,
.about__content .pub-link {
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
}

.about__content .pub-link {
  margin-bottom: 1.5rem;
}

.about__content .pub-link a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ===== Steps (бывший product-list) ===== */
.steps .container {
  container-type: inline-size;
  container-name: steps;
}

.steps__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px 30px;
}

@container steps (min-width: 640px) {
  .steps__list { grid-template-columns: repeat(2, 1fr); }
}
@container steps (min-width: 980px) {
  .steps__list { grid-template-columns: repeat(3, 1fr); }
}

.step-card {
  display: flex;
  flex-direction: column;
}

.step-card__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 20px;
  background-color: #eee;
}

.step-card__title {
  font-size: clamp(1.1rem, 1vw + 0.8rem, 1.4rem);
  margin-bottom: 0.5rem;
}

.step-card__desc {
  color: var(--color-text-muted);
}

/* ===== Tech ===== */
.tech__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.tech__item {
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 20px;
}

.tech__item dt {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.tech__item dd {
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

.tech__item a {
  color: inherit;                /* ← берёт цвет родителя, т.е. --color-text-muted */
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ===== CTA Secondary ===== */
.cta-secondary {
  background-color: var(--color-primary);
  text-align: center;
}

/* ===== Team ===== */

.team--gradient {
  background: linear-gradient(0deg, rgba(163, 194, 241, 0.15), var(--color-light));
  text-align: center;
  padding: 100px 0;
}

.team__grid {
  display: flex;
  gap: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 24px;              /* место под тень карточек и скроллбар */
  scroll-snap-type: x mandatory;
  scroll-padding-left: 4px;
  -webkit-overflow-scrolling: touch;  /* плавный скролл на iOS */
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.team-member {
  flex: 0 0 280px;
  scroll-snap-align: start;
  background-color: var(--color-light);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: transform var(--transition);
}

/* Стилизация скроллбара (WebKit) */
.team__grid::-webkit-scrollbar {
  height: 6px;
}
.team__grid::-webkit-scrollbar-track {
  background: transparent;
}
.team__grid::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 3px;
}

@media (max-width: 480px) {
  .team-member {
    flex: 0 0 240px;                   /* компактнее на узких экранах */
  }
}

.team-member:hover {
  transform: translateY(-5px);
}

.team-member:focus-visible,
.partner-card:focus-visible,
.patent-card:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 4px;
  transform: translateY(-5px);
}

/* Убираем «синюю рамку» от браузера по умолчанию */
.team-member:focus,
.partner-card:focus,
.patent-card:focus { outline: none; }

.team-member__photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.team-member__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.team-member__name {
  font-size: 1.4rem;
  margin: 20px 20px 5px;
}

.team-member__role {
  margin: 0 20px;
  font-weight: 600;
  color: var(--color-dark);
}

.team-member__desc {
  margin: 10px 20px 20px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ===== Contacts ===== */
.contacts {
  background-color: var(--color-light);
}

.contacts__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
}

.contact-item {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.contact-item__icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-item__title {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.contact-item__content p {
  color: var(--color-text-muted);
  margin-bottom: 5px;
}

/* ===== Map ===== */
.map {
  padding: 0;
  line-height: 0; /* Убирает пробел под iframe */
}

.map__container {
  width: 100%;
  height: 320px;
  background-color: #e9e9e9; /* Цвет фона на время загрузки карты */
}

.map__container iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===== Footer ===== 
.page-footer {
  background-color: var(--color-light);
  border-top: 1px solid #e0e0e0;
  padding: 40px 0;
} */

.page-footer {
  background-color: var(--color-light);
  border-top: 1px solid rgba(0, 0, 0, 0.1); /* слегка затемняем границу, если нужна */
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.footer__logo {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
}

.footer__nav {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.footer__nav a {
  font-size: 1rem;
  transition: color var(--transition);
}

.footer__nav a:hover {
  color: var(--color-text-muted);
}

.footer__copy {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ===== Адаптивность ===== */
@media (max-width: 768px) {
  :root {
    --spacing-section: 48px;
  }
  
  body {
  line-height: 1.6;
  }

  .hero__title {
    font-size: 3rem;
  }

  .hero__subtitle {
    font-size: 1.25rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .footer__inner {
    justify-content: center;
    text-align: center;
  }

  /* На мобильных вместо нагромождения ссылок — только "ВиТИМ 2026" */
  .footer__logo,
  .footer__nav {
    display: none;
  }

  .footer__copy {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
  }

  .steps__list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero__title {
    font-size: 2.5rem;
  }

  .button {
    padding: 12px 24px;
  }
}

/* ===== Партнёры ===== */
.partners {
  padding: var(--spacing-section) 0;
  background-color: var(--color-light);
}

.partners__grid {
  display: flex;
  gap: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 4px 24px;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.partner-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  background-color: var(--color-gray-light);
  border-radius: 20px;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.partners__grid::-webkit-scrollbar {
  height: 6px;
}
.partners__grid::-webkit-scrollbar-track {
  background: transparent;
}
.partners__grid::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 3px;
}

@media (max-width: 480px) {
  .partner-card {
    flex: 0 0 260px;
  }
}

.partner-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.partner-card__image {
  width: 100%;
  aspect-ratio: 1 / 1.4;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.partner-card__info {
  padding: 20px;
  text-align: center;
}

.partner-card__title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.partner-card__type {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0;
}

@media (max-width: 768px) {
  .partner-card__info { padding: 15px; }
  .partner-card__title { font-size: 1rem; }
}

/* ===== Разработки (патенты) ===== */
.developments {
  padding: var(--spacing-section) 0;
  background-color: var(--color-primary);  /* #c7f447 */
}

.developments__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
}

.patent-card {
  background-color: var(--color-light);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: transform var(--transition), box-shadow var(--transition);
}

.patent-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.patent-card__image {
  width: 100%;
  aspect-ratio: 1 / 1.4;
  object-fit: cover;
  display: block;
}

.patent-card__info {
  padding: 20px;
  text-align: center;
}

.patent-card__title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.patent-card__number {
  font-family: var(--font-text);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-dark);
  margin-bottom: 12px;
  display: inline-block;
  background: var(--color-primary);
  padding: 4px 12px;
  border-radius: 20px;
}

.patent-card__desc {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .developments__grid {
    gap: 30px;
  }
  .patent-card__title {
    font-size: 1.2rem;
  }
}

/* Анимация появления секций */
.section-fade {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.9, 0.4, 1.1), transform 0.7s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.section-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Модальное окно (<dialog>) ===== */
.modal {
  width: min(92vw, 800px);
  max-height: 88vh;
  /* Центрируем диалог во вьюпорте — компенсируем сброс `* { margin: 0 }` */
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 24px;
  background: var(--color-light);
  color: var(--color-text);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
}

.modal[open] {
  animation: modalFadeIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal__form {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  margin: 0;
}

.modal-close {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.modal-close:hover {
  background: var(--color-primary);
  color: var(--color-dark);
  transform: scale(1.05);
}
.modal-close:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.modal-img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  background: #eee;
  display: block;
}

.modal-text {
  padding: 24px;
  text-align: center;
  font-size: 1.05rem;
  color: var(--color-text);
  overflow-y: auto;
  max-height: 40vh;
}

/* Медиа-контейнер модалки: картинка ИЛИ 3D-модель */
.modal-media {
  width: 100%;
  display: flex;
  justify-content: center;
  background: #eee;
}

.modal-model-wrap {
  width: 100%;
  height: 50vh;
  min-height: 320px;
}

.modal-model {
  width: 100%;
  height: 100%;
  display: block;
  --poster-color: transparent;
  background: transparent;
}

.dark-mode .modal-media { background: #333; }

.modal__title {
  margin: 0 0 12px;
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--color-text);
}

.dark-mode .modal { background: #242424; }
.dark-mode .modal-img { background: #333; }
.dark-mode .modal-close { background: rgba(255, 255, 255, 0.15); color: #fff; }


/* ===== Тёмная тема ===== */
.dark-mode {
  color-scheme: dark;
  --color-primary: #7ba7e8;
  --color-light: #1a1a1a;
  --color-dark: #f0f0f0;
  --color-text: #f0f0f0;
  --color-gray-light: #2a2a2a;
  --color-text-muted: rgba(240, 240, 240, 0.75);
}

.dark-mode body {
  background-color: #121212;
  color: var(--color-text);
}

.dark-mode .team-member,
.dark-mode .patent-card,
.dark-mode .partner-card {
  background-color: #2a2a2a;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.dark-mode .step-card__image,
.dark-mode .partner-card__image,
.dark-mode .patent-card__image {
  background-color: #333;
}

.dark-mode .sticky-header {
  background-color: rgba(18, 18, 18, 0.92);
}

/* ==== ФИКС: тёмные акцентные секции ==== */
.dark-mode .cta-secondary {
  background-color: #1f3455;
  color: #f0f0f0;
}
.dark-mode .cta-secondary .section-title {
  color: #f0f0f0;
}
.dark-mode .cta-secondary .button--primary {
  background-color: #f0f0f0;
  color: #121212;
}
.dark-mode .cta-secondary .button--primary:hover {
  background-color: var(--color-primary);
  color: #121212;
}

.dark-mode .developments {
  background-color: #1f3455;
  color: #f0f0f0;
}
.dark-mode .developments .section-title {
  color: #f0f0f0;
}

.dark-mode .patent-card__number {
  background: rgba(163, 194, 241, 0.25);
  color: #f0f0f0;
}

.dark-mode .map__container iframe {
  filter: brightness(0.8) contrast(1.15) saturate(0.9);
}

.dark-mode .button--primary {
  background-color: #f0f0f0;
  color: #121212;
}
.dark-mode .button--primary:hover {
  background-color: var(--color-primary);
  color: #121212;
}

.dark-mode .theme-toggle {
  background: var(--color-primary);
  color: #121212;
}

/* ===== View Transitions ===== */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .section-fade { opacity: 1; transform: none; }
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-dark));
  z-index: 1100;
  width: 0;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ===== Новые стили для раздела "Наши разработки" ===== */
.developments__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px; /* Чуть увеличили отступ между двумя блоками */
  margin-bottom: 40px;
}

.development-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 650px;
  width: 100%; /* Чтобы блок занимал всю доступную ширину до max-width */
}

.development-desc {
  margin-top: 16px;
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* Обертка для кнопки и списка */
.download-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 500px; /* Ограничиваем ширину группы */
}

/* ===== Стили для выпадающего списка ===== */
.library-dropdown {
  width: 100%;
  margin-top: 8px; /* Небольшой отступ от основной кнопки */
}

.library-dropdown__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.08); /* Полупрозрачный фон */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px; /* Скругленные углы, чтобы было похоже на кнопку */
  color: var(--color-dark);
  font-family: var(--font-title);
  font-weight: 600;
  cursor: pointer;
  list-style: none; /* Убираем стандартный маркер (треугольник) */
  transition: background 0.3s ease, border-color 0.3s ease;
}

.library-dropdown__summary::-webkit-details-marker {
  display: none; /* Убираем маркер в Safari/Chrome */
}

.library-dropdown__summary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Создаем красивую стрелочку через псевдоэлемент */
.library-dropdown__summary::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg); /* Смотрим вниз */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 15px;
}

/* Переворачиваем стрелочку при открытии */
.library-dropdown[open] .library-dropdown__summary::after {
  transform: rotate(-135deg); /* Смотрим вверх */
}

/* ===== Анимация раскрытия (Современный CSS) ===== */
.library-dropdown__content {
  display: grid;
  grid-template-rows: 0fr; /* Начальная высота 0 */
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.library-dropdown[open] .library-dropdown__content {
  grid-template-rows: 1fr; /* Конечная высота (по контенту) */
}

.library-dropdown__inner {
  overflow: hidden; /* Скрываем контент, пока высота 0 */
}

/* Внутренние отступы для списка */
.library-list {
  columns: 2; /* Две колонки на десктопе */
  column-gap: 30px;
  margin-top: 15px;
  margin-bottom: 10px;
  padding-left: 20px;
  list-style-type: disc;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-align: left; 
}

/* НОВОЕ: Запрещаем разрывать элемент списка между колонками */
.library-list li {
  break-inside: avoid;
  margin-bottom: 6px;
}

@media (max-width: 600px) {
  .library-list { 
    columns: 1; /* На мобильных одна колонка */
  }
  .library-dropdown__summary {
    font-size: 0.9rem;
    padding: 10px 16px;
  }
}

/* Темная тема для новых элементов */
.dark-mode .development-desc {
  color: rgba(240, 240, 240, 0.75); 
}
.dark-mode .library-dropdown__summary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
}
.dark-mode .library-dropdown__summary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== Объединенная кнопка со списком (Split Action) ===== */
.split-action {
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  /* Используем drop-shadow, чтобы тень облегала форму кнопок и списка */
  filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.1));
}

/* Основная кнопка (левая часть) */
.split-action__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 32px;
  background-color: var(--color-dark);
  color: var(--color-light);
  font-family: var(--font-title);
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  transition: opacity 0.2s;
  /* Скругляем только левую сторону */
  border-radius: var(--border-radius-btn) 0 0 var(--border-radius-btn);
  position: relative;
  z-index: 2; /* Кнопка будет перекрывать список */
}

.split-action__btn:hover {
  opacity: 0.85;
}

/* Добавляем синий фон и темный текст в темной теме */
.dark-mode .split-action__btn:hover {
  background-color: var(--color-primary);
  color: #121212;
  opacity: 1; /* Убираем прозрачность, чтобы цвет был сочным */
}

/* МАГИЯ: display: contents заставляет браузер "игнорировать" обертку details, 
   и ее внутренние элементы (summary и div) становятся прямыми участниками сетки Grid */
.split-action__details {
  display: contents; 
}

/* Кнопка-переключатель (правая часть) */
.split-action__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  background-color: var(--color-dark);
  color: var(--color-light);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  border-left: 1px solid rgba(128, 128, 128, 0.3);
  transition: background 0.2s;
  user-select: none;
  /* Скругляем только правую сторону */
  border-radius: 0 var(--border-radius-btn) var(--border-radius-btn) 0;
  position: relative;
  z-index: 2; /* Кнопка будет перекрывать список */
}

/* Добавляем обводку при клике с клавиатуры (Tab) */
.split-action__toggle:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: -3px;
}

.split-action__toggle::-webkit-details-marker {
  display: none; /* Скрываем маркер в Safari */
}

.split-action__toggle:hover {
  background-color: #333; /* Подсветка при наведении в светлой теме */
}
.dark-mode .split-action__toggle:hover {
  background-color: var(--color-primary);
  color: #121212;
}

/* Анимация стрелочки */
.split-action__icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-action__details[open] .split-action__icon {
  transform: rotate(180deg);
}

/* Контент выпадающего списка */
.split-action__content {
  grid-column: 1 / -1;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--color-light);
  border-radius: 0; /* Убираем скругление, делаем прямым */
  overflow: hidden;
  position: relative;
  z-index: 1; /* Уводим список на задний план, под кнопку */
  margin-top: -20px; /* Задвигаем список под кнопку, чтобы скрыть стык */
}

.split-action__details[open] .split-action__content {
  grid-template-rows: 1fr; /* Раскрытие по высоте контента */
}

.split-action__content .library-dropdown__inner {
  overflow: hidden; /* Скрываем контент при 0fr */
}

/* Стили самого списка */
.split-action__content .library-list {
  columns: 2;
  column-gap: 30px;
  padding: 36px 30px 20px 30px; /* Верхний отступ больше (36px), т.к. часть списка спрятана под кнопкой */
  margin: 0;
  list-style-type: disc;
  list-style-position: inside;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  text-align: left; 
  width: 100%;
}

.split-action__content .library-list li {
  break-inside: avoid; /* Запрещаем разрывать элемент между колонками */
  margin-bottom: 8px;
}

@media (max-width: 600px) {
  .split-action {
    grid-template-columns: 1fr; /* Складываем кнопки в столбик */
  }
  
  .split-action__btn {
    /* Верхняя кнопка скругляется сверху */
    border-radius: var(--border-radius-btn) var(--border-radius-btn) 0 0;
  }
  
  .split-action__toggle {
    /* Нижняя кнопка скругляется снизу */
    border-radius: 0 0 var(--border-radius-btn) var(--border-radius-btn);
    border-left: none;
    border-top: 1px solid rgba(128, 128, 128, 0.3);
    padding: 12px 24px;
    justify-content: center;
  }
  
  .split-action__content .library-list { 
    columns: 1; 
  }
}

/* Темная тема */
.dark-mode .split-action__content {
  background: #1a1a1a; /* Темный фон для панели */
}
.dark-mode .split-action__content .library-list {
  color: rgba(240, 240, 240, 0.75);
}

/* ===== Стили для кнопки Смотреть (сброс стилей button) ===== */
button.split-action__toggle {
  border: none;
  border-left: 1px solid rgba(128, 128, 128, 0.3);
  background-color: var(--color-dark);
  color: var(--color-light);
}

/* ===== Модальное окно галереи ===== */
.gallery-modal {
  width: min(95vw, 1000px);
  max-height: 90vh;
  flex-direction: column;
  background: var(--color-light);
}

.gallery-modal[open] {
  display: flex;
}

.gallery-header {
  padding: 24px 24px 0;
  text-align: center;
}

.gallery-container {
  display: flex;
  gap: 20px;
  padding: 20px 24px 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

.gallery-container::-webkit-scrollbar { height: 8px; }
.gallery-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 4px; }
.gallery-container::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 4px; }

.gallery-item {
  flex: 0 0 85%; /* Занимает 85% ширины, чтобы было видно край следующей картинки */
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  background: var(--color-gray-light);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.gallery-item img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.gallery-caption {
  padding: 20px;
  text-align: left;
}

.gallery-caption h4 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--color-dark);
}

.gallery-caption p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* Адаптив для галереи (на больших экранах показываем больше) */
@media (min-width: 768px) {
  .gallery-item { flex: 0 0 70%; }
}
@media (min-width: 1024px) {
  .gallery-item { flex: 0 0 60%; }
}

/* Темная тема для галереи */
.dark-mode .gallery-modal {
  background: #242424;
}
.dark-mode .gallery-item {
  background: #2a2a2a;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}
.dark-mode .gallery-item img {
  border-bottom-color: rgba(255,255,255,0.1);
}
.dark-mode .gallery-caption h4 {
  color: var(--color-text);
}
.dark-mode .gallery-container::-webkit-scrollbar-track { 
  background: rgba(255,255,255,0.1); 
}