/* Две программы и что между ними передаётся (блок link). Только свои классы w-link*, цвета и шрифты переменными сайта.
   Без скрипта (.w-link без .is-js): связка по умолчанию со сценариями и ссылками, поля выбора выключены. Выбор включает w-link.js. */
.w-link:not(.is-js) .w-link__js { display: none; }
.w-link.is-js .w-link__nojs { display: none; }
.w-link__vh { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.w-link__head { display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin-bottom: 32px; }
.w-link__intro { font-size: 19px; color: var(--muted); text-wrap: pretty; }
.w-link__stage { display: grid; grid-template-columns: minmax(0, .78fr) minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "pick res" "nums res"; gap: 22px 20px; background: var(--cob); border-radius: 36px; padding: clamp(16px, 2.6vw, 32px); }
.w-link__win { scroll-margin-top: 92px; }
.w-link__whd { min-height: 68px; }
.w-link__hd { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.w-link__t { font-family: var(--hf); font-weight: 700; font-size: 18px; line-height: 1.2; }
.w-link__hd small { font-size: 13.5px; color: var(--muted); line-height: 1.3; }
.w-link__lg { width: 30px; height: 30px; border-radius: 8px; }

/* окно выбора. Список раскрывается поверх соседей, поэтому окно не обрезает содержимое и лежит выше окна результата */
.w-link .w-link__pick { grid-area: pick; position: relative; z-index: 2; overflow: visible; }
.w-link__fields { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.w-link-f { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.w-link-f__l { font-size: 14px; line-height: 1.3; color: var(--muted); }
.w-link-f__box { position: relative; }
.w-link-f__btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 7px 14px 7px 7px; border: 2px solid transparent;
  border-radius: 18px; background: var(--stone); color: var(--ink); text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.w-link-f__btn:disabled { cursor: default; }
.w-link-f__btn:focus-visible { outline: 3px solid var(--cob); outline-offset: 3px; border-radius: 18px; }
.w-link-f__btn[aria-expanded="true"] { background: var(--white); border-color: var(--cob); }
.w-link__tile { width: 46px; height: 46px; border-radius: 13px; }
.w-link-f__v { flex: 1; min-width: 0; font-family: var(--hf); font-weight: 700; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.w-link-f__chev { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .2s var(--ease, ease); }
.w-link-f__btn[aria-expanded="true"] .w-link-f__chev { transform: rotate(180deg); stroke: var(--cob); }
@media (hover: hover) { .w-link-f__btn:enabled:hover { background: var(--tint); } .w-link-f__btn[aria-expanded="true"]:hover { background: var(--white); } }

/* быстрые кнопки: программы, у которых есть связка с программой из соседнего поля */
.w-link-q { --q: 46px; display: flex; gap: 6px; min-height: 46px; }
.w-link-f.is-open .w-link-q { visibility: hidden; }      /* ряд под раскрытым списком не выглядывает из-под него */
.w-link-q__b { position: relative; display: grid; place-items: center; flex: 1 1 var(--q); min-width: var(--q); max-width: 60px; height: 46px; padding: 0; border: 2px solid transparent;
  border-radius: 14px; background: var(--stone); cursor: pointer; transition: background .15s, border-color .15s, transform .16s var(--ease, ease); }
.w-link-q__b .w-link__lg { width: 28px; height: 28px; border-radius: 7px; }
.w-link-q__b[aria-pressed="true"] { background: var(--white); border-color: var(--cob); }
/* отметка выбранной программы: кобальтовый кружок с галочкой, как в блоке order */
.w-link-q__b[aria-pressed="true"]::before { content: ""; position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--white); background: var(--cob); }
.w-link-q__b[aria-pressed="true"]::after { content: ""; position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; background: var(--white);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 11px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 11px no-repeat; }
.w-link-q__b:focus-visible { outline: 3px solid var(--cob); outline-offset: 3px; border-radius: 14px; }
.w-link-q__b:active { transform: scale(.94); }
@media (hover: hover) { .w-link-q__b[aria-pressed="false"]:hover { background: var(--tint); } }

/* поменять местами */
.w-link__swap { display: flex; align-items: center; gap: 12px; }
.w-link__swap::before, .w-link__swap::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.w-link__swapb { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--tint);
  color: var(--cob); cursor: pointer; transition: background .15s, color .15s; }
.w-link__swapb svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .34s var(--ease, ease); }
.w-link__swapb.is-turn svg { transform: rotate(180deg); }
.w-link__swapb:focus-visible { outline: 3px solid var(--cob); outline-offset: 3px; border-radius: 50%; }
.w-link__swapb:active { background: var(--cob); color: var(--white); }
@media (hover: hover) { .w-link__swapb:hover { background: var(--cob); color: var(--white); } }
.w-link__note { padding: 12px 14px; border-radius: 14px; background: var(--stone); font-size: 14px; line-height: 1.4; color: var(--muted); }

/* список программ с поиском */
.w-link-pop { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 6px); display: flex; flex-direction: column; max-height: min(408px, 64vh);
  background: var(--white); border: 2px solid var(--cob); border-radius: 20px; overflow: hidden; }
.w-link-pop[hidden] { display: none; }
.w-link-pop__s { position: relative; flex: none; padding: 10px 10px 8px; }
.w-link-pop__s svg { position: absolute; left: 26px; top: 24px; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round;
  pointer-events: none; }
.w-link-pop__in { display: block; width: 100%; height: 46px; padding: 0 16px 0 44px; border: 2px solid transparent; border-radius: 999px; background: var(--stone);
  font-size: 16px; line-height: 1.2; }
.w-link-pop__in::placeholder { color: var(--muted); opacity: 1; }
.w-link-pop__in:focus, .w-link-pop__in:focus-visible { outline: 0; border-radius: 999px; background: var(--tint); }
.w-link-pop__list { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 6px; scrollbar-width: thin; }
.w-link-pop__list[hidden], .w-link-pop__grp[hidden], .w-link-o[hidden], .w-link-pop__empty[hidden] { display: none; }
.w-link-pop__g { position: sticky; top: 0; z-index: 1; padding: 9px 10px 6px; background: var(--white); font-size: 13px; line-height: 1.3; font-weight: 600; color: var(--muted); }
.w-link-o { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border-radius: 12px; font-size: 16px; font-weight: 500; line-height: 1.25;
  cursor: pointer; }
.w-link-o .w-link__lg { width: 28px; height: 28px; border-radius: 7px; }
.w-link-o__n { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.w-link-o__m { flex: none; font-size: 13px; font-weight: 500; color: var(--muted); }
.w-link-o.is-active { background: var(--tint); }
.w-link-o[aria-selected="true"] { font-weight: 700; }
.w-link-o[aria-selected="true"]::after { content: ""; flex: none; width: 20px; height: 20px; background: var(--cob);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.w-link-pop__empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 8px 16px 16px; font-size: 15px; line-height: 1.4; color: var(--muted); }
.w-link-pop__empty .pill:focus-visible { outline: 3px solid var(--cob); outline-offset: 3px; border-radius: 999px; }

/* окно результата */
.w-link__res { grid-area: res; display: flex; flex-direction: column; }
.w-link__rhd { flex-wrap: wrap; gap: 10px 14px; min-height: 68px; }
.w-link__duo { display: inline-flex; align-items: center; flex: none; }
.w-link__tl { width: 46px; height: 46px; border-radius: 13px; }
.w-link__tl--none { border-style: dashed; border-color: var(--muted); background: var(--stone); }
.w-link__seam { flex: none; width: 44px; height: 46px; fill: none; stroke: var(--cob); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.w-link__res:not([data-state="pair"]) .w-link__seam { stroke: var(--muted); stroke-dasharray: 2.4 5.2; }
.w-link__rt { flex: 1 1 200px; min-width: 0; font-family: var(--hf); font-weight: 700; font-size: 19px; line-height: 1.2; overflow-wrap: anywhere; }
.w-link__rb { display: flex; flex-direction: column; padding: 18px 18px 0; }
.w-link__lead { font-size: 18px; line-height: 1.4; font-weight: 500; text-wrap: pretty; }
.w-link__p { margin-top: 8px; font-size: 16px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.w-link__sc { margin: 16px 0 0; padding: 0; list-style: none; }
.w-link__sc li { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.w-link__sc div { flex: 1; min-width: 0; }
.w-link__sc b { display: block; font-weight: 600; font-size: 16px; line-height: 1.3; }
.w-link__sc div > span { display: block; margin-top: 2px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.w-link__sys { display: flex; flex-direction: column; margin-top: 16px; padding-bottom: 6px; }
.w-link__sysa { display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 9px 0; border-top: 1px solid var(--line); font-weight: 600; font-size: 16px;
  line-height: 1.3; text-decoration: none; }
.w-link__sysn { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.w-link__sysa .arr { stroke: var(--cob); transition: transform .2s var(--ease, ease); }
.w-link__sysa:hover .arr { transform: translateX(3px); }
.w-link__sysa:focus-visible, .w-link__more:focus-visible { outline: 3px solid var(--cob); outline-offset: 3px; border-radius: 8px; }
.w-link__rf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: auto; padding: 14px 18px 18px;
  border-top: 1px solid var(--line); }
.w-link__more { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; font-size: 16px; line-height: 1.25; color: var(--cob);
  text-decoration: none; }
.w-link__more:hover { color: var(--cob-d); }
.w-link__more .arr { width: 18px; height: 18px; transition: transform .2s var(--ease, ease); }
.w-link__more:hover .arr { transform: translateX(3px); }
.w-link__cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; margin-left: auto; }
.w-link__cta:focus-visible { outline: 3px solid var(--cob); outline-offset: 3px; border-radius: 999px; }

/* счётчик каталога на кобальте и подпись под панелью */
.w-link__nums { grid-area: nums; align-self: end; display: flex; flex-wrap: wrap; gap: 12px 36px; margin: 0; padding: 0 2px; color: var(--white); }
.w-link__nums div { display: flex; flex-direction: column-reverse; gap: 2px; }
.w-link__nums dt { font-size: 14px; line-height: 1.3; color: var(--on-cob); }
.w-link__nums dd { margin: 0; font-family: var(--hf); font-weight: 800; letter-spacing: -0.02em; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.w-link__cap { max-width: 760px; margin: 12px auto 0; font-size: 14px; color: var(--muted); text-align: center; text-wrap: balance; }
.w-link__cap a { font-weight: 600; white-space: nowrap; }

/* смена выбора: плитка приезжает и защёлкивается, шов прорисовывается, строки появляются по очереди */
.w-link__res.is-in .w-link__rb > *, .w-link__res.is-in .w-link__rf, .w-link__res.is-in .w-link__rt { animation: w-link-in .36s var(--ease, ease) both; }
.w-link__res.is-in .w-link__sc, .w-link__res.is-in .w-link__sys, .w-link__res.is-in .w-link__p { animation-delay: .06s; }
.w-link__res.is-in .w-link__rf { animation-delay: .12s; }
.w-link__res.is-in[data-state="pair"] .w-link__seam path { stroke-dasharray: 100; animation: w-link-draw .5s var(--ease, ease) both; }
.w-link__res.is-in[data-ch~="a"] .w-link__duo > :first-child { animation: w-link-dock-a .42s var(--dock, ease) both; }
.w-link__res.is-in[data-ch~="b"] .w-link__duo > :last-child { animation: w-link-dock-b .42s var(--dock, ease) both; }
.w-link-pop.is-in { animation: w-link-pop .16s var(--ease, ease) both; }
@keyframes w-link-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes w-link-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes w-link-dock-a { from { opacity: 0; transform: translateX(-14px); } }
@keyframes w-link-dock-b { from { opacity: 0; transform: translateX(14px); } }
@keyframes w-link-pop { from { opacity: 0; transform: translateY(-6px); } }

/* окно выбора шире 600 px (планшет, одна колонка): поля в ряд */
@container (min-width: 600px) {
  .w-link__fields { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 12px 16px; }
  .w-link__swap { margin-top: 36px; }
  .w-link__swap::before, .w-link__swap::after { display: none; }
  .w-link__swapb svg { transform: rotate(90deg); }
  .w-link__swapb.is-turn svg { transform: rotate(270deg); }
  .w-link__note { grid-column: 1 / -1; }
}
@container (max-width: 420px) {
  .w-link__rf { flex-direction: column; align-items: stretch; }
  .w-link__cta { margin-left: 0; white-space: normal; text-align: center; }
}
@container (max-width: 330px) {      /* самые узкие телефоны: длинное название программы встаёт в поле целиком */
  .w-link-f__v { font-size: 16px; }
  .w-link-f__btn { gap: 10px; padding-right: 10px; }
}
@media (max-width: 900px) {
  .w-link__stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "pick" "res" "nums"; gap: 14px; border-radius: 28px; }
  .w-link__t { font-size: 17px; }
  .w-link__fields { padding: 16px 14px; }
  .w-link__rhd { padding-left: 14px; padding-right: 14px; }
  .w-link__rb { padding: 16px 14px 0; }
  .w-link__rf { padding: 12px 14px 14px; }
  .w-link__lead { font-size: 17px; }
  .w-link__nums { gap: 10px 28px; padding: 8px 2px 4px; }
  .w-link__nums dd { font-size: 30px; }
  .w-link__cap a { display: block; width: fit-content; margin: 0 auto; padding: 12px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .w-link-f__btn, .w-link-f__chev, .w-link-q__b, .w-link__swapb, .w-link__swapb svg, .w-link__sysa .arr, .w-link__more .arr { transition: none; }
  .w-link__res.is-in .w-link__rb > *, .w-link__res.is-in .w-link__rf, .w-link__res.is-in .w-link__rt, .w-link__res.is-in .w-link__seam path,
  .w-link__res.is-in .w-link__duo > *, .w-link-pop.is-in { animation: none; }
}
