<?php

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

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

if (!function_exists('eryndo_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 eryndo_register_block_styles() {
        // Register checkmark list style for core/list block
        register_block_style(
            'core/list',
            [
                'name'         => 'checkmark-list',
                'label'        => __('Checkmark', 'eryndo'),
                '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', 'eryndo_register_block_styles');
}
