<!--FansPaysite/header.php-->
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo('charset'); ?>">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<?php wp_head(); ?>
</head>

<?php $fanspaysite_layout = get_theme_mod('fanspaysite_layout', 'left-sidebar'); ?>

<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'fanspaysite' ); ?></a>

<?php if ($fanspaysite_layout === 'top-bar') : ?>
<!-- Top Bar Layout (Fansly-style) -->
<div class="site-wrapper">

<header class="site-topbar" role="banner">
	<div class="topbar-logo">
		<?php
		if (has_custom_logo()) {
			the_custom_logo();
		}
		if (get_theme_mod('display_site_title', true)) {
			if ( is_front_page() ) {
				echo '<h1 class="site-title"><a href="' . esc_url(home_url('/')) . '" rel="home">' . esc_html(get_bloginfo('name')) . '</a></h1>';
			} else {
				echo '<p class="site-title"><a href="' . esc_url(home_url('/')) . '" rel="home">' . esc_html(get_bloginfo('name')) . '</a></p>';
			}
		}
		?>
	</div>

	<nav class="topbar-nav" aria-label="<?php esc_attr_e('Primary navigation', 'fanspaysite'); ?>">
		<div class="topbar-menu">
			<?php
			wp_nav_menu(array(
				'theme_location' => 'menu-1',
				'menu_id'        => 'topbar-primary-menu',
				'container'      => false,
				'items_wrap'     => '%3$s',
				'walker'         => new FansPaysite_TopBar_Walker_Nav_Menu(),
			));
			?>
		</div>
	</nav>

	<div class="topbar-actions">
		<?php if (get_theme_mod('fanspaysite_show_theme_mode_switcher', 'yes') === 'yes') : ?>
			<?php $theme_mode = fanspaysite_get_current_theme_mode(); ?>
			<div id="fanspaysiteMode" class="ui buttons tiny">
				<button class="ui button fpsMode <?php echo ($theme_mode == 'light' ? 'active' : ''); ?>" id="light-mode" title="<?php esc_attr_e('Light', 'fanspaysite'); ?>">
					<i class="fas fa-lightbulb"></i>
				</button>
				<button class="ui button fpsMode <?php echo ($theme_mode == 'dark' ? 'active' : ''); ?>" id="dark-mode" title="<?php esc_attr_e('Dark', 'fanspaysite'); ?>">
					<i class="fas fa-moon"></i>
				</button>
				<button class="ui button fpsMode <?php echo ($theme_mode == 'auto' ? 'active' : ''); ?>" id="auto-mode" title="<?php esc_attr_e('Auto', 'fanspaysite'); ?>">
					<i class="fas fa-cog"></i>
				</button>
			</div>
		<?php endif; ?>
		<button class="topbar-hamburger" id="topbar-hamburger" aria-label="<?php esc_attr_e('Toggle menu', 'fanspaysite'); ?>" aria-expanded="false" aria-controls="topbar-expanded-menu">
			<i class="fas fa-bars"></i>
		</button>
	</div>
</header>

<!-- Expandable full menu panel (hamburger) - always shows icons & text -->
<div class="site-topbar-expanded" id="topbar-expanded-menu" style="display:none;" role="region" aria-label="<?php esc_attr_e('Expanded menu', 'fanspaysite'); ?>">
	<div class="topbar-expanded-inner">
		<div id="fanspaysiteMenu" class="ui vertical menu small fluid fps-expanded-menu">
			<?php
			wp_nav_menu(array(
				'theme_location' => 'menu-1',
				'menu_id'        => 'expanded-primary-menu',
				'container'      => false,
				'items_wrap'     => '%3$s',
				'walker'         => new FansPaysite_Custom_Walker_Nav_Menu(),
			));
			?>
		</div>
	</div>
</div>

<?php do_action( 'fanspaysite_breadcrumb' ); ?>

<div class="site-content-wrapper">
<main id="content" class="site-content">

<?php
if ( get_header_image() ) {
	$header_obj = get_custom_header();
	echo '<div class="header-image"><img src="' . esc_url( get_header_image() ) . '"'
		. ' width="' . esc_attr( $header_obj->width ) . '"'
		. ' height="' . esc_attr( $header_obj->height ) . '"'
		. ' alt="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '"></div>';
}
?>

<?php else : ?>
<!-- Left Sidebar Layout (default, OnlyFans-style) -->
<div class="site-wrapper">
<aside class="site-sidebar">

<header id="masthead" class="site-header" role="banner">
    <div class="logo-title">
        <?php
        if (has_custom_logo()) {
            the_custom_logo();
        }

        if (get_theme_mod('display_site_title', true)) {
            if ( is_front_page() ) {
                echo '<h1 class="site-title"><a href="' . esc_url(home_url('/')) . '" rel="home">' . esc_html(get_bloginfo('name')) . '</a></h1>';
            } else {
                echo '<p class="site-title"><a href="' . esc_url(home_url('/')) . '" rel="home">' . esc_html(get_bloginfo('name')) . '</a></p>';
            }
        }

        if (get_theme_mod('display_site_tagline', true)) {
            echo '<p class="site-tagline">' . esc_html(get_bloginfo('description')) . '</p>';
        }
        ?>
    </div>
    <button class="sidebar-hamburger" id="sidebar-hamburger" aria-label="<?php esc_attr_e('Toggle menu', 'fanspaysite'); ?>" aria-expanded="false" aria-controls="sidebar-menu-panel">
        <i class="fas fa-bars"></i>
    </button>
</header>

<!-- Sidebar menu panel (wraps nav; becomes full-screen overlay in burger mode) -->
<div id="sidebar-menu-panel" class="sidebar-menu-panel">
    <button class="sidebar-panel-close" id="sidebar-panel-close" aria-label="<?php esc_attr_e('Close menu', 'fanspaysite'); ?>">
        <i class="fas fa-times"></i>
    </button>

    <nav id="site-navigation" class="main-navigation" aria-label="<?php esc_attr_e('Primary navigation', 'fanspaysite'); ?>">
        <div id="fanspaysiteMenu" class="ui vertical menu small fluid">
            <?php
                wp_nav_menu(array(
                    'theme_location' => 'menu-1',
                    'menu_id'        => 'primary-menu',
                    'container'      => false,
                    'items_wrap'     => '%3$s',
                    'walker'         => new FansPaysite_Custom_Walker_Nav_Menu(),
                ));
            ?>
        </div>
    </nav>
</div>

<?php if (get_theme_mod('fanspaysite_show_theme_mode_switcher', 'yes') === 'yes') : ?>
    <?php $theme_mode = fanspaysite_get_current_theme_mode(); ?>
    <div id="fanspaysiteMode" class="ui buttons stackable tiny">
        <button class="ui button fpsMode <?php echo ($theme_mode == 'light' ? 'active' : ''); ?>" id="light-mode" title="<?php esc_attr_e('Light', 'fanspaysite'); ?>">
            <i class="fas fa-lightbulb"></i>
        </button>
        <button class="ui button fpsMode <?php echo ($theme_mode == 'dark' ? 'active' : ''); ?>" id="dark-mode" title="<?php esc_attr_e('Dark', 'fanspaysite'); ?>">
            <i class="fas fa-moon"></i>
        </button>
        <button class="ui button fpsMode <?php echo ($theme_mode == 'auto' ? 'active' : ''); ?>" id="auto-mode" title="<?php esc_attr_e('Auto', 'fanspaysite'); ?>">
            <i class="fas fa-cog"></i>
        </button>
    </div>
<?php endif; ?>

<!-- Left sidebar, under menu-->
<div class="site-sidebar-left">
  <?php if (is_active_sidebar('fanspaysite_left_sidebar')) : ?>
	  <?php dynamic_sidebar('fanspaysite_left_sidebar'); ?>
  <?php endif; ?>
</div>

</aside>

<?php do_action( 'fanspaysite_breadcrumb' ); ?>

<main id="content" class="site-content">

<?php
if ( get_header_image() ) {
	$header_obj = get_custom_header();
	echo '<div class="header-image"><img src="' . esc_url( get_header_image() ) . '"'
		. ' width="' . esc_attr( $header_obj->width ) . '"'
		. ' height="' . esc_attr( $header_obj->height ) . '"'
		. ' alt="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '"></div>';
}
?>
<?php endif; ?>
