<?php
/**
 * Card Opening Tag - Template
 * 
 * @package OrokuBlocks
 * @author OrokuBlocks (https://orokublocks.com/)
 * 
 * @since 1.0.0
 * 
 * @param array $args {
 *   @type string $version          Card template version.
 *   @type array  $options          Template options.
 * }
 */

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

$options = $args['options'];

$card_style_attributes = [
  /**
   * Font
   */
  '--font-family'                           => $options['use_plugin_font'] ? '"Inter", sans-serif' : 'inherit',
  '--font-scale'                            => $options['font_scale'],
  /**
   * Card
   */
  '--card-border-radius'                    => $options['card_border_radius'],
  '--card-image-border-radius'              => $options['card_image_border_radius'],
  /**
   * Light Theme
   */
  '--light-primary-color'                   => $options['light_primary_color'],
  '--light-background-color'                => $options['light_background_color'],
  '--light-background-alt-color'            => $options['light_background_alt_color'],
  '--light-line-color'                      => $options['light_line_color'],
  '--light-text-color'                      => $options['light_text_color'],
  /**
   * Dark Theme
   */
  '--dark-primary-color'                    => $options['dark_primary_color'],
  '--dark-background-color'                 => $options['dark_background_color'],
  '--dark-background-alt-color'             => $options['dark_background_alt_color'],
  '--dark-line-color'                       => $options['dark_line_color'],
  '--dark-text-color'                       => $options['dark_text_color'],
  /**
   * Rating
   */
  '--rating-color'                          => $options['rating_color'],
  '--rating-underline-color'                => $options['rating_underline_color']
];

if ( $options['width'] !== 0 ) {
  $card_style_attributes['max-width'] = $options['width'] . 'px';
}

$card_style_attributes_string = '';

foreach ( $card_style_attributes as $property => $value ) {
  $card_style_attributes_string .= $property . ': ' . $value . ';';
}

?>
<div
  class="orokublocks-affiliatereferral orokublocks-widget orokublocks-widget--theme--<?php echo esc_attr( $options['theme'] ); ?>"
  style="<?php echo esc_attr( $card_style_attributes_string ); ?>"
  data-decimalpoints="<?php echo esc_attr( $options['decimal_points'] ); ?>"
>