{%- comment -%}
  The cheapest build the configurator can actually reach, in cents — printed
  bare so callers capture and `| plus: 0` it back into a number:

    {%- capture floor_s -%}{% render 'bs-config-floor', floor_product: product %}{%- endcapture -%}
    {%- assign floor = floor_s | plus: 0 -%}

  Shared by bs-product-configurator (the "Starting from" line) and
  bs-item-grid (the Beyond 2 tile price) so the number a visitor clicks on the
  grid is the number the product page opens with. The grid used to sum
  product.price + the Custom-Fit Cushion by hand, and the two drifted the
  moment the default cushion flipped to Universal-Fit.

  Why not product.price: that is the bare headset variant, with nothing
  against your face. Nobody can buy that — a facial interface is physically
  required (the configurator refuses to uncheck the last one) and neither
  cushion is free. So walk the base model's add-on groups and add each group's
  unavoidable minimum:
    - a Link Card group (the Rx inserts) renders outside the configurator and
      never enters its total or its /cart/add payload — LensAdvizor owns that
      line item — so it never prices into the floor (its toggleable=false once
      read as "forced" and the advertised "from" sat $89 above any build the
      page could produce)
    - an ephemeral option (the included Soft Strap) costs nothing, so any
      group holding one contributes 0
    - a toggleable group that is not the facial interface can be emptied, so
      it contributes 0
    - anything else forces a choice — the shell radio, the cushion group — so
      it contributes its cheapest option
  Halo never counts: it lives in the strap group, which is toggleable and
  carries the free ephemeral Soft Strap, so that group's floor is 0 either way.

  A product with no addon_groups prints plain product.price, so this is safe
  on any tile.

  Everything is cents in the visitor's presentment currency, which is what
  makes this per-market for free: the arithmetic happens in whatever currency
  Shopify resolved for this request, and money_with_currency formats it. No
  table of per-country floors to keep in sync.
{%- endcomment -%}
{%- assign floor_price = floor_product.price -%}
{%- assign floor_base = floor_product.variants.first -%}
{%- for group in floor_base.metafields.store.addon_groups.value -%}
  {%- if group.addon_type.value.ui_style == 'Link Card' -%}{%- continue -%}{%- endif -%}
  {%- assign fgkey = group.addon_type.value.prop_key | strip -%}
  {%- assign is_cushion_grp = false -%}
  {%- if fgkey contains 'cushion' -%}{%- assign is_cushion_grp = true -%}{%- endif -%}
  {%- assign forced = is_cushion_grp -%}
  {%- unless group.toggleable.value -%}{%- assign forced = true -%}{%- endunless -%}
  {%- if forced -%}
    {%- comment -%} -1 = nothing priced yet; a group with no usable option adds
    nothing rather than adding a bogus zero {%- endcomment -%}
    {%- assign group_min = -1 -%}
    {%- for av in group.variants.value -%}
      {%- assign av_cost = av.price -%}
      {%- for eid in group.ephemeral_variants.value -%}
        {%- if eid.id == av.id -%}{%- assign av_cost = 0 -%}{%- endif -%}
      {%- endfor -%}
      {%- if group_min < 0 or av_cost < group_min -%}{%- assign group_min = av_cost -%}{%- endif -%}
    {%- endfor -%}
    {%- if group_min > 0 -%}{%- assign floor_price = floor_price | plus: group_min -%}{%- endif -%}
  {%- endif -%}
{%- endfor -%}
{{- floor_price -}}
