/*
  CTA 20 — standalone HTML/CSS/JS implementation.
  No build step, no framework, no external dependency: copy these three
  files into any project and open index.html as-is.
*/

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

:root {
  --white: #ffffff;
  --violet-700: #6d28d9;
  --violet-100: #ede9fe;
  --violet-200: #ddd6fe;
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--white);
  background-color: var(--white);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cta {
  padding: clamp(3.5rem, 2.9rem + 2.4vw, 5.5rem) clamp(1rem, 0.3rem + 3vw, 2rem);
}

.cta__card {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  overflow: hidden;
  border-radius: 1rem;
  background-image: linear-gradient(120deg, #7c3aed, #a855f7, #6366f1, #7c3aed);
}

.cta__copy {
  container-type: inline-size;
  padding: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.cta__heading {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--white);
}

.cta__description {
  margin: 1rem 0 0;
  max-width: 24rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--violet-100);
}

.cta__form {
  margin-top: 1.75rem;
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 0.625rem;
}

@container (min-width: 22rem) {
  .cta__form {
    flex-direction: row;
  }
}

.input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--white);
}

.input::placeholder {
  color: var(--violet-200);
}

.input:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
  border-color: var(--white);
}

.input[aria-invalid="true"] {
  border-color: #fecaca;
}

.input[aria-invalid="true"]:focus-visible {
  outline-color: #fee2e2;
  border-color: #fee2e2;
}

.cta__field-error {
  margin: 0.5rem 0 0;
  width: 100%;
  font-size: 0.75rem;
  color: #fecdd3;
}

.cta__field-error[hidden] {
  display: none;
}

.button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 150ms ease;
}

.button:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.button--primary {
  color: var(--violet-700);
  background-color: var(--white);
}

.button--primary:hover {
  background-color: var(--violet-100);
}

.cta__success {
  margin-top: 1.75rem;
  width: 100%;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.15);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.cta__success[hidden] {
  display: none;
}

.cta__media {
  position: relative;
  height: 14rem;
  overflow: hidden;
}

.cta__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cta__media-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to top, rgba(76, 29, 149, 0.4), transparent 60%);
  pointer-events: none;
}

@media (min-width: 640px) {
  .cta__card {
    grid-template-columns: 1fr 1fr;
  }

  .cta__media {
    height: auto;
  }

  .cta__media-overlay {
    background-image: linear-gradient(to left, rgba(76, 29, 149, 0.4), transparent 60%);
  }
}

/* Motion — disabled entirely under reduced motion; the gradient renders
   static at its resting position and every element already renders at its
   final, fully visible state outside this media query. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes al-cta20-shift {
    0%,
    100% {
      background-position: 0% 50%;
    }
    50% {
      background-position: 100% 50%;
    }
  }

  @keyframes al-cta20-up {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .gradient {
    background-size: 220% 220%;
    animation: al-cta20-shift 10000ms ease-in-out infinite;
  }

  .reveal {
    animation: al-cta20-up 650ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
}
