/**
 * Floating slide-in CTA — global widget rendered in <wp_footer>.
 * Layout: header → hero (visual + title/subtitle) → footer (full-width button).
 * Theme tokens from root.css; локальні дотюнінги — змінні `--cta-*` на корені блока.
 */

.slide-cta {
  --cta-muted:           #B0B2B5;
  --cta-close-hover-bg:  rgba(255, 255, 255, 0.08);
  --cta-shadow:
    0 16px 40px rgba(0, 0, 0, 0.24),
    0 4px 12px rgba(0, 0, 0, 0.12);

  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: var(--z-fixed);

  width: 440px;
  max-width: calc(100vw - 32px);

  background: var(--color-gray-10);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--cta-shadow);

  color: var(--color-white);

  transform: translateY(120%);
  opacity: 0;
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.slide-cta.is-visible {
  transform: translateY(0);
  opacity: 1;
}

/* Після завершення transition прибираємо transform — GPU-шар відключається,
   текст рендериться native pixel-perfect (без розмиття від rasterization). */
.slide-cta.is-settled {
  transform: none;
}

.slide-cta.is-hiding {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

/* Header — eyebrow + close */
.slide-cta__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 0 24px;
}

.slide-cta__eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: var(--font-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-green-60);
}

.slide-cta__eyebrow-placeholder {
  display: block;
  height: 1px;
}

/* Close button (DS spec — 16px padding around 10.5×10.5 icon) */
.slide-cta__close {
  flex-shrink: 0;
  padding: 16px;
  border: none;
  background: transparent;
  color: var(--cta-muted);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.slide-cta__close:hover {
  background: var(--cta-close-hover-bg);
  color: var(--color-white);
}

.slide-cta__close:focus-visible {
  outline: none;
  background: var(--cta-close-hover-bg);
  color: var(--color-white);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.slide-cta__close svg {
  width: 10.5px;
  height: 10.5px;
  display: block;
}

/* Hero — image + (title + subtitle) side by side */
.slide-cta__hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px 24px 0;
}

.slide-cta__visual {
  flex-shrink: 0;
  width: 140px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-cta__visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.slide-cta__body {
  flex: 1;
  min-width: 0;
}

.slide-cta__title {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 20px;
  font-weight: var(--font-bold);
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-white);
}

.slide-cta__title .accent {
  color: var(--color-green-60);
}

.slide-cta__subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--cta-muted);
}

/* Без картинки — body займає всю ширину */
.slide-cta--no-image .slide-cta__hero {
  padding-top: 12px;
}

/* Footer — full-width CTA */
.slide-cta__footer {
  padding: 18px 24px 22px;
  margin-top: 18px;
}

.slide-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  width: 100%;
  height: 48px;
  padding: 10px 20px;

  background: var(--color-green-60);
  color: var(--color-gray-20);
  text-decoration: none;

  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: var(--font-bold);
  line-height: 1.5;
  letter-spacing: 0.01em;

  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;

  transition:
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.slide-cta__btn:hover {
  background: var(--color-green-50);
}

.slide-cta__btn:focus-visible {
  outline: none;
  background: var(--color-green-50);
  box-shadow: 0 0 0 4px rgba(61, 208, 120, 0.2);
}

.slide-cta__btn:active {
  background: var(--color-green-40);
}

.slide-cta__btn[aria-disabled="true"] {
  background: #87D9A8;
  color: var(--color-white);
  cursor: not-allowed;
}

.slide-cta__btn svg {
  width: 24px;
  height: 24px;
}

/* Tablet — трохи стиснутий блок справа */
@media (max-width: 1024px) {
  .slide-cta {
    width: 400px;
    right: 20px;
    bottom: 20px;
  }
}

/* Mobile — блок розтягується знизу на всю ширину */
@media (max-width: 560px) {
  .slide-cta {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
  .slide-cta__header { padding: 4px 4px 0 18px; }
  .slide-cta__close  { padding: 12px; }
  .slide-cta__hero   { gap: 14px; padding: 4px 18px 0; }
  .slide-cta__visual { width: 110px; height: 105px; }
  .slide-cta__title  { font-size: 17px; }
  .slide-cta__subtitle { font-size: 12px; }
  .slide-cta__footer { padding: 14px 18px 18px; margin-top: 14px; }
  .slide-cta__btn    { font-size: 15px; }
}

/* Very small / landscape phones */
@media (max-width: 360px) {
  .slide-cta__visual { width: 96px; height: 92px; }
  .slide-cta__title  { font-size: 15px; }
  .slide-cta__subtitle { font-size: 11.5px; }
  .slide-cta__btn    { height: 44px; font-size: 14px; }
}

/* Landscape orientation on short screens */
@media (max-height: 480px) and (orientation: landscape) {
  .slide-cta {
    bottom: 8px;
    right: 8px;
    left: 8px;
  }
  .slide-cta__hero   { padding-top: 2px; }
  .slide-cta__visual { width: 96px; height: 90px; }
  .slide-cta__title  { font-size: 15px; }
  .slide-cta__footer { padding: 10px 18px 12px; margin-top: 10px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .slide-cta {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .slide-cta.is-visible { transform: none; }
  .slide-cta.is-hiding  { transform: none; }
}
