{#- Lance Docs custom theme — shared skeleton: head, header, footer, scripts. -#}
{%- macro first_url(item) -%}
  {%- if item.is_link or item.is_page -%}
    {{- item.url -}}
  {%- elif item.children -%}
    {{- first_url(item.children[0]) -}}
  {%- endif -%}
{%- endmacro -%}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% if page and page.title and not page.is_homepage %}
<title>{{ page.title }} — {{ config.site_name }}</title>
{% else %}
<title>{{ config.site_name }} — The open lakehouse format for multimodal AI</title>
{% endif %}
{% if page and page.meta and page.meta.description %}
<meta name="description" content="{{ page.meta.description }}">
{% elif config.site_description %}
<meta name="description" content="{{ config.site_description }}">
{% endif %}
{% if page and page.canonical_url %}<link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
<link rel="icon" href="{{ 'logo/logo.png' | url }}">
<link rel="stylesheet" href="{{ 'assets/tokens.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/site.css' | url }}">
<script>
/* Set the theme before first paint to avoid a light-mode flash. */
(function () {
  try {
    var t = localStorage.getItem("ld-theme");
    if (t !== "light" && t !== "dark") {
      t = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
    }
    document.documentElement.dataset.theme = t;
  } catch (e) { document.documentElement.dataset.theme = "light"; }
})();
</script>
</head>
<body>
<div class="ld-shell">
  <header class="ld-header">
    <a class="ld-brand" href="{{ nav.homepage.url | url }}" aria-label="{{ config.site_name }}">
      <img src="{{ 'logo/wide.png' | url }}" alt="{{ config.site_name }}">
    </a>
    <nav class="ld-topnav" aria-label="Sections">
      {%- for item in nav %}
      <a class="ld-toptab{% if item.active %} active{% endif %}" href="{{ first_url(item) | url }}">{{ item.title }}</a>
      {%- endfor %}
    </nav>
    <div class="ld-header__actions">
      <button class="ld-btn ld-btn--ghost ld-btn--icon" id="search-open" type="button" aria-label="Search docs" title="Search (/)">
        <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>
      </button>
      <a class="ld-btn ld-btn--ghost" href="{{ config.repo_url }}" target="_blank" rel="noopener" aria-label="Lance on GitHub">
        <svg viewBox="0 0 16 16" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.4 7.4 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"/></svg>
        <span class="ld-btn__label">GitHub</span>
        <span class="ld-btn__count" id="gh-stars" hidden></span>
      </a>
      <a class="ld-btn ld-btn--ghost ld-btn--icon" href="https://discord.gg/lance" target="_blank" rel="noopener" aria-label="Join the Lance Discord" title="Discord">
        <svg viewBox="0 0 24 24" width="15" height="15" fill="currentColor" aria-hidden="true"><path d="M20.32 4.37a19.8 19.8 0 0 0-4.89-1.52.07.07 0 0 0-.08.04c-.21.38-.44.87-.61 1.25a18.27 18.27 0 0 0-5.48 0 12.64 12.64 0 0 0-.62-1.25.08.08 0 0 0-.08-.04c-1.71.3-3.35.81-4.88 1.52a.07.07 0 0 0-.04.03C.53 9.05-.32 13.58.1 18.06c0 .02.01.04.03.05a19.9 19.9 0 0 0 6 3.03c.03.01.06 0 .08-.02.46-.63.87-1.3 1.22-2a.08.08 0 0 0-.04-.11 13.1 13.1 0 0 1-1.87-.89.08.08 0 0 1-.01-.13c.13-.09.25-.19.37-.29a.07.07 0 0 1 .08-.01c3.93 1.79 8.18 1.79 12.06 0a.07.07 0 0 1 .08.01c.12.1.25.2.37.29a.08.08 0 0 1-.01.13c-.6.35-1.22.64-1.87.89a.08.08 0 0 0-.04.11c.36.7.77 1.36 1.22 2 .02.02.05.03.08.02a19.84 19.84 0 0 0 6.02-3.03.08.08 0 0 0 .03-.05c.5-5.18-.84-9.68-3.55-13.66a.06.06 0 0 0-.03-.03ZM8.02 15.33c-1.18 0-2.16-1.08-2.16-2.42 0-1.33.96-2.42 2.16-2.42 1.21 0 2.18 1.1 2.16 2.42 0 1.34-.96 2.42-2.16 2.42Zm7.97 0c-1.18 0-2.15-1.08-2.15-2.42 0-1.33.95-2.42 2.15-2.42 1.21 0 2.18 1.1 2.16 2.42 0 1.34-.95 2.42-2.16 2.42Z"/></svg>
      </a>
      <button class="ld-btn ld-btn--ghost ld-btn--icon" id="theme-toggle" type="button" aria-label="Toggle light / dark theme" title="Toggle theme">
        <svg class="ld-icon-sun" viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32 1.41 1.41M2 12h2m16 0h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>
        <svg class="ld-icon-moon" viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z"/></svg>
      </button>
      <a class="ld-btn ld-btn--primary" href="{{ 'quickstart/' | url }}">Get started</a>
    </div>
  </header>

  {% block container %}{% endblock %}

  <footer class="ld-footer">
    <div class="ld-footer__brand">
      <img src="{{ 'logo/wide.png' | url }}" alt="{{ config.site_name }}">
      <p>Lance is an open-source columnar format for multimodal AI. Apache-2.0. {{ config.copyright }}</p>
    </div>
    <div class="ld-footer__cols">
      <div class="ld-footer__col">
        <h5>Format</h5>
        <a href="{{ 'format/' | url }}">Specification</a>
        <a href="{{ 'format/file/' | url }}">File format</a>
        <a href="{{ 'format/table/' | url }}">Table format</a>
      </div>
      <div class="ld-footer__col">
        <h5>Develop</h5>
        <a href="{{ 'quickstart/' | url }}">Getting started</a>
        <a href="{{ 'guide/read_and_write/' | url }}">User guide</a>
        <a href="{{ 'sdk_docs/' | url }}">SDK docs</a>
      </div>
      <div class="ld-footer__col">
        <h5>Community</h5>
        <a href="{{ config.repo_url }}" target="_blank" rel="noopener">GitHub</a>
        <a href="https://discord.gg/lance" target="_blank" rel="noopener">Discord</a>
        <a href="https://groups.google.com/a/lance.org/g/dev" target="_blank" rel="noopener">Mailing list</a>
        <a href="{{ 'community/contributing/' | url }}">Contributing</a>
      </div>
    </div>
  </footer>
</div>

<!-- Search overlay -->
<div class="ld-search" id="search-overlay" hidden>
  <div class="ld-search__scrim" data-search-close></div>
  <div class="ld-search__panel" role="dialog" aria-label="Search documentation">
    <div class="ld-search__bar">
      <input class="ld-search__input" id="search-input" type="search" placeholder="Search documentation…" autocomplete="off" spellcheck="false">
      <button class="ld-search__close" type="button" data-search-close aria-label="Close search">Esc</button>
    </div>
    <div class="ld-search__results" id="search-results"></div>
  </div>
</div>

<script>window.LD_BASE = "{{ base_url }}";</script>
<script src="{{ 'assets/site.js' | url }}" defer></script>
</body>
</html>
