component CTASection {
  props {
    eyebrow: string = ""
    title: string = "Ready to get started?"
    description: string = ""
    icon: string = ""
    align: string = "center"
    size: string = "default"
    color: string = "primary"
    variant: string = "solid"
    primaryLabel: string = "Get started"
    primaryHref: string = "#"
    primaryIcon: string = ""
    secondaryLabel: string = ""
    secondaryHref: string = ""
    secondaryIcon: string = ""
    backgroundImage: string = ""
    visualImage: string = ""
    visualAlt: string = ""
    visualIcon: string = ""
    visualTitle: string = ""
    visualDescription: string = ""
    visualItems: unknown[] = []
    visualPosition: string = "right"
    maxWidth: string = "xl"
    fullBleed: boolean = false
    class: string = ""
  }

  view {
    <section
      {...attrs}
      data-ui-component="CTASection"
      data-align='{align}'
      data-size='{size}'
      data-color='{color}'
      data-variant='{variant}'
      data-max-width='{maxWidth}'
      data-full-bleed='{fullBleed ? "true" : "false"}'
      data-visual-position='{visualPosition}'
      class='wire-cta-section {class}'
    >
      <div class="wire-cta-section__outer">
        <div class="wire-cta-section__surface">
          {#if backgroundImage}
            <img
              src='{backgroundImage}'
              alt=""
              aria-hidden="true"
              class="wire-cta-section__background-image"
            />
          {/if}

          <div class="wire-cta-section__glow wire-cta-section__glow--one" aria-hidden="true"></div>
          <div class="wire-cta-section__glow wire-cta-section__glow--two" aria-hidden="true"></div>

          <div class="wire-cta-section__layout">
            <div class="wire-cta-section__content">
              {#if icon}
                <div class="wire-cta-section__icon" aria-hidden="true">
                  <span class='{icon}'></span>
                </div>
              {/if}

              {#if eyebrow}
                <p class="wire-cta-section__eyebrow">{eyebrow}</p>
              {/if}

              <h2 class="wire-cta-section__title">{title}</h2>

              {#if description}
                <p class="wire-cta-section__description">{description}</p>
              {/if}

              <slot></slot>

              {#if primaryLabel || secondaryLabel}
                <div class="wire-cta-section__actions">
                  {#if primaryLabel}
                    <a href='{primaryHref || "#"}' class="wire-cta-section__action wire-cta-section__action--primary">
                      {#if primaryIcon}
                        <span class='wire-cta-section__action-icon {primaryIcon}' aria-hidden="true"></span>
                      {/if}
                      <span>{primaryLabel}</span>
                    </a>
                  {/if}

                  {#if secondaryLabel}
                    <a href='{secondaryHref || "#"}' class="wire-cta-section__action wire-cta-section__action--secondary">
                      {#if secondaryIcon}
                        <span class='wire-cta-section__action-icon {secondaryIcon}' aria-hidden="true"></span>
                      {/if}
                      <span>{secondaryLabel}</span>
                    </a>
                  {/if}

                  <slot name="actions"></slot>
                </div>
              {:else}
                <div class="wire-cta-section__actions wire-cta-section__actions--slot">
                  <slot name="actions"></slot>
                </div>
              {/if}
            </div>

            <div class="wire-cta-section__visual-column">
              <slot name="visual"></slot>

              {#if visualImage || visualIcon || visualTitle || visualDescription || visualItems.length > 0}
                <div class="wire-cta-section__visual">
                  {#if visualImage}
                    <div class="wire-cta-section__visual-media">
                      <img src='{visualImage}' alt='{visualAlt}' class="wire-cta-section__visual-image" />
                    </div>
                  {/if}

                  {#if visualIcon || visualTitle || visualDescription}
                    <div class="wire-cta-section__visual-header">
                      {#if visualIcon}
                        <div class="wire-cta-section__visual-icon" aria-hidden="true">
                          <span class='{visualIcon}'></span>
                        </div>
                      {/if}

                      <div class="wire-cta-section__visual-copy">
                        {#if visualTitle}
                          <h3 class="wire-cta-section__visual-title">{visualTitle}</h3>
                        {/if}

                        {#if visualDescription}
                          <p class="wire-cta-section__visual-description">{visualDescription}</p>
                        {/if}
                      </div>
                    </div>
                  {/if}

                  {#if visualItems.length > 0}
                    <div class="wire-cta-section__visual-list">
                      {#each visualItems as item}
                        <div class="wire-cta-section__visual-item">
                          {#if item.icon}
                            <span class='wire-cta-section__visual-item-icon {item.icon}' aria-hidden="true"></span>
                          {/if}
                          <div>
                            <strong>{item.label || item.title}</strong>
                            {#if item.description}
                              <p>{item.description}</p>
                            {/if}
                          </div>
                        </div>
                      {/each}
                    </div>
                  {/if}
                </div>
              {/if}
            </div>
          </div>

          <div class="wire-cta-section__footer">
            <slot name="footer"></slot>
          </div>
        </div>
      </div>
    </section>
  }

  style {
    .wire-cta-section {
      --cta-accent: var(--wire-color-primary);
      --cta-accent-hover: var(--wire-color-primary-hover);
      --cta-accent-soft: var(--wire-color-primary-soft);
      --cta-accent-muted: var(--wire-color-primary-muted);
      --cta-contrast: var(--wire-color-primary-contrast);
      --cta-border: color-mix(in srgb, var(--cta-accent) 15%, var(--wire-color-border));

      position: relative;
      width: 100%;
      color: var(--wire-color-text);
    }

    .wire-cta-section[data-color="secondary"] {
      --cta-accent: var(--wire-color-secondary);
      --cta-accent-hover: var(--wire-color-secondary-hover);
      --cta-accent-soft: var(--wire-color-secondary-soft);
      --cta-accent-muted: var(--wire-color-secondary-muted);
      --cta-contrast: var(--wire-color-secondary-contrast);
    }

    .wire-cta-section[data-color="info"] {
      --cta-accent: var(--wire-color-info);
      --cta-accent-hover: var(--wire-color-info-hover);
      --cta-accent-soft: var(--wire-color-info-soft);
      --cta-accent-muted: var(--wire-color-info-muted);
      --cta-contrast: var(--wire-color-info-contrast);
    }

    .wire-cta-section[data-color="success"] {
      --cta-accent: var(--wire-color-success);
      --cta-accent-hover: var(--wire-color-success-hover);
      --cta-accent-soft: var(--wire-color-success-soft);
      --cta-accent-muted: var(--wire-color-success-muted);
      --cta-contrast: var(--wire-color-success-contrast);
    }

    .wire-cta-section[data-color="warning"] {
      --cta-accent: var(--wire-color-warning);
      --cta-accent-hover: var(--wire-color-warning-hover);
      --cta-accent-soft: var(--wire-color-warning-soft);
      --cta-accent-muted: var(--wire-color-warning-muted);
      --cta-contrast: var(--wire-color-warning-contrast);
    }

    .wire-cta-section[data-color="danger"] {
      --cta-accent: var(--wire-color-danger);
      --cta-accent-hover: var(--wire-color-danger-hover);
      --cta-accent-soft: var(--wire-color-danger-soft);
      --cta-accent-muted: var(--wire-color-danger-muted);
      --cta-contrast: var(--wire-color-danger-contrast);
    }

    .wire-cta-section__outer {
      width: min(calc(100% - 2rem), 80rem);
      margin-inline: auto;
    }

    .wire-cta-section[data-max-width="compact"] .wire-cta-section__outer {
      width: min(calc(100% - 2rem), 64rem);
    }

    .wire-cta-section[data-max-width="lg"] .wire-cta-section__outer {
      width: min(calc(100% - 2rem), 72rem);
    }

    .wire-cta-section[data-max-width="wide"] .wire-cta-section__outer,
    .wire-cta-section[data-max-width="2xl"] .wire-cta-section__outer {
      width: min(calc(100% - 2rem), 90rem);
    }

    .wire-cta-section[data-max-width="full"] .wire-cta-section__outer {
      width: 100%;
      max-width: none;
    }

    .wire-cta-section[data-full-bleed="true"] .wire-cta-section__outer {
      width: 100%;
      max-width: none;
    }

    .wire-cta-section__surface {
      position: relative;
      isolation: isolate;
      overflow: hidden;
      padding: 3rem;
      background:
        radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--cta-accent) 10%, transparent), transparent 28%),
        var(--wire-color-surface-raised);
      border: 1px solid var(--cta-border);
      border-radius: 1.5rem;
      box-shadow:
        0 1px 0 color-mix(in srgb, white 5%, transparent) inset,
        0 24px 70px color-mix(in srgb, black 15%, transparent);
    }

    .wire-cta-section[data-size="compact"] .wire-cta-section__surface,
    .wire-cta-section[data-size="sm"] .wire-cta-section__surface {
      padding: 2rem;
    }

    .wire-cta-section[data-size="lg"] .wire-cta-section__surface {
      padding: 4rem;
    }

    .wire-cta-section[data-full-bleed="true"] .wire-cta-section__surface {
      border-inline: 0;
      border-radius: 0;
    }

    .wire-cta-section[data-variant="soft"] .wire-cta-section__surface {
      background:
        radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--cta-accent) 14%, transparent), transparent 30%),
        linear-gradient(135deg, var(--cta-accent-soft), transparent 64%),
        var(--wire-color-surface-raised);
      box-shadow: none;
    }

    .wire-cta-section[data-variant="outline"] .wire-cta-section__surface {
      background: transparent;
      box-shadow: none;
    }

    .wire-cta-section[data-variant="gradient"] .wire-cta-section__surface {
      color: var(--cta-contrast);
      background:
        radial-gradient(circle at 90% 8%, color-mix(in srgb, white 16%, transparent), transparent 30%),
        linear-gradient(135deg, var(--cta-accent), color-mix(in srgb, var(--cta-accent) 70%, var(--wire-color-secondary)));
      border-color: color-mix(in srgb, white 22%, transparent);
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__surface {
      color: var(--cta-contrast);
      background:
        radial-gradient(circle at 90% 8%, color-mix(in srgb, white 14%, transparent), transparent 30%),
        var(--cta-accent);
      border-color: color-mix(in srgb, white 22%, transparent);
      box-shadow: 0 30px 80px color-mix(in srgb, var(--cta-accent) 28%, transparent);
    }

    .wire-cta-section__background-image {
      position: absolute;
      inset: 0;
      z-index: -3;
      width: 100%;
      height: 100%;
      object-fit: cover;
      opacity: 0.14;
    }

    .wire-cta-section__glow {
      position: absolute;
      z-index: -2;
      width: 22rem;
      height: 22rem;
      pointer-events: none;
      background: var(--cta-accent);
      border-radius: 999px;
      filter: blur(110px);
      opacity: 0.1;
    }

    .wire-cta-section__glow--one {
      top: -12rem;
      right: -7rem;
    }

    .wire-cta-section__glow--two {
      bottom: -14rem;
      left: -8rem;
      opacity: 0.06;
    }

    .wire-cta-section__layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      align-items: center;
      gap: 2.5rem;
    }

    .wire-cta-section__content,
    .wire-cta-section__visual-column {
      min-width: 0;
    }

    .wire-cta-section__content {
      max-width: 48rem;
    }

    .wire-cta-section[data-align="center"] .wire-cta-section__content {
      margin-inline: auto;
      text-align: center;
    }

    .wire-cta-section[data-align="right"] .wire-cta-section__content {
      margin-left: auto;
      text-align: right;
    }

    .wire-cta-section__icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 3rem;
      height: 3rem;
      margin-bottom: 1.1rem;
      color: var(--cta-accent);
      background: var(--cta-accent-soft);
      border: 1px solid color-mix(in srgb, var(--cta-accent) 20%, transparent);
      border-radius: 0.9rem;
      font-size: 1.35rem;
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__icon,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__icon {
      color: currentColor;
      background: color-mix(in srgb, white 14%, transparent);
      border-color: color-mix(in srgb, white 22%, transparent);
    }

    .wire-cta-section__eyebrow {
      margin: 0;
      color: var(--cta-accent);
      font-size: 0.72rem;
      font-weight: 650;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__eyebrow,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__eyebrow {
      color: currentColor;
      opacity: 0.78;
    }

    .wire-cta-section__title {
      max-width: 18ch;
      margin: 0.75rem 0 0;
      color: var(--wire-color-text);
      font-size: clamp(2rem, 5vw, 4rem);
      font-weight: 650;
      line-height: 1.05;
      letter-spacing: -0.045em;
    }

    .wire-cta-section[data-align="center"] .wire-cta-section__title,
    .wire-cta-section[data-align="right"] .wire-cta-section__title {
      margin-inline: auto;
    }

    .wire-cta-section[data-align="right"] .wire-cta-section__title {
      margin-right: 0;
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__title,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__title {
      color: currentColor;
    }

    .wire-cta-section__description {
      max-width: 44rem;
      margin: 1rem 0 0;
      color: var(--wire-color-text-muted);
      font-size: 0.96rem;
      line-height: 1.75;
    }

    .wire-cta-section[data-align="center"] .wire-cta-section__description,
    .wire-cta-section[data-align="right"] .wire-cta-section__description {
      margin-inline: auto;
    }

    .wire-cta-section[data-align="right"] .wire-cta-section__description {
      margin-right: 0;
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__description,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__description {
      color: color-mix(in srgb, currentColor 82%, transparent);
    }

    .wire-cta-section__actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.75rem;
      margin-top: 1.75rem;
    }

    .wire-cta-section__actions--slot:empty {
      display: none;
    }

    .wire-cta-section[data-align="center"] .wire-cta-section__actions {
      justify-content: center;
    }

    .wire-cta-section[data-align="right"] .wire-cta-section__actions {
      justify-content: flex-end;
    }

    .wire-cta-section__action {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.55rem;
      min-height: 2.85rem;
      padding: 0.78rem 1.1rem;
      border-radius: 0.75rem;
      font-size: 0.84rem;
      font-weight: 700;
      line-height: 1;
      text-decoration: none;
      transition:
        transform 160ms ease,
        background-color 160ms ease,
        color 160ms ease,
        border-color 160ms ease;
    }

    .wire-cta-section__action:hover {
      transform: translateY(-2px);
    }

    .wire-cta-section__action--primary {
      color: var(--cta-contrast);
      background: var(--cta-accent);
      border: 1px solid transparent;
    }

    .wire-cta-section__action--primary:hover {
      background: var(--cta-accent-hover);
    }

    .wire-cta-section__action--secondary {
      color: var(--cta-accent);
      background: transparent;
      border: 1px solid color-mix(in srgb, var(--cta-accent) 42%, var(--wire-color-border));
    }

    .wire-cta-section__action--secondary:hover {
      background: var(--cta-accent-soft);
      border-color: var(--cta-accent);
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__action--primary,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__action--primary {
      color: var(--cta-accent);
      background: var(--cta-contrast);
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__action--secondary,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__action--secondary {
      color: currentColor;
      border-color: color-mix(in srgb, white 46%, transparent);
    }

    .wire-cta-section[data-variant="solid"] .wire-cta-section__action--secondary:hover,
    .wire-cta-section[data-variant="gradient"] .wire-cta-section__action--secondary:hover {
      background: color-mix(in srgb, white 12%, transparent);
      border-color: color-mix(in srgb, white 68%, transparent);
    }

    .wire-cta-section__action-icon {
      width: 1rem;
      height: 1rem;
    }

    .wire-cta-section__action:focus-visible {
      outline: 2px solid var(--wire-color-focus);
      outline-offset: 3px;
    }

    .wire-cta-section__visual-column {
      position: relative;
      min-height: 0;
    }

    .wire-cta-section__visual {
      overflow: hidden;
      color: var(--wire-color-text);
      background: var(--wire-color-surface-raised);
      border: 1px solid var(--wire-color-border);
      border-radius: 1.2rem;
      box-shadow: 0 20px 54px color-mix(in srgb, black 18%, transparent);
    }

    .wire-cta-section__visual-media {
      aspect-ratio: 16 / 9;
      overflow: hidden;
      background: var(--wire-color-surface-soft);
    }

    .wire-cta-section__visual-image {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .wire-cta-section__visual-header {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      gap: 0.9rem;
      padding: 1.25rem;
    }

    .wire-cta-section__visual-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 2.6rem;
      height: 2.6rem;
      color: var(--cta-accent);
      background: var(--cta-accent-soft);
      border-radius: 0.82rem;
      font-size: 1.15rem;
    }

    .wire-cta-section__visual-copy {
      min-width: 0;
    }

    .wire-cta-section__visual-title {
      margin: 0;
      color: var(--wire-color-text);
      font-size: 1rem;
      font-weight: 650;
    }

    .wire-cta-section__visual-description {
      margin: 0.42rem 0 0;
      color: var(--wire-color-text-muted);
      font-size: 0.78rem;
      line-height: 1.6;
    }

    .wire-cta-section__visual-list {
      display: grid;
      border-top: 1px solid var(--wire-color-border);
    }

    .wire-cta-section__visual-item {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      gap: 0.7rem;
      padding: 0.95rem 1.25rem;
    }

    .wire-cta-section__visual-item + .wire-cta-section__visual-item {
      border-top: 1px solid var(--wire-color-border);
    }

    .wire-cta-section__visual-item-icon {
      width: 1rem;
      height: 1rem;
      margin-top: 0.12rem;
      color: var(--cta-accent);
    }

    .wire-cta-section__visual-item strong {
      color: var(--wire-color-text);
      font-size: 0.78rem;
    }

    .wire-cta-section__visual-item p {
      margin: 0.3rem 0 0;
      color: var(--wire-color-text-muted);
      font-size: 0.73rem;
      line-height: 1.5;
    }

    .wire-cta-section__footer:empty {
      display: none;
    }

    .wire-cta-section__footer:not(:empty) {
      margin-top: 2rem;
      padding-top: 1.25rem;
      border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent);
    }

    @media (min-width: 900px) {
      .wire-cta-section[data-align="split"] .wire-cta-section__layout {
        grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
        gap: 4rem;
      }

      .wire-cta-section[data-align="split"][data-visual-position="left"] .wire-cta-section__content {
        order: 2;
      }

      .wire-cta-section[data-align="split"][data-visual-position="left"] .wire-cta-section__visual-column {
        order: 1;
      }

      .wire-cta-section[data-align="split"] .wire-cta-section__visual-column:empty {
        display: none;
      }

      .wire-cta-section[data-align="split"] .wire-cta-section__visual-column:empty + * {
        grid-column: 1 / -1;
      }
    }

    @media (max-width: 639px) {
      .wire-cta-section__surface {
        padding: 1.6rem;
        border-radius: 1.2rem;
      }

      .wire-cta-section__actions {
        align-items: stretch;
      }

      .wire-cta-section__action {
        width: 100%;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .wire-cta-section__action {
        transition: none;
      }

      .wire-cta-section__action:hover {
        transform: none;
      }
    }
  }
}
