{#
/**
* @file
* LocalGovDrupal theme implementation to display a single page.
*
* The doctype, html, head and body tags are not in this template. Instead they
* can be found in the html.html.twig template in this directory.
*
* Available variables:
*
* General utility variables:
* - base_path: The base URL path of the Drupal installation. Will usually be
*   "/" unless you have installed Drupal in a sub-directory.
* - is_front: A flag indicating if the current page is the front page.
* - logged_in: A flag indicating if the user is registered and signed in.
* - is_admin: A flag indicating if the user has permission to access
*   administration pages.
* - has_sidebar_first: Can we expect any content in the first sidebar?
* - has_sidebar_second: See above.
*
* Site identity:
* - front_page: The URL of the front page. Use this instead of base_path when
*   linking to the front page. This includes the language domain or prefix.
*
* Page content (in order of occurrence in the default page.html.twig):
* - messages: Status and error messages. Should be displayed prominently.
* - node: Fully loaded node, if there is an automatically-loaded node
*   associated with the page and the node ID is the second argument in the
*   page's path (e.g. node/12345 and node/12345/revisions, but not
*   comment/reply/12345).
*
* Regions:
* - page.header
* - page.search
* - page.mobile_search
* - page.primary_menu
* - page.secondary_menu
* - page.banner
* - page.breadcrumb
* - page.messages
* - page.content_top
* - page.content
* - page.content_bottom
* - page.sidebar_first
* - page.sidebar_second
* - page.footer_first
* - page.footer_second
* - page.disabled
* @see template_preprocess_page()
* @see html.html.twig
*
* @ingroup themeable
*/
#}

{#
  We'll use this `footer_regions` array later to check if there is content in
  at least one of them before we start rendering the footer element. It will
  probably always return true, but no harm in checking.
#}
{%
  set footer_regions = [
    'has_footer_first',
    'has_footer_second',
    'has_footer_third',
    'footer',
    'has_lower_footer_first',
    'has_lower_footer_second',
    'has_lower_footer_third',
  ]
%}

{#
  We create a dedicated tabs region and place it at the top of the page.
  This is to make sure tabs don't interfere with any other content, but
  especially to make sure other content doesn't interfere with tabs (which)
  can often happen if `position: absolute` further down the page, causing
  content to cover tabs and other issues.

  Taking this approach also means we can have consistent styling for the
  tabs region on all localgov_drupal websites. Yay!
#}
{% if has_tabs %}
  {{ page.tabs }}
{% endif %}

{% block header %}
  {% include '@localgov_base/layout/header.html.twig' with {'page': page} %}
{% endblock %}

{% if has_banner %}
  {{ page.banner }}
{% endif %}

{% if has_breadcrumb %}
  {{ page.breadcrumb }}
{% endif %}

{{ page.messages }}

<main class="main" id="main-content"> {# The "skip to content" link jumps to here. #}

  {% if has_content_top %}
    {{ page.content_top }}
  {% endif %}

  {% block page_content %}
    {#
      Placing this in a block, so we can override it with custom HTML if we
      want on any templates that extend this one.
    #}
    <div class="lgd-container">
        <div class="lgd-row">
          <div class="lgd-row__full">
            <div class="padding-horizontal">
              {{ default_status_content }}
              {{ page.content }}
            </div>
          </div>
        </div>
    </div>
  {% endblock %}

  {% if has_content_bottom %}
    {{ page.content_bottom }}
  {% endif %}
</main>

{# Begin Footer Regions #}
{% block footer_sections %}
  {% if footer_regions %}
    {#
      Wrap all of the "lgd-footers" in a `footer` element for semantics.
      This should ensure that all the contact/housekeeping links/etc
      are within the footer element to assist screenreaders and other
      automated tools.
    #}
    <footer class="lgd-footer">

    {# Begin Pre-footer #}
    {% block pre_footer %}
      {% if has_footer_first or has_footer_second or has_footer_third %}
        <div class="lgd-footer__pre-footer">
          <div class="lgd-container">
            <div class="lgd-row">
              {% if has_footer_first %}
                <div class="lgd-row__one-third">
                  {{ page.footer_first }}
                </div>
              {% endif %}

              {% if has_footer_second %}
                <div class="lgd-row__one-third">
                  {{ page.footer_second }}
                </div>
              {% endif %}

              {% if has_footer_third %}
                <div class="lgd-row__one-third">
                  {{ page.footer_third }}
                </div>
              {% endif %}
            </div>
          </div>
        </div>
      {% endif %}
    {% endblock %}
    {# End Pre-footer #}

    {# Begin Footer #}
    {% block footer %}
      {% if has_footer %}
        <div class="lgd-footer__footer">
          <div class="lgd-container">
            <div class="lgd-row">
              <div class="lgd-row__full">
                {{ page.footer }}
              </div>
            </div>
          </div>
        </div>
      {% endif %}
    {% endblock %}
    {# End Footer #}

    {# Begin Post-footer #}
    {% block post_footer %}
      {% if has_lower_footer_first or has_lower_footer_second or has_lower_footer_third %}
        <div class="lgd-footer__post-footer">
          <div class="lgd-container">
            <div class="lgd-row">
              {% if has_lower_footer_first %}
                <div class="lgd-row__one-third">
                  {{ page.lower_footer_first }}
                </div>
              {% endif %}

              {% if has_lower_footer_second %}
                <div class="lgd-row__one-third">
                  {{ page.lower_footer_second }}
                </div>
              {% endif %}

              {% if has_lower_footer_third %}
                <div class="lgd-row__one-third">
                  {{ page.lower_footer_third }}
                </div>
              {% endif %}
            </div>
          </div>
        </div>
      {% endif %}
    {% endblock %}
    {# End Post-footer #}

    </footer>
  {% endif %}
{% endblock %}
{# End Footer Regions #}
