/* BM VPN — движение: длинные мягкие кривые, без резких скачков. */
:root {
  --out: cubic-bezier(.16, 1, .3, 1);      /* мягкое торможение */
  --spring: cubic-bezier(.34, 1.4, .64, 1); /* лёгкая пружина */
  --ease: var(--out);
}

/* общий «подъём» — мягче, с лёгким размытием */
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.985) } to { opacity: 1; transform: none } }
.wallet, .sheet, .ref-card, .help-card { animation-duration: 1.1s !important; animation-timing-function: var(--out) !important }

/* ---------- появление при прокрутке ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(34px) scale(.98);
  transition: opacity 1s var(--out), transform 1.2s var(--out);
  transition-delay: var(--d, 0s);
  animation: none !important;
}
.js [data-reveal].in { opacity: 1; transform: none }

/* первый экран: строки по очереди, робот выплывает и парит */
.js .hero-copy > * { animation: heroIn 1.1s var(--out) both }
.js .hero-copy > :nth-child(2) { animation-delay: .08s }
.js .hero-copy > :nth-child(3) { animation-delay: .18s }
.js .hero-copy > :nth-child(4) { animation-delay: .28s }
.js .hero-copy > :nth-child(5) { animation-delay: .38s }
@keyframes heroIn { from { opacity: 0; transform: translateY(26px) } to { opacity: 1; transform: none } }
.hero-visual { animation: mascotIn 1.6s .15s var(--out) both }
@keyframes mascotIn { from { opacity: 0; transform: translateY(40px) scale(.94) } to { opacity: 1; transform: none } }
.hero-visual img { animation: float 7s ease-in-out 1.6s infinite }
@keyframes float { 0%, 100% { transform: translateX(-50%) translateY(0) } 50% { transform: translateX(-50%) translateY(-14px) } }
.hero-light { animation: trace 6s ease-in-out infinite }
@keyframes trace { 0%, 100% { opacity: .75 } 50% { opacity: 1 } }

/* смена экрана главная ↔ кабинет */
.view-in { animation: viewIn .8s var(--out) both }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

/* ---------- кнопки: мягкое нажатие и пробегающий блик ---------- */
.button, .pill { position: relative; overflow: hidden; isolation: isolate; transition: transform .5s var(--spring), background .3s, box-shadow .4s var(--out), border-color .3s, color .2s }
.button:active, .pill:active { transform: scale(.96); transition-duration: .12s }
.primary::after, .pill.acid::after, .plan-family .pill::after, .plan-max .pill::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 66%);
  transform: translateX(-120%); transition: transform .9s var(--out);
}
.primary:hover::after, .pill.acid:hover::after, .plan-family .pill:hover::after, .plan-max .pill:hover::after { transform: translateX(120%) }
/* постоянное «дыхание» тени убрано: оно перерисовывало кнопки каждый кадр */
@keyframes breatheGlow { 50% { box-shadow: 0 12px 40px -8px rgba(215, 250, 85, .75) } }

/* ---------- карточки: свет за курсором и лёгкий 3D-наклон ---------- */
.plan, .feature, .how-steps li, .help-card { position: relative; transform-style: preserve-3d }
.plan::after, .feature::after, .how-steps li::after, .help-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(215, 250, 85, .13), transparent 60%);
  opacity: 0; transition: opacity .5s var(--out);
}
.plan:hover::after, .feature:hover::after, .how-steps li:hover::after, .help-card:hover::after { opacity: 1 }
.plan > *, .feature > *, .how-steps li > * { position: relative; z-index: 1 }
.plan, .feature {
  transition: transform .9s var(--out), box-shadow .6s var(--out), border-color .4s, opacity 1s var(--out), filter 1s var(--out) !important;
}
.plan.tilt, .feature.tilt {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px) !important;
  transition: transform .25s var(--out), box-shadow .6s var(--out), border-color .4s !important;
}
.plan:hover { transform: translateY(-6px) }

/* цены и подписи меняются плавно */
.plan-price b { display: inline-block; font-variant-numeric: tabular-nums }
.plan-total.swap { animation: swapIn .6s var(--out) }
@keyframes swapIn { from { opacity: 0; transform: translateY(6px); filter: blur(4px) } to { opacity: 1; transform: none; filter: none } }

/* ---------- переключатель срока: скользящая таблетка ---------- */
.period { position: relative }
.seg-thumb {
  position: absolute; z-index: 0; top: 4px; left: 4px; bottom: 4px; border-radius: 999px; background: var(--acid);
  box-shadow: 0 6px 20px -6px rgba(215, 250, 85, .6); opacity: 0;
  transition: transform .6s var(--spring), width .6s var(--spring), opacity .3s;
}
.seg-thumb.ready { opacity: 1 }
.period-btn { position: relative; z-index: 1; transition: color .4s var(--out) }
.period:has(.seg-thumb.ready) .period-btn[aria-checked="true"] { background: transparent; box-shadow: none }

/* ---------- окна: плавно открываются И закрываются ---------- */
dialog, dialog.sheet-dlg {
  opacity: 0; transform: translateY(24px) scale(.97);
  transition: opacity .45s var(--out), transform .6s var(--out), overlay .45s allow-discrete, display .45s allow-discrete;
  animation: none !important;
}
dialog[open], dialog.sheet-dlg[open] { opacity: 1; transform: none }
@starting-style { dialog[open], dialog.sheet-dlg[open] { opacity: 0; transform: translateY(24px) scale(.97) } }
dialog::backdrop { opacity: 0; transition: opacity .45s var(--out), overlay .45s allow-discrete, display .45s allow-discrete }
dialog[open]::backdrop { opacity: 1 }
@starting-style { dialog[open]::backdrop { opacity: 0 } }
@media (max-width: 700px) {
  dialog.sheet-dlg { transform: translateY(100%); transition: opacity .3s var(--out), transform .65s var(--out), overlay .5s allow-discrete, display .5s allow-discrete }
  dialog.sheet-dlg[open] { transform: none }
  @starting-style { dialog.sheet-dlg[open] { transform: translateY(100%) } }
}

/* строки в окне выбора устройства появляются по очереди */
.sheet-dlg[open] .ad-kinds .row { animation: rise .7s var(--out) both }
.sheet-dlg[open] .ad-kinds .row:nth-child(2) { animation-delay: .05s }
.sheet-dlg[open] .ad-kinds .row:nth-child(3) { animation-delay: .1s }
.sheet-dlg[open] .ad-kinds .row:nth-child(4) { animation-delay: .15s }
#ad-steps:not([hidden]) .steps > li { animation: rise .7s var(--out) both }
#ad-steps:not([hidden]) .steps > li:nth-child(2) { animation-delay: .08s }
#ad-steps:not([hidden]) .steps > li:nth-child(3) { animation-delay: .16s }

/* вопросы раскрываются плавно */
/* (высоту анимирует app.js — одинаково плавно во всех браузерах, включая iPhone) */
.faq details { overflow: hidden }
.faq details p { transition: opacity .45s var(--out), transform .55s var(--out) }
.faq details:not(.is-open) p { opacity: 0; transform: translateY(-6px) }
.faq details.is-open p { opacity: 1; transform: none }

/* нижнее меню: активная кнопка мягко «перетекает» */
.tabbar a, .tabbar button { transition: background .5s var(--out), color .4s, box-shadow .5s var(--out), transform .4s var(--spring) }
.tabbar a:active, .tabbar button:active { transform: scale(.92) }

/* экран успеха — мягче */
.success { animation: reveal .9s var(--out) both }
.success.out { animation: fadeOut .5s var(--out) forwards }
@keyframes fadeOut { to { opacity: 0; transform: scale(1.03); filter: blur(6px) } }

@media (hover: none) { .plan.tilt, .feature.tilt { transform: none !important } }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; filter: none; transition: none }
  .hero-visual img { animation: none }
  .primary { animation: none }
}

/* ---------- нижнее меню на телефоне ---------- */
@media (max-width: 700px) {
  .tabbar {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 22px) !important;
    padding: 6px !important; gap: 2px !important;
    animation: tabIn .9s .25s var(--out) both;
  }
  @keyframes tabIn { from { opacity: 0; transform: translate(-50%, 40px) scale(.94) } to { opacity: 1; transform: translate(-50%, 0) } }
  /* кислотная «таблетка» сама переезжает к выбранному разделу */
  .tab-thumb {
    position: absolute; z-index: 0; top: 6px; left: 0; width: 74px; height: 54px; border-radius: 22px;
    background: var(--acid); box-shadow: 0 0 22px -4px rgba(215, 250, 85, .7);
    opacity: 0; transition: transform .6s var(--spring), width .6s var(--spring), opacity .3s;
  }
  .tab-thumb.ready { opacity: 1 }
  .tabbar a, .tabbar button { position: relative; z-index: 1 }
  .tabbar:has(.tab-thumb.ready) .on { background: transparent !important; box-shadow: none !important; color: var(--dark) }
  /* подвал не прячется под меню, уведомление — над меню */
  body:has(#cabinet:not([hidden])) .footer { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 104px) }
  body:has(#cabinet:not([hidden])) .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 100px) }
  .cab .wallet, .cab .sheet, .cab .ref-card, .cab .help-card { scroll-margin-top: 12px }
}
@media (prefers-reduced-motion: reduce) { .tabbar { animation: none !important } }

/* меню из трёх кнопок: шире и ровнее */
.tabbar[hidden] { display: none !important }
@media (max-width: 700px) {
  .tabbar a, .tabbar button { width: 96px !important }
  .tab-thumb { width: 96px }
}

/* ---------- наведение: заметнее на тёмном фоне ---------- */
.plan::after, .feature::after, .how-steps li::after, .help-card::after {
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), rgba(215, 250, 85, .22), rgba(215, 250, 85, .05) 45%, transparent 70%);
}
/* подъём при наведении сильнее появления при прокрутке */
.js .plan.in:hover, .js .feature.in:hover, .js .how-steps li.in:hover { transform: translateY(-6px) }
.plan:hover, .feature:hover, .how-steps li:hover, .help-card:hover {
  border-color: rgba(215, 250, 85, .38) !important;
  box-shadow: 0 26px 60px -22px rgba(0, 0, 0, .9), 0 0 0 1px rgba(215, 250, 85, .12), 0 18px 50px -24px rgba(215, 250, 85, .35) !important;
}
.how-steps li, .help-card { transition: transform .9s var(--out), box-shadow .6s var(--out), border-color .4s, opacity 1s var(--out), filter 1s var(--out) }
/* кабинет: блоки тоже отзываются на мышь */
.row, .w-chip, .ref-card, .wallet .pill, .sheet .pill { transition: background .35s var(--out), border-color .35s, box-shadow .45s var(--out), transform .45s var(--spring) }
.row:hover { background: rgba(215, 250, 85, .06) !important }
.pill:hover { transform: translateY(-2px) }
.pill.dark:hover, .quiet:hover { border-color: rgba(215, 250, 85, .45) !important; box-shadow: 0 10px 30px -12px rgba(215, 250, 85, .4) !important }
.pill.white:hover { box-shadow: 0 12px 34px -12px rgba(255, 255, 255, .45) }
