{# HyperWeave Document Template — outer SVG wrapper for ALL frames.
   Every frame template extends this via {% extends "document.svg.j2" %}.
   Blocks: defs, content. CSS is injected as assembled string. #}
<svg xmlns="http://www.w3.org/2000/svg"
     xmlns:hw="https://hyperweave.app/hw/v1.0"
     role="img"
     aria-labelledby="{{ uid }}-title {{ uid }}-desc"
     viewBox="0 0 {{ viewbox_w | default(0) or width }} {{ viewbox_h | default(0) or height }}"
     width="{{ width }}" height="{{ height }}"
     shape-rendering="geometricPrecision"
     data-hw-id="{{ artifact_id }}"
     data-hw-type="{{ frame_type }}"
     data-hw-frame="{{ frame_type }}"
     data-hw-genome="{{ genome_id }}"
     data-hw-mode="{{ genome_category | default('dark') }}"
     data-hw-status="{{ status }}"
     data-hw-profile="{{ profile_id }}"
     data-hw-motion="{{ motion_id }}"
     data-hw-generation="1"
     data-hw-contract="{{ contract_id }}"
     data-hw-size="{{ size | default('default') }}"
{% if font_faces | default('') %}     data-hw-fonts="self-contained"
{% endif %}
{% if regime %}     data-hw-regime="{{ regime }}"
{% endif %}
{% if has_glyph | default(false) %}     data-hw-glyph="{{ glyph_id }}"
{% endif %}
{% if data_hw_value %}     data-hw-value="{{ data_hw_value }}"
{% endif %}
{% if data_hw_statemode and data_hw_statemode != 'off' %}     data-hw-statemode="{{ data_hw_statemode }}"
{% endif %}
{% if data_hw_state_shape | default('') %}     data-hw-state-shape="{{ data_hw_state_shape }}"
{% endif %}
{% if data_hw_subvariant | default('') %}     data-hw-subvariant="{{ data_hw_subvariant }}"
{% endif %}
{% if inline_style_overrides | default('') %}     style="{{ inline_style_overrides }}"
{% endif %}
     data-hw-chromatic="{{ genome_id }}">
  <title id="{{ uid }}-title">{{ title_text }}</title>
  <desc id="{{ uid }}-desc">{{ desc_text }}</desc>
{% if metadata_tier >= 1 %}
{% include "components/metadata.svg.j2" %}
{% endif %}
  <style>{{ css }}</style>
  <defs>
{% block defs %}{% endblock %}
  </defs>
{% block content %}{% endblock %}
</svg>
