/* Тестовый вариант главной: статичная плата + интерактивный Canvas-слой. */

.circuit-home {
  --circuit-x: 68%;
  --circuit-y: 50%;
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  isolation: isolate;
  padding-top: var(--header-h);
  color: #eef8ff;
  background: #02060d;
}

.home-screen--circuit {
  --circuit-x: 68%;
  --circuit-y: 50%;
}

/* На выбранной главной шапка превращается в компактный языковой переключатель. */
body:has(.home-screen--circuit) .site-header__inner { justify-content: flex-end; }
body:has(.home-screen--circuit) .site-header .brand,
body:has(.home-screen--circuit) .site-header .nav,
body:has(.home-screen--circuit) .site-header .burger { display: none; }
body:has(.home-screen--circuit) .site-header .header__actions { margin-left: auto; }
body:has(.home-screen--circuit) .site-header .header__contact { display: block; }
body:has(.home-screen--circuit) .site-header .header__cta { display: none; }
body:has(.home-screen--circuit) .site-header .lang { display: flex; }

body:has(.circuit-home) {
  min-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #02060d;
}

html:has(.circuit-home),
body:has(.circuit-home) {
  max-width: 100%;
  overflow-x: clip;
}

body:has(.circuit-home) .site-footer { display: none; }

.circuit-home__body {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-bottom: clamp(3rem, 7vh, 5.25rem);
}

.circuit-home__media,
.circuit-home__veil,
.circuit-home__grid {
  position: absolute;
  inset: 0;
}

.circuit-home__media { z-index: -3; }

.circuit-home__base,
.circuit-home__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  transform: translateY(-3.2%) scale(1.07);
}

.circuit-home__base {
  filter: brightness(0.72) saturate(0.86) contrast(1.08);
}

.circuit-home__video {
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  filter: brightness(0.92) saturate(1.12) contrast(1.06);
  -webkit-mask-image: radial-gradient(
    circle 240px at var(--circuit-x) var(--circuit-y),
    #000 0%, #000 34%, rgba(0, 0, 0, 0.72) 58%, transparent 100%
  );
  mask-image: radial-gradient(
    circle 240px at var(--circuit-x) var(--circuit-y),
    #000 0%, #000 34%, rgba(0, 0, 0, 0.72) 58%, transparent 100%
  );
  transition: opacity 460ms ease-out;
  will-change: opacity;
}

.circuit-home.is-circuit-active .circuit-home__video,
.home-screen--circuit.is-circuit-active .circuit-home__video { opacity: 0.94; }

.hs-touch-hint,
.circuit-touch-canvas { display: none; }

.circuit-home__veil {
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(2, 6, 13, 0.97) 0%, rgba(2, 6, 13, 0.86) 23%, rgba(2, 6, 13, 0.42) 46%, rgba(2, 6, 13, 0.05) 72%),
    linear-gradient(180deg, rgba(2, 6, 13, 0.62) 0%, transparent 23%, transparent 72%, rgba(2, 6, 13, 0.72) 100%),
    radial-gradient(circle at 68% 54%, transparent 14%, rgba(2, 6, 13, 0.16) 68%);
}

.circuit-home__grid {
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(79, 178, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 178, 255, 0.12) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: linear-gradient(90deg, #000, transparent 48%);
}

.circuit-home__content {
  width: min(650px, 48vw);
  position: relative;
  z-index: 2;
}

.circuit-home__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: clamp(1rem, 2.5vh, 1.6rem);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8ed8ff;
}

.circuit-home__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fe4ff;
  box-shadow: 0 0 0 5px rgba(74, 199, 255, 0.12), 0 0 18px #43c7ff;
  animation: circuit-status 2.2s ease-in-out infinite;
}

@keyframes circuit-status {
  50% { box-shadow: 0 0 0 8px rgba(74, 199, 255, 0), 0 0 25px #43c7ff; }
}

.circuit-home__title {
  max-width: 12ch;
  margin-bottom: clamp(1.1rem, 2.5vh, 1.7rem);
  font-family: 'Unbounded', var(--font-heading);
  font-size: clamp(2.25rem, 4.6vw, 5.3rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.72);
}

.circuit-home__title span {
  display: block;
  background: linear-gradient(96deg, #49c5ff 3%, #b9ecff 44%, #2795ec 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(58, 178, 255, 0.28));
}

.circuit-home__lead {
  max-width: 57ch;
  margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
  font-size: clamp(0.98rem, 0.85rem + 0.28vw, 1.12rem);
  line-height: 1.65;
  color: #a7bad0;
  text-shadow: 0 3px 14px #02060d;
}

.circuit-home__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.4rem;
}

.circuit-home__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding-block: 0.8rem;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9fb4ca;
}

.circuit-home__back svg {
  width: 18px;
  height: 18px;
  transition: transform var(--dur) var(--ease);
}

.circuit-home__back:hover { color: #dff5ff; }
.circuit-home__back:hover svg { transform: translateX(-5px); }

.circuit-home__hint {
  position: absolute;
  right: clamp(1.25rem, 3vw, 4rem);
  bottom: clamp(1.25rem, 3vh, 2.5rem);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-heading);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(190, 221, 243, 0.7);
}

.circuit-home__hint span {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(125, 211, 252, 0.45);
  border-radius: 50%;
  box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.14), 0 0 18px rgba(56, 189, 248, 0.12);
  animation: circuit-hint 1.8s ease-out infinite;
}

@keyframes circuit-hint {
  60%, 100% { transform: scale(1.22); opacity: 0.28; }
}

@media (max-width: 900px) {
  body:has(.circuit-home) { overflow: auto; }
  .circuit-home { align-items: stretch; min-height: 100svh; }
  .circuit-home__content { width: 100%; }
  .circuit-home__base,
  .circuit-home__video { object-position: 62% center; }
  .circuit-home__veil {
    background:
      linear-gradient(180deg, rgba(2, 6, 13, 0.18) 0%, rgba(2, 6, 13, 0.34) 38%, rgba(2, 6, 13, 0.96) 72%, #02060d 100%);
  }
  .circuit-home__hint { display: none; }
  .circuit-home__title { font-size: clamp(2rem, 9vw, 3.5rem); }
}

@media (max-width: 560px) {
  .circuit-home { padding-inline: 0; padding-bottom: 0; }
  .circuit-home__actions { align-items: stretch; gap: 0.7rem; }
  .circuit-home__actions .btn-hero { width: 100%; }
  .circuit-home__back { justify-content: center; width: 100%; }
  .circuit-home__lead { font-size: 0.94rem; }
}

/* ── Мобильная главная: полноэкранная обложка вместо тесной карточки ── */
@media (max-width: 700px) {
  body:has(.home-screen--circuit) {
    width: 100%;
    min-width: 0;
    overflow-x: clip;
    background: #02060d;
  }

  body:has(.home-screen--circuit) .site-header {
    height: calc(112px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(180deg, rgba(2, 6, 13, 0.9), rgba(2, 6, 13, 0));
    border: 0;
    pointer-events: none;
  }

  body:has(.home-screen--circuit) .site-header.is-stuck {
    background: linear-gradient(180deg, rgba(2, 6, 13, 0.94), rgba(2, 6, 13, 0.7));
    backdrop-filter: blur(16px) saturate(130%);
  }

  body:has(.home-screen--circuit) .site-header__inner {
    min-width: 0;
    height: 112px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.48rem;
    padding-top: 0.55rem;
    padding-inline: 1rem;
  }

  body:has(.home-screen--circuit) .site-header .brand {
    display: flex !important;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    pointer-events: auto;
  }

  body:has(.home-screen--circuit) .site-header .brand__mark {
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 0 12px rgba(78, 190, 255, 0.28));
  }

  body:has(.home-screen--circuit) .site-header .brand__divider,
  body:has(.home-screen--circuit) .site-header .brand__tag {
    display: none;
  }

  body:has(.home-screen--circuit) .site-header .brand__name {
    display: block;
    font-family: 'Unbounded', var(--font-heading);
    font-size: 0.98rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.075em;
    text-transform: none;
    color: #edf7ff;
    text-shadow: 0 0 24px rgba(83, 194, 255, 0.28);
  }

  body:has(.home-screen--circuit) .site-header .header__contact {
    display: none !important;
  }

  body:has(.home-screen--circuit) .site-header .header__actions {
    gap: 0;
    margin: 0;
    pointer-events: auto;
  }

  body:has(.home-screen--circuit) .site-header .lang {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid rgba(125, 211, 252, 0.2);
    border-radius: 14px;
    background: rgba(4, 12, 24, 0.68);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(18px) saturate(145%);
  }

  body:has(.home-screen--circuit) .site-header .lang__item {
    min-width: 39px;
    height: 31px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 10px;
    font-size: 0.64rem;
    color: #8294aa;
  }

  body:has(.home-screen--circuit) .site-header .lang__item.is-active {
    color: #dff6ff;
    background: linear-gradient(145deg, rgba(26, 148, 225, 0.34), rgba(5, 58, 101, 0.5));
    box-shadow: inset 0 0 0 1px rgba(91, 203, 255, 0.38), 0 0 20px rgba(31, 169, 238, 0.16);
  }

  .home-screen--circuit {
    --mobile-media-h: clamp(390px, 58svh, 520px);
    min-height: 100svh;
    padding-top: 0;
    overflow: clip;
    isolation: isolate;
    background:
      radial-gradient(circle at 72% 18%, rgba(18, 111, 176, 0.18), transparent 34%),
      linear-gradient(180deg, #02060d 0%, #030914 48%, #02060d 100%);
  }

  .home-screen--circuit .hs-bg {
    position: absolute;
    inset: 0 0 auto;
    z-index: 0;
    width: 100%;
    height: var(--mobile-media-h);
    margin: 0;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    touch-action: pan-y;
  }

  .home-screen--circuit .circuit-home__base,
  .home-screen--circuit .circuit-home__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 61% 48%;
    transform: scale(1.025);
  }

  .home-screen--circuit .circuit-home__base {
    z-index: 2;
    filter: brightness(0.78) saturate(0.94) contrast(1.08);
    -webkit-mask-image: none;
    mask-image: none;
  }

  .home-screen--circuit .circuit-home__video {
    display: none;
  }

  .home-screen--circuit.is-circuit-active .circuit-home__base {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .home-screen--circuit .circuit-touch-canvas {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    opacity: 1;
    pointer-events: auto;
    touch-action: none;
    mix-blend-mode: screen;
  }

  .home-screen--circuit .hs-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(
      circle 185px at var(--circuit-x) var(--circuit-y),
      transparent 45%, rgba(64, 192, 255, 0.13) 66%, transparent 78%
    );
    transition: opacity 500ms ease;
  }

  .home-screen--circuit.is-circuit-active .hs-bg::after {
    opacity: 1;
    transition-duration: 120ms;
  }

  .home-screen--circuit .hs-veil {
    display: block;
    inset: 0 0 auto;
    width: 100%;
    height: calc(var(--mobile-media-h) + 100px);
    background:
      linear-gradient(180deg, rgba(2, 6, 13, 0.16) 0%, transparent 38%, rgba(2, 6, 13, 0.52) 66%, #02060d 91%, #02060d 100%),
      linear-gradient(90deg, rgba(2, 6, 13, 0.2), transparent 42%, rgba(2, 6, 13, 0.1));
  }

  .home-screen--circuit .hs-grain {
    opacity: 0.035;
  }

  .home-screen--circuit .hs-touch-hint {
    position: absolute;
    left: 50%;
    bottom: 4.4rem;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: max-content;
    max-width: calc(100% - 2rem);
    margin: 0;
    padding: 0.56rem 0.78rem;
    border: 1px solid rgba(125, 211, 252, 0.24);
    border-radius: 999px;
    background: rgba(2, 9, 18, 0.62);
    backdrop-filter: blur(12px);
    translate: -50% 0;
    font-family: var(--font-heading);
    font-size: 0.61rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(210, 237, 250, 0.82);
    transition: opacity 300ms ease, translate 300ms ease;
  }

  .home-screen--circuit .hs-touch-hint span {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #56d6ff;
    box-shadow: 0 0 0 5px rgba(86, 214, 255, 0.12), 0 0 18px rgba(86, 214, 255, 0.74);
    animation: mobile-circuit-hint 1.8s ease-out infinite;
  }

  .home-screen--circuit.has-circuit-touched .hs-touch-hint {
    opacity: 0;
    translate: -50% 8px;
  }

  .home-screen--circuit .hs-body {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: calc(var(--mobile-media-h) - 78px) 1.25rem calc(2rem + env(safe-area-inset-bottom));
    gap: 1.7rem;
    /* Контейнер занимает весь экран и раньше перехватывал касания над платой. */
    pointer-events: none;
  }

  .home-screen--circuit .hs-copy {
    width: 100%;
    max-width: none;
    padding: 0;
    pointer-events: auto;
  }

  .home-screen--circuit .hs-eyebrow {
    align-self: flex-start;
    gap: 0.48rem;
    max-width: 100%;
    margin-bottom: 1rem;
    padding: 0.48rem 0.68rem;
    border: 1px solid rgba(94, 203, 255, 0.19);
    border-radius: 999px;
    background: rgba(3, 12, 24, 0.58);
    backdrop-filter: blur(12px);
    font-size: 0.56rem;
    line-height: 1.35;
    letter-spacing: 0.09em;
    color: #77d6ff;
  }

  .home-screen--circuit .hs-eyebrow svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
  }

  .home-screen--circuit .hs-title {
    max-width: 100%;
    margin-bottom: 1rem;
    font-size: clamp(1.38rem, 6.25vw, 1.82rem);
    line-height: 1.17;
    letter-spacing: 0;
    text-wrap: balance;
  }

  .home-screen--circuit .hs-line {
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
  }

  .home-screen--circuit .hs-lead {
    max-width: 34ch;
    margin-bottom: 1.35rem;
    font-size: 0.88rem;
    line-height: 1.58;
    color: #a9bbcf;
  }

  .home-screen--circuit .hs-lead__extended {
    display: none;
  }

  .home-screen--circuit .hs-actions {
    margin-bottom: 1.55rem;
  }

  .home-screen--circuit .hs-actions .btn-hero {
    width: 100%;
    min-height: 56px;
    padding-inline: 1.15rem;
    border-radius: 15px;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    box-shadow: 0 14px 36px rgba(5, 101, 178, 0.32), inset 0 1px rgba(255, 255, 255, 0.16);
  }

  .home-screen--circuit .hs-vendors {
    margin-inline: -1.25rem;
    overflow: hidden;
  }

  .home-screen--circuit .hs-vendors__label {
    margin: 0 1.25rem 0.7rem;
    font-size: 0.61rem;
    color: #53677d;
  }

  .home-screen--circuit .hs-vendors__row {
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0 1.25rem 0.35rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .home-screen--circuit .hs-vendors__row::-webkit-scrollbar { display: none; }

  .home-screen--circuit .hs-vendors__row li {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 0.58rem 0.75rem;
    border: 1px solid rgba(137, 179, 211, 0.12);
    border-radius: 999px;
    background: rgba(8, 18, 32, 0.68);
    font-size: 0.68rem;
    color: #8ea5bd;
    opacity: 1;
  }

  .home-screen--circuit .home-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    pointer-events: auto;
  }

  .home-screen--circuit .home-nav__item,
  .home-screen--circuit .home-nav__item:nth-child(n) {
    grid-column: auto;
    min-width: 0;
    min-height: 116px;
    gap: 0.72rem;
    padding: 0.9rem;
    border-color: rgba(125, 211, 252, 0.12);
    border-radius: 18px;
    background:
      linear-gradient(145deg, rgba(14, 29, 49, 0.8), rgba(5, 12, 23, 0.9));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 12px 30px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(14px);
  }

  .home-screen--circuit .home-nav__item:last-child {
    grid-column: 1 / -1;
    min-height: 82px;
    justify-content: center;
  }

  .home-screen--circuit .home-nav__top {
    margin: 0;
  }

  .home-screen--circuit .home-nav__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .home-screen--circuit .home-nav__icon svg {
    width: 19px;
    height: 19px;
  }

  .home-screen--circuit .home-nav__no,
  .home-screen--circuit .home-nav__hint {
    display: none;
  }

  .home-screen--circuit .home-nav__title {
    padding-right: 1.8rem;
    font-size: 0.72rem;
    line-height: 1.35;
    letter-spacing: 0.07em;
  }

  .home-screen--circuit .home-nav__go {
    right: 0.78rem;
    bottom: 0.78rem;
    display: grid;
    width: 29px;
    height: 29px;
    border-radius: 9px;
  }
}

@keyframes mobile-circuit-hint {
  70%, 100% { box-shadow: 0 0 0 11px rgba(86, 214, 255, 0), 0 0 24px rgba(86, 214, 255, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
  .circuit-home .circuit-home__video { display: none; }
  .circuit-home__status,
  .circuit-home__hint span,
  .hs-touch-hint span { animation: none; }
}
