<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
  <meta charset="<?php bloginfo( 'charset' ); ?>" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="shortcut icon" href="<?php echo esc_url( get_template_directory_uri() ); ?>/img/favicon.ico" />
  <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
</head>
<!-- FIXME: Mehr ARIA role setzen -->
<body <?php body_class(); ?>>
  <div id="wrap"><!-- FIXME: Klassen hfeed, site? -->
    <header id="header" role="banner"><!-- FIXME: Klasse site-header? -->
      <hgroup id="branding">
        <h1 class="site-title">
          <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php _e( 'Zurück zur Startseite', 'buena-theme' ); ?>">
            <img alt="Bund der Pfadfinderinnen und Pfadfinder" src="<?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen.png" srcset="<?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen.png 1x, <?php echo esc_url( get_template_directory_uri() ); ?>/img/bundeszeichen@2x.png 2x" width="390" height="79" />
          </a>
        </h1>
        <h2 class="site-description">
          <?php echo esc_html( get_bloginfo( 'name', 'display' ) ); ?>
        </h2>
      </hgroup>
      <nav class="screen-reader-text">
        <!-- FIXME: Tollere Navigation ausdenken -->
        <a href="#content">
          <?php _e( 'Zum Inhalt springen', 'buena-theme' ); ?>
        </a>
      </nav>
      <?php do_action( 'buena_search_form' ); ?>
    </header>
    <div id="left">
      <?php wp_nav_menu( [ 'theme_location' => 'primary', 'depth' => 2, 'container' => 'nav', 'container_class' => 'nav-menu' ] ); ?>
      <?php if ( is_active_sidebar( 'below-navigation' ) ): ?>
        <ul class="widgets">
          <?php dynamic_sidebar( 'below-navigation' ); ?>
        </ul>
      <?php endif; ?>
    </div>
    <div id="teaser">
      <?php if ( is_page() || have_posts() && is_single() ): the_post(); ?>
        <?php if ( has_post_thumbnail() ): ?>
          <?php the_post_thumbnail( 'poster', [ 'alt' => '' ] ); ?>
        <?php else: ?>
          <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
        <?php endif; ?>
        <div id="teaserTitle">
          <h2><?php the_title(); ?></h2>
        </div>
        <?php rewind_posts(); ?>
      <?php elseif ( get_header_image() ): ?>
        <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />
        <div id="teaserTitle">
          <h2><?php bloginfo( 'description' ); ?></h2>
        </div>
      <?php endif; ?>
    </div>
    <div id="main" role="main">
      <div id="content">
        <?php if ( have_posts() ): ?>
          <?php while ( have_posts() ): the_post(); ?>
            <?php get_template_part( 'content', get_post_format() ); ?>
          <?php endwhile; ?>
        <?php else: // FIXME: Wenn berechtigt: Erstellen anbieten ?>
          <article id="post-0" class="post no-results not-found">
            <?php _e( 'Nicht gefunden.', 'buena-theme' ); ?>
          </article>
        <?php endif; ?>
      </div>
      <nav class="pagination">
        <div class="previous"><?php previous_posts_link( __( '« Neuere Beiträge', 'buena-theme' ) ); ?></div>
        <div class="next"><?php next_posts_link( __( 'Ältere Beiträge »', 'buena-theme' ) ); ?></div>
      </nav>
      <?php comments_template(); ?>
    </div>
  </div>
  <?php if ( is_active_sidebar( 'footer' ) ): ?>
    <footer id="footer">
      <ul class="widgets">
        <?php dynamic_sidebar( 'footer' ); ?>
      </ul>
    </footer>
  <?php endif; ?>
<?php wp_footer(); ?>
</body>
</html>
