/* ==========================================================================
   SanDez Control — components.css
   Переиспользуемые UI-компоненты: кнопки, карточки, формы, бейджи, иконки.
   ========================================================================== */

/* ---------- Иконки --------------------------------------------------------- */

.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  vertical-align: -0.125em;
}
.icon--sm { width: 16px; height: 16px; }
.icon--md { width: 20px; height: 20px; }
.icon--lg { width: 24px; height: 24px; }
.icon--xl { width: 32px; height: 32px; }

/* ---------- Кнопки --------------------------------------------------------- */

.btn {
  --_bg: var(--accent);
  --_color: #FFFFFF;
  --_border: transparent;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  min-height: 56px;
  background: var(--_bg);
  color: var(--_color);
  border: 1.5px solid var(--_border);
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: -0.01em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  text-decoration: none;
  transition:
    transform var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
  will-change: transform;
}

.btn__arrow {
  transition: transform var(--dur-base) var(--ease-spring);
}

@media (hover: hover) {
  .btn:hover {
    --_bg: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
  }
  .btn:hover .btn__arrow { transform: translateX(4px); }
}

.btn:active { transform: translateY(0) scale(0.98); }

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Модификаторы */
.btn--lg {
  padding: 20px 36px;
  min-height: 64px;
  font-size: 1.0625rem;
}

.btn--sm {
  padding: 10px 18px;
  min-height: 40px;
  font-size: 0.875rem;
}

.btn--secondary {
  --_bg: transparent;
  --_color: var(--ink);
  --_border: var(--ink);
}
@media (hover: hover) {
  .btn--secondary:hover {
    --_bg: var(--ink);
    --_color: var(--bg);
    --_border: var(--ink);
  }
}

.btn--ghost {
  --_bg: transparent;
  --_color: var(--ink);
  --_border: var(--border);
  min-height: 52px;
}
@media (hover: hover) {
  .btn--ghost:hover {
    --_bg: var(--bg-soft);
    --_border: var(--ink-muted);
  }
}

.btn--dark {
  --_bg: var(--ink);
  --_color: var(--bg);
}
@media (hover: hover) {
  .btn--dark:hover { --_bg: #000; }
}

/* WhatsApp-кнопка: бирюзовая (НЕ кислотный зелёный — он перебивает оранжевый
   акцент). Кислотный зелёный остался ТОЛЬКО в финальном CTA («Контакты»)
   и mobile-bottom-bar — там он уместен как «официальная» WhatsApp-метка. */
.btn--wa {
  --_bg: var(--cta-teal);
  --_color: #FFFFFF;
}
@media (hover: hover) {
  .btn--wa:hover { --_bg: var(--cta-teal-hover); }
}

.btn--block { width: 100%; }

/* ---------- Trust-бейджи --------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--trust-soft);
  color: var(--trust);
  border-radius: var(--r-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge .icon { width: 16px; height: 16px; }

.badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Бирюзовый badge — для Google Maps и других источников, где не хочется
   дублировать оранжевый акцент 2ГИС. Палитра — единая со всеми CTA. */
.badge--teal {
  background: var(--cta-teal-soft);
  color: var(--cta-teal);
}

.badge--ink {
  background: var(--bg-soft);
  color: var(--ink);
}

.badge--sticker {
  transform: rotate(-3deg);
  box-shadow: var(--shadow-1);
}

/* ---------- Карточки ------------------------------------------------------- */

.card {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(20px, 3vw, 32px);
  /* overflow: hidden — критично для секции услуг: персонажи .character-float
     позиционированы в углу с небольшим overflow, без этого правила они
     вылезали за пределы карточки и наезжали на соседние карточки/кнопки. */
  overflow: hidden;
  transition:
    transform var(--dur-base) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}

.card--soft { background: var(--bg-soft); border-color: transparent; }
.card--accent { background: var(--accent-soft); border-color: transparent; }
.card--trust { background: var(--trust-soft); border-color: transparent; }
.card--dark { background: var(--ink); color: var(--bg); border-color: transparent; }
.card--dark h3 { color: var(--bg); }

@media (hover: hover) {
  .card--hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2);
    border-color: var(--ink-muted);
  }
  .card--hover:hover .character-float { transform: translate(-3%, -6%) rotate(-4deg); }
}

.card__eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.card__title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.8vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--ink);
  text-wrap: balance;
}

/* В сетке услуг заголовок резервирует место под 2 строки — короткие
   заголовки тоже занимают эту высоту, и карточки выглядят одинаковыми
   по вертикали независимо от длины фразы. */
.bento--services .card__title {
  min-height: 2.4em;
}

/* Карточки услуг — flex column с прижимом цены+кнопки к низу.
   Без этого Боб (span 2 rows = вдвое выше) растягивает только текст,
   а цена и «Заказать» висят посередине карточки. С margin-top: auto на
   .card__price блок «цена + footer» сдвигается вниз и встаёт на одну
   линию с такими же блоками в соседних карточках («Блохи», «Муравьи»). */
.bento--services .card {
  display: flex;
  flex-direction: column;
}
.bento--services .card__price {
  margin-top: auto;
}

.card__text {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.card__price {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.card__price-from {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Footer карточки: badge'ев больше нет, в футере только кнопка «Заказать».
   Раньше был border-top как разделитель между ценой и блоком badge+кнопка —
   теперь убран: отделять одну кнопку линией не нужно, плюс раньше эта линия
   проходила ПОВЕРХ персонажа и визуально его «разрезала». */
.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* Персонаж в углу карточки услуг.
   • bottom-right угол; правое пространство footer теперь свободно (badge'ов
     больше нет, остался только button слева), персонаж может быть крупнее.
   • overflow: hidden у .card клипает любые залезания на соседнюю карточку.
   • bottom: -3% — лёгкое «выглядывание» из карточки (не торчит низко). */
.character-float {
  position: absolute;
  bottom: -3%;
  right: -3%;
  width: 55%;
  aspect-ratio: 1;
  object-fit: contain;
  object-position: bottom right;
  pointer-events: none;
  transition: transform var(--dur-slow) var(--ease-spring);
  z-index: 0;
  filter: drop-shadow(0 12px 20px rgba(26, 24, 21, 0.12));
}

/* Большая акцент-карточка Боба (span 2 rows) — широкая и высокая,
   персонаж заполняет нижнюю треть, чтобы карточка не выглядела пустой
   ниже подзаголовка. */
.card--accent .character-float {
  width: 70%;
  bottom: -2%;
  right: -1%;
}

/* Валера на широкой row-3-карточке (span 3 cols на десктопе) — там много
   горизонтального места, поэтому персонаж в относительных % будет огромным.
   Прижимаем к фиксированному размеру + размещаем в правой части. */
@media (min-width: 1024px) {
  .bento--services > *:nth-child(6) .character-float {
    width: 28%;
    max-width: 280px;
    bottom: -2%;
    right: 2%;
  }
}

.card > *:not(.character-float) { position: relative; z-index: 1; }

/* ---------- Плейсхолдеры изображений (пока нет реальных) ------------------- */

.img-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-lg);
  background:
    linear-gradient(135deg, var(--accent-soft), var(--bg-soft) 60%, var(--trust-soft));
  border: 1.5px dashed var(--border);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}

.img-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 20%,
    rgba(238, 92, 52, 0.15),
    transparent 60%
  );
  z-index: -1;
}

.img-placeholder__label {
  display: grid;
  gap: 6px;
  padding: 16px 20px;
  background: rgba(250, 246, 240, 0.85);
  backdrop-filter: blur(8px);
  border-radius: var(--r-md);
  line-height: 1.4;
}

.img-placeholder__label span:first-child {
  color: var(--accent);
  font-size: 0.75rem;
}
.img-placeholder__label span:last-child {
  color: var(--ink);
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.img-placeholder--character {
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 50% 55%, var(--bg), var(--bg-soft) 70%);
}

.img-placeholder--hero {
  aspect-ratio: 3 / 2;
  background:
    linear-gradient(160deg, var(--accent-soft) 0%, var(--bg) 30%, var(--trust-soft) 100%);
}

.img-placeholder--wide { aspect-ratio: 16 / 9; }

/* ---------- Поля ввода (только в калькуляторе) ---------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
}

.field__input {
  height: 64px;
  padding: 0 20px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 1.125rem;
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  font-variant-numeric: tabular-nums;
}

.field__input::placeholder {
  color: var(--ink-muted);
  font-weight: 400;
}

.field__input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field__input[aria-invalid="true"] {
  border-color: var(--error);
}

.field__hint {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.field__hint--error { color: var(--error); }

/* Чекбокс */
.check {
  display: inline-flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
}
.check__input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  display: grid;
  place-items: center;
  color: transparent;
  transition: all var(--dur-fast) var(--ease);
  margin-top: 1px;
}
.check__box .icon { width: 14px; height: 14px; }
.check__input:checked + .check__box {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFF;
}
.check__input:focus-visible + .check__box { box-shadow: var(--shadow-focus); }
.check__label {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.check__label a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

/* Radio-tile (кнопка выбора в калькуляторе) */
.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  min-height: 72px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  font-weight: 500;
  font-size: 1.0625rem;
  color: var(--ink);
  text-align: left;
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
  user-select: none;
}

.tile__emoji {
  font-size: 1.625rem;
  line-height: 1;
  flex-shrink: 0;
}

.tile__text { flex: 1; }

.tile__sub {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  font-weight: 400;
  margin-top: 2px;
}

@media (hover: hover) {
  .tile:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
  }
}

.tile[aria-pressed="true"],
.tile.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

/* ---------- Sticker (круглый бейдж c поворотом) --------------------------- */

.sticker {
  display: inline-grid;
  place-items: center;
  width: 88px;
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: #FFF;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transform: rotate(-8deg);
  box-shadow: var(--shadow-2);
}

.sticker--trust { background: var(--trust); }
.sticker--highlight { background: var(--highlight); color: var(--ink); }

/* ---------- Marquee (бегущая строка) --------------------------------------- */

.marquee {
  overflow: hidden;
  padding-block: 18px;
  background: var(--ink);
  color: var(--bg);
  /* Раньше был mask-image с transparent-градиентами по краям — это давало
     «белые блики» по бокам, через которые просвечивал фон страницы.
     Убрано: текст резко обрезается overflow'ом, строка читается как
     единая тёмная полоса без «засветов». */
}

.marquee__track {
  display: flex;
  gap: 3rem;
  white-space: nowrap;
  width: max-content;
  animation: marquee-scroll 40s linear infinite;
}

.marquee__item {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
}
.marquee__item::before {
  content: '✦';
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none; }
  .marquee { overflow-x: auto; scrollbar-width: none; }
}

/* ---------- Mobile bottom bar: Позвонить + WhatsApp ----------------------- */

.m-bottom-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 80;
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* gap: 0 — кнопки слеплены вплотную, без полоски-зазора между ними.
     Раньше был gap: 1px на сером фоне (создавал тонкую разделительную
     линию) — на мобилке она читалась как «белая щель» и портила вид. */
  gap: 0;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -8px 24px rgba(26, 24, 21, 0.08);
}

@media (min-width: 768px) {
  .m-bottom-bar { display: none; }
}

.m-bottom-bar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  min-height: 64px;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  touch-action: manipulation;
  transition: filter var(--dur-fast) var(--ease);
}
.m-bottom-bar__btn:active { filter: brightness(0.92); }

.m-bottom-bar__btn--call { background: var(--accent); }
/* WA-кнопка в моб. нижней панели — бирюзовая, та же палитра что live-плашка
   и кнопки «Заказать». Раньше был кислотный --wa-brand (#25D366), он
   диссонировал с оранжевым в палитре. Зелёный остался только в финальном
   CTA («Контакты»), где он уместен как «официальная» WA-метка. */
.m-bottom-bar__btn--wa   { background: var(--cta-teal); }

.m-bottom-bar__icon {
  width: 22px; height: 22px;
  flex-shrink: 0;
}

/* ---------- Scroll-driven анимации (CSS-only) -----------------------------
   Используем нативный `animation-timeline: view()` — без JS, без jank,
   без IntersectionObserver. Работает в Chrome 115+, Edge 115+, Safari 26+.
   В Firefox и старых браузерах @supports не срабатывает, элементы видны
   сразу без анимации — сайт не ломается, просто без «появления».

   animation-range: entry 0% cover 30% — элемент проявляется за первые
   ~30% пути через вьюпорт после входа. Это даёт «быстрый» ощутимый
   эффект, но не раздражает затянутыми fade'ами. */
@supports (animation-timeline: view()) {
  .reveal,
  .s-header,
  .symptom,
  .bento__item,
  .step,
  .diy__item,
  .timeline__item,
  .faq__item,
  .after-visual,
  .calc,
  .calc-trust,
  .final-cta__title,
  .final-cta__sub,
  .final-cta__buttons {
    animation: reveal-in linear both;
    animation-timeline: view();
    /* Быстрый range (15% пути): элемент на 100% проявляется почти сразу
       после входа в вьюпорт, не успевая быть «тусклым» при скролле. */
    animation-range: entry 0% cover 15%;
  }

  .reveal-weight {
    animation: reveal-weight linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 20%;
  }
}

/* ---------- Hero load-in (один раз при загрузке) -------------------------
   Чистое появление через opacity — без движения, без scale, без дёрганья.
   Короткая длительность (350 ms) — пользователь не успевает заметить fade
   как «тусклость», это просто «материализация». */
@media (prefers-reduced-motion: no-preference) {
  .hero__title,
  .hero__sub,
  .hero__actions-area,
  .hero-stats {
    animation: reveal-in 350ms var(--ease) both;
  }
  .hero__sub          { animation-delay: 60ms; }
  .hero__actions-area { animation-delay: 120ms; }
  .hero-stats         { animation-delay: 240ms; }

  /* .hero__live: pure opacity-fade + параллельно вечная live-glow пульсация.
     Специфичность .hero .hero__live перекрывает одиночный .hero__live
     из layout.css (там только live-glow). */
  .hero .hero__live {
    animation:
      reveal-in 350ms var(--ease) 180ms both,
      live-glow 3.6s ease-in-out 530ms infinite;
  }
}

/* Только появление через opacity, никаких transform. Элементы стоят на
   своих местах с нулевой геометрией — ничего не двигается, не сжимается,
   не масштабируется. При скролле они просто «проявляются» на месте.
   Range 15% пути делает эффект быстрым — fade не успевает стать тусклым. */
@keyframes reveal-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes reveal-weight {
  from { opacity: 0; font-variation-settings: "wght" 400; }
  to   { opacity: 1; font-variation-settings: "wght" 700; }
}

/* Idle-анимация персонажа (floating) */
.character-idle {
  animation: char-float 5s ease-in-out infinite;
  will-change: transform;
}
@keyframes char-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-10px) rotate(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .character-idle { animation: none; }
}
