<?php

/**
 * Register custom block styles for the Axvart theme.
 *
 * This file defines custom block styles that extend the default
 * WordPress block styles with theme-specific variations.
 *
 * @package Axvart
 * @since 1.0.0
 */

if (! defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

if (!function_exists('axvart_register_block_styles')) {
    /**
     * Register custom block styles.
     *
     * Adds theme-specific variations to WordPress core blocks.
     * Currently includes a checkmark list style for the list block.
     *
     * @return void
     */
    function axvart_register_block_styles() {
        // Register checkmark list style for core/list block
        register_block_style(
            'core/list',
            [
                'name'         => 'checkmark-list',
                'label'        => __('Checkmark', 'axvart'),
                'inline_style' => '
                    /* Remove default list styling */
                    ul.is-style-checkmark-list {
                        list-style: none;
                        padding-left: 0;
                    }

                    /* Style list items with custom checkmark */
                    ul.is-style-checkmark-list li {
                        position: relative;
                        padding-inline-start: 4ch;
                        margin-bottom: 0.75em;
                    }

                    /* Create checkmark using pseudo-element */
                    ul.is-style-checkmark-list li::before {
                        content: "\\2713"; /* Unicode checkmark */
                        position: absolute;
                        left: 0.5ch;
                        top: 50%;
                        transform: translateY(-50%);
                        width: 1.2em;
                        height: 1.2em;
                        border: 2px solid currentColor;
                        border-radius: 50%;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        font-size: 0.9em;
                        background-color: transparent;
                    }
                ',
            ]
        );
    }
    add_action('init', 'axvart_register_block_styles');
}
