<?php

/** @var \Kirby\Cms\Block $block */ ?>

<?php
$styles = "";
$styles .= $block->txtcolor()->isNotEmpty() ? "--b-fc:" . $block->txtcolor() . ";"  : "";
$styles .= $block->fontsize()->isNotEmpty() ? "--b-fs: calc(" . $block->fontsize() . " * var(--fs-base));"  : "";
$styles .= $block->fontweight()->isNotEmpty() ? "--b-fw:" . $block->fontweight() . ";"  : "";
$styles .= $block->fontfamily()->isNotEmpty() ? "--b-ff:" . $block->fontfamily() . ";"  : "";

$pre_class = $block->pre_class()->isNotEmpty() ? $block->pre_class()->value() : '';
$class = $block->class()->or('');

?>
<?php if (strlen($styles) > 0) : ?>
    <span class="txt-styled <?= e($pre_class || $class, $class . ' ' . $pre_class) ?>" style="<?= $styles ?>">
        <?= $block->text(); ?>
    </span>
<?php else : ?>
    <span <?= e($pre_class || $class, 'class="' . $class . ' ' . $pre_class . '"') ?>>
        <?= $block->text(); ?>
    </span>
<?php endif ?>