<?php
use Magento\Framework\App\RequestInterface;

/** @var \Magento\Framework\View\Element\Template $block */
$request = $block->getRequest();
$route = $request->getRouteName();
$controller = $request->getControllerName();
$action = $request->getActionName();

$isOrderView = $route === 'sales' && $controller === 'order' && $action === 'view';
$pageHeading = $isOrderView ? __('Order Details') : $block->getPageHeading();

$textSizeCssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : ' text-3xl';
$titleContainerClasses = 'px-3 2xl:container 3xl:max-w-screen-2xl py-1 flex flex-col md:flex-row flex-wrap mt-4 font-bold justify-center';
$titleHtml = '';

if (trim((string)$pageHeading)) {
    $titleHtml = '<span class="base" data-ui-id="page-title-wrapper" '
        . $block->getAddBaseAttribute()
        . '>'
        . $escaper->escapeHtml($pageHeading)
        . '</span>';
}
?>
<?php if ($titleHtml): ?>
    <div class="<?= $escaper->escapeHtmlAttr($titleContainerClasses . $textSizeCssClass) ?>">
        <h1 class="text-primary-darker text-xl md:text-2xl xl:text-3xl page-title title-font text-center md:text-start"
            <?php if ($block->getId()): ?> id="<?= $escaper->escapeHtmlAttr($block->getId()) ?>" <?php endif; ?>>
            <?= /* @noEscape */ $titleHtml ?>
        </h1>
        <?= $block->getChildHtml() ?>
    </div>
<?php endif; ?>
