<noscript><p id="javascript-warning"><%= t(".javascript") %></p></noscript>

<!-- BEGIN header -->
<% if @collection %>
  <!-- custom css for header -->
  <style type="text/css">
  #header h2 { 
    background: #616C90 <% if (header_url = @collection.header_image_url || (@collection_parent && @collection_parent.header_image_url)) %>
      <% height = (size = FastImage.size(header_url, timeout: 1)) ? "#{size[1]}px" : "100%" %>
      url(<%= header_url %>); height: <%= height %>
    <% end %>;
  }
  </style>
<% end %>

<header id="header" class="region<% if @collection %> collection<% end %>">

  <h1 class="heading">
    <%= link_to(content_tag(:span, ArchiveConfig.APP_NAME) + content_tag(:sup, "loving women+ online") +
    image_tag("/images/ao3_logos/logo_42.png", alt: ArchiveConfig.ALT_LOGO, class: "logo", skip_pipeline: true), root_path) %>
  </h1>

  <% if logged_in? || logged_in_as_admin? %>
    <%= render "users/sessions/greeting" %>
  <% else %>
    <div id="login" class="dropdown">
      <p class="user actions">
        <%= link_to t(".login"), new_user_session_path, id: "login-dropdown" %>
      </p>
      <%= render "users/sessions/login" %>
    </div>
  <% end %>

  <nav aria-label="<%= t(".nav.label") %>">
    <ul class="primary navigation actions">
      <li class="dropdown">
        <%= link_to t(".nav.fandoms"), menu_fandoms_path %>
        <%= render "menu/menu_fandoms" %>
      </li>
      <li class="dropdown">
        <%= link_to t(".nav.browse"), menu_browse_path %>
        <%= render "menu/menu_browse" %>
      </li>
      <li class="dropdown">
        <%= link_to t(".nav.search"), menu_search_path %>
        <%= render "menu/menu_search" %>
      </li>
      <li class="dropdown">
        <%= link_to t(".nav.about"), menu_about_path %>
        <%= render "menu/menu_about" %>
      </li>
      <li class="dropdown">
        <a href="/">Links</a>
        <%= render "menu/menu_othersites" %> 
          </li>
          <li class="dropdown">
        <a href="/">Community</a>
        <%= render "menu/menu_community" %> 
          </li>
      <li class="search"><%= render "works/search_box" %></li>
    </ul>
  </nav>

  <% if logged_in_as_admin? %>
    <%= render "admin/header" %>
  <% end %>

  <% if @collection %>
    <h2 class="collections">
      <% unless @collection.header_image_url.present? %>
        <%= @collection.title || @collection_parent&.title || t(".collections.new") %>
      <% end %>
    </h2>
  <% end %>

  <div class="clear"></div>

</header>

<%= render "layouts/banner" %>

<!-- END header -->
