<!DOCTYPE html>
<html data-theme="docuseal" lang="<%= I18n.locale %>">
  <head>
    <%= render 'layouts/head_tags' %>
    <% if Docuseal.enable_pwa? %>
      <link rel="manifest" href="/manifest.json">
    <% end %>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <%= csrf_meta_tags %>
    <% if ENV['ROLLBAR_CLIENT_TOKEN'] %>
      <meta name="rollbar-token" content="<%= ENV.fetch('ROLLBAR_CLIENT_TOKEN', nil) %>">
      <%= javascript_pack_tag 'rollbar', 'application', defer: true %>
    <% else %>
      <%= javascript_pack_tag 'application', defer: true %>
    <% end %>
    <% if canonical_url = content_for(:canonical_url) %>
      <link href="<%= canonical_url %>" rel="canonical">
    <% end %>
    <%= stylesheet_pack_tag 'application', media: 'all' %>
  </head>
  <body>
    <%# Skip navigation link for keyboard users - WCAG 2.4.1 Bypass Blocks %>
    <a href="#main-content" class="absolute left-0 top-0 -translate-y-full focus:translate-y-0 z-50 p-4 bg-base-100 text-base-content border-2 border-neutral" tabindex="0">
      Skip to main content
    </a>
    <% if params[:modal].present? %>
      <% url_params = Rails.application.routes.recognize_path(params[:modal], method: :get) %>
      <% if url_params[:action] == 'new' %>
        <open-modal src="<%= params[:modal] %>"></open-modal>
      <% end %>
    <% end %>
    <turbo-frame id="modal"></turbo-frame>
    <turbo-frame id="drawer"></turbo-frame>
    <%= render 'shared/navbar' %>
    <% if flash.present? %><%= render 'shared/flash' %><% end %>
    <main id="main-content" class="max-w-6xl mx-auto px-4 md:px-2 mb-8">
      <%= yield %>
    </main>
    <%= render 'shared/body_scripts' %>
  </body>
</html>
