<section class="location-embedded-dossier {{#if dossier.isConnectionsTab}}is-connections-surface{{/if}}" data-location-embedded-dossier {{#if dossier.isConnectionsTab}}data-connections-drop-surface{{/if}}>
    {{#if missing}}
    <div class="npc-dossier-missing">This location could not be found.</div>
    {{else}}
    <header class="npc-dossier-header faction-dossier-header" style="--npc-accent: {{profile.accent}};">
        <div class="npc-dossier-portrait faction-dossier-emblem" {{#if isGM}}draggable="true" data-location-dossier-drag="true" title="Drag {{profile.name}}"{{/if}}>
            {{#if profile.imageSrc}}<img src="{{profile.imageSrc}}" alt="{{profile.name}}" draggable="false">{{else}}<i class="fas fa-map-location-dot"></i>{{/if}}
        </div>
        <div class="npc-dossier-title">
            <h2>{{profile.name}}</h2>
            <p>{{profile.subtitle}}</p>

            <nav class="npc-dossier-tabs" aria-label="Location dossier tabs">
                {{#if showProfileTab}}<button type="button" class="{{#if dossier.isProfileTab}}active{{/if}}" data-location-dossier-tab="profile">Profile</button>{{/if}}
                <button type="button" class="{{#if dossier.isJournalTab}}active{{/if}}" data-location-dossier-tab="journal">Journal</button>
                <button type="button" class="npc-dossier-tab-icon {{#if dossier.isConnectionsTab}}active{{/if}}" data-location-dossier-tab="connections" title="Connections" aria-label="Connections"><i class="fas fa-share-nodes"></i></button>
                {{#if hasChronicle}}<button type="button" class="npc-dossier-tab-icon {{#if dossier.isChronicleTab}}active{{/if}}" data-location-dossier-tab="chronicle" title="Chronicle" aria-label="Chronicle"><i class="fas fa-scroll"></i></button>{{/if}}
            </nav>
        </div>
        {{#if isGM}}<div class="npc-dossier-header-actions faction-dossier-header-actions"><button type="button" class="npc-dossier-action" data-action="openEmbeddedLocationActions" title="Location actions" aria-label="Location actions"><i class="fas fa-ellipsis"></i></button></div>{{/if}}
    </header>

    {{#if dossier.isProfileTab}}
    <div class="location-embedded-dossier-scroll">
        {{{profileExtensionHtml}}}
        {{#if profile.profileRows.length}}
        <section class="npc-dossier-section">
            <h3 class="npc-profile-section-heading npc-profile-information"><span><i class="fas fa-feather-pointed"></i> Information</span></h3>
            <div class="npc-dossier-custom-row location-dossier-profile-rows">
                {{#each profile.profileRows}}<span class="{{#if multiline}}is-multiline{{/if}}"><em>{{label}}</em><strong>{{value}}</strong></span>{{/each}}
            </div>
        </section>
        {{else}}{{#unless profileExtensionHtml}}
        {{#unless profile.hasCurrentThread}}<section class="npc-dossier-section"><div class="npc-dossier-empty compact">{{profile.emptyLabel}}</div></section>{{/unless}}
        {{/unless}}{{/if}}
        {{#if profile.hasCurrentThread}}
        <section class="npc-dossier-section npc-profile-current-thread">
            <h3 class="npc-profile-section-heading is-thread"><span><i class="fas fa-wand-sparkles"></i> Current Thread</span>{{#if profile.canRerollCurrentThread}}<button type="button" class="faction-current-thread-reroll" data-action="rerollLocationCurrentThread" title="Reroll Current Thread" aria-label="Reroll Current Thread"><i class="fas fa-dice"></i></button>{{/if}}</h3>
            <div class="faction-current-thread-grid">{{#each profile.currentThread}}<article><span><i class="{{icon}}"></i> {{label}}</span><strong>{{value}}</strong></article>{{/each}}</div>
        </section>
        {{/if}}
    </div>
    {{#if sceneControl.canOpen}}
    <footer class="npc-dossier-journal-footer location-dossier-profile-footer">
        <button type="button" class="npc-dossier-secondary" data-action="openEmbeddedLocationScene" title="{{sceneControl.title}}"><i class="{{sceneControl.icon}}"></i><span>{{sceneControl.label}}</span></button>
    </footer>
    {{/if}}
    {{/if}}

    {{#if dossier.isJournalTab}}
    <section class="npc-dossier-section npc-dossier-journal location-embedded-dossier-scroll">
        <div class="npc-dossier-journal-body">
            {{#if journal.hasPage}}
                {{#if journal.hasContent}}<div class="npc-dossier-journal-content">{{{journal.content}}}</div>{{else}}<div class="npc-dossier-empty">This journal is blank.</div>{{/if}}
            {{else}}<div class="npc-dossier-empty">No journal has been created for this location.</div>{{/if}}
        </div>
        {{#if isGM}}<footer class="npc-dossier-journal-footer"><button type="button" class="npc-dossier-secondary" data-action="editEmbeddedLocationJournal"><i class="fas fa-book-open"></i><span>{{#if journal.hasPage}}Edit Journal{{else}}Create Journal{{/if}}</span></button></footer>{{/if}}
    </section>
    {{/if}}

    {{#if dossier.isConnectionsTab}}
    <section class="location-embedded-connections">{{{connectionsHtml}}}</section>
    {{/if}}

    {{#if dossier.isChronicleTab}}
    <section class="location-embedded-chronicle">{{{chronicleHtml}}}</section>
    {{/if}}
    {{/if}}
</section>
