/* TUNDRA AI · premium interaction layer
   Переключатель языка · командная палитра · тосты · кнопка наверх ·
   мобильный CTA · подсветка карточек · поиск по моделям */

/* защита от «мигания» русским текстом при автопереключении на EN */
html.i18n-pending body { visibility: hidden; }

/* ───────────────────────── переключатель языка ───────────────────────── */
.lang-sw {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 2px;
  margin-left: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 240, 220, .035);
}
.lang-sw button {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--soft);
  transition: color .25s var(--ease);
}
.lang-sw button:hover { color: var(--cream); }
.lang-sw button.on { color: #1F1104; }
.lang-sw-pill {
  position: absolute;
  z-index: 0;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  border-radius: 999px;
  background: var(--grad);
  box-shadow: 0 4px 14px rgba(255, 122, 41, .3);
  transition: transform .38s var(--ease-out);
}
.lang-sw[data-active="en"] .lang-sw-pill { transform: translateX(100%); }
.lang-sw button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

@media (max-width: 560px) {
  .lang-sw { padding: 0; border: 0; background: none; }
  .lang-sw .lang-sw-pill { display: none; }
  .lang-sw button.on { display: none; }
  .lang-sw button {
    color: var(--cream);
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: rgba(255, 240, 220, .04);
  }
}

/* ─── подсказка ⌘K живёт в поле поиска моделей, а не в шапке (там нет места) ─── */
.kbd-hint {
  flex: none;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 240, 220, .04);
  color: var(--soft);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.kbd-hint:hover { color: var(--cream); border-color: rgba(255, 178, 92, .38); background: rgba(255, 138, 60, .09); }
.model-find:focus-within .kbd-hint { opacity: 0; pointer-events: none; }
@media (max-width: 640px) { .kbd-hint { display: none; } }

/* ───────────────────────── командная палитра ───────────────────────── */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: none;
  padding: 12vh 20px 20px;
  justify-content: center;
  align-items: flex-start;
  background: rgba(6, 5, 4, .68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .22s var(--ease);
}
.cmdk.show { display: flex; opacity: 1; }
.cmdk-box {
  width: min(620px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(255, 214, 170, .14);
  background: linear-gradient(180deg, rgba(29, 24, 20, .98), rgba(19, 16, 13, .98));
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 240, 220, .06);
  overflow: hidden;
  transform: translateY(-10px) scale(.985);
  opacity: 0;
  transition: transform .3s var(--ease-out), opacity .3s var(--ease-out);
}
.cmdk.show .cmdk-box { transform: none; opacity: 1; }
.cmdk-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line2);
}
.cmdk-top svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--soft); stroke-width: 2; }
.cmdk-top input {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
}
.cmdk-top input::placeholder { color: var(--soft); }
.cmdk-esc {
  flex: none;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 7px;
}
.cmdk-list { overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.cmdk-list::-webkit-scrollbar { width: 8px; }
.cmdk-list::-webkit-scrollbar-thumb { background: rgba(255, 178, 92, .18); border-radius: 8px; }
.cmdk-group {
  padding: 12px 12px 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--soft);
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 13px;
  background: none;
  color: var(--muted);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.cmdk-item .ci-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line2);
  background: rgba(255, 138, 60, .07);
  color: var(--amber);
}
.cmdk-item .ci-ic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.cmdk-item .ci-sub {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--soft);
  white-space: nowrap;
}
.cmdk-item.sel, .cmdk-item:hover { background: rgba(255, 138, 60, .1); color: var(--cream); }
.cmdk-item.sel .ci-ic { border-color: rgba(255, 178, 92, .4); }
.cmdk-empty { padding: 28px 14px; text-align: center; color: var(--soft); font-size: 13px; }
.cmdk-foot {
  display: flex;
  gap: 16px;
  padding: 11px 18px;
  border-top: 1px solid var(--line2);
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--soft);
  letter-spacing: .04em;
}
.cmdk-foot b { color: var(--muted); font-weight: 700; }
@media (max-width: 640px) { .cmdk { padding-top: 8vh; } .cmdk-foot { display: none; } }

/* ───────────────────────── тосты ───────────────────────── */
.toast-host {
  position: fixed;
  z-index: 240;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 90vw;
  padding: 11px 17px;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 170, .16);
  background: rgba(26, 21, 17, .96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  color: var(--cream);
  font-size: 13px;
  font-weight: 600;
  animation: toastIn .34s var(--ease-out) both;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast svg { width: 15px; height: 15px; flex: none; fill: none; stroke: var(--ok); stroke-width: 2.4; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ───────────────────────── кнопка «наверх» ───────────────────────── */
/* bottom рассчитан так, чтобы не сесть на виджет поддержки (.tsw-root: right/bottom 20px, ~56px) */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 90;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(22, 18, 15, .9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  cursor: pointer;
  opacity: 0;
  transform: translateY(14px) scale(.9);
  pointer-events: none;
  transition: opacity .32s var(--ease), transform .32s var(--ease-out);
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-2px); }
.to-top svg.arw { position: relative; z-index: 1; width: 17px; height: 17px; fill: none; stroke: var(--amber); stroke-width: 2.2; }
.to-top svg.ring { position: absolute; inset: 0; width: 48px; height: 48px; transform: rotate(-90deg); }
.to-top svg.ring circle { fill: none; stroke-width: 2.5; }
.to-top svg.ring .bg { stroke: rgba(255, 214, 170, .1); }
.to-top svg.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
@media (max-width: 640px) { .to-top { right: 16px; bottom: 154px; width: 42px; height: 42px; } .to-top svg.ring { width: 42px; height: 42px; } }
/* когда снизу поднята панель покупки — уводим и виджет, и кнопку выше неё.
   var(--tundra-cookie-h) ставит cookie-consent.js — сохраняем его сдвиг под баннер */
@media (max-width: 720px) {
  body.dock-on .tsw-root { bottom: calc(86px + var(--tundra-cookie-h, 0px)); transition: bottom .4s var(--ease-out); }
  body.dock-on .to-top { bottom: 154px; }
}
/* палитра важнее виджета: у него z-index 2147483000, перебить можно только пряча */
body.cmdk-open .tsw-root { opacity: 0; pointer-events: none; transition: opacity .2s; }

/* ───────────────────────── мобильная панель покупки ───────────────────────── */
.buy-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(14, 12, 10, .93);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateY(110%);
  transition: transform .4s var(--ease-out);
}
.buy-dock.show { transform: none; }
.buy-dock .bd-txt { flex: 1; min-width: 0; }
.buy-dock .bd-txt b { display: block; font-size: 12.5px; font-weight: 800; color: var(--cream); }
.buy-dock .bd-txt span { display: block; margin-top: 2px; font-size: 10.5px; color: var(--soft); }
.buy-dock .btn { min-height: 40px; padding: 0 18px; font-size: 12.5px; white-space: nowrap; }
@media (max-width: 720px) { .buy-dock { display: flex; } }

/* ───────────────────────── подсветка карточек курсором ───────────────────────── */
.spot { position: relative; }
.spot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s var(--ease);
  background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 160, 80, .11), transparent 62%);
}
.spot:hover::after { opacity: 1; }
@media (hover: none) { .spot::after { display: none; } }

/* ───────────────────────── поиск по моделям ───────────────────────── */
.model-find {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-width: 190px;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 240, 220, .03);
  transition: border-color .25s, background .25s;
}
.model-find:focus-within { border-color: rgba(255, 178, 92, .45); background: rgba(255, 138, 60, .06); }
.model-find svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--soft); stroke-width: 2; }
.model-find input {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
}
.model-find input::placeholder { color: var(--soft); font-weight: 500; }
.mcard.hide-find { display: none !important; }
.models-none {
  grid-column: 1 / -1;
  padding: 34px 18px;
  text-align: center;
  color: var(--soft);
  font-size: 14px;
}
@media (max-width: 640px) { .model-find { width: 100%; min-width: 0; } }

/* ───────────────────────── магнитные CTA ───────────────────────── */
.btn-fire.magnetic { will-change: transform; }

/* ───────────────────────── уважение к prefers-reduced-motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .lang-sw-pill { transition: none; }
  .btn-fire.magnetic { transform: none !important; }
  .buy-dock, .to-top, .cmdk, .cmdk-box { transition: none; }
}


}
