<div class="bol-post-item" data-jsondata="{{jsondata}}">

  {{!-- Header: image + name + type --}}
  <div class="bpi-header">
    {{#if img}}
    <img class="bpi-img" src="{{img}}" title="{{name}}" />
    {{/if}}
    <div class="bpi-title-block">
      <h3 class="bpi-name">{{name}}</h3>
      <span class="bpi-type">
        {{#if (eq type "feature")}}
          {{localize (concat "BOL.featureSubtypes." system.subtype)}}
        {{else}}
          {{localize (concat "BOL.itemCategory." system.category)}}
          {{#if (and (eq system.category "equipment") system.subtype)}}
            &mdash; {{localize (concat "BOL.equipmentCategory." system.subtype)}}
          {{/if}}
        {{/if}}
      </span>
    </div>
  </div>

  {{!-- ======= WEAPON ======= --}}
  {{#if (or system.properties.weapon (eq system.subtype "weapon"))}}
  <div class="bpi-stats-row">
    {{#if system.properties.damage}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.damage"}}</span>
      <span class="bpi-sv">{{system.properties.damage}}{{#if system.properties.damageAttribute}} + {{localize (concat "BOL.attributes." system.properties.damageAttribute)}}{{/if}}{{#if system.properties.damageModifiers}} {{#if (isPositive system.properties.damageModifiers)}}+{{/if}}{{system.properties.damageModifiers}}{{/if}}</span>
    </div>
    {{/if}}
    {{#if system.properties.weaponSize}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.weaponSize"}}</span>
      <span class="bpi-sv">{{localize (concat "BOL.weaponSize." system.properties.weaponSize)}}</span>
    </div>
    {{/if}}
    {{#if system.properties.attackModifiers}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.attackModifiers"}}</span>
      <span class="bpi-sv">{{system.properties.attackModifiers}}</span>
    </div>
    {{/if}}
    {{#if system.properties.range}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.range"}}</span>
      <span class="bpi-sv">{{system.properties.range}} m</span>
    </div>
    {{/if}}
    {{#if system.properties.reload}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.reload"}}</span>
      <span class="bpi-sv">{{system.properties.reload}}</span>
    </div>
    {{/if}}
  </div>
  <div class="bpi-tags">
    {{#if system.properties.melee}}<span class="bpi-tag">{{localize "BOL.itemProperty.melee"}}</span>{{/if}}
    {{#if system.properties.ranged}}<span class="bpi-tag">{{localize "BOL.itemProperty.ranged"}}</span>{{/if}}
    {{#if system.properties.throwing}}<span class="bpi-tag">{{localize "BOL.itemProperty.throwing"}}</span>{{/if}}
    {{#if (lookup system.properties "2H")}}<span class="bpi-tag">{{localize "BOL.itemProperty.2H"}}</span>{{/if}}
    {{#if system.properties.bashing}}<span class="bpi-tag">{{localize "BOL.itemProperty.bashing"}}</span>{{/if}}
    {{#if system.properties.throwable}}<span class="bpi-tag">{{localize "BOL.itemProperty.throwable"}}</span>{{/if}}
    {{#if system.properties.concealable}}<span class="bpi-tag">{{localize "BOL.itemProperty.concealable"}}</span>{{/if}}
    {{#if system.properties.ignoreshield}}<span class="bpi-tag">{{localize "BOL.itemProperty.ignoreshield"}}</span>{{/if}}
    {{#if system.properties.attackBonusDice}}<span class="bpi-tag bpi-tag-bonus">{{localize "BOL.itemProperty.attackBonusDice"}}</span>{{/if}}
    {{#if system.properties.attackMalusDice}}<span class="bpi-tag bpi-tag-malus">{{localize "BOL.itemProperty.attackMalusDice"}}</span>{{/if}}
    {{#if system.properties.magical}}<span class="bpi-tag bpi-tag-magic">{{localize "BOL.itemProperty.magical"}}</span>{{/if}}
  </div>
  {{/if}}

  {{!-- ======= PROTECTION ======= --}}
  {{#if system.properties.protection}}
  <div class="bpi-stats-row">
    {{#if system.properties.armor}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.armorQuality"}}</span>
      <span class="bpi-sv">{{localize (concat "BOL.armorQuality." system.properties.armorQuality)}}</span>
    </div>
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.soakFormula"}}</span>
      <span class="bpi-sv">{{system.properties.soak.formula}}{{#if system.properties.soak.value}} ({{system.properties.soak.value}}){{/if}}</span>
    </div>
    {{/if}}
    {{#if system.properties.helm}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.soakModifiers"}}</span>
      <span class="bpi-sv">{{system.properties.soak.modifier}}</span>
    </div>
    {{/if}}
    {{#if system.properties.shield}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemProperty.blockingMalus"}}</span>
      <span class="bpi-sv">{{system.properties.blocking.malus}}</span>
    </div>
    {{/if}}
    {{#if system.properties.modifiers.init}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemModifiers.init"}}</span>
      <span class="bpi-sv">{{system.properties.modifiers.init}}</span>
    </div>
    {{/if}}
    {{#if system.properties.modifiers.agility}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.itemModifiers.agility"}}</span>
      <span class="bpi-sv">{{system.properties.modifiers.agility}}</span>
    </div>
    {{/if}}
  </div>
  <div class="bpi-tags">
    {{#if system.properties.armor}}<span class="bpi-tag">{{localize "BOL.itemProperty.armor"}}</span>{{/if}}
    {{#if system.properties.shield}}<span class="bpi-tag">{{localize "BOL.itemProperty.shield"}}</span>{{/if}}
    {{#if system.properties.helm}}<span class="bpi-tag">{{localize "BOL.itemProperty.helm"}}</span>{{/if}}
    {{#if system.properties.blocking.blocking1}}<span class="bpi-tag">{{localize "BOL.itemProperty.blocking1Attack"}}</span>{{/if}}
    {{#if system.properties.blocking.blockingAll}}<span class="bpi-tag">{{localize "BOL.itemProperty.blockingAllAttacks"}}</span>{{/if}}
    {{#if system.properties.magical}}<span class="bpi-tag bpi-tag-magic">{{localize "BOL.itemProperty.magical"}}</span>{{/if}}
  </div>
  {{/if}}

  {{!-- ======= SPELL ======= --}}
  {{#if (eq system.category "spell")}}
  <div class="bpi-stats-row">
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.circle"}}</span>
      <span class="bpi-sv">
        {{#if (eq system.properties.circle 0)}}{{localize "BOL.spellItem.charm"}}{{/if}}
        {{#if (eq system.properties.circle 1)}}{{localize "BOL.spellItem.circle1"}}{{/if}}
        {{#if (eq system.properties.circle 2)}}{{localize "BOL.spellItem.circle2"}}{{/if}}
        {{#if (eq system.properties.circle 3)}}{{localize "BOL.spellItem.circle3"}}{{/if}}
      </span>
    </div>
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.ppcost"}}</span>
      <span class="bpi-sv">{{system.properties.ppcost}} PP</span>
    </div>
    {{#if system.properties.difficulty}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.difficulty"}}</span>
      <span class="bpi-sv">{{system.properties.difficulty}}</span>
    </div>
    {{/if}}
    {{#if system.properties.duration}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.duration"}}</span>
      <span class="bpi-sv">{{system.properties.duration}}</span>
    </div>
    {{/if}}
  </div>
  {{#if system.properties.nbmandatoryconditions}}
  <div class="bpi-conditions">
    <span class="bpi-cond-label">{{localize "BOL.ui.mandatoryconditions"}} :</span>
    {{#each system.properties.mandatoryconditions as |cond idx|}}
      {{#if (lt idx ../system.properties.nbmandatoryconditions)}}
        {{#if cond}}<span class="bpi-condition bpi-cond-req">{{cond}}</span>{{/if}}
      {{/if}}
    {{/each}}
  </div>
  {{/if}}
  {{#if system.properties.nboptionnalconditions}}
  <div class="bpi-conditions">
    <span class="bpi-cond-label">{{localize "BOL.ui.optionnalconditions"}} :</span>
    {{#each system.properties.optionnalconditions as |cond idx|}}
      {{#if (lt idx ../system.properties.nboptionnalconditions)}}
        {{#if cond}}<span class="bpi-condition bpi-cond-opt">{{cond}}</span>{{/if}}
      {{/if}}
    {{/each}}
  </div>
  {{/if}}
  <div class="bpi-tags">
    {{#if system.properties.spellkeep}}<span class="bpi-tag">{{localize "BOL.ui.spellkeep"}}</span>{{/if}}
    {{#if system.properties.concentrate}}<span class="bpi-tag">{{localize "BOL.ui.concentrate"}}</span>{{/if}}
    {{#if system.properties.aggressive}}<span class="bpi-tag bpi-tag-malus">{{localize "BOL.ui.aggressive"}}</span>{{/if}}
  </div>
  {{/if}}

  {{!-- ======= ALCHEMY ======= --}}
  {{#if (eq system.category "alchemy")}}
  <div class="bpi-stats-row">
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.alchemyType"}}</span>
      <span class="bpi-sv">{{localize (concat "BOL.alchemyItem." system.properties.alchemytype)}}</span>
    </div>
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.pccost"}}</span>
      <span class="bpi-sv">{{system.properties.pccost}} PC</span>
    </div>
    {{#if system.properties.pccurrent}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.pcnow"}}</span>
      <span class="bpi-sv">{{system.properties.pccurrent}}</span>
    </div>
    {{/if}}
    {{#if system.properties.difficulty}}
    <div class="bpi-stat">
      <span class="bpi-sl">{{localize "BOL.ui.difficulty"}}</span>
      <span class="bpi-sv">{{system.properties.difficulty}}</span>
    </div>
    {{/if}}
  </div>
  {{/if}}

  {{!-- ======= FEATURE ======= --}}
  {{#if (eq type "feature")}}
    {{#if (eq system.subtype "career")}}
    <div class="bpi-stats-row">
      <div class="bpi-stat">
        <span class="bpi-sl">{{localize "BOL.ui.rank"}}</span>
        <span class="bpi-sv">{{system.rank}}</span>
      </div>
    </div>
    <div class="bpi-tags">
      {{#if system.properties.sorcerer}}<span class="bpi-tag bpi-tag-magic">{{localize "BOL.ui.isSorcerer"}}</span>{{/if}}
      {{#if system.properties.alchemist}}<span class="bpi-tag bpi-tag-magic">{{localize "BOL.ui.isAlchemist"}}</span>{{/if}}
      {{#if system.properties.priest}}<span class="bpi-tag bpi-tag-magic">{{localize "BOL.ui.isPriest"}}</span>{{/if}}
      {{#if system.properties.astrologer}}<span class="bpi-tag bpi-tag-magic">{{localize "BOL.ui.isAstrologer"}}</span>{{/if}}
    </div>
    {{/if}}
    {{#if (eq system.subtype "boon")}}
    <div class="bpi-tags">
      {{#if system.properties.isbonusdice}}<span class="bpi-tag bpi-tag-bonus">{{localize "BOL.ui.isbonusdice"}}</span>{{/if}}
    </div>
    {{/if}}
    {{#if (eq system.subtype "flaw")}}
    <div class="bpi-tags">
      {{#if system.properties.ismalusdice}}<span class="bpi-tag bpi-tag-malus">{{localize "BOL.ui.ismalusdice"}}</span>{{/if}}
    </div>
    {{/if}}
  {{/if}}

  {{!-- ======= DESCRIPTION ======= --}}
  {{#if system.description}}
  <div class="bpi-description">
    <div class="bpi-desc-content">{{{system.description}}}</div>
  </div>
  {{/if}}

</div>
