<?php
/**
 * Custom Block Style for Gutenberg Block Editor
 *
 * Registers custom block styles for various core blocks
 * (lists, buttons, headings, groups, etc.).
 *
 * @package    Wira
 * @since      1.0.0
 */

namespace Wira;

if ( ! class_exists( 'Register_Block_Style' ) ) {

	/**
	 * Register_Block_Style
	 *
	 * Handles registering all custom block styles
	 * for Gutenberg core blocks.
	 *
	 * @since 1.0.0
	 */
	class Register_Block_Style {

		/**
		 * Constructor
		 *
		 * Registers init hook.
		 *
		 * @since 1.0.0
		 */
		public function __construct() {
			add_action( 'init', array( $this, 'register_styles' ) );
		}

		/**
		 * Register all custom block styles.
		 *
		 * Each block style is tied to a core block type,
		 * with a unique `name` and human-readable `label`.
		 *
		 * @since 1.0.0
		 * @return void
		 */
		public function register_styles() {

			// === Core Details: Arrow icon style ===
			register_block_style(
				'core/details',
				array(
					'name'         => 'arrow-icon-details',
					'label'        => __( 'Arrow icon', 'wira' ),
					/* Inline CSS specific to arrow-icon-details */
					'inline_style' => '
						.is-style-arrow-icon-details {
							padding-top: var(--wp--preset--spacing--10);
							padding-bottom: var(--wp--preset--spacing--10);
						}

						.is-style-arrow-icon-details summary::after {
							content: "\f078";
							font-family: "Font Awesome Free";
							font-weight: 900;
							font-size: inherit !important;
						}

						.is-style-arrow-icon-details[open] > summary {
							list-style-type: "\2192\00a0\00a0\00a0";
						}',
				)
			);

			// === Core Post Terms: Pill style ===
			register_block_style(
				'core/post-terms',
				array(
					'name'         => 'pill',
					'label'        => __( 'Pill', 'wira' ),
					/* Styles variation for post terms */
					'inline_style' => '
						.is-style-pill a,
						.is-style-pill span:not([class], [data-rich-text-placeholder]) {
							display: inline-block;
							background-color: var(--wp--preset--color--base-2);
							padding: 0.375rem 0.875rem;
							border-radius: var(--wp--preset--spacing--20);
						}

						.is-style-pill a:hover {
							background-color: var(--wp--preset--color--contrast-3);
						}',
				)
			);

			// === Core List: variations ===
			register_block_style(
				'core/list',
				array(
					'name'  => 'checkmark-list-light',
					'label' => __( 'Checkmark Light', 'wira' ),
				)
			);
			register_block_style(
				'core/list',
				array(
					'name'  => 'checkmark-list-dark',
					'label' => __( 'Checkmark Dark', 'wira' ),
				)
			);
			register_block_style(
				'core/list',
				array(
					'name'  => 'icon-right-light',
					'label' => __( 'Icon Right Light', 'wira' ),
				)
			);
			register_block_style(
				'core/list',
				array(
					'name'  => 'icon-right-dark',
					'label' => __( 'Icon Right Dark', 'wira' ),
				)
			);

			// === Core Navigation ===
			register_block_style(
				'core/navigation',
				array(
					'name'  => 'hover-dark',
					'label' => __( 'Hover Dark', 'wira' ),
				)
			);

			// === Core Button: multiple variations ===
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-primary',
					'label' => __( 'Button Primary', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-secondary',
					'label' => __( 'Button Secondary', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-grad-primary',
					'label' => __( 'Button Gradient Primary', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-grad-secondary',
					'label' => __( 'Button Gradient Secondary With Arrow', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-grad-primary-arrow',
					'label' => __( 'Button Gradient Primary With Arrow', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-grad-secondary-arrow',
					'label' => __( 'Button Gradient Secondary', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-transparent',
					'label' => __( 'Button Transparent', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-white',
					'label' => __( 'Button White', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-link',
					'label' => __( 'Button Link', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-link-secondary',
					'label' => __( 'Button Link Secondary', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-link-arrow',
					'label' => __( 'Button Link Arrow', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-link-arrow-secondary',
					'label' => __( 'Button Link Arrow Secondary', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-link-phone',
					'label' => __( 'Button Link Phone', 'wira' ),
				)
			);
			register_block_style(
				'core/button',
				array(
					'name'  => 'btn-link-phone-secondary',
					'label' => __( 'Button Link Phone Secondary', 'wira' ),
				)
			);

			// === Core Heading ===
			register_block_style(
				'core/heading',
				array(
					'name'  => 'subheading',
					'label' => __( 'Subheading', 'wira' ),
				)
			);
			register_block_style(
				'core/heading',
				array(
					'name'  => 'mark-light',
					'label' => __( 'With Mark Light', 'wira' ),
				)
			);
			register_block_style(
				'core/heading',
				array(
					'name'  => 'mark-dark',
					'label' => __( 'With Mark Dark', 'wira' ),
				)
			);

			// === Core Paragraph ===
			register_block_style(
				'core/paragraph',
				array(
					'name'  => 'block-quote-paragraph',
					'label' => __( 'Block Quote Style', 'wira' ),
				)
			);
			register_block_style(
				'core/paragraph',
				array(
					'name'  => 'quote-paragraph',
					'label' => __( 'Quote Style', 'wira' ),
				)
			);

			// === Core Group ===
			register_block_style(
				'core/group',
				array(
					'name'  => 'block-section',
					'label' => __( 'Block Section', 'wira' ),
				)
			);
			register_block_style(
				'core/group',
				array(
					'name'  => 'box-shadow',
					'label' => __( 'With Box Shadow', 'wira' ),
				)
			);
			register_block_style(
				'core/group',
				array(
					'name'  => 'box-hover',
					'label' => __( 'Box Hovered', 'wira' ),
				)
			);
			register_block_style(
				'core/group',
				array(
					'name'  => 'stack-big',
					'label' => __( 'Stack Big', 'wira' ),
				)
			);
			register_block_style(
				'core/group',
				array(
					'name'  => 'stack-medium',
					'label' => __( 'Stack Medium', 'wira' ),
				)
			);
			register_block_style(
				'core/group',
				array(
					'name'  => 'stack-small',
					'label' => __( 'Stack Small', 'wira' ),
				)
			);

			// === Core Columns ===
			register_block_style(
				'core/columns',
				array(
					'name'  => 'columns-reverse',
					'label' => __( 'Columns Reverse', 'wira' ),
				)
			);

			// === Core Column ===
			register_block_style(
				'core/column',
				array(
					'name'  => 'column-centered',
					'label' => __( 'Column With Centered', 'wira' ),
				)
			);

			// === Core Cover ===
			register_block_style(
				'core/cover',
				array(
					'name'  => 'cover-mobile-3',
					'label' => __( 'Cover Height 100% Responsive', 'wira' ),
				)
			);
		}
	}
}
