/* ============================================================================
   ЦЛП · Поп-ап лид-магнита — продакшн-стили
   Вариант 1 (тёплый минимал). Адаптив: десктоп — модалка по центру,
   мобильный — bottom-sheet. Все классы в пространстве имён .clp- .
   Подключается одним файлом, ни от чего не зависит.
   ========================================================================= */

.clp-root {
  --clp-primary: #009AA8;
  --clp-primary-d: #007B8A;
  --clp-accent: #F2762E;
  --clp-accent-d: #E0631B;
  --clp-ink: #1B2B2E;
  --clp-muted: #5C6E72;
  --clp-faint: #8A999C;
  --clp-line: #E4EAEB;
  --clp-tint: #F3FAFB;
  --clp-error: #E5786B;
  --clp-radius: 24px;
  --clp-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.clp-root *,
.clp-root *::before,
.clp-root *::after { box-sizing: border-box; }

/* ── Overlay / scrim над страницей ──────────────────────────────────── */
.clp-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 36, 40, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: var(--clp-font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-y: auto;
}
.clp-overlay[hidden] { display: none; }

/* ── Карточка (десктоп) ─────────────────────────────────────────────── */
.clp-card {
  position: relative;
  width: 472px;
  max-width: 100%;
  background: #fff;
  border-radius: var(--clp-radius);
  box-shadow: rgba(8, 40, 45, 0.45) 0px 30px 80px -24px, rgba(8, 40, 45, 0.06) 0px 2px 8px;
  padding: 32px;
}

/* Появление / закрытие — базовое состояние ВИДИМОЕ, анимация только украшает.
   Если анимация не проиграется (троттлинг/reduced-motion) — поп-ап всё равно виден. */
@media (prefers-reduced-motion: no-preference) {
  .clp-overlay:not(.is-closing) .clp-card { animation: clp-card-in 0.34s cubic-bezier(0.22, 1, 0.36, 1); }
  .clp-overlay.is-closing { animation: clp-overlay-out 0.22s ease forwards; }
  .clp-overlay.is-closing .clp-card { animation: clp-card-out 0.22s ease forwards; }
}
@keyframes clp-overlay-out { to { opacity: 0; } }
@keyframes clp-card-in { from { transform: translateY(14px) scale(0.98); } }
@keyframes clp-card-out { to { opacity: 0; transform: translateY(10px) scale(0.985); } }

/* ── Кнопка закрытия ────────────────────────────────────────────────── */
.clp-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #F4F6F6;
  color: var(--clp-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  z-index: 4;
}
.clp-close:hover { background: #ECEFEF; color: var(--clp-muted); transform: rotate(90deg); }
.clp-close svg { width: 15px; height: 15px; }

/* ── Заголовок ──────────────────────────────────────────────────────── */
.clp-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.clp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 100px;
  background: var(--clp-tint);
  color: var(--clp-primary-d);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  width: fit-content;
}
.clp-eyebrow .clp-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--clp-accent);
  box-shadow: rgba(242, 118, 46, 0.18) 0px 0px 0px 4px;
}
.clp-h1 {
  margin: 0;
  color: var(--clp-primary-d);
  font-weight: 800;
  font-size: 27px;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
  padding-right: 28px;
}
.clp-sub { margin: 0; color: var(--clp-muted); font-size: 14.5px; line-height: 1.5; text-wrap: pretty; }

/* ── Выбор гайда ────────────────────────────────────────────────────── */
.clp-guides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.clp-guide {
  position: relative;
  text-align: left;
  border: 1.5px solid var(--clp-line);
  border-radius: 16px;
  background: #fff;
  padding: 10px 10px 12px;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s, transform 0.16s;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-family: inherit;
}
.clp-guide:hover { border-color: #BCD9DD; transform: translateY(-2px); }
.clp-guide.is-active { border-color: var(--clp-primary); background: var(--clp-tint); box-shadow: rgba(0, 154, 168, 0.14) 0px 0px 0px 3px; }
.clp-guide__cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  background: center center / cover no-repeat #fff;
  box-shadow: rgba(0, 0, 0, 0.05) 0px 0px 0px 1px inset;
}
.clp-guide__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.clp-guide__name { font-size: 15px; font-weight: 700; color: var(--clp-ink); line-height: 1.2; }
.clp-guide__desc { font-size: 12.5px; color: var(--clp-muted); line-height: 1.35; }
.clp-guide__check {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--clp-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.16s, transform 0.16s;
  box-shadow: rgba(0, 154, 168, 0.4) 0px 2px 8px;
}
.clp-guide.is-active .clp-guide__check { opacity: 1; transform: scale(1); }
.clp-guide__check svg { width: 12px; height: 12px; }

/* ── Поля ───────────────────────────────────────────────────────────── */
.clp-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.clp-input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--clp-line);
  border-radius: 12px;
  padding: 0 15px;
  font-family: inherit;
  font-size: 15px;
  color: var(--clp-ink);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.clp-input::placeholder { color: var(--clp-faint); }
.clp-input:focus { border-color: var(--clp-primary); box-shadow: rgba(0, 154, 168, 0.13) 0px 0px 0px 3px; }
.clp-input.is-error { border-color: var(--clp-error); box-shadow: rgba(229, 120, 107, 0.13) 0px 0px 0px 3px; }

/* ── Согласия ───────────────────────────────────────────────────────── */
.clp-consents { display: flex; flex-direction: column; gap: 9px; margin-bottom: 18px; }
.clp-check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; user-select: none; }
.clp-check__box {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 5px;
  border: 1.5px solid #C2C2C2;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s, border-color 0.14s;
}
.clp-check.is-checked .clp-check__box { background: var(--clp-primary); border-color: var(--clp-primary); }
.clp-check.is-error .clp-check__box { border-color: var(--clp-error); }
.clp-check__box svg { width: 11px; height: 11px; color: #fff; opacity: 0; transition: opacity 0.12s; }
.clp-check.is-checked .clp-check__box svg { opacity: 1; }
.clp-check__label { font-size: 12px; line-height: 1.4; color: var(--clp-muted); }
.clp-check__label a { color: var(--clp-primary-d); text-decoration: underline; text-underline-offset: 2px; }

/* ── Кнопка отправки ────────────────────────────────────────────────── */
.clp-cta {
  width: 100%;
  height: 54px;
  flex: 0 0 auto;
  border: none;
  border-radius: 14px;
  background: var(--clp-accent);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: background 0.16s, transform 0.12s, box-shadow 0.16s;
  box-shadow: rgba(242, 118, 46, 0.6) 0px 10px 22px -8px;
}
.clp-cta:hover { background: var(--clp-accent-d); transform: translateY(-1px); }
.clp-cta:active { transform: translateY(0px); }
.clp-cta svg { width: 17px; height: 17px; transition: transform 0.16s; }
.clp-cta:hover svg { transform: translateX(3px); }
.clp-cta.is-loading { pointer-events: none; opacity: 0.85; }
.clp-cta.is-loading .clp-cta__label,
.clp-cta.is-loading .clp-cta__arrow { display: none; }
.clp-cta__spinner { display: none; width: 20px; height: 20px; }
.clp-cta.is-loading .clp-cta__spinner { display: block; animation: clp-spin 0.7s linear infinite; }
@keyframes clp-spin { to { transform: rotate(360deg); } }

.clp-foot { font-size: 12px; color: var(--clp-faint); line-height: 1.45; text-align: center; margin: 16px 0 0; }

/* ── Экран «успех» ──────────────────────────────────────────────────── */
.clp-success { position: relative; text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.clp-success__icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--clp-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clp-primary);
  box-shadow: rgba(0, 154, 168, 0.07) 0px 0px 0px 8px;
}
.clp-success__icon svg { width: 34px; height: 34px; }
.clp-success__head { display: flex; flex-direction: column; gap: 9px; }
.clp-success .clp-h1 { font-size: 25px; padding-right: 0; }
.clp-success .clp-sub { font-size: 14.5px; max-width: 360px; margin-inline: auto; }
.clp-success__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--clp-tint);
  color: var(--clp-primary-d);
  font-size: 13.5px;
  font-weight: 600;
}
.clp-success__chip svg { width: 16px; height: 16px; }
.clp-success__chip b { color: var(--clp-ink); font-weight: 700; }
.clp-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 13px 15px;
  border-radius: 12px;
  background: #FFF6EE;
  border: 1px solid #FBE4CF;
}
.clp-note svg { flex: 0 0 auto; width: 17px; height: 17px; color: var(--clp-accent-d); margin-top: 1px; }
.clp-note span { font-size: 12.5px; line-height: 1.45; color: #7A5A3A; }
.clp-ghost {
  width: 100%;
  height: 50px;
  border-radius: 14px;
  background: #fff;
  color: var(--clp-primary-d);
  border: 1.5px solid var(--clp-line);
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}
.clp-ghost:hover { background: var(--clp-tint); border-color: #BCD9DD; }

/* ── Переключение экранов ───────────────────────────────────────────── */
.clp-screen[hidden] { display: none; }
.clp-screen { animation: clp-fade 0.32s ease both; }
@keyframes clp-fade {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: none; }
}

/* ── Тряска при ошибке ──────────────────────────────────────────────── */
.clp-shake { animation: clp-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes clp-shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* ── Скрытый «хваталка» для мобильного листа ────────────────────────── */
.clp-grab { display: none; }

/* блокировка прокрутки страницы под открытым поп-апом */
html.clp-lock, body.clp-lock { overflow: hidden; }

/* ====================================================================== */
/* МОБИЛЬНЫЙ: bottom-sheet                                                 */
/* ====================================================================== */
@media (max-width: 560px) {
  .clp-overlay { align-items: flex-end; padding: 0; }

  .clp-card {
    width: 100%;
    max-width: 100%;
    border-radius: 26px 26px 0 0;
    padding: 8px 22px calc(34px + env(safe-area-inset-bottom, 0px));
    max-height: 94vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: rgba(8, 40, 45, 0.4) 0px -16px 50px -10px;
  }
  /* на мобильном лист выезжает снизу */
  @media (prefers-reduced-motion: no-preference) {
    .clp-overlay:not(.is-closing) .clp-card { animation: clp-sheet-in 0.36s cubic-bezier(0.22, 1, 0.36, 1); }
    .clp-overlay.is-closing .clp-card { animation: clp-sheet-out 0.24s ease forwards; }
  }

  .clp-grab {
    display: block;
    width: 40px;
    height: 5px;
    border-radius: 100px;
    background: #DBE2E3;
    margin: 6px auto 12px;
  }

  .clp-close { top: 16px; right: 16px; width: 34px; height: 34px; }
  .clp-h1 { font-size: 22px; }

  /* гайды в столбик, горизонтальной строкой */
  .clp-guides { grid-template-columns: 1fr; gap: 10px; }
  .clp-guide {
    flex-direction: row;
    align-items: center;
    gap: 13px;
    padding: 11px 13px;
    border-radius: 15px;
  }
  .clp-guide:hover { transform: none; }
  .clp-guide__cover { width: 62px; aspect-ratio: 1 / 1; flex: 0 0 auto; border-radius: 10px; }
  .clp-guide__body { flex: 1 1 auto; gap: 3px; }
  /* галочка превращается в радио-точку справа */
  .clp-guide__check {
    position: static;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    opacity: 1;
    transform: none;
    background: #fff;
    border: 1.5px solid #C9D2D3;
    color: #fff;
    box-shadow: none;
  }
  .clp-guide__check svg { opacity: 0; transition: opacity 0.14s; }
  .clp-guide.is-active .clp-guide__check { background: var(--clp-primary); border-color: var(--clp-primary); }
  .clp-guide.is-active .clp-guide__check svg { opacity: 1; }

  .clp-cta { height: 58px; font-size: 17px; border-radius: 16px; }
}

/* ── Keyframes мобильного листа ─────────────────────────────────────── */
@keyframes clp-sheet-in { from { transform: translateY(100%); } }
@keyframes clp-sheet-out { to { transform: translateY(100%); } }

/* ── Уважение к prefers-reduced-motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .clp-overlay, .clp-card, .clp-screen, .clp-close, .clp-guide, .clp-cta { transition: none; animation: none; }
}
