/* Секции главной: преимущества, схема, путь, финал. Токены и правила — site.css и DESIGN.md. */

.band,
.path,
.final {
  padding: clamp(4rem, 8vw, 6.5rem) 0;
  border-top: 1px solid var(--line);
}

.band h2,
.path h2,
.thread h2,
.final h2 {
  font-size: clamp(2.25rem, 5.5vw, 3.5rem);
  line-height: 1.1;
  text-wrap: balance;
}

.final--compact {
  padding: 2rem 0;
  gap: 1.25rem;
}

.final--compact .final-logo {
  width: 5rem;
  height: 5rem;
}

.band h2,
.path h2 {
  margin-bottom: 2.5rem;
}

.band-lead {
  max-width: var(--measure);
  margin: -1.25rem 0 2.5rem;
  color: var(--muted);
}

/* Что вы получаете: три строки набраны крупным шрифтом, без карточек */
#preimushchestva {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

#preimushchestva h2 {
  margin-bottom: 1rem;
}

#preimushchestva .facts li {
  padding-block: 1.5rem;
}

.facts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts li {
  display: grid;
  gap: 1rem;
  padding: 1.75rem 0 2rem;
}

.facts li + li {
  border-top: 1px solid var(--line);
}

.facts h3 {
  margin: 0;
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  text-wrap: balance;
}

.facts h3 em {
  font-style: normal;
  color: var(--accent);
}

.facts p {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
}

.facts .lead {
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-size: 1.1875rem;
  line-height: 1.5;
}

@media (min-width: 960px) {
  .facts li {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: start;
    gap: 4rem;
    padding: 2.5rem 0 2.75rem;
  }

  .facts .lead {
    padding-top: 0.5rem;
  }
}

/* Иллюстрации строк: рисуются в CSS, анимация только без reduced motion */
.art {
  display: grid;
  gap: 0.5rem;
  width: 100%;
  max-width: 22rem;
  padding: 0.875rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.art--bot {
  grid-template-columns: minmax(0, 1fr);
  min-height: 7.5rem;
  align-content: start;
}

.unit {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.dot {
  position: relative;
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--ok);
  border-radius: 50%;
}

.load {
  display: block;
  flex: 1;
  height: 0.25rem;
  overflow: hidden;
  background: var(--line);
  border-radius: 0.125rem;
}

.load::after {
  content: "";
  display: block;
  width: 62%;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transform-origin: left;
}

.unit:nth-child(2) .load::after { width: 38%; }
.unit:nth-child(3) .load::after { width: 78%; }

.ip-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.ip-value {
  display: block;
  padding: 0.5rem 0.625rem;
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.ip-text {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.9375rem;
  white-space: nowrap;
  vertical-align: bottom;
  border-right: 2px solid transparent;
}

.bubble {
  grid-column: 1;
  max-width: 92%;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  border-radius: 0.875rem;
}

.bubble--me {
  justify-self: end;
  color: var(--ink);
  background: var(--accent-soft);
  border-bottom-right-radius: 0.25rem;
}

.bubble--bot {
  grid-row: 2;
  justify-self: start;
  color: var(--ink);
  background: var(--surface);
  border-bottom-left-radius: 0.25rem;
}

.bubble--typing {
  display: none;
  grid-row: 2;
  justify-self: start;
  gap: 0.25rem;
  background: var(--surface);
  border-bottom-left-radius: 0.25rem;
}

.bubble--typing i {
  width: 0.3125rem;
  height: 0.3125rem;
  background: var(--muted);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--ok);
    border-radius: 50%;
    animation: dot-ping 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  }

  .unit:nth-child(2) .dot::after { animation-delay: 0.8s; }
  .unit:nth-child(3) .dot::after { animation-delay: 1.6s; }

  .load::after {
    animation: load-sway 5s cubic-bezier(0.65, 0, 0.35, 1) infinite alternate;
  }

  .unit:nth-child(2) .load::after { animation-duration: 6.5s; }
  .unit:nth-child(3) .load::after { animation-duration: 4.2s; }

  .ip-text {
    width: 0;
    border-right-color: var(--accent);
    animation: ip-type 6s steps(12, end) infinite;
  }

  .art--bot .bubble--me {
    animation: bubble-me 7s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  }

  .art--bot .bubble--typing {
    display: inline-flex;
    animation: bubble-typing 7s ease-out infinite;
  }

  .art--bot .bubble--typing i {
    animation: type-dot 1s ease-in-out infinite;
  }

  .art--bot .bubble--typing i:nth-child(2) { animation-delay: 0.15s; }
  .art--bot .bubble--typing i:nth-child(3) { animation-delay: 0.3s; }

  .art--bot .bubble--bot {
    animation: bubble-bot 7s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  }
}

@keyframes dot-ping {
  0% { opacity: 0.9; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(2.6); }
}

@keyframes load-sway {
  from { transform: scaleX(0.55); }
  to { transform: scaleX(1.12); }
}

@keyframes ip-type {
  0% { width: 0; }
  45%, 85% { width: 7.5em; }
  100% { width: 0; }
}

@keyframes bubble-me {
  0% { opacity: 0; transform: translateY(0.5rem); }
  8%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

@keyframes bubble-typing {
  0%, 14% { opacity: 0; transform: translateY(0.5rem); }
  20%, 36% { opacity: 1; transform: none; }
  40%, 100% { opacity: 0; transform: none; }
}

@keyframes bubble-bot {
  0%, 38% { opacity: 0; transform: translateY(0.5rem); }
  46%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

@keyframes type-dot {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@media (min-width: 960px) {
  .facts li {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 15rem;
  }

  .facts .art {
    align-self: center;
    justify-self: end;
    max-width: 15rem;
  }
}

/* Три «Свой» сливаются в агента: ролик по центру. Без скрипта виден последний кадр. */
.merge {
  margin: 3rem 0 0;
  padding-top: 3rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.merge video {
  display: block;
  width: 100%;
  max-width: 72rem;
  height: auto;
  margin: 0 auto;
  background: var(--canvas);
  border-radius: var(--radius-card);
}

.merge figcaption {
  max-width: 34rem;
  margin: 1.25rem auto 0;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Как это устроено: схема из трёх частей и входа доступа OpenAI */
.schema {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "cab" "wa" "server" "wb" "bot" "key";
  gap: 0;
}

.part--cab { grid-area: cab; }
.part--server { grid-area: server; }
.part--bot { grid-area: bot; }
.part--key { grid-area: key; margin-top: 2rem; }
.wire--a { grid-area: wa; }
.wire--b { grid-area: wb; }
.wire.wire--v { grid-area: wv; display: none; }

.part {
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.part-icon {
  display: block;
  margin-bottom: 1rem;
  color: var(--accent);
}

.part h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

.part p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.part--server {
  padding: 1.75rem 1.5rem;
  background: var(--accent-softer);
  border-color: var(--accent);
}

.part--server h3 {
  font-size: 1.5rem;
}

.part--server p {
  color: var(--ink);
}

.part--key {
  background: transparent;
  border-style: dashed;
}

.wire {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 5rem;
  color: var(--muted);
}

.wire-label {
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  white-space: nowrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.wire svg {
  flex: none;
  overflow: visible;
}

.wire-h { display: none; }

.wire-rail,
.comet {
  fill: none;
}

.wire-rail {
  stroke-linecap: round;
}

.wire-rail {
  stroke: var(--line);
  stroke-width: 2;
}

.comet {
  display: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: 24 200;
  stroke-dashoffset: 26;
}

.head {
  fill: var(--accent);
  stroke: none;
}

@media (prefers-reduced-motion: no-preference) {
  .comet {
    display: block;
    animation: wire-comet 2.8s linear infinite backwards;
  }

  .head {
    animation: wire-head 2.8s ease-out infinite backwards;
  }

  .wire--v .comet,
  .wire--v .head { animation-delay: 0s; }
  .wire--a .comet,
  .wire--a .head { animation-delay: 0.55s; }
  .wire--b .comet,
  .wire--b .head { animation-delay: 1.1s; }
}

@keyframes wire-comet {
  0% { stroke-dashoffset: 26; }
  70%, 100% { stroke-dashoffset: -102; }
}

@keyframes wire-head {
  0%, 52%, 100% { opacity: 0.45; }
  68% { opacity: 1; }
}

@media (min-width: 1120px) {
  .schema {
    grid-template-columns: minmax(0, 1fr) 11.5rem minmax(0, 1.2fr) 11.5rem minmax(0, 1fr);
    grid-template-areas:
      ". . key . ."
      ". . wv . ."
      "cab wa server wb bot";
    align-items: stretch;
  }

  .part--key { margin-top: 0; }
  .wire {
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    padding: 0 1rem;
  }
  .wire.wire--v {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 12px minmax(0, 1fr);
    column-gap: 0.75rem;
    min-height: 5rem;
    padding: 0;
  }

  .wire--v .wire-label {
    justify-self: end;
  }

  .wire--v .wire-v {
    grid-column: 2;
    grid-row: 1;
  }
  .wire--a,
  .wire--b { align-self: center; }
  .wire-h { display: block; }
  .wire--a .wire-v,
  .wire--b .wire-v { display: none; }
  .wire--v .wire-h { display: none; }
}

/* Четыре задачи: у каждой своя короткая переписка */
.thread {
  padding: clamp(4rem, 8vw, 6.5rem) 0;
  border-top: 1px solid var(--line);
}

.thread h2 {
  margin-bottom: 2.5rem;
}

.thread .band-lead {
  margin-top: -1.25rem;
}

.cases {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.case {
  display: grid;
  align-content: start;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.case-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
}

.case-icon {
  flex: none;
  color: var(--accent);
}

.case video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--canvas);
  border-radius: var(--radius-xl);
}

.case-answer {
  margin: 0;
  color: var(--muted);
}

@media (min-width: 760px) {
  .cases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .case {
    padding: 1.75rem;
  }
}

/* Путь: пять шагов, между ними отрезки линии. Шаги загораются по очереди слева направо,
   на узком экране сверху вниз. Без скрипта и при reduced motion всё уже горит. */
.rail {
  position: relative;
  display: grid;
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail li {
  position: relative;
  min-height: 3rem;
  padding-left: 4.5rem;
}

.rail li:not(:last-child)::before,
.rail li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 3rem;
  bottom: -2rem;
  left: calc(1.5rem - 1px);
  width: 2px;
  background: var(--line);
}

.rail li:not(:last-child)::after {
  background: var(--accent);
  transform-origin: top;
  transition: transform 600ms cubic-bezier(0.65, 0, 0.35, 1);
  transition-delay: calc(var(--i) * 1s + 0.4s);
}

.rail-dot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  color: var(--accent);
  background: var(--canvas);
  border: 2px solid var(--accent);
  border-radius: 50%;
  transition: color 400ms ease-out, border-color 400ms ease-out, background-color 400ms ease-out, scale 400ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--i) * 1s);
}

.rail li:last-child .rail-dot {
  color: var(--accent-foreground);
  background: var(--accent-brand);
  border-color: var(--accent-brand);
}

.rail-title,
.rail-text {
  transition: opacity 500ms ease-out;
  transition-delay: calc(var(--i) * 1s);
}

.rail-title {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.rail-text {
  max-width: 16rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

html[data-motion="ok"] .rail:not(.is-lit) li::after {
  transform: scaleY(0);
  transition-delay: 0s;
}

html[data-motion="ok"] .rail:not(.is-lit) .rail-dot {
  color: var(--muted);
  background: var(--canvas);
  border-color: var(--line);
  scale: 0.9;
  transition-delay: 0s;
}

html[data-motion="ok"] .rail:not(.is-lit) .rail-title,
html[data-motion="ok"] .rail:not(.is-lit) .rail-text {
  opacity: 0.35;
  transition-delay: 0s;
}

.path-cta {
  display: grid;
  gap: 0.75rem;
  margin-top: 3.5rem;
}

.path-cta .button {
  justify-self: stretch;
  text-align: center;
}

.path-cta .button--secondary,
.path-cta .button--secondary:visited {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.path-cta .button--secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (min-width: 960px) {
  .rail {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .rail li {
    padding: 4.5rem 0 0;
  }

  .rail li:not(:last-child)::before,
  .rail li:not(:last-child)::after {
    top: calc(1.5rem - 1px);
    bottom: auto;
    left: 3rem;
    width: calc(100% - 1.5rem);
    height: 2px;
  }

  .rail li:not(:last-child)::after {
    transform-origin: left;
  }

  html[data-motion="ok"] .rail:not(.is-lit) li::after {
    transform: scaleX(0);
  }

  .rail-title {
    margin-top: 0;
  }

  .path-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
}

/* Финал */
.final {
  display: grid;
  gap: 1.75rem;
  justify-items: center;
  text-align: center;
}

.final-logo {
  display: block;
  width: 7rem;
  height: 7rem;
}

.final h2 {
  max-width: 16em;
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
}

.button--large {
  padding: 18px 32px;
  font-size: 18px;
}

