/* itbakulev.ru — горизонтальные главы главной страницы */

.chapters-hud,
.chapters-hint { display: none; }

html.chapters-on,
html.chapters-on body { height: 100%; overflow: hidden; }

html.chapters-on .chapter {
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.85s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.5s ease !important;
  will-change: transform;
  backface-visibility: hidden;
}

html.chapters-on .chapter.is-active { opacity: 1; }

html.chapters-on .chapter.is-prev,
html.chapters-on .chapter.is-next { pointer-events: none; }

/* прячем главы, которые сейчас за экраном */
html.chapters-on .chapter[aria-hidden="true"] {
  pointer-events: none;
}

/* слой декоративных картинок: едет вместе с главами, но не обрезается
   их рамкой — поэтому картинка «проходит сквозь» соседнюю сцену */
html.chapters-on .chapter-art-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

/* главы и шапка всегда над слоем картинок */
html.chapters-on .chapter {
  z-index: 1;
}

html.chapters-on .chapter-art {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  transition: transform 0.85s cubic-bezier(0.76, 0, 0.24, 1) !important;
  will-change: transform;
}

/* прокрутка внутри главы без полосы: она ехала вместе со страницей
   и выглядела как линия края */
html.chapters-on .chapter {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html.chapters-on .chapter::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* внутри главы блоки уже на экране — ждать появления нечего */
html.chapters-on .chapter .reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

/* в режиме глав подвал и кнопка «наверх» не нужны */
html.chapters-on .footer,
html.chapters-on .up { display: none !important; }

/* индикатор главы */
html.chapters-on .chapters-hud {
  position: fixed;
  left: 26px;
  bottom: 22px;
  z-index: 56;
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

html.chapters-on .chapters-hud__count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

html.chapters-on .chapters-hud__count b {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

html.chapters-on .chapters-hud__bar {
  width: 64px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

html.chapters-on .chapters-hud__bar i {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: 2px;
  background: var(--blue-2);
  transition: width 0.5s ease;
}

html.chapters-on .chapters-hud__name {
  display: none;
}

/* листание примеров стоит над кнопками: держим группу плотной */
html.chapters-on .slider-nav,
html:not(.chapters-on) .slider-nav {
  margin-top: 24px;
}

html.chapters-on .hero__actions,
html:not(.chapters-on) .hero__actions {
  margin-top: 18px;
}

/* ---------- средние ширины: шапке тесно, канбан не влезает ---------- */
@media (max-width: 1024px) {
  .nav,
  .header__cta {
    display: none;
  }

  .burger {
    display: flex;
    margin-left: auto;
  }

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

  .hero__art {
    order: -1;
    margin-top: 14px;
    margin-bottom: 16px;
    max-width: 100%;
  }
}

/* ---------- мобильная вёрстка главной ---------- */
@media (max-width: 760px) {
  html,
  body {
    overflow-x: clip;
    max-width: 100%;
  }

  /* примеры (канбан, чаты, дашборд) поднимаем над текстом */
  .hero__art {
    order: -1;
    margin-top: 8px;
    margin-bottom: 10px;
  }

  .kanban {
    padding: 12px;
  }

  .hero {
    padding-top: calc(var(--header-h) + 14px);
  }

  .hero__art .art {
    max-width: 100%;
  }

  /* канбан не растягиваем в столбик: колонки листаются вбок */
  .hero__art {
    width: 100%;
    max-width: 100%;
  }

  .kanban,
  .chats,
  .dash {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .kanban__cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .kanban__col {
    flex: none;
    max-width: none;
    min-width: 0;
    padding: 8px 6px;
  }

  .kanban__head,
  .kanban__title {
    font-size: 9px;
  }

  .kanban__card {
    padding: 5px 6px;
    font-size: 9px;
    line-height: 1.25;
    border-radius: 8px;
  }

  .kanban__card b {
    font-size: 9.5px;
  }

  /* тяжёлые рендеры на телефоне только мешают: прячем */
  .hero__glass,
  .section__art,
  .contact__orb {
    display: none !important;
  }

  .hero h1,
  .h2,
  .post__title,
  .case__title {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* «Что я делаю» — полноценная кнопка, а не обрезанная ссылка */
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .hero__actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .hero__actions .btn--ghost {
    background: rgba(59, 130, 246, 0.09);
    border: 1px solid var(--line-strong);
    box-shadow: none;
    padding: 14px 22px;
    color: var(--blue-2);
  }

  .hero__chips {
    gap: 8px;
  }

  .slider-nav {
    justify-content: flex-start;
  }
}

/* плитки статистики: убираем щель в 1px, через которую просвечивал фон */
.stats {
  gap: 0;
  background: transparent;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

@media (max-width: 760px) {
  .stat:nth-child(odd) {
    border-left: 0;
  }

  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

/* подсказка «листайте» на первой главе */
html.chapters-on .chapters-hint {
  position: fixed;
  right: 26px;
  bottom: 120px;
  z-index: 56;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(12, 22, 48, 0.55);
  border: 1px solid rgba(120, 160, 255, 0.24);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  animation: chaptersHint 2.6s ease-in-out infinite;
}

html.chapters-on .chapters-hint.is-hidden {
  opacity: 0;
  transform: translateY(8px);
}

@keyframes chaptersHint {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

html.chapters-on:root[data-theme="light"] .chapters-hud__bar {
  background: rgba(11, 27, 58, 0.14);
}

html.chapters-on:root[data-theme="light"] .chapters-hint {
  background: rgba(255, 255, 255, 0.82);
  color: #24334f;
  border-color: rgba(37, 99, 235, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  html.chapters-on .chapters-hint { animation: none; }
}

/* в режиме глав точки справа не нужны — есть индикатор и стрелки */
html.chapters-on .dot-nav { display: none; }

/* переход между главами должен быть виден даже при системной настройке
   «уменьшить движение» — иначе листание выглядит как рывок */
@media (prefers-reduced-motion: reduce) {
  html.chapters-on .chapter {
    transition: transform 0.85s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.5s ease !important;
  }
}

/* стрелки перехода между главами */
html.chapters-on .chapters-nav {
  position: fixed;
  right: 26px;
  bottom: 68px;
  z-index: 57;
  display: flex;
  gap: 8px;
}

html.chapters-on .chapters-nav__btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(120, 160, 255, 0.24);
  background: rgba(12, 22, 48, 0.55);
  color: var(--ink-soft);
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

html.chapters-on .chapters-nav__btn svg {
  width: 18px;
  height: 18px;
}

html.chapters-on .chapters-nav__btn--next svg {
  transform: rotate(180deg);
}

html.chapters-on .chapters-nav__btn:hover:not(:disabled) {
  color: #fff;
  border-color: var(--blue-2);
}

html.chapters-on .chapters-nav__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

html.chapters-on:root[data-theme="light"] .chapters-nav__btn {
  background: rgba(255, 255, 255, 0.82);
  color: #24334f;
  border-color: rgba(37, 99, 235, 0.2);
}

/* стрелки перехода между главами */
