/*
  Стили к site-src/ui.js и точечные исправления макетов (мобильная вёрстка, кликабельные фото).
  Стили макетов лежат в шаблоне страницы и подключаются позже этого файла — где нужно, !important.
*/

/* ---------- Плавные якоря: раздел не прячется под липкой шапкой ---------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
#dc-root [id] { scroll-margin-top: 96px; }

/* ---------- Cookie: согласие уже дано ---------- */
html.ps-ck-done .ck { display: none !important; }

/* ---------- Всплывающее «Скопировано» ---------- */
.ps-toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 200; transform: translateX(-50%);
  display: inline-flex; align-items: center; height: 46px; padding: 0 20px; border-radius: 999px;
  background: #0E1220; color: #FFFFFF; font: 500 14px/1 'Onest', system-ui, sans-serif; white-space: nowrap;
  box-shadow: 0 12px 32px rgba(14, 18, 32, .24); animation: ps-toast-in .28s cubic-bezier(.2, .8, .2, 1) both; transition: opacity .25s;
}
.ps-toast.out { opacity: 0; }
@keyframes ps-toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }
[data-copy] { cursor: copy; border-radius: 6px; transition: background-color .16s, color .16s; }
[data-copy]:hover { color: #2F5BFF; background: #F2F5FF; }

/* ---------- Подсказки поиска ---------- */
.ps-sug {
  position: fixed; z-index: 140; max-height: min(420px, 60vh); overflow: auto; padding: 6px; box-sizing: border-box;
  border-radius: 24px; background: #FFFFFF; box-shadow: 0 24px 60px rgba(14, 18, 32, .18), 0 0 0 1px #EDEFF3;
  font-family: 'Onest', system-ui, sans-serif; color: #0E1220; animation: ps-sug-in .18s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes ps-sug-in { from { opacity: 0; transform: translateY(-4px); } }
.ps-sug-i { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; color: #0E1220; text-decoration: none; text-align: left; }
.ps-sug-i:hover, .ps-sug-i.on { background: #F2F5FF; color: #0E1220; }
.ps-sug-i img, .ps-sug-g { width: 32px; height: 32px; flex: none; display: block; }
.ps-sug-g { border-radius: 50%; background: #E6ECFF; color: #1F45D6; display: inline-flex; align-items: center; justify-content: center; }
.ps-sug-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ps-sug-t b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-sug-t small { font-size: 12.5px; color: #5A6175; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-sug-p { font-size: 14px; font-weight: 600; white-space: nowrap; }
.ps-sug-none { padding: 14px 16px; font-size: 14px; line-height: 21px; color: #5A6175; text-align: left; }

/* ---------- Мобильное меню (макет site-14) поверх страницы ---------- */
html.ps-menu-lock, html.ps-menu-lock body { overflow: hidden; }
.ps-menu-wrap { position: fixed; inset: 0; z-index: 150; font-family: 'Onest', ui-sans-serif, system-ui, sans-serif; color: #0E1220; }
.ps-menu-wrap[hidden] { display: none; }
.ps-menu-back { position: absolute; inset: 0; background: rgba(14, 18, 32, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
.ps-menu {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #FFFFFF; display: flex; flex-direction: column;
  box-shadow: -24px 0 60px rgba(14, 18, 32, .18); transform: translateX(100%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.ps-menu-wrap.on .ps-menu-back { opacity: 1; }
.ps-menu-wrap.on .ps-menu { transform: none; }
@media (prefers-reduced-motion: reduce) { .ps-menu, .ps-menu-back { transition: none; } }
.ps-menu-hd { height: 64px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; flex: none; margin-top: env(safe-area-inset-top); }
.ps-menu-logo { display: flex; align-items: center; gap: 8px; color: #0E1220; text-decoration: none; }
.ps-menu-logo span { display: inline-flex; align-items: center; gap: 5px; }
.ps-menu-logo b { font-size: 20px; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.ps-menu-logo i { font-style: normal; font-size: 9px; font-weight: 500; letter-spacing: .04em; line-height: 1; color: #FFFFFF; background: #2F5BFF; border-radius: 5px; padding: 4px 5px; }
.ps-menu-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #FFFFFF; box-shadow: inset 0 0 0 1px #E3E6ED; color: #0E1220; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ps-menu-bd { flex: 1; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 20px; overflow: auto; overscroll-behavior: contain; }
.ps-msearch { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: 999px; background: #F5F6F9; flex: none; }
.ps-msearch input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 16px/1 'Onest', system-ui, sans-serif; color: #0E1220; }
.ps-menu-me { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; background: #F2F5FF; color: #0E1220; text-decoration: none; }
.ps-menu-me > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ps-menu-me b { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-menu-me small { font-size: 13px; color: #5A6175; }
.ps-menu-ava { width: 40px; height: 40px; border-radius: 50%; background: #E6ECFF; color: #1F45D6; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; flex: none; }
.ps-menu nav { display: flex; flex-direction: column; }
.ps-menu .mi { display: flex; align-items: center; justify-content: space-between; height: 60px; border-bottom: 1px solid #EDEFF3; color: #0E1220; text-decoration: none; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.ps-menu .mi:hover { color: #2F5BFF; }
.ps-menu-bal { font-size: 15px; font-weight: 500; color: #5A6175; letter-spacing: 0; }
.ps-menu-25 { height: 26px; padding: 0 10px; border-radius: 8px; background: #FF7A45; color: #0E1220; font: 600 13px/26px 'Onest', system-ui, sans-serif; letter-spacing: 0; }
.ps-menu .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 20px; border-radius: 999px; border: 0; font: 600 16px/1 'Onest', system-ui, sans-serif; cursor: pointer; text-decoration: none; white-space: nowrap; box-sizing: border-box; }
.ps-menu .btn-primary { background: #2F5BFF; color: #FFFFFF; }
.ps-menu .btn-ghost { background: #FFFFFF; color: #0E1220; box-shadow: inset 0 0 0 1px #E3E6ED; }
.ps-menu .btn-dark { background: #0E1220; color: #FFFFFF; flex: none; }
.ps-menu-ft { padding: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border-top: 1px solid #EDEFF3; flex: none; }

/* ---------- Главная: фото и флаги ведут на eSIM страны ---------- */
.ps-hero-in { pointer-events: none; }
.ps-hero-in > * { pointer-events: auto; }
.ps-hero-in > h1, .ps-hero-in > p { pointer-events: none; }
.hero-stage a { cursor: pointer; }
.hero-stage a .pop { transition: filter .25s; }
.hero-stage a:hover .pop { filter: drop-shadow(0 22px 34px rgba(47, 91, 255, .35)); }
a.ps-mq { color: #0E1220 !important; text-decoration: none; transition: background-color .16s, transform .2s cubic-bezier(.2, .8, .2, 1); }
a.ps-mq:hover { background: #E6ECFF !important; transform: translateY(-2px); }
a.pc { text-decoration: none; cursor: pointer; transition: box-shadow .25s; }
a.pc:hover { box-shadow: 0 30px 60px rgba(14, 18, 32, .35); }
.cta-cards { pointer-events: none; }
.cta-cards a.pc { pointer-events: auto; }

/* ---------- «Как это работает»: шаги нажимаются ---------- */
#how li.hs { cursor: pointer; }
#how li.hs:focus-visible { outline: 2px solid #2F5BFF; outline-offset: 2px; }
#how .how-dots i { cursor: pointer; }
/* Телефон, экраны листаются прокруткой: в конце остаётся последний экран, а не пустой */
@keyframes psScrHold { 0% { opacity: 0; transform: translateX(28px); } 3%, 100% { opacity: 1; transform: none; } }
@keyframes psCapHold { 0% { opacity: 0; transform: translateY(8px); } 3%, 100% { opacity: 1; transform: none; } }
@keyframes psDotHold { 0% { width: 8px; background: #C9D5FF; } 3%, 100% { width: 28px; background: #2F5BFF; } }
@supports (animation-timeline: view()) {
  @media (max-width: 599px) {
    #how .how-grid .scr.hk3 { animation-name: psScrHold !important; }
    #how .how-grid .how-c.hk3 { animation-name: psCapHold !important; }
    #how .how-grid .how-dots i.hk3 { animation-name: psDotHold !important; }
  }
}

/* ---------- Вопросы-ответы на телефоне: левая колонка не «липнет» и не наезжает на ответы ---------- */
@media (max-width: 899px) {
  #faq .wrap > .rv:first-child { position: static !important; }
}
@media (max-width: 599px) {
  #faq details.faq-i p { margin-left: 48px !important; }
}

/* ---------- Чат поддержки на телефоне: открывается снизу, над кнопкой ---------- */
@media (max-width: 599px) {
  .cw-pop {
    top: auto !important; left: 12px !important; right: 12px !important; bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    height: min(560px, calc(100dvh - 120px)) !important; max-height: none !important; transform-origin: bottom right;
  }
}

/* ---------- Позвать друзей: иллюстрация справа от ссылки (как в макете) ---------- */
.ps-rf-sec { container-type: inline-size; }
@media (min-width: 768px) {
  .ps-rf-sec { flex-wrap: nowrap !important; }
  .ps-rf-sec > div:first-of-type { flex: 1 1 0 !important; min-width: 0; }
  .ps-rf-sec > .rf { flex: 0 0 auto !important; width: 390px; }
}
@container (max-width: 880px) { .ps-rf-sec > .rf { zoom: .78; } }
@container (max-width: 720px) { .ps-rf-sec > .rf { zoom: .62; } }

/* ---------- Профиль, уведомления: подписи у переключателей на телефоне ---------- */
.nt-c { display: inline-flex; align-items: center; gap: 8px; }
.nt-l { display: none; font: 500 13px/1 'Onest', system-ui, sans-serif; color: #5A6175; }
@media (max-width: 599px) {
  .nt-head { display: none !important; }
  .nt-sw { width: 100%; gap: 24px !important; }
  .nt-l { display: inline; }
}

/* ---------- Страны: популярное и алфавит ---------- */
.ps-pop { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 12px; }
.ps-pop a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; background: #FFFFFF; box-shadow: inset 0 0 0 1px #EDEFF3; color: #0E1220; text-decoration: none; transition: box-shadow .2s, transform .2s cubic-bezier(.2, .8, .2, 1); }
.ps-pop a:hover { box-shadow: inset 0 0 0 1.5px #2F5BFF, 0 12px 28px rgba(14, 18, 32, .08); transform: translateY(-2px); color: #0E1220; }
.ps-pop img { width: 40px; height: 40px; flex: none; }
.ps-pop .n { position: absolute; }
.ps-abc { display: flex; flex-wrap: wrap; gap: 4px; }
.ps-abc button { min-width: 34px; height: 34px; padding: 0 8px; border: 0; border-radius: 10px; background: #F5F6F9; color: #0E1220; font: 600 14px/1 'Onest', system-ui, sans-serif; cursor: pointer; transition: background-color .16s, color .16s; }
.ps-abc button:hover { background: #2F5BFF; color: #FFFFFF; }
.ps-letter { grid-column: 1 / -1; padding: 20px 0 6px; font: 600 22px/1 'Onest', system-ui, sans-serif; color: #2F5BFF; letter-spacing: -.02em; border-bottom: 1px solid #EDEFF3; }

/* ---------- Шапка главной на узком телефоне: кнопка меню не вылезает за край ---------- */
@media (max-width: 400px) {
  header .hdr-in { gap: 8px !important; padding: 0 8px 0 14px !important; }
  header .hdr-in .btn-sm.btn-primary { padding: 0 12px !important; }
}

/* ---------- Шапка внутренних страниц на планшете и маленьком ноутбуке: не вылезает за край ---------- */
@media (max-width: 1180px) { .sh-desc, .sh-sep { display: none !important; } }
@media (max-width: 1060px) { .sh-nav { display: none !important; } .sh-hm { display: none !important; } .sh-burger { display: inline-flex !important; } }
@media (max-width: 400px) {
  .sh-in { gap: 8px !important; padding: 0 8px 0 14px !important; }
  .sh-act .sh-pri { padding: 0 12px !important; }
}

/* ---------- Баланс: суммы пополнения на телефоне — три в ряд, сумма и валюта в одну строку ---------- */
.am { container-type: inline-size; min-width: 0; }
.am .mono { white-space: nowrap; font-size: clamp(11px, 19cqi, 20px) !important; }
@media (max-width: 599px) {
  div:has(> .am) { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px !important; }
  .am { padding: 12px 10px !important; border-radius: 16px !important; }
  .am > span:last-child { font-size: 11px !important; line-height: 14px; }
  .am-hit { right: 6px !important; }
}
@media (max-width: 360px) { .am { padding: 12px 8px !important; } }

/* Баннеры и техработы из админки (ui.js → banners) */
.ps-bnr { position: relative; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 48px 10px 16px; font: 500 14px/20px 'Onest', system-ui, sans-serif; text-align: center; }
.ps-bnr.warn { background: #FFF4DE; color: #8A5A00; }
.ps-bnr.info { background: #F2F5FF; color: #1F45D6; }
.ps-bnr button { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 14px; cursor: pointer; }
.ps-bnr button:hover { background: rgba(14, 18, 32, .06); }

/* Блок доверия (TRUST в tools/patches.mjs): 4 в ряд на широкой главной, иначе 2×2, на телефоне столбиком */
.ps-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1100px) { .ps-trust-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 559px) { .ps-trust { grid-template-columns: 1fr; } }
