<main class="npc-life-overview" style="--npc-life-accent: {{life.identity.accent}};">
    <div class="npc-life-primary">
        <aside class="npc-life-importance-rail">
            <section class="npc-life-featured {{#if life.featuredIsManual}}is-manual{{/if}}" data-npc-featured-drop>
                <h3>{{#if life.hasFeatured}}<i class="{{life.featured.icon}}"></i> {{life.featured.role}}{{else}}<i class="fas fa-link"></i> Defining Connection{{/if}} {{#if life.featuredIsManual}}<span>Featured</span>{{/if}}</h3>
                {{#if life.hasFeatured}}
                <button type="button" class="npc-life-featured-card" data-npc-life-node="{{life.featured.nodeId}}" data-npc-life-edge="{{life.featured.edgeId}}" draggable="true" title="{{life.featured.note}}">
                    <span class="npc-life-featured-image nexus-entity-image {{#if life.featured.isShip}}is-ship{{/if}} {{#if life.featured.isEmblem}}is-emblem{{else}}{{#if life.featured.isSquare}}is-place is-square{{else}}is-person{{/if}}{{/if}}">
                        {{#if life.featured.imageSrc}}<img src="{{life.featured.imageSrc}}" alt="">{{else}}<i class="{{life.featured.icon}}"></i>{{/if}}
                    </span>
                    <span class="npc-life-featured-copy">
                        <strong>{{life.featured.name}}</strong>
                        <small>{{life.featured.subtitle}}</small>
                        {{#if life.featured.opinion}}<b style="--opinion-color: {{life.featured.opinion.tierColor}};">{{life.featured.opinion.scoreLabel}} {{life.featured.opinion.tierLabel}}</b>{{/if}}
                    </span>
                </button>
                {{#if isGM}}{{#if life.featuredIsManual}}
                <button type="button" class="npc-life-featured-reset" data-action="resetNpcFeaturedConnection" title="Return to automatic Standing"><i class="fas fa-wand-magic-sparkles"></i> Automatic</button>
                {{/if}}{{/if}}
                {{else}}
                <div class="npc-life-featured-empty"><i class="fas fa-link"></i><strong>No featured connection</strong><small>{{#if isGM}}Drop an entity here to connect and feature it.{{else}}No defining connection has been recorded.{{/if}}</small></div>
                {{/if}}
            </section>

            {{#each life.importanceCards}}
            <section class="npc-life-featured npc-life-importance-card is-responsibility">
                <h3><i class="{{icon}}"></i> {{role}}</h3>
                <button type="button" class="npc-life-featured-card npc-life-responsibility-card" data-npc-life-node="{{nodeId}}" data-npc-life-edge="{{edgeId}}" draggable="true">
                    <span class="npc-life-featured-image is-unframed nexus-entity-image {{#if isShip}}is-ship{{/if}} {{#if isEmblem}}is-emblem{{else}}{{#if isSquare}}is-place is-square{{else}}is-person{{/if}}{{/if}}">{{#if imageSrc}}<img src="{{imageSrc}}" alt="">{{else}}<i class="{{icon}}"></i>{{/if}}</span>
                    <span class="npc-life-featured-copy"><strong>{{name}}</strong><small>{{subtitle}}</small>{{#if opinion}}<b style="--opinion-color: {{opinion.tierColor}};">{{opinion.scoreLabel}} {{opinion.tierLabel}}</b>{{/if}}</span>
                </button>
            </section>
            {{/each}}
            {{#if life.responsibilityOverflow}}<small class="npc-life-responsibility-overflow">+{{life.responsibilityOverflow}} more in Connections</small>{{/if}}
        </aside>

        <div class="npc-life-main-column">
            <div class="npc-life-core-details">
                <section class="npc-life-core-panel">
                    <h3><i class="fas fa-masks-theater"></i> Personality</h3>
                    {{#if life.hasTraits}}
                    <div class="npc-life-traits">
                        {{#each life.traits}}
                        <span class="npc-life-trait {{#if missing}}missing{{/if}}">
                            {{#if iconSrc}}<img src="{{iconSrc}}" alt="">{{else}}<i class="fas fa-user"></i>{{/if}}
                            <strong>{{label}}</strong>
                        </span>
                        {{/each}}
                    </div>
                    {{else}}
                    <p class="npc-life-core-empty">No personality traits have been recorded.</p>
                    {{/if}}
                </section>

                <section class="npc-life-core-panel">
                    <h3><i class="fas fa-compass"></i> Beliefs</h3>
                    {{#if life.hasIdeology}}
                    <div class="npc-life-beliefs">
                        {{#each life.ideology}}
                        <article title="{{topicQuestion}}">
                            <span><i class="{{topicIcon}}"></i> {{topicLabel}}</span>
                            <strong>{{tenetLabel}}</strong>
                            <p>{{tenetDescription}}</p>
                        </article>
                        {{/each}}
                    </div>
                    {{else}}
                    <p class="npc-life-core-empty">No defining beliefs have been recorded.</p>
                    {{/if}}
                </section>
            </div>

            <section class="npc-life-section npc-life-world-ties" data-connections-drop-surface>
                <h3><i class="fas fa-diagram-project"></i> World Ties <span>{{life.worldTieCount}}</span></h3>
                {{#if life.hasAffiliations}}
                <div class="npc-life-world-group">
                    <h4><i class="fas fa-shield-halved"></i> Factions <span>{{life.affiliations.length}}</span></h4>
                    <div class="npc-life-card-grid">
                        {{#each life.affiliations}}
                        <article class="npc-life-card is-world-tie {{#if opinion}}has-opinion{{/if}}" data-npc-life-edge="{{edgeId}}" style="--connection-category-color: {{categoryColor}};">
                            <button type="button" class="npc-life-card-open" data-npc-life-node="{{nodeId}}" draggable="true" title="{{note}}">
                                <span class="npc-life-card-image is-emblem nexus-entity-image is-emblem">{{#if imageSrc}}<img src="{{imageSrc}}" alt="">{{else}}<i class="fas fa-shield-halved"></i>{{/if}}</span>
                                <span class="npc-life-card-copy"><em><i class="{{categoryIcon}}"></i> {{role}}</em><strong>{{name}}</strong><small>{{subtitle}}</small></span>
                            </button>
                            {{#if opinion}}<button type="button" class="connection-card-opinion npc-life-opinion-pill" data-npc-life-opinion data-connection-edge-id="{{edgeId}}" style="--opinion-tier-color: {{opinion.tierColor}};" title="Why is this opinion {{opinion.scoreLabel}}?" aria-label="Show opinion breakdown"><i class="fas fa-scale-balanced"></i><b>{{opinion.scoreLabel}}</b><span>{{opinion.tierLabel}}</span></button>{{/if}}
                        </article>
                        {{/each}}
                    </div>
                </div>
                {{/if}}

                {{#if life.hasShips}}
                <div class="npc-life-world-group">
                    <h4><i class="fas fa-rocket"></i> Ships <span>{{life.ships.length}}</span></h4>
                    <div class="npc-life-card-grid">
                        {{#each life.ships}}
                        <article class="npc-life-card is-world-tie {{#if opinion}}has-opinion{{/if}}" data-npc-life-edge="{{edgeId}}" style="--connection-category-color: {{categoryColor}};">
                            <button type="button" class="npc-life-card-open" data-npc-life-node="{{nodeId}}" draggable="true" title="{{note}}">
                                <span class="npc-life-card-image is-square nexus-entity-image is-object">{{#if imageSrc}}<img src="{{imageSrc}}" alt="">{{else}}<i class="fas fa-rocket"></i>{{/if}}</span>
                                <span class="npc-life-card-copy"><em><i class="{{categoryIcon}}"></i> {{role}}</em><strong>{{name}}</strong><small>{{subtitle}}</small></span>
                            </button>
                            {{#if opinion}}<button type="button" class="connection-card-opinion npc-life-opinion-pill" data-npc-life-opinion data-connection-edge-id="{{edgeId}}" style="--opinion-tier-color: {{opinion.tierColor}};" title="Why is this opinion {{opinion.scoreLabel}}?" aria-label="Show opinion breakdown"><i class="fas fa-scale-balanced"></i><b>{{opinion.scoreLabel}}</b><span>{{opinion.tierLabel}}</span></button>{{/if}}
                        </article>
                        {{/each}}
                    </div>
                </div>
                {{/if}}

                {{#if life.hasPeople}}
                <div class="npc-life-world-group">
                    <h4><i class="fas fa-people-arrows"></i> People <span>{{life.people.length}}</span></h4>
                    <div class="npc-life-card-grid">
                        {{#each life.people}}
                        <article class="npc-life-card is-world-tie {{#if opinion}}has-opinion{{/if}}" data-npc-life-edge="{{edgeId}}" style="--connection-category-color: {{categoryColor}};">
                            <button type="button" class="npc-life-card-open {{#if allegiance}}has-allegiance{{/if}}" data-npc-life-node="{{nodeId}}" draggable="true" title="{{note}}">
                                <span class="npc-life-card-image nexus-entity-image is-person">{{#if imageSrc}}<img src="{{imageSrc}}" alt="">{{else}}<i class="fas fa-user"></i>{{/if}}</span>
                                <span class="npc-life-card-copy"><em><i class="{{categoryIcon}}"></i> {{role}}</em><strong>{{name}}</strong><small>{{subtitle}}</small></span>
                                {{#if allegiance}}
                                <span class="npc-life-card-allegiance" title="{{allegiance.rank}} &mdash; {{allegiance.name}}">
                                    <span class="npc-life-card-allegiance-image nexus-entity-image is-emblem">{{#if allegiance.imageSrc}}<img src="{{allegiance.imageSrc}}" alt="">{{else}}<i class="fas fa-shield-halved"></i>{{/if}}</span>
                                    <span class="npc-life-card-allegiance-copy"><strong>{{allegiance.rank}}</strong><small>{{allegiance.name}}</small></span>
                                </span>
                                {{/if}}
                            </button>
                            {{#if opinion}}<button type="button" class="connection-card-opinion npc-life-opinion-pill is-score-only" data-npc-life-opinion data-connection-edge-id="{{edgeId}}" style="--opinion-tier-color: {{opinion.tierColor}};" title="{{opinion.scoreLabel}} {{opinion.tierLabel}} &mdash; Show opinion breakdown" aria-label="{{opinion.scoreLabel}} {{opinion.tierLabel}}; show opinion breakdown"><i class="fas fa-scale-balanced"></i><b>{{opinion.scoreLabel}}</b></button>{{/if}}
                        </article>
                        {{/each}}
                    </div>
                </div>
                {{/if}}

                {{#if life.hasPlaces}}
                <div class="npc-life-world-group">
                    <h4><i class="fas fa-map-location-dot"></i> Places <span>{{life.places.length}}</span></h4>
                    <div class="npc-life-card-grid">
                        {{#each life.places}}
                        <article class="npc-life-card is-world-tie {{#if opinion}}has-opinion{{/if}}" data-npc-life-edge="{{edgeId}}" style="--connection-category-color: {{categoryColor}};">
                            <button type="button" class="npc-life-card-open" data-npc-life-node="{{nodeId}}" draggable="true" title="{{note}}">
                                <span class="npc-life-card-image is-square nexus-entity-image is-place">{{#if imageSrc}}<img src="{{imageSrc}}" alt="">{{else}}<i class="fas fa-location-dot"></i>{{/if}}</span>
                                <span class="npc-life-card-copy"><em><i class="{{categoryIcon}}"></i> {{role}}</em><strong>{{name}}</strong><small>{{subtitle}}</small></span>
                            </button>
                            {{#if opinion}}<button type="button" class="connection-card-opinion npc-life-opinion-pill" data-npc-life-opinion data-connection-edge-id="{{edgeId}}" style="--opinion-tier-color: {{opinion.tierColor}};" title="Why is this opinion {{opinion.scoreLabel}}?" aria-label="Show opinion breakdown"><i class="fas fa-scale-balanced"></i><b>{{opinion.scoreLabel}}</b><span>{{opinion.tierLabel}}</span></button>{{/if}}
                        </article>
                        {{/each}}
                    </div>
                </div>
                {{/if}}
                {{#unless life.hasWorldTieEntities}}
                <div class="npc-life-world-ties-empty"><i class="fas fa-link"></i><strong>No world ties recorded.</strong><small>{{#if isGM}}Drop a faction, ship, person, location, or site here to create a connection.{{else}}No factions, ships, people, or places are connected to this person.{{/if}}</small></div>
                {{/unless}}
                {{#if isGM}}
                <p class="npc-life-world-ties-drop-hint"><i class="fas fa-hand-pointer"></i> NPCs, factions, ships, locations, and sites can be dragged here to create connections.</p>
                {{/if}}
            </section>
        </div>
    </div>
</main>
