/* Главная: одна 3D-сцена и обычная прокрутка остальных разделов. */
:root { color-scheme: dark; }
body { margin: 0; background: var(--c-black); color: var(--c-bone); }
.home { --quiet: var(--mute-on-black); --rule: var(--line-on-black); }
.home h1, .home h2, .home h3 { margin: 0; line-height: 1.16; letter-spacing: -.045em; }
.home h1 { font-size: clamp(2rem, 4vw, 4.25rem); }
.home h2 { font-size: clamp(1.7rem, 3.2vw, 3.15rem); }
.home h3 { font-size: clamp(1.1rem, 1.9vw, 1.55rem); }
.home p { margin: 0; }
.home-wrap { width: min(100% - 2 * clamp(20px, 5vw, 76px), 1264px); margin-inline: auto; }
.home-kicker { color: var(--quiet); font: 400 .75rem/1.4 var(--font-mono); text-transform: uppercase; letter-spacing: .085em; }
.home h1, .home h2 { text-wrap: balance; }
.home-section { padding-block: clamp(54px, 8vw, 122px); border-top: 1px solid var(--rule); scroll-margin-top: 82px; }
.home-section .home-kicker + h2, .home-section .home-kicker + .home-intro { margin-top: 18px; }
.home-intro { display: grid; grid-template-columns: 1.22fr 1fr; gap: clamp(24px, 5.5vw, 84px); align-items: start; }
.home-intro p, .home-lead { color: var(--quiet); font-size: clamp(1.06rem, 1.55vw, 1.25rem); max-width: 46ch; }
.home-hero { position: relative; min-height: min(880px, 100svh); display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; padding-block: 114px 64px; }
.home-hero-copy { position: relative; z-index: 1; }
.home-hero h1 { margin-block: 18px 24px; text-wrap: initial; overflow-wrap: break-word; }
.home-hero-actions { margin-top: 30px; }
.home-actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 9px; }
.home-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 2px; padding: 9px clamp(12px, 1.6vw, 24px); font-size: .97rem; font-weight: 550; text-decoration: none; }
.home-button.is-primary { color: var(--c-black); background: var(--c-bone); border-color: var(--c-bone); }
.home-button:hover { border-color: var(--c-bone); }
.home-button.is-primary:hover { background: #d8d6d0; border-color: #d8d6d0; }
.home-link { display: inline-flex; align-items: baseline; gap: .55em; padding-block: .45em; text-decoration-line: underline; text-underline-offset: .28em; text-decoration-color: var(--quiet); font-size: .99rem; }
.home-link:hover { text-decoration-color: currentColor; }
.home-hero-actions > .home-link { margin-top: 8px; }
.home-motion { margin: 0; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.home-motion figcaption { margin-top: 2px; color: var(--quiet); text-align: center; font-size: .93rem; }
.home-scene { position: relative; height: clamp(340px, 52vw, 640px); overflow: hidden; isolation: isolate; }
.home-scene::after { content: ""; position: absolute; pointer-events: none; inset: 0; background: linear-gradient(90deg,var(--c-black),transparent 16%,transparent 84%,var(--c-black)), linear-gradient(0deg,var(--c-black),transparent 15%,transparent 86%,var(--c-black)); }
.home-scene img, .home-scene canvas { position: absolute; display: block; inset: 0; width: 100%; height: 100%; }
.home-scene img { object-fit: contain; }
html.home-scene-loading:not(.no-webgl) .home-scene img { visibility: hidden; }
.home-scene canvas { opacity: 0; pointer-events: none; }
html:not(.no-webgl) .home-scene canvas.is-ready { opacity: 1; }
.home-system { list-style: none; margin: clamp(24px, 5vw, 66px) 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: clamp(16px,3vw,44px); }
.home-system li { border-top: 1px solid var(--rule); padding-top: 16px; }
.home-system h3 { margin-bottom: 8px; }
.home-system p, .home-card p, .home-steps p, .home-example p { color: var(--quiet); }
.home-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-top: clamp(24px,4vw,48px); }
.home-cards-two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.home-card { border: 1px solid var(--rule); padding: clamp(20px, 3vw, 38px); display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.home-card p:not(.home-kicker):not(.home-status) { max-width: 44ch; }
.home-card .home-link { margin-top: auto; }
.home p.home-side-route { margin-top: 16px; color: var(--quiet); }
.home-side-route a { color: var(--c-bone); }
.home-method { display: grid; grid-template-columns: 1.22fr 1fr; align-items: start; gap: clamp(20px,5vw,72px); margin: clamp(24px,4vw,48px) 0 14px; }
.home-steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.home-steps li { counter-increment: step; border-top: 1px solid var(--rule); padding: 16px 0 16px 34px; position: relative; }
.home-steps li::before { content: counter(step, decimal-leading-zero); position: absolute; inset: 20px auto auto 0; color: var(--quiet); font: 400 .75rem var(--font-mono); }
.home-steps h3 { font: 560 1.12rem/1.3 var(--font-text); letter-spacing: 0; margin-bottom: 5px; }
.home-example { border: 1px solid var(--rule); margin: 0; }
.home-example svg { width: 100%; max-height: 220px; display: block; padding: 6px 12px 0; font: 400 11px var(--font-mono); }
.home-example figcaption { padding: 16px clamp(16px,3vw,32px) 22px; border-top: 1px solid var(--rule); }
.home-example figcaption p { margin-top: 9px; font-size: .94rem; }
.home-contact .home-button, .home-intro .home-link { margin-top: 16px; }
.home-routes { border-top: 1px solid var(--rule); margin-top: clamp(28px,5vw,60px); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); }
.home-routes a { padding: 15px 8px 15px 0; font-size: .97rem; display: flex; align-items: baseline; gap: 6px; }
.home-routes a:hover { text-decoration: underline; text-underline-offset: .25em; }
.home-footer { border-top: 1px solid var(--line-on-black); padding-block: 22px 34px; display: flex; gap: 9px 22px; align-items: baseline; flex-wrap: wrap; color: var(--mute-on-black); font-size: .8rem; }
.home-footer a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.ftr-legal { display: flex; gap: 6px 18px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .home-hero { grid-template-columns: minmax(0,1fr); padding-block: 99px 44px; min-height: 0; }
  .home-hero-copy { display: contents; }
  .home-hero h1 { margin: 11px 0 13px; font-size: clamp(1.7rem, 5.1vw, 2.95rem); }
  .home-hero-actions { order: 2; margin-top: 16px; }
  .home-motion { order: 1; margin-top: 4px; }
  .home-motion figcaption { font-size: .83rem; }
  .home-scene { height: clamp(170px, 28svh, 330px); }
  .home-scene img { object-fit: contain; }
  .home-intro { align-items: start; gap: 14px; }
  .home-cards:not(.home-cards-two) { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 620px) {
  .home-intro, .home-system, .home-cards-two, .home-method { grid-template-columns: minmax(0,1fr); }
  .home h2 { text-wrap: initial; }
  .home-system { gap: 16px; }
  .home-steps li { padding-block: 14px; }
  .home-steps li::before { top: 17px; }
  .home-routes { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 360px) {
  .home-button { font-size: .88rem; padding-inline: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-scene canvas { visibility: hidden; }
  html.home-scene-loading .home-scene img { visibility: visible; }
}


/* Исходная 3D-сцена открывается на весь экран. Текст остаётся в обычном потоке. */
#hdr, .home-hero-copy > *, .home-motion figcaption, #acBar {
  transition: opacity .8s ease, transform .35s var(--ease);
}
.home-intro-active :is(#hdr, #acBar, .home-hero-copy > *, .home-motion figcaption) {
  opacity: 0;
  visibility: hidden;
}
.home-intro-skip :is(#hdr, #acBar, .home-hero-copy > *, .home-motion figcaption) { transition: none; }
.home-intro-active .home-scene img { visibility: hidden; }
.home-intro-active .home-scene::after { opacity: 0; }
.home-scene::after { transition: opacity .8s ease; }

@media (max-width: 860px) {
  .home-intro-active .home-motion .home-scene { overflow: visible; isolation: auto; }
  .home-intro-active .home-motion canvas {
    position: fixed;
    width: 100%;
    height: 100svh;
    z-index: 2;
  }
}

/* Общий ракурс первого экрана и компании. Прокрутка секций остаётся нативной. */
.home-opening { position: relative; isolation: isolate; }
.home-visuals { position: absolute; z-index: -1; inset: 0; pointer-events: none; }
.home-stage { position: sticky; top: 0; height: 100svh; }
.home-opening.home-panoramic .home-stage .home-scene {
  position: absolute;
  inset: 0;
  height: auto;
}
.home-panoramic .home-stage .home-scene::after {
  background:
    linear-gradient(90deg, var(--c-black) 0%, rgba(10,10,8,.89) 28%, rgba(10,10,8,.24) 59%, transparent 81%),
    linear-gradient(0deg, var(--c-black), transparent 22%, transparent 90%, rgba(10,10,8,.2));
}
.home-panoramic .home-stage img { width: 47%; inset: 0 0 0 auto; mask-image: radial-gradient(ellipse 65% 51%, #000 62%, transparent 100%); }
.home-panoramic .home-hero {
  min-height: 100svh;
  grid-template-columns: minmax(0, 1.72fr) minmax(0, 1fr);
  align-items: center;
}
.home-panoramic .home-hero h1 {
  font-size: clamp(2.5rem, 4.48vw, 5.25rem);
  line-height: 1.09;
  text-wrap: balance;
}
.home-panoramic .home-motion {
  justify-content: flex-end;
  padding-bottom: clamp(0px, 2vh, 18px);
}
.home-panoramic .home-company {
  display: flex;
  align-items: flex-end;
  min-height: clamp(620px, 92svh, 950px);
  background: linear-gradient(0deg, var(--c-black) 2%, rgba(10,10,8,.97) 27%, rgba(10,10,8,.83) 39%, rgba(10,10,8,.17) 78%, transparent);
  border-top: 0;
}
.home-panoramic .home-company .home-intro {
  display: block;
  max-width: 60%;
}
.home-company .home-intro h2 { max-width: 20ch; }
.home-panoramic .home-company .home-intro p { margin-top: 22px; }

/* Витрина: список направлений и один кадр выбранного предложения. */
.home-showcase-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 14px 32px; }
.home-showcase-heading .home-link { flex-shrink: 0; }
.home-showcase {
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
  gap: clamp(20px, 5vw, 76px);
  align-items: start;
  margin-top: clamp(22px, 4vw, 50px);
}
.home-showcase-group + .home-showcase-group { margin-top: 24px; }
.home-showcase-group h3, .home-showcase-select > span, .home-showcase-status {
  color: var(--quiet);
  font: 400 .75rem/1.4 var(--font-mono);
  letter-spacing: .055em;
  text-transform: uppercase;
}
.home-showcase-group ul { list-style: none; margin: 8px 0 0; padding: 0; }
.home-showcase-group li { border-bottom: 1px solid var(--rule); }
.home-showcase-group button {
  display: block;
  width: 100%;
  border: 0;
  border-inline-start: 2px solid transparent;
  background: transparent;
  color: var(--quiet);
  padding: 10px 12px;
  font: 450 .99rem/1.35 var(--font-text);
  min-height: 42px;
  text-align: start;
}
.home-showcase-group button:not(:disabled) { cursor: pointer; }
.home-showcase-group button[aria-pressed="true"] {
  border-inline-start-color: var(--c-bone);
  color: var(--c-bone);
  background: rgba(242,240,235,.055);
}
.home-showcase-group button:hover:not(:disabled) { color: var(--c-bone); }
.home-showcase-select { display: none; }
.home-showcase-preview { margin: 0; min-width: 0; }
.home-showcase-art {
  position: relative;
  overflow: hidden;
  aspect-ratio: 5 / 3;
  background: #0a0a08;
  border: 1px solid var(--rule);
}
.home-showcase[data-preview-active="stat"] .home-showcase-art { background: #f2f0eb; }
.home-showcase-art .stage {
  position: absolute;
  inset: 0;
  touch-action: pan-y pinch-zoom;
}
.home-showcase-art :is(.static, .stage-canvas) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.home-showcase-art .static { display: none; }
.home-showcase-art .fallback .static { display: block; }
.home-showcase-art .fallback .stage-canvas { visibility: hidden; }
.home-showcase-art .stage:not(.fallback)[data-hit] { cursor: grab; }
.home-showcase-art .stage:not(.fallback)[data-hit]:active { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) {
  .home-showcase-art .stage .static { display: block; }
  .home-showcase-art .stage .stage-canvas { display: none; }
}
.home-showcase-art [hidden] { display: none; }
.home-showcase-preview figcaption {
  display: grid;
  gap: 7px;
  padding-block: 17px;
  border-bottom: 1px solid var(--rule);
}
.home-showcase[data-development] .home-showcase-status { color: var(--c-brass); }
.home-showcase-name { font: 240 clamp(1.2rem, 2.2vw, 1.75rem)/1.3 var(--font-display); }
.home-showcase-description { color: var(--quiet); }

@media (max-width: 760px) {
  .home-showcase { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .home-showcase-heading { gap: 7px 24px; }
  .home-showcase.is-ready .home-showcase-list { display: none; }
  .home-showcase.is-ready .home-showcase-select { display: grid; gap: 6px; }
  .home-showcase-select select {
    min-height: 46px;
    min-width: 0;
    width: 100%;
    border: 1px solid var(--rule);
    border-radius: 2px;
    padding: 8px 12px;
    background: var(--c-black);
    color: var(--c-bone);
    font: 465 1rem/1.35 var(--font-text);
  }
}

/* Разметка замера появляется после входа схемы в кадр. */
.home #method { background: radial-gradient(ellipse at 76% 45%, rgba(242,240,235,.045), transparent 55%); }
.home-example svg {
  max-height: none;
  min-height: clamp(180px, 22vw, 315px);
  background: radial-gradient(ellipse, rgba(242,240,235,.045), transparent 72%);
}
.home-example.has-entered .home-measure-line {
  animation: home-trace .85s .14s ease-out both;
  stroke-dasharray: 1;
}
.home-example.has-entered .home-measure-point { animation: home-point .65s ease-out both; }
@keyframes home-trace { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes home-point { from { opacity: .18; } to { opacity: 1; } }

/* Роли организаций и схема сотрудничества. */
.home #institute .home-cards { gap: clamp(20px, 4vw, 58px); }
.home #institute .home-card { border: 0; border-block: 1px solid var(--rule); padding-inline: 0; }
.home-handoff {
  display: grid;
  grid-template-columns: auto minmax(32px, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 3vw, 50px);
  margin-top: clamp(36px, 7vw, 98px);
  padding-block: clamp(18px, 3vw, 40px);
  border-block: 1px solid var(--rule);
  font-size: clamp(.9rem, 1.8vw, 1.45rem);
}
.home-handoff i { position: relative; height: 1px; background: var(--rule); }
.home-handoff i::before { content: ""; position: absolute; inset: 0; background: var(--quiet); }
.home-handoff.has-entered i::before { animation: home-connect .9s ease-out both; transform-origin: left; }
@keyframes home-connect { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.home-institute-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(126px, 13vw, 176px);
  height: clamp(100px, 10.5vw, 146px);
  max-width: 100%;
  overflow: hidden;
}
/* Финальный знак растворён в фоне и не перекрывает текст. */
.home-contact { position: relative; isolation: isolate; overflow: clip; min-height: min(620px, 80svh); display: grid; align-items: center; }
.home-contact .home-intro h2 { font-size: clamp(2.2rem, 5.6vw, 5.5rem); }
.home-contact-mark {
  position: absolute;
  z-index: -1;
  inset: 12% -10% 6% 42%;
  background: radial-gradient(circle, rgba(242,240,235,.22) 0 1px, transparent 1.3px) 0 0 / 6px 6px;
  mask: url(img/logo-ac-solid.svg) center / contain no-repeat;
  opacity: .46;
}
.home-contact-mark.has-entered { animation: home-contact-in 1.2s ease-out both; }
@keyframes home-contact-in { from { opacity: .12; transform: translateX(10px) scale(.98); } to { opacity: .46; transform: none; } }

@media (max-width: 860px) {
  .home-motion .home-scene { margin-inline: calc(-1 * clamp(20px, 5vw, 76px)); }
  .home-contact { min-height: auto; }
}
@media (max-width: 620px) {
  .home #institute .home-cards { gap: 24px; }
  .home-handoff { grid-template-columns: minmax(0, 1fr) minmax(20px, .3fr) minmax(0, 1fr); }
  .home-contact-mark { inset: 12% -38% 8% 30%; opacity: .3; }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero-copy > *, .home-motion figcaption, .home-scene::after { transition: none; }
  .home [data-home-motion], .home [data-home-motion] *, .home [data-home-motion]::before, .home [data-home-motion] *::before { animation: none !important; }
}


/* Волна рисуется за началом блока, а текст и ссылки остаются в обычном потоке. */
.home-wave-entering > .home-wrap {
  --wave-gutter: clamp(20px, 5vw, 76px);
  position: relative;
  isolation: isolate;
}
.home-wave {
  position: absolute;
  z-index: -1;
  inset: -36px auto auto calc(-1 * var(--wave-gutter));
  width: calc(100% + 2 * var(--wave-gutter));
  height: clamp(126px, 17vw, 220px);
  pointer-events: none;
}
.home-wave-entering > .home-wrap > :is(.home-kicker, h2, .home-intro) {
  animation: home-wave-title .77s cubic-bezier(.23,.68,.26,1) both;
}
.home-wave-entering > .home-wrap > :is(.home-system, .home-cards, .home-showcase, .home-method, .home-handoff, .home-routes) {
  animation: home-wave-content .8s .10s cubic-bezier(.23,.68,.26,1) both;
}
@keyframes home-wave-title {
  from { opacity: .57; transform: translateY(13px); }
  to { opacity: 1; transform: none; }
}
@keyframes home-wave-content {
  from { opacity: .72; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
.home-wave-entering > .home-wrap:focus-within > :not(.home-wave) { animation: none; }

@media (max-width: 620px) {
  .home-wave { top: -20px; }
  @keyframes home-wave-title {
    from { opacity: .66; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-wave { display: none; }
  .home-wave-entering > .home-wrap > :not(.home-wave) { animation: none; }
}
