{{/* Hugo Blox: CTA Card */}} {{/* Documentation: https://hugoblox.com/blocks/ */}} {{/* License: https://github.com/HugoBlox/hugo-blox-builder/blob/main/LICENSE.md */}} {{/* Initialise */}} {{ $page := .wcPage }} {{ $block := .wcBlock }} {{ $title := $block.content.title | emojify | $page.RenderString }} {{ $text := $block.content.text | emojify | $page.RenderString | safeHTML }} {{ $card_class := $block.design.card.css_class }} {{ $card_style := $block.design.card.css_style }} {{/* Contrast and accessibility controls */}} {{ $text_color_mode := $block.design.card.text_color | default "auto" }} {{ $overlay_opacity := $block.design.card.overlay_opacity | default 0.15 }} {{/* Auto-detect text color based on background */}} {{ $text_classes := "" }} {{ $button_classes := "" }} {{ if eq $text_color_mode "light" }} {{ $text_classes = "text-white" }} {{ $button_classes = "text-gray-900" }} {{ else if eq $text_color_mode "dark" }} {{ $text_classes = "text-gray-900" }} {{ $button_classes = "text-gray-900" }} {{ else }} {{/* Auto mode - detect based on gradient colors */}} {{ $is_dark_bg := false }} {{ with $block.design.background.gradient.start }} {{ if or (hasPrefix . "primary-7") (hasPrefix . "primary-8") (hasPrefix . "primary-9") (hasPrefix . "secondary-7") (hasPrefix . "secondary-8") (hasPrefix . "secondary-9") }} {{ $is_dark_bg = true }} {{ end }} {{ end }} {{ if $is_dark_bg }} {{ $text_classes = "text-white" }} {{ $button_classes = "text-gray-900" }} {{ else }} {{ $text_classes = "text-gray-900 dark:text-white" }} {{ $button_classes = "text-gray-900 dark:text-gray-100" }} {{ end }} {{ end }} {{/* Modern 2025 CTA Card - Background controlled via design.background in front matter */}} {{ $custom_style := printf "--glassmorphism-opacity: %s;" (string $overlay_opacity) }} {{ if $card_style }} {{ $custom_style = printf "%s%s" $custom_style $card_style }} {{ end }}