<?php
/**
 * Theme-independent 404 template for protected login requests.
 *
 * @package Polanger_Dashboard_Tools
 */

if ( ! defined( 'ABSPATH' ) ) {
  exit;
}

$pdt_login_guard_404_context = isset( $pdt_login_guard_404_context ) && is_array( $pdt_login_guard_404_context )
  ? $pdt_login_guard_404_context
  : array(
    'page_title'      => __( 'Page not found', 'polanger-admin-menu-manager' ),
    'eyebrow'         => '',
    'title'           => __( 'Looks like we wandered off the map.', 'polanger-admin-menu-manager' ),
    'message'         => __( 'We could not find the address you were looking for, but that does not mean the road ends here.', 'polanger-admin-menu-manager' ),
    'supporting_text' => __( 'There may be a typo, or the page may have been updated. We will guide you back to a safe path right away. Use the link below to return to the homepage.', 'polanger-admin-menu-manager' ),
    'home_label'      => __( 'Return to homepage', 'polanger-admin-menu-manager' ),
    'home_url'        => home_url( '/' ),
    'site_title'      => wp_strip_all_tags( get_bloginfo( 'name' ), true ),
    'site_icon_url'   => '',
    'logo_url'        => '',
    'body_style'      => '',
  );

if ( function_exists( 'remove_action' ) ) {
  remove_action( 'wp_print_styles', 'print_emoji_styles' );
  remove_action( 'admin_print_styles', 'print_emoji_styles' );
}

if ( function_exists( 'wp_register_style' ) && function_exists( 'wp_add_inline_style' ) && function_exists( 'wp_enqueue_style' ) ) {
  wp_register_style( 'pdt-login-guard-emoji-safe', false );
  wp_add_inline_style(
    'pdt-login-guard-emoji-safe',
    'img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 0.07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; }'
  );
  wp_enqueue_style( 'pdt-login-guard-emoji-safe' );
}
?><!doctype html>
<html <?php language_attributes(); ?>>
  <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="robots" content="noindex,nofollow" />
    <title><?php echo esc_html( $pdt_login_guard_404_context['page_title'] ); ?></title>
    <?php if ( ! empty( $pdt_login_guard_404_context['site_icon_url'] ) ) : ?>
      <link rel="icon" href="<?php echo esc_url( $pdt_login_guard_404_context['site_icon_url'] ); ?>" />
    <?php endif; ?>
    <?php
    if ( function_exists( 'wp_print_styles' ) ) {
      wp_print_styles( array( 'pdt-login-guard-404', 'pdt-login-guard-emoji-safe' ) );
    }
    ?>
  </head>
  <body class="pdt-login-guard-404-body" style="<?php echo esc_attr( $pdt_login_guard_404_context['body_style'] ); ?>">
    <main class="pdt-login-guard-404-shell" role="main" aria-labelledby="pdt-login-guard-404-title">
      <div class="pdt-login-guard-404-orb pdt-login-guard-404-orb--one" aria-hidden="true"></div>
      <div class="pdt-login-guard-404-orb pdt-login-guard-404-orb--two" aria-hidden="true"></div>

      <section class="pdt-login-guard-404-card">
        <div class="pdt-login-guard-404-visual">
          <div class="pdt-login-guard-404-brand">
            <?php if ( ! empty( $pdt_login_guard_404_context['logo_url'] ) ) : ?>
              <img class="pdt-login-guard-404-brand__logo" src="<?php echo esc_url( $pdt_login_guard_404_context['logo_url'] ); ?>" alt="<?php echo esc_attr( $pdt_login_guard_404_context['site_title'] ); ?>" />
            <?php elseif ( ! empty( $pdt_login_guard_404_context['site_icon_url'] ) ) : ?>
              <img class="pdt-login-guard-404-brand__icon" src="<?php echo esc_url( $pdt_login_guard_404_context['site_icon_url'] ); ?>" alt="" />
            <?php else : ?>
              <span class="pdt-login-guard-404-brand__fallback" aria-hidden="true"><?php echo esc_html( strtoupper( function_exists( 'mb_substr' ) ? mb_substr( $pdt_login_guard_404_context['site_title'], 0, 1 ) : substr( $pdt_login_guard_404_context['site_title'], 0, 1 ) ) ); ?></span>
            <?php endif; ?>

            <div class="pdt-login-guard-404-brand__copy">
              <?php if ( ! empty( $pdt_login_guard_404_context['eyebrow'] ) ) : ?>
                <span class="pdt-login-guard-404-brand__eyebrow"><?php echo esc_html( $pdt_login_guard_404_context['eyebrow'] ); ?></span>
              <?php endif; ?>
              <strong class="pdt-login-guard-404-brand__title"><?php echo esc_html( $pdt_login_guard_404_context['site_title'] ); ?></strong>
            </div>
          </div>

          <div class="pdt-login-guard-404-stage" aria-hidden="true">
            <div class="pdt-login-guard-404-cloud pdt-login-guard-404-cloud--one"></div>
            <div class="pdt-login-guard-404-cloud pdt-login-guard-404-cloud--two"></div>

            <div class="pdt-login-guard-404-speech">
              <strong><?php esc_html_e( 'Wrong turn detected.', 'polanger-admin-menu-manager' ); ?></strong>
              <span><?php esc_html_e( 'This URL skipped the map and walked straight into a 404.', 'polanger-admin-menu-manager' ); ?></span>
            </div>

            <div class="pdt-login-guard-404-mascot">
              <div class="pdt-login-guard-404-mascot__shadow"></div>
              <div class="pdt-login-guard-404-mascot__body">
                <span class="pdt-login-guard-404-mascot__eye pdt-login-guard-404-mascot__eye--left"></span>
                <span class="pdt-login-guard-404-mascot__eye pdt-login-guard-404-mascot__eye--right"></span>
                <span class="pdt-login-guard-404-mascot__mouth"></span>
                <span class="pdt-login-guard-404-mascot__cheek pdt-login-guard-404-mascot__cheek--left"></span>
                <span class="pdt-login-guard-404-mascot__cheek pdt-login-guard-404-mascot__cheek--right"></span>
              </div>
              <div class="pdt-login-guard-404-mascot__arm pdt-login-guard-404-mascot__arm--left"></div>
              <div class="pdt-login-guard-404-mascot__arm pdt-login-guard-404-mascot__arm--right"></div>
            </div>

            <div class="pdt-login-guard-404-sign">
              <span class="pdt-login-guard-404-sign__code">404</span>
              <span class="pdt-login-guard-404-sign__label"><?php esc_html_e( 'Lost Route', 'polanger-admin-menu-manager' ); ?></span>
            </div>
          </div>

          <div class="pdt-login-guard-404-code" aria-hidden="true">404</div>
        </div>

        <div class="pdt-login-guard-404-content">
          <span class="pdt-login-guard-404-badge"><?php esc_html_e( 'Page unavailable', 'polanger-admin-menu-manager' ); ?></span>
          <h1 id="pdt-login-guard-404-title" class="pdt-login-guard-404-title"><?php echo esc_html( $pdt_login_guard_404_context['title'] ); ?></h1>
          <p class="pdt-login-guard-404-message"><?php echo esc_html( $pdt_login_guard_404_context['message'] ); ?></p>
          <p class="pdt-login-guard-404-supporting"><?php echo esc_html( $pdt_login_guard_404_context['supporting_text'] ); ?></p>

          <div class="pdt-login-guard-404-actions">
            <a class="pdt-login-guard-404-button pdt-login-guard-404-button--primary" href="<?php echo esc_url( $pdt_login_guard_404_context['home_url'] ); ?>">
              <?php echo esc_html( $pdt_login_guard_404_context['home_label'] ); ?>
            </a>
          </div>
        </div>
      </section>
    </main>
  </body>
</html>
