<?php
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

?><!DOCTYPE html>
<html <?php language_attributes(); ?> class="elementsell-thank-you-html">
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
    <meta name="format-detection" content="telephone=no">
    <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title>
    <!-- ElementSell thank-you layout 2026-07-24.01 -->
    <style>
        html.elementsell-thank-you-html {
            margin: 0;
            padding: 0;
            width: 100%;
            overflow-x: hidden;
            -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
        }
        html.elementsell-thank-you-html,
        body.elementsell-thank-you-page {
            margin: 0;
            padding: 0;
            min-height: 100%;
            min-height: 100dvh;
            background: #fff;
            font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            color: #222;
        }
        body.elementsell-thank-you-page {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 100%;
            box-sizing: border-box;
        }
        .elementsell-thank-you-canvas,
        .elementsell-thank-you-canvas .wp-block-shortcode,
        .elementsell-thank-you-canvas .entry-content {
            width: 100%;
            max-width: 420px;
            margin: 0 auto;
            padding: 0 16px;
            box-sizing: border-box;
        }
    </style>
    <?php
    if ( function_exists( 'elementsell_ensure_thank_you_minimal_styles_printed' ) ) {
        elementsell_ensure_thank_you_minimal_styles_printed( true );
    }
    ?>
</head>
<body class="elementsell-thank-you-page">
<main class="elementsell-thank-you-canvas">
<?php
$payment_uid = function_exists( 'elementsell_get_thank_you_request_payment_uid' )
    ? elementsell_get_thank_you_request_payment_uid()
    : '';

// Po platbě vždy přímý shortcode — Elementor the_content na /diky bývá prázdný.
if ( $payment_uid !== '' && function_exists( 'elementsell_render_thank_you_shortcode' ) ) {
    echo elementsell_render_thank_you_shortcode(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
    while ( have_posts() ) {
        the_post();
        the_content();
    }
}
?>
</main>
</body>
</html>
