doctype html
html
  head
    meta(charset="utf-8")
    meta(name="viewport" content="width=device-width, initial-scale=1")
    - const theme = ["dark", "light", "edgeless-light", "eir"][settings && settings.theme || constants.user_settings.theme.default]
    link(rel="stylesheet" type="text/css" href=getStaticURL("sass", `/${theme}.sass`))
    script(type="module" src=getStaticURL("html", "/static/js/focus.js"))
    link(rel="apple-touch-icon" sizes="180x180" href="/static/images/apple-touch-icon.png")
    link(rel="icon" type="image/png" sizes="32x32" href="/static/images/favicon-32x32.png")
    link(rel="icon" type="image/png" sizes="16x16" href="/static/images/favicon-16x16.png")
    link(rel="manifest" href="/site.webmanifest" crossorigin="use-credentials")
    link(rel="mask-icon" href="/static/images/safari-pinned-tab.svg" color="#5bbad5")
    link(rel="shortcut icon" href="/static/images/favicon.ico")
    meta(name="apple-mobile-web-app-title" content="EirTube")
    meta(name="application-name" content="EirTube")
    meta(name="msapplication-TileColor" content="#2b5797")
    meta(name="msapplication-config" content="/browserconfig.xml")
    meta(name="theme-color" content="#faaaab")
    //-   - Eir
    - let dark = false
    if theme == "eir"
      if req && req.headers && req.headers.cookie && req.headers.cookie.includes("dark=1")
        - dark = true
      if !(req && isMobile(req))
        script(type="text/javascript" res-root="/static" src="https://eir-nya.gay/res/js/cursors.js")
      script(type="module" src=getStaticURL("html", "/static/js/dark-mode.js"))
      meta(name="darkreader-lock")

    block head

  body(class={ "show-focus": true, dark: dark })
    - let showNav = true
    block pre-nav
    if showNav
      nav.main-nav
        .links
          if req && req.headers && "x-insecure" in req.headers
            a(href="/").link.home #[img(src="/static/images/bow.png")] EirTube - Insecure
          else
            a(href="/").link.home #[img(src="/static/images/bow.png")] EirTube
          a(href="/subscriptions" title="Subscriptions").link.icon-link
            != icons.get("subscriptions")
          a(href="/settings" title="Settings").link.icon-link
            != icons.get("settings")
          if theme == "eir"
            .light-button.link.icon-link.hidden
              input(type="checkbox", checked=!dark).light-toggle
              .light-on
                != icons.get("light-on")
              .light-off
                != icons.get("light-off")
        form(method="get" action="/search").search-form
          input(type="text" placeholder="Search" aria-label="Search a video" name="q" autocomplete="off" value=query).search
          input(id="search-subm" type="submit").search-button
          label(for="search-subm").search-icon.link.icon-link
            != icons.get("search")

    div
      block content

    if showNav
      footer.footer__container
        div.footer__center
          p Released as AGPL free software.
          .footer__cols
            div
              h3.footer__colhead Source code
              ul.footer__list
                li: a(href="https://sr.ht/~cadence/tube") Project hub
                li: a(href="https://lists.sr.ht/~cadence/tube-announce") Announcements
                li: a(href="https://todo.sr.ht/~cadence/tube") Report a problem
            div
              h3.footer__colhead About
              ul.footer__list
                li: a(href="/privacy") Privacy policy
                li: a(href="/licenses" data-jslicense=1) Licenses
                if constants.takedown
                  li: a(href="/takedown") DMCA
            div
              h3.footer__colhead EirTube
              ul.footer__list
                li: a(href="/eirTube") About
                li: a(href="https://git.eir-nya.gay/eir/eirtube") Source Code
