{#
/**
 * @file
 * Theme override 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.
 *
 * 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):
 * - 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: Items for the header region.
 * - page.primary_menu: Items for the primary menu region.
 * - page.secondary_menu: Items for the secondary menu region.
 * - page.highlighted: Items for the highlighted content region.
 * - page.help: Dynamic help text, mostly for admin pages.
 * - page.content: The main content of the current page.
 * - page.sidebar_first: Items for the first sidebar.
 * - page.sidebar_second: Items for the second sidebar.
 * - page.footer: Items for the footer region.
 * - page.footer_col1: Column 1 of the footer.
 * - page.footer_col2: Column 2 of the footer.
 * - page.footer_col3: Column 3 of the footer.
 * - page.footer_col4: Column 4 of the footer.
 * - page.breadcrumb: Items for the breadcrumb region.
 *
 * @see template_preprocess_page()
 * @see html.html.twig
 */
#}

{%
set nav_classes = 'navbar navbar-expand-md navbar-dark su-bg-cardinal-dark ' ~ (is_front ? 'mb-0' : 'mb-md-8')
%}
{% set node_type = node.getType() %}
<header>
  {% if not is_front %}
  <!-- start su-brand-bar -->
  <div class="su-brand-bar su-brand-bar--dark">
    <div class="su-brand-bar__container">
      <a class="su-brand-bar__logo" href="https://stanford.edu">
        Stanford University
        <span class="su-brand-bar__link--a11y">(link is external)</span>
      </a>
    </div>
  </div>
  <!-- end su-brand-bar -->
  {% endif %}
  {{ page.header }}  

  {% if page.nav_branding or page.nav_main or page.nav_additional %}  
  <nav class="{{ nav_classes }}">
    <div class="container-fluid d-flex">
      {{ page.nav_branding }}

      <button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse"
              data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
              aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
      </button>

      <div class="collapse navbar-collapse justify-content-md-center" id="navbarSupportedContent">
        {{ page.nav_main }}
        {{ page.nav_additional }}
      </div>
    </div>
  </nav>
  {% endif %}

</header>

<main role="main">
  <a id="main-content" tabindex="-1"></a>{# link is in html.html.twig #}

  {% 
  set sidebar_first_classes = (page.sidebar_first and page.sidebar_second) ? 'col-12 col-sm-6 col-lg-3' : 'col-12 col-lg-3'
  %}
  
  {% 
  set sidebar_second_classes = (page.sidebar_first and page.sidebar_second) ? 'col-12 col-sm-6 col-lg-3' : 'col-12 col-lg-3'
  %}
  
  {% 
  set content_classes = (page.sidebar_first and page.sidebar_second) ? 'col-12 col-lg-6' : ((page.sidebar_first or page.sidebar_second) ? 'col-12 col-lg-9' : 'col-12' )
   %}

  {% set container_class = is_front ? 'container-fluid g-0' : (node_type ? 'container container-' ~ node_type : 'container') %}

  <div class="{{ container_class }}">
    {% if page.breadcrumb %}
      {{ page.breadcrumb }}
    {% endif %}
    <div class="row g-0">
      {% if page.sidebar_first %}
        <div class="order-2 order-lg-1 {{ sidebar_first_classes }}">
          {{ page.sidebar_first }}
        </div>
      {% endif %}
      <div class="order-1 order-lg-2 {{ content_classes }}">
        {{ page.content }}
      </div>
      {% if page.sidebar_second %}
        <div class="order-3 {{ sidebar_second_classes }}">
          {{ page.sidebar_second }}
        </div>
      {% endif %}
    </div>
  </div>

</main>

<footer class="mt-auto">

{% if page.footer %}
  <div class="container-fluid">
    {{ page.footer }}
  </div>
{% endif %}
  <!-- start su-local-footer -->
  <div class="su-local-footer">
    <div class="su-local-footer__header">
      <div class="su-lockup su-lockup--option-a">
        <div class="su-lockup__cell1">
          <div class="su-lockup__wordmark-wrapper">
            <span class="su-lockup__wordmark">Stanford</span>
            <span class="su-lockup__line4">{{ ee_basic_school_name|default('Engineering') }}</span>
          </div>
        </div>
        <div class="su-lockup__cell2">
          <span class="su-lockup__line1">{{ ee_basic_department_name|default('Electrical Engineering') }}</span>
        </div>
      </div>
      <a href="{{ logged_in ? path('entity.user.canonical', {'user': user.id }) : path('samlauth.saml_controller_login') }}" class="su-link su-link--internal">{{ logged_in ? 'Logged in as '|t ~ user.account.name : 'Web Login'|t }}</a>
    </div>
    <div class="su-local-footer__columns">
      <div class="su-local-footer__cell1">
        {% if address['#text'] and address['#text'] != '' %}
        <h2 class="su-sr-only-element">Address</h2>
        <address class="su-local-footer__address">
         {{ address }}
        </address>
        {% endif %}{# address #}

        {% if action_links|length %}
        <ul class="su-local-footer__action-links">
          {% for action_link in action_links %}
          <li>
            {{ action_link }}
          </li>
          {% endfor %}
	  <li><a href="/search" title="Search" hreflang="en">Search</a></li>
        </ul>
        {% endif %}
        <ul class="su-local-footer__social-links">
          {% if ee_basic_facebook_link %}
          <li>
            <a href="{{ ee_basic_facebook_link }}" class="su-local-footer__social-facebook">
              <i aria-hidden="true"></i>
              <span>Facebook</span>
            </a>
          </li>
          {% endif %}
          {% if ee_basic_linkedin_link %}
          <li>
            <a href="{{ ee_basic_linkedin_link }}" class="su-local-footer__social-linkedin">
              <i aria-hidden="true"></i>
              <span>LinkedIn</span>
            </a>
          </li>
          {% endif %}
          {% if ee_basic_twitter_link %}
          <li>
            <a href="{{ ee_basic_twitter_link }}" class="su-local-footer__social-twitter">
              <i aria-hidden="true"></i>
              <span>Twitter</span>
            </a>
          </li>
          {% endif %}
          {% if ee_basic_instagram_link %}
          <li>
            <a href="{{ ee_basic_instagram_link }}" class="su-local-footer__social-instagram">
              <i aria-hidden="true"></i>
              <span>Instagram</span>
            </a>
          </li>
          {% endif %}
          {% if ee_basic_youtube_link %}
          <li>
            <a href="{{ ee_basic_youtube_link }}" class="su-local-footer__social-youtube">
              <i aria-hidden="true"></i>
              <span>Youtube</span>
            </a>
          </li>
          {% endif %}
        </ul>
      </div>
      <div class="su-local-footer__cell2">
        {% if page.footer_col1 %}
        {{ page.footer_col1 }}
        {% endif %}
        <!--<nav aria-label="footer primary nav">
          <h2 class="su-local-footer__list-heading">Links to</h2>
          <ul class="su-local-footer__primary-links">
            <li>
              <a href="#">lorem ipsum dolor sit amit</a>
            </li>
            <li>
              <a href="#">Vestibellum ultices nueue</a>
            </li>
            <li>
              <a href="#">Blendius tellus</a>
            </li>
            <li>
              <a href="#">Arnen cowalls</a>
            </li>
            <li>
              <a href="#">Finibus</a>
            </li>
          </ul>
        </nav>
        <nav aria-label="footer secondary nav">
          <h2 class="su-local-footer__list-heading">Resources for</h2>
          <ul class="su-local-footer__secondary-links">
            <li>
              <a href="#">Finibus</a>
            </li>
            <li>
              <a href="#">lorem ipsum dolor sit amit</a>
            </li>
            <li>
              <a href="#">Vestibellum ultices nueue</a>
            </li>
            <li>
              <a href="#">Blendius tellus</a>
            </li>
            <li>
              <a href="#">Arnen cowalls</a>
            </li>
          </ul>
        </nav>-->
      </div>
      <div class="su-local-footer__cell3">
        {% if page.footer_col2 %}
        {{ page.footer_col2 }}
        {% endif %}
        <!--<div class="su-signup-form">
          <h2 class="su-local-footer__list-heading">Sign up for our email.</h2>
          <p>Your source for pellentesque leo accumsan ultrices</p>
          <form action="/" method="post" class="row g-2">
            <div class="col-auto">
            <input type="email" id="su-email" aria-label="email address" name="su-email" placeholder="email address" required="" class="form-control" />
            </div>
            <div class="col-auto">
              <input type="submit" id="su-submit" name="su-submit" value="Sign-up" class="btn btn-primary"/>
            </div>
          </form>
        </div>
      </div>-->
    </div>
  </div>
  <!-- end su-local-footer -->

  <!-- start su-global-footer -->
  <div class="su-global-footer su-global-footer--dark">
    <div class="su-global-footer__container" title="Common Stanford resources">
      <div class="su-global-footer__brand">
        <a class="su-logo su-global-footer--dark" href="https://www.stanford.edu">
          Stanford
          <br />
          University
        </a>
      </div>
      <div class="su-global-footer__content">
        <nav aria-label="global footer menu">
          <ul class="su-global-footer__menu su-global-footer__menu--global">
            <li>
              <a href="https://www.stanford.edu">
                Stanford Home
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://visit.stanford.edu/plan/">
                Maps &amp; Directions
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://www.stanford.edu/search/">
                Search Stanford
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://emergency.stanford.edu">
                Emergency Info
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
          </ul>
          <ul class="su-global-footer__menu su-global-footer__menu--policy">
            <li>
              <a href="https://www.stanford.edu/site/terms/" title="Terms of use for sites">
                Terms of Use
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://www.stanford.edu/site/privacy/" title="Privacy and cookie policy">
                Privacy
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://uit.stanford.edu/security/copyright-infringement" title="Report alleged copyright infringement">
                Copyright
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://adminguide.stanford.edu/chapter-1/subchapter-5/policy-1-5-4" title="Ownership and use of Stanford trademarks and images">
                Trademarks
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="http://exploredegrees.stanford.edu/nonacademicregulations/nondiscrimination/" title="Non-discrimination policy">
                Non-Discrimination
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
            <li>
              <a href="https://www.stanford.edu/site/accessibility" title="Report web accessibility issues">
                Accessibility
                <span class="su-global-footer__link-a11y">(link is external)</span>
              </a>
            </li>
          </ul>
        </nav>
        <div class="su-global-footer__copyright">
          <span>&copy; Stanford University.</span>
          <span>&nbsp; Stanford, California 94305.</span>
        </div>
      </div>
    </div>
  </div>
  <!-- end su-global-footer -->
</footer>

