/* ==========================================================================
   Демо ховеров. Общие элементы демо
   ========================================================================== */
.demo-wrap { padding: 28px 0 80px; }

.demo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.demo-head h1 {
  margin: 0;
  font: 700 clamp(1.6rem, 3vw, 2.2rem) / 1.15 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.demo-head p { margin: 8px 0 0; max-width: 560px; color: var(--muted); }

.demo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.demo-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--green-700); }

.demo-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 32px;
  align-items: center;
  margin-top: 14px;
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--panel-radius);
  background: var(--surface);
}
.demo-num {
  font: 700 13px/1 var(--font-display);
  letter-spacing: 0.1em;
  color: var(--green-600);
}
.demo-meta h2 {
  margin: 12px 0 0;
  font: 700 1.35rem/1.2 var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.demo-meta p { margin: 10px 0 0; font-size: 15px; line-height: 1.55; color: var(--muted); }

.demo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 32px 28px;
  border-radius: 20px;
  background: var(--bg);
}
.demo-note { margin: 24px 0 0; font-size: 14px; color: var(--muted); max-width: 640px; }

@media (max-width: 800px) {
  .demo-card { grid-template-columns: 1fr; gap: 20px; }
  .demo-row { padding: 20px 16px; }
}

/* Общая разметка кнопок в демо */
.btn-ico { display: inline-flex; align-items: center; justify-content: center; }
.btn-txt { display: block; position: relative; }
.btn-txt-in { display: block; }
.btn .ic { width: 20px; height: 20px; }
.text-link .ic { width: 18px; height: 18px; }
.text-link .btn-ico { transition: transform 0.3s var(--ease-out); }

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

/* ==========================================================================
   0. Сдержанный
   ========================================================================== */
.v0 .btn { transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.12s; }
.v0 .btn-ico { transition: transform 0.2s var(--ease-out); }
.v0 .btn-primary:is(:hover, .is-hover) { background: var(--green-900); }
.v0 .btn-secondary:is(:hover, .is-hover) { border-color: var(--green-600); color: var(--green-800); }
.v0 .btn-tonal:is(:hover, .is-hover) { background: var(--green-200); }
.v0 .btn:is(:hover, .is-hover) .btn-ico { transform: translateX(2px); }
.v0 .text-link:is(:hover, .is-hover) .btn-ico { transform: translateX(4px); }

/* ==========================================================================
   A. Заливка от иконки
   ========================================================================== */
.vA .btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --fx: 40px;
  transition: color 0.25s 0.08s, border-color 0.3s;
}
.vA .btn-sm { --fx: 50%; }
.vA .btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--fill);
  clip-path: circle(0px at var(--fx) 50%);
  transition: clip-path 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.vA .btn:is(:hover, .is-hover)::before { clip-path: circle(130% at var(--fx) 50%); }

.vA .btn-primary { --fill: var(--green-900); }
.vA .btn-secondary { --fill: var(--green-700); }
.vA .btn-secondary:is(:hover, .is-hover) { color: #fff; border-color: var(--green-700); }
.vA .btn-secondary .ic { transition: color 0.25s 0.08s; }
.vA .btn-secondary:is(:hover, .is-hover) .ic { color: #fff; }
.vA .btn-tonal { --fill: var(--green-900); }
.vA .btn-tonal:is(:hover, .is-hover) { color: #fff; }

.vA .btn:is(:hover, .is-hover) .ic-cal { animation: tick-pop 0.5s var(--ease-out); }
.vA .btn:is(:hover, .is-hover) .ic-phone { animation: ring 0.65s ease-in-out; }

.vA .text-link { position: relative; }
.vA .text-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 26px;
  bottom: -3px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}
.vA .text-link:is(:hover, .is-hover)::after { transform: scaleX(1); }
.vA .text-link:is(:hover, .is-hover) .btn-ico { transform: translateX(4px); }

@keyframes tick-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22) rotate(-5deg); }
  100% { transform: scale(1); }
}
@keyframes ring {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-16deg); }
  40% { transform: rotate(13deg); }
  60% { transform: rotate(-9deg); }
  80% { transform: rotate(6deg); }
}

/* ==========================================================================
   B. Перекат текста и иконка «насквозь»
   ========================================================================== */
.vB .btn { transition: background 0.3s, border-color 0.3s; }
.vB .btn-txt, .vB .text-link .btn-txt { overflow: hidden; }
.vB .btn-txt::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 100%;
  white-space: nowrap;
}
.vB .btn-txt-in, .vB .btn-txt::after { transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.vB :is(.btn, .text-link):is(:hover, .is-hover) .btn-txt-in { transform: translateY(-110%); }
.vB :is(.btn, .text-link):is(:hover, .is-hover) .btn-txt::after { transform: translateY(-100%); }

.vB .btn-primary:is(:hover, .is-hover) { background: var(--green-900); }
.vB .btn-secondary:is(:hover, .is-hover) { border-color: var(--green-600); }
.vB .btn-tonal:is(:hover, .is-hover) { background: var(--green-200); }

.vB .btn-ico { overflow: hidden; }
.vB :is(.btn, .text-link):is(:hover, .is-hover) :is(.ic-cal, .ic-arrow) { animation: through 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.vB .btn:is(:hover, .is-hover) .ic-phone { animation: ring 0.65s ease-in-out; }

@keyframes through {
  0% { transform: translateX(0); opacity: 1; }
  45% { transform: translateX(150%); opacity: 0; }
  50% { transform: translateX(-150%); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   C. Иконка в кружке и сдвиг заливки
   ========================================================================== */
.vC .btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  gap: 12px;
  transition: border-color 0.3s;
}
.vC .btn-lg { padding-left: 9px; padding-right: 26px; }
.vC .btn-lg .btn-ico {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.3s, color 0.3s, transform 0.35s var(--ease-out);
}
.vC .btn-secondary .btn-ico { background: var(--green-100); }
.vC .btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--sweep);
  transform: translateX(-101%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.vC .btn:is(:hover, .is-hover)::before { transform: translateX(0); }
.vC .btn-txt { transition: transform 0.35s var(--ease-out); }
.vC .btn:is(:hover, .is-hover) .btn-txt { transform: translateX(3px); }

.vC .btn-primary { --sweep: var(--green-900); }
.vC .btn-primary:is(:hover, .is-hover) .btn-ico { background: #fff; color: var(--green-800); transform: scale(1.04); }
.vC .btn-secondary { --sweep: var(--green-100); }
.vC .btn-secondary:is(:hover, .is-hover) { border-color: var(--green-100); }
.vC .btn-secondary:is(:hover, .is-hover) .btn-ico { background: var(--green-700); color: #fff; transform: scale(1.04); }
.vC .btn-tonal { --sweep: var(--green-200); }

.vC .btn:is(:hover, .is-hover) .ic-cal { animation: tick-pop 0.5s var(--ease-out) 0.05s; }
.vC .btn:is(:hover, .is-hover) .ic-phone { animation: ring 0.65s ease-in-out 0.05s; }

.vC .text-link { gap: 10px; }
.vC .text-link .btn-ico {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-700);
  transition: background 0.3s, color 0.3s, transform 0.3s var(--ease-out);
}
.vC .text-link:is(:hover, .is-hover) .btn-ico { background: var(--green-700); color: #fff; transform: translateX(3px); }

/* Уважение к настройкам движения */
@media (prefers-reduced-motion: reduce) {
  .demo *, .demo *::before, .demo *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
