{%- extends "basic/layout.html" %}

{%- block extrahead %}
  {{ super() }}
  {% if theme_no_index or 'no-index' in (meta or {}) %}
    <meta name="robots" content="noindex">
  {% endif %}
  {% if theme_standalone %}
  <meta name="standalone">
  {% endif %}
  <meta name="repository" content="{{ repotoc_current }}">
  <meta name="version" content="{{ version }}">
  {% if page_source_suffix %}
    <meta name="page_source_suffix" content="{{ page_source_suffix }}">
  {% endif %}
  {% if 'stub' in (meta or {}) %}
    <meta name="stub" content="{{ meta['stub'] }}">
  {% endif %}

  {%- block theme_styles %}
  {% include "section/css_variables.html" with context %}
  {%- endblock -%}

{% endblock %}

{# top+bottom related navs; we also have our own in sidebar #}
{%- macro rellink_markup() %}
  {%- if prev %}
    <a href="{{ prev.link|e }}" title="Previous document (Alt+Shift+LeftArrow)" class="prev">{{ prev.title }}</a>
  {%- else %}
    <div></div>
  {%- endif %}
  {%- if next %}
    <a href="{{ next.link|e }}" title="Next document (Alt+Shift+RightArrow)" class="next">{{ next.title }}</a>
  {%- else %}
    <div></div>
  {%- endif %}
{%- endmacro %}

{# remove basic inherited related elements #}
{%- block relbar1 %}{% endblock %}
{%- block relbar2 %}{% endblock %}

{%- block header %}
  <input type="checkbox" id="input-show-toc">
  <input type="checkbox" id="input-show-localtoc">
  <input type="checkbox" id="input-show-repotoc">

  {% block searchbox %}
  <div class="search-area">
    <form action="" method="get">
      <input type="text" name="q" aria-labelledby="search-documentation" value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="search" placeholder="Search"/>
      <button class="icon"></button>
    </form>
  </div>
  {% endblock %}

  <header>
    <div id="left">
      <label id="show-sidebar" class="icon" for="input-show-toc" title="Show/hide index"></label>
    </div>
    <div id="right">
      <span>
        <a id="logo-org" href="{{ theme_org_url }}" aria-label="Analog Devices Inc. landing page"></a>
        <div class="vertical-divider"></div>
        {% if not theme_standalone %}
        <label id="show-repotoc" for="input-show-repotoc" title="Show/hide docs" tabindex="0">Docs</label>
        {% endif %}
        <a id="logo" href="{{ pathto(master_doc) }}">
          <div>{{ repotoc_current_name }}</div>
        </a>
      </span>
      <span class="reverse">
        <label id="show-localtoc" class="icon" for="input-show-localtoc" title="Show/hide contents"></label>
      </span>
    </div>
  </header>
{% endblock %}

{%- block sidebarlogo %}
  {%- if theme_light_logo and theme_dark_logo %}
    <a id="logo" href="{{ pathto(master_doc) }}">
      <img class="only-light" src="{{ pathto('_static/' + theme_light_logo, 1) }}"/>
      <img class="only-dark" src="{{ pathto('_static/' + theme_dark_logo, 1) }}"/>
    </a>
  {%- elif theme_light_logo %}
    <a id="logo" href="{{ pathto(master_doc) }}">
      <img src="{{ pathto('_static/' + theme_light_logo, 1) }}"/>
    </a>
  {%- else %}
    <a id="no-logo" href="{{ pathto(master_doc) }}">
      {{ project }}
    </a>
  {%- endif %}
{%- endblock %}

{%- block body_tag %}
  {% if body_class %}
    <body class="{{ body_class.replace(',', ' ') }}">
  {% else %}
    <body>
  {% endif %}
{%- endblock %}

{%- block content %}

  <div class="repotoc-tree overlay">
    {{ repotoc_tree }}
  </div>

  {%- block toc %}
    <div class="localtoc">
      <div class="tocwrapper">
        <div class="header localtoc-header">
          <a id="scroll-up" href="#top-anchor" title="Back to top"></a>
        </div>
        <nav>
          {{ toc }}
        </nav>
      </div>
    </div>
  {%- endblock %}

  {{ sidebar() }}

  <div class="document">
    {%- block document %}
      <div class="documentwrapper">
        <div class="bodywrapper" id="top-anchor">
          {% include "section/breadcrumb.html" %}
          <div class="body" role="main">
            {% block body %} {% endblock %}
          </div>

          {%- block relbar_bottom %}
            {%- if theme_show_relbar %}
              <div class="related">
                &nbsp;
                {{- rellink_markup () }}
              </div>
            {%- endif %}
          {% endblock %}
        </div>
      </div>
    {%- endblock %}
  </div>

  <label id="cancel-area-show-toc" for="input-show-toc"></label>
  <label id="cancel-area-show-localtoc" for="input-show-localtoc"></label>

{%- endblock %}

{%- block footer %}
    <footer>
      {% if show_copyright %}&#169;{{ copyright }}{% endif %}
      {% if show_sphinx %}
      {% if show_copyright %}|{% endif %}
      Made with <a href="https://www.sphinx-doc.org/">Sphinx</a>
      &amp; <a href="https://github.com/analogdevicesinc/doctools">Doctools</a>
      {% endif %}
    </footer>
{%- endblock %}
