### search_filters = {FOCUS_FILTER_POLITICAL}
### search_filters = {FOCUS_FILTER_RESEARCH}
### search_filters = {FOCUS_FILTER_INDUSTRY}
### search_filters = {FOCUS_FILTER_STABILITY}
### search_filters = {FOCUS_FILTER_WAR_SUPPORT}
### search_filters = {FOCUS_FILTER_MANPOWER}
### search_filters = {FOCUS_FILTER_ANNEXATION}

#!gfx:interface\r56_goals.gfx
focus_tree = {
	id = portuguese_focus

	country = {
		factor = 0

		modifier = {
			add = 30
			tag = POR
			has_dlc = "La Resistance"
			NOT = {
				has_global_flag = POR_R56_focus_tree
			}
		}
		modifier = {
			factor = 0
			NOT = {
				has_global_flag = por_lar_focus_tree
			}
		}
	}

	default = no

	continuous_focus_position = { x = 50 y = 1500 }

	focus = {
		id = POR_colonial_assimilation_policy
		available = {
			any_owned_state = {
				NOT = { is_core_of = ROOT }
			}
		}

		icon = GFX_focus_generic_military_academy
		x = 2
		y = 0

		cost = 10
		search_filters = {FOCUS_FILTER_MANPOWER}
		completion_reward = {
			add_ideas = POR_colonial_assimilation_policy
		}
	}

	focus = {
		id = POR_colonial_army
		available = {
			any_owned_state = {
				NOT = { is_core_of = ROOT }
			}
		}
		prerequisite = { focus = POR_colonial_assimilation_policy }

		icon = GFX_focus_generic_little_entente
		x = 0
		y = 1

		relative_position_id = POR_colonial_assimilation_policy
		cost = 10
		search_filters = {FOCUS_FILTER_MANPOWER}
		completion_reward = {
			add_ideas = POR_colonial_army
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_francisco_craveiro_lopes
		}
	}

	focus = {
		id = POR_luso_tropicalism
		available = {
			NOT = { has_government = fascism }
			OR = {
				has_full_control_of_state = 796 #North Angola
				has_full_control_of_state = 540 #South Angola
				has_full_control_of_state = 544 #Mozambique
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				add = 1
				OR = {
					has_government = neutrality
					has_government = fascism
					has_government = communism
				}
			}
		}
		prerequisite = { focus = POR_colonial_assimilation_policy }
		mutually_exclusive = { focus = POR_limited_self_rule }

		icon = GFX_focus_por_luso_tropicalism
		x = -2
		y = 2

		relative_position_id = POR_colonial_assimilation_policy
		cost = 10
		search_filters = {FOCUS_FILTER_ANNEXATION}
		completion_reward = {
			unlock_decision_tooltip = POR_mozambique_overseas_territory
			unlock_decision_tooltip = POR_angola_overseas_province
		}
	}

	focus = {
		id = POR_limited_self_rule
		available = {
			OR = {
				has_full_control_of_state = 796 #North Angola
				has_full_control_of_state = 540 #Luanda
				has_full_control_of_state = 891 #Zambesi
				has_full_control_of_state = 892 #Southwest Angola
				has_full_control_of_state = 544 #Mozambique
				has_full_control_of_state = 896 #Manica e Sofala
				has_full_control_of_state = 897 #Zambezia
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					has_government = fascism
					has_government = neutrality
				}			
			}
			modifier = {
				add = 1
				OR = {
					has_government = democratic
					any_country = {
						is_in_faction_with = ROOT
						is_faction_leader = yes
						has_government = democratic
					}
				}
			}
		}
		prerequisite = { focus = POR_colonial_army }
		mutually_exclusive = { focus = POR_luso_tropicalism }

		icon = GFX_focus_por_limited_self_rule

		x = 0
		y = 1

		relative_position_id = POR_colonial_army
		cost = 10
		completion_reward = {
			add_political_power = 120
			add_manpower = 30000
			ANG = {
				if = {
					limit = { 
						POR = { has_full_control_of_state = 796 }
					}
					transfer_state = 796
					POR = { set_country_flag = POR_released_angola_flag }
				}
				if = {
					limit = { 
						POR = { has_full_control_of_state = 540 }
					}
					transfer_state = 540
					POR = { set_country_flag = POR_released_angola_flag }
				}
				if = {
					limit = { 
						POR = { has_full_control_of_state = 891 }
					}
					transfer_state = 891
					POR = { set_country_flag = POR_released_angola_flag }
				}	
				if = {
					limit = { 
						POR = { has_full_control_of_state = 892 }
					}
					transfer_state = 892
					POR = { set_country_flag = POR_released_angola_flag }
				}							
			}

			MZB = {
				if = {
					limit = { 
						POR = { has_full_control_of_state = 544 }
					}
					transfer_state = 544
					POR = { set_country_flag = POR_released_mozambique_flag }
				}	
				if = {
					limit = { 
						POR = { has_full_control_of_state = 896 }
					}
					transfer_state = 896
					POR = { set_country_flag = POR_released_mozambique_flag }
				}
				if = {
					limit = { 
						POR = { has_full_control_of_state = 897 }
					}
					transfer_state = 897
					POR = { set_country_flag = POR_released_mozambique_flag }
				}
			}
			POR = {
				if = {
					limit = { has_country_flag = POR_released_angola_flag }
					set_autonomy = {
						target = ANG
						autonomy_state = autonomy_integrated_puppet
					}
				}
				if = {
					limit = { has_country_flag = POR_released_mozambique_flag }
					set_autonomy = {
						target = MZB
						autonomy_state = autonomy_integrated_puppet
					}
				}
			}

			every_other_country = {
				limit = { has_government = democratic }
				add_opinion_modifier = {
					target = POR
					modifier = democratic_leanings_good 
				}
			}

			if = {
				limit = {
					has_completed_focus = POR_allow_free_elections
				}
				custom_effect_tooltip = available_political_advisor
				show_ideas_tooltip = POR_francisco_da_cunha_leal
			}
		}
	}

	focus = {
		id = POR_haven_of_neutrality_macau
		available = {
			has_war = no 
			592 = {
				OWNER = {
					has_war = yes 
				}
			}
			729 = {
				state_is_fully_controlled_by_ROOT_or_subject = yes
			}
		}

		bypass = {		
		}
		prerequisite = { focus = POR_colonial_assimilation_policy }	
			
		icon = GFX_focus_ARG_defense_and_democracy
		x = 3
		y = 1

		relative_position_id = POR_colonial_assimilation_policy

		cost = 5

		search_filters = { FOCUS_FILTER_INDUSTRY }

		completion_reward = { 

			729 = {

				add_extra_state_shared_building_slots = 2 # R56
				
				IF = {
					limit = {
						729 = {
							infrastructure < 4 
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 2
						instant_build = yes
					}
				}
				ELSE_IF = {
					limit = {
						729 = {
							infrastructure < 5 
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}

				IF = {
					limit = {
						729 = {
							free_building_slots = {
								building = industrial_complex
								size > 0
								include_locked = yes
							}	
						}
					}
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
					
				add_manpower = 25000 # R56

			}
							
		}

	}

	focus = {
		id = POR_restart_investment_into_timor
		available = {
			721 = {
				state_is_fully_controlled_by_ROOT_or_subject = yes
			}
		}

		bypass = {		
		}
		prerequisite = { focus = POR_colonial_assimilation_policy }	
			
		icon = GFX_focus_generic_welfare
		x = 2
		y = 0

		relative_position_id = POR_limited_self_rule

		cost = 5

		search_filters = {FOCUS_FILTER_INDUSTRY}

		completion_reward = { 

			721 = {
				
				IF = {
					limit = {
						721 = {
							infrastructure < 5 
						}
					}
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
				IF = {
					limit = {
						721 = {
							free_building_slots = {
								building = industrial_complex
								size > 0
								include_locked = yes
							}		
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}

				add_resource = {
					type = rubber
					amount = 4
				}

			}
							
		}

	}

	focus = {
		id = POR_revert_the_local_autonomy_policies
		available = {
			has_full_control_of_state = 721 # East Timor 
		}

		mutually_exclusive = { focus = POR_invest_in_sandalwood_and_coffee_production }

		bypass = {		
		}
		prerequisite = { focus = POR_restart_investment_into_timor }	
			
		icon = GFX_focus_renounce_the_treaty_of_trianon
		x = -1
		y = 1

		relative_position_id = POR_restart_investment_into_timor

		cost = 5

		search_filters = {FOCUS_FILTER_INDUSTRY}

		completion_reward = { 

			unlock_decision_tooltip = POR_timor_overseas_territory
							
		}

	}

	focus = {
		id = POR_invest_in_sandalwood_and_coffee_production
		available = {
			721 = {
				state_is_fully_controlled_by_ROOT_or_subject = yes
			}
		}

		mutually_exclusive = { focus = POR_revert_the_local_autonomy_policies }

		bypass = {		
		}
		prerequisite = { focus = POR_restart_investment_into_timor }	
			
		icon = GFX_focus_generic_coffee
		x = 1
		y = 1

		relative_position_id = POR_restart_investment_into_timor

		cost = 10 

		search_filters = {FOCUS_FILTER_INDUSTRY}

		completion_reward = { 

			add_ideas = POR_timorese_coffe_and_sandalwood_exports_idea 
							
		}

	}

	focus = {
		id = POR_infrastructure_in_angola
		available = {
			OR = {
				has_full_control_of_state = 796
				796 = {
					owner = { is_subject_of = ROOT }
				}
			}
		}
		prerequisite = { focus = POR_colonial_assimilation_policy }

		icon = GFX_focus_generic_africa_infrastructure
		x = 5
		y = 0

		relative_position_id = POR_limited_self_rule
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {

			796 = {

				add_building_construction = {
					type = naval_base
					level = 2
					province = 2115
					instant_build = yes
				}

				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
				add_extra_state_shared_building_slots = 1
			}

			540 = {

				add_building_construction = {
					type = naval_base
					level = 3
					province = 8248
					instant_build = yes
				}

				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
				add_extra_state_shared_building_slots = 1
			}
		}
	}

	focus = {
		id = POR_develop_north_angola
		available = {
			OR = {
				has_full_control_of_state = 796
				796 = {
					owner = { is_subject_of = ROOT }
				}
			}
		}
		prerequisite = { focus = POR_infrastructure_in_angola }
		prerequisite = { focus = POR_roads_bridges_and_dams }

		icon = GFX_focus_generic_africa_factory
		x = 0
		y = 1

		relative_position_id = POR_infrastructure_in_angola
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_STEEL}
		completion_reward = {
			796 = {
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}

				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}

				add_resource = {
					type = steel
					amount = 8
				}
			}
		}
	}

	focus = {
		id = POR_develop_south_angola
		available = {
			OR = {
				has_full_control_of_state = 540
				540 = {
					owner = { is_subject_of = ROOT }
				}
			}
		}
		prerequisite = { focus = POR_develop_north_angola }

		icon = GFX_focus_generic_africa_production
		x = 0
		y = 1

		relative_position_id = POR_develop_north_angola
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_STEEL FOCUS_FILTER_RUBBER}
		completion_reward = {
			540 = {
				add_extra_state_shared_building_slots = 4
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}

				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}

				add_building_construction = {
					type = naval_base
					level = 2
					province = 8248
					instant_build = yes
				}

				add_resource = {
					type = steel
					amount = 8
				}

				add_resource = {
					type = rubber
					amount = 4
				}
			}
		}
	}

	focus = {
		id = POR_portuguese_oil
		available = {
			OR = {
				has_full_control_of_state = 796
				796 = {
					owner = { is_subject_of = ROOT }
				}
			}
		}
		prerequisite = { focus = POR_develop_south_angola }

		icon = GFX_goal_generic_oil_refinery
		x = -1
		y = 1

		relative_position_id = POR_develop_south_angola
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_OIL}
		completion_reward = {
			796 = {
				add_resource = {
					type = oil
					amount = 12
				}
			}
		}
	}

	focus = {
		id = POR_develop_mozambique
		available = {
			OR = {
				has_full_control_of_state = 544
				544 = {
					owner = { is_subject_of = ROOT }
				}
			}
		}
		prerequisite = { focus = POR_develop_south_angola }

		icon = GFX_focus_generic_africa_naval
		x = 1
		y = 1

		relative_position_id = POR_develop_south_angola
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_ALUMINIUM}
		completion_reward = {
			544 = {
				add_extra_state_shared_building_slots = 4
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}

				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}

				add_building_construction = {
					type = naval_base
					level = 2
					province = 2123
					instant_build = yes
				}
				add_resource = {
					type = aluminium
					amount = 12
				}
			}
		}
	}

	focus = {
		id = POR_continue_the_public_works
		available = {
			OR = {
				has_full_control_of_state = 180 #PORTO
				has_full_control_of_state = 181 #GUARDA
				has_full_control_of_state = 795 #SANTAREM
				has_full_control_of_state = 179 #BEJA
				has_full_control_of_state = 112 #LISBON
			}
		}

		bypass = {		
		}
			
		icon = GFX_goal_generic_road2
		x = 12
		y = 0

		relative_position_id = POR_colonial_assimilation_policy
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {			
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = {
					add_extra_state_shared_building_slots = 1	
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}	
			
			if = {
				limit = { has_full_control_of_state = 181 }
				181 = {
					add_extra_state_shared_building_slots = 1	
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 795 }
				795 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}	
				}
			}

			if = {
				limit = { has_full_control_of_state = 179 }
				179 = {
					add_extra_state_shared_building_slots = 1	
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1	
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}

					add_building_construction = {
						type = naval_base
						level = 2
						province = 11805					
						instant_build = yes
					}				
				}
			}

			add_ideas = POR_improved_production
		}
	}

	focus = {
		id = POR_instituto_superior_tecnico
		prerequisite = { focus = POR_continue_the_public_works }
		icon = GFX_focus_research
		x = 0
		y = 1

		relative_position_id = POR_continue_the_public_works
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_research_slot = 1
		}
	}

	focus = {
		id = POR_ogme
		prerequisite = { focus = POR_instituto_superior_tecnico }
		icon = GFX_goal_generic_build_airforce
		x = -1
		y = 1

		relative_position_id = POR_instituto_superior_tecnico
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_RESEARCH}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = arms_factory
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			IF = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				custom_effect_tooltip = available_mio_tt
				show_mio_tooltip = POR_ogme_organization
				mio:POR_ogme_organization = {
					add_mio_funds = 500
				}
			}
			#In ideas, we use Lancia which is always unlocked instead of vanilla's OGME
		}
	}

	focus = {
		id = POR_ogma
		prerequisite = { focus = POR_instituto_superior_tecnico }
		icon = GFX_goal_generic_air_production
		x = 1
		y = 1

		relative_position_id = POR_instituto_superior_tecnico
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_RESEARCH}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = arms_factory
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			IF = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				custom_effect_tooltip = available_mio_tt
				show_mio_tooltip = POR_ogma_organization
				mio:POR_ogma_organization = {
					add_mio_funds = 500
				}
			}
			ELSE = {
				custom_effect_tooltip = available_designer
				show_ideas_tooltip = ogma
			}
		}
	}

	focus = {
		id = POR_roads_bridges_and_dams
		available = {
			OR = {
				has_full_control_of_state = 181 #GUARDA
				has_full_control_of_state = 795 #SANTAREM
				has_full_control_of_state = 179 #BEJA
				has_full_control_of_state = 180 #PORTO
				has_full_control_of_state = 112 #LISBON
			}
		}
		prerequisite = { focus = POR_instituto_superior_tecnico }
		icon = GFX_goal_generic_construct_infrastructure
		x = 2
		y = 0

		relative_position_id = POR_infrastructure_in_angola
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 181 }
				181 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 795 }
				795 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}	
				}
			}

			if = {
				limit = { has_full_control_of_state = 179 }
				179 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 180 }
				180 = {
					add_extra_state_shared_building_slots = 3
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_building_construction = {
						type = naval_base
						level = 2
						province = 9817
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}

					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
		}
	}

	focus = {
		id = POR_extraction_industries
		available = {
			OR = {
				has_full_control_of_state = 112
				has_full_control_of_state = 795
			}
		}
		prerequisite = { focus = POR_roads_bridges_and_dams }
		icon = GFX_goal_generic_construction2
		x = 0
		y = 1

		relative_position_id = POR_roads_bridges_and_dams
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_CHROMIUM FOCUS_FILTER_TUNGSTEN}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				unlock_decision_tooltip = POR_develop_lisbon_tungsten_deposits
			}
			if = {
				limit = { has_full_control_of_state = 795 }
				unlock_decision_tooltip = POR_develop_santarem_chromium_deposits
			}
		}
	}

	focus = {
		id = POR_hydroelectricity
		available = {
			OR = {
				has_full_control_of_state = 180 #PORTO
				has_full_control_of_state = 181 #GUARDA
				has_full_control_of_state = 179 #BEJA
				has_full_control_of_state = 112 #LISBON
			}
		}
		prerequisite = { focus = POR_extraction_industries }
		icon = GFX_goal_italy_expand_hydroelectricity_production
		x = 0
		y = 1

		relative_position_id = POR_extraction_industries
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_ideas = POR_hydroelectric_power
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = {
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
			if = {
				limit = { has_full_control_of_state = 181 }
				181 = {
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
			if = {
				limit = { has_full_control_of_state = 179 }
				179 = {
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_building_construction = {
						type = infrastructure
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
		}
	}

	focus = {
		id = POR_military_vehicles
		prerequisite = { focus = POR_ogme }

		icon = GFX_goal_generic_army_motorized
		x = 0
		y = 1

		relative_position_id = POR_ogme
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_tech_bonus = {
				name = POR_military_vehicles
			    bonus = 1.0
			    uses = 1
			    category = motorized_equipment
			}

			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = arms_factory
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
		}
	}

	focus = {
		id = POR_portuguese_artillery
		prerequisite = { focus = POR_ogme }

		icon = GFX_goal_generic_army_artillery
		x = -2
		y = 1

		relative_position_id = POR_ogme
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_tech_bonus = {
				name = POR_portuguese_artillery
			    bonus = 1.0
			    uses = 1
			    category = artillery
			}

			if = {
				limit = { has_full_control_of_state = 179 }
				179 = {
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = arms_factory
						level = 2
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = arms_factory
							size > 2
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = arms_factory
						level = 2
						instant_build = yes
					}
				}
			}
			IF = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				custom_effect_tooltip = available_mio_tt
				show_mio_tooltip = POR_fma_organization
				mio:POR_fma_organization = {
					add_mio_funds = 500
				}
			}
			ELSE = {
				custom_effect_tooltip = available_designer
				show_ideas_tooltip = fma
			}
		}
	}

	focus = {
		id = POR_advanced_artillery
		prerequisite = { focus = POR_portuguese_artillery}
		prerequisite = { focus = POR_military_research_facilities}
		icon = GFX_goal_generic_army_artillery2
		x = 0
		y = 2

		relative_position_id = POR_portuguese_artillery
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_advanced_artillery
			    bonus = 1.0
			    uses = 2
			    category = artillery
			}

			add_doctrine_cost_reduction = {
				name = POR_advanced_artillery
			    cost_reduction = 0.5
			    uses = 1
			    category = land_doctrine
			    category = naval_doctrine
			    category = air_doctrine
			}
		}
	}

	focus = {
		id = POR_military_research_facilities
		prerequisite = { focus = POR_military_vehicles focus = POR_portuguese_artillery focus = POR_light_aircraft_focus }
		icon = GFX_focus_research
		x = 0
		y = 1

		relative_position_id = POR_military_vehicles
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_research_slot = 1
		}
	}

	focus = {
		id = POR_armor_focus
		prerequisite = { focus = POR_military_research_facilities}
		mutually_exclusive = { focus = POR_advanced_light_aircraft}
		icon = GFX_goal_generic_army_tanks
		x = 0
		y = 1

		relative_position_id = POR_military_research_facilities
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_RESEARCH}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = arms_factory
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			add_tech_bonus = {
				name = POR_armor_focus
			    bonus = 1.0
			    uses = 1
			    category = armor
			}
		}
	}

	focus = {
		id = POR_mechanized_focus
		prerequisite = { focus = POR_armor_focus}
		icon = GFX_goal_generic_build_tank
		x = 0
		y = 1

		relative_position_id = POR_armor_focus
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_mechanized_focus
			    bonus = 1.0
			    uses = 1
			    category = cat_mechanized_equipment
			}
		}
	}

	focus = {
		id = POR_light_aircraft_focus
		prerequisite = { focus = POR_ogma}
		icon = GFX_goal_POR_coa_air_force
		x = 0
		y = 1

		relative_position_id = POR_ogma
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_tech_bonus = {
				name = POR_light_aircraft_focus
			    bonus = 1.0
			    uses = 1
			    category = light_air
			}
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = arms_factory
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = arms_factory
						level = 1
						instant_build = yes
					}
				}
			}
			air_experience = 25
		}
	}

	focus = {
		id = POR_advanced_light_aircraft
		prerequisite = { focus = POR_light_aircraft_focus}
		mutually_exclusive = { focus = POR_armor_focus}
		icon = GFX_goal_generic_air_bomber
		x = 0
		y = 2

		relative_position_id = POR_light_aircraft_focus
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_tech_bonus = {
				name = POR_advanced_light_aircraft
			    bonus = 1.0
			    uses = 1
			    category = light_air
			}
			air_experience = 50
			add_ideas = POR_advanced_light_aircraft
		}
	}

	focus = {
		id = POR_jet_research
		prerequisite = { focus = POR_advanced_light_aircraft}
		icon = GFX_goal_generic_air_jet_new
		x = 0
		y = 1

		relative_position_id = POR_advanced_light_aircraft
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			air_experience = 25
			add_tech_bonus = {
				name = POR_jet_research
			    bonus = 1.0
			    uses = 1
			    category = jet_technology
			}
			add_breakthrough_progress = {
				specialization = specialization_air
				value = 0.25
			}
		}
	}

	focus = {
		id = POR_industrial_modernization
		prerequisite = { focus = POR_instituto_superior_tecnico }
		mutually_exclusive = { focus = POR_food_industries}
		icon = GFX_goal_generic_construct_civ_factory
		x = 3
		y = 1

		relative_position_id = POR_instituto_superior_tecnico
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_industrial_modernization
			    bonus = 1.0
			    uses = 2
			    category = industry
			}
		}
	}

	focus = {
		id = POR_a_new_industry
		available = {
			has_tech = advanced_machine_tools
		}
		prerequisite = { focus = POR_industrial_modernization }
		icon = GFX_focus_generic_industry_3
		x = 0
		y = 1

		relative_position_id = POR_industrial_modernization
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
		   if = {
				limit = { has_full_control_of_state = 112 }
			    112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 795 }
				795 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex		
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = industrial_complex
							size > 2
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 2
						instant_build = yes
					}
				}
			}
			add_ideas = POR_a_new_industry
		}
	}

	focus = {
		id = POR_food_industries
		available = {
			OR = {
				has_full_control_of_state = 180
				has_full_control_of_state = 181
			}
		}
		prerequisite = { focus = POR_continue_the_public_works }
		mutually_exclusive = { focus = POR_industrial_modernization }
		icon = GFX_goal_generic_consumer_goods
		x = 5
		y = 2

		relative_position_id = POR_continue_the_public_works
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 181 }
				181 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
		}
	}

	focus = {
		id = POR_textile_industry
		available = {
			OR = {
				has_full_control_of_state = 179
				has_full_control_of_state = 112
			}
		}
		prerequisite = { focus = POR_food_industries }
		icon = GFX_goal_generic_trade
		x = 0
		y = 1

		relative_position_id = POR_food_industries
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 179 }
				179 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 795 }
				795 = {
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex		
						level = 1
						instant_build = yes
					}
				}
			}
		}
	}

	focus = {
		id = POR_second_navy_reequipment
		prerequisite = {
		}
		icon = GFX_goal_POR_coa_navy
		x = 9
		y = 0

		relative_position_id = POR_continue_the_public_works
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = {
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = dockyard
						level = 2
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = dockyard
							size > 2
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = dockyard
						level = 2
						instant_build = yes
					}
				}
			}
			unlock_decision_tooltip = POR_buy_ships_britain
			unlock_decision_tooltip = POR_buy_ships_italy
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = available_political_advisor	#56
			show_ideas_tooltip = POR_anibal_de_mesquita_guimaraes	#56
		}
	}

	focus = {
		id = POR_a_powerful_merchant_marine
		prerequisite = { focus = POR_second_navy_reequipment }
		icon = GFX_goal_generic_navy_battleship
		x = 0
		y = 1

		relative_position_id = POR_second_navy_reequipment
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_RESEARCH}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 179 }
				179 = { #Beja
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = dockyard
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = dockyard
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = dockyard
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = { #Porto
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = dockyard
						level = 1
						instant_build = yes
					}
				}
			}
			else = {
				random_owned_state = {
					limit = {
						is_controlled_by = ROOT
						is_core_of = ROOT
						free_building_slots = {
							building = dockyard
							size > 1
							include_locked = yes
						}
					}
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = dockyard
						level = 1
						instant_build = yes
					}
				}
			}
			add_tech_bonus = {
				name = POR_a_powerful_merchant_marine
			    bonus = 1.0
			    uses = 1
			    category = dd_tech
			}
			add_ideas = POR_convoy_build_efficiency
		}
	}

	focus = {
		id = POR_merchant_marine_protection
		prerequisite = { focus = POR_a_powerful_merchant_marine }
		icon = GFX_goal_generic_amphibious_assault
		x = 0
		y = 1

		relative_position_id = POR_a_powerful_merchant_marine
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_merchant_marine_protection
			    bonus = 1.0
			    uses = 2
			    category = dd_tech
			}
			add_tech_bonus = {
				name = POR_merchant_marine_protection
				bonus = 1.0
				uses = 2
				category = asw_tech
			}
		}
	}

	focus = {
		id = POR_submarine_effort
		prerequisite = { focus = POR_second_navy_reequipment }
		icon = GFX_goal_generic_navy_submarine
		x = -2
		y = 1

		relative_position_id = POR_second_navy_reequipment
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_mastery_bonus = {
				name = POR_submarine_effort
				bonus = 0.1
				days = 240
				track = submarines
			}
			add_doctrine_cost_reduction = {
				name = POR_submarine_effort
			    cost_reduction = 0.2
			    uses = 1
			    category = naval_doctrine			   
			}
			add_tech_bonus = {
				name = POR_submarine_effort
			    bonus = 1.0
			    uses = 2
			    category = ss_tech
			}
		}
	}

	focus = {
		id = POR_fuzileiros
		prerequisite = { focus = POR_submarine_effort}
		prerequisite = { focus = POR_merchant_marine_protection }
		icon = GFX_goal_generic_occupy_states_coastal
		x = 0
		y = 3

		relative_position_id = POR_submarine_effort
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_fuzileiros
			    bonus = 1.0
			    uses = 2
			    category = marine_tech
			}
			
			add_tech_bonus = {
				name = POR_fuzileiros
			    bonus = 1.0
			    uses = 2
			    category = tp_tech
			}
			hidden_effect = {
				set_country_flag = cite_a_marine_unit_flag
			}
			unlock_decision_tooltip = { decision = cite_a_marine_unit show_effect_tooltip = yes }			
			# AI will build the required docks for the next focus
			add_ai_strategy = {
				type = building_target
				id = dockyard
				value = 15
			}
		}
	}

	focus = {
		id = POR_naval_research_institute
		available = {
			num_of_naval_factories > 15
		}
		prerequisite = { focus = POR_fuzileiros }
		icon = GFX_focus_research
		x = 0
		y = 1

		relative_position_id = POR_fuzileiros
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			navy_experience = 50
			add_research_slot = 1
		}
	}

	focus = {
		id = POR_air_naval_research
		prerequisite = { focus = POR_naval_research_institute }
		prerequisite = { focus = POR_advanced_light_aircraft }
		icon = GFX_goal_generic_air_naval_bomber
		x = 0
		y = 1

		relative_position_id = POR_naval_research_institute
		cost = 10
		completion_reward = {
			navy_experience = 50
			air_experience = 50
		}
	}

	focus = {
		id = POR_arsenal_do_alfeite
		available = {
			has_full_control_of_state = 112
		}
		prerequisite = { focus = POR_second_navy_reequipment }
		icon = GFX_goal_generic_navy_cruiser
		x = 2
		y = 1

		relative_position_id = POR_second_navy_reequipment
		cost = 20
		search_filters = {FOCUS_FILTER_RESEARCH FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_tech_bonus = {
				name = POR_arsenal_do_alfeite
			    bonus = 1.0
			    uses = 1
			    category = ca_tech
			}
			add_tech_bonus = {
				name = POR_arsenal_do_alfeite
			    bonus = 1.0
			    uses = 1
			    category = cl_tech
			}

			112 = { #Lisbon
				add_extra_state_shared_building_slots = 2
				add_building_construction = {
					type = dockyard
					level = 3
					instant_build = yes
				}

				add_building_construction = {
					type = naval_base
					level = 2
					instant_build = yes
					province = 11805	#technically on the other side of the river, province 970
				}
			}
		}
	}

	focus = {
		id = POR_national_cruiser_production
		prerequisite = { focus = POR_arsenal_do_alfeite }
		icon = GFX_goal_generic_construct_naval_dockyard
		x = 0
		y = 1

		relative_position_id = POR_arsenal_do_alfeite
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_national_cruiser_production
			    bonus = 1.0
			    uses = 1
			    category = ca_tech
			}
			add_tech_bonus = {
				name = POR_national_cruiser_production
			    bonus = 1.0
			    uses = 1
			    category = cl_tech
			}

			navy_experience = 50
		}
	}

	focus = {
		id = POR_battleship_effort
		prerequisite = { focus = POR_national_cruiser_production }
		icon = GFX_focus_generic_navy_battleship2
		x = -1
		y = 1

		relative_position_id = POR_national_cruiser_production
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_battleship_effort
			    bonus = 1.0
			    uses = 2
			    category = bb_tech
			}
			add_mastery_bonus = {
				name = POR_battleship_effort
				bonus = 0.2
				days = 240
				track = capital_ships
			}
			add_tech_bonus = {
				name = industrial_bonus
				bonus = 1
				uses = 1
				category = naval_armor_tech
			}
			add_tech_bonus = {
				name = SPR_navy_modernization
				bonus = 1
				uses = 1
				technology = fire_control_methods_1
				technology = fire_control_methods_2
				technology = fire_control_methods_3
			}		
		}
	}

	focus = {
		id = POR_carrier_effort
		prerequisite = { focus = POR_national_cruiser_production }
		icon = GFX_goal_generic_navy_carrier
		x = 1
		y = 1

		relative_position_id = POR_national_cruiser_production
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_tech_bonus = {
				name = POR_carrier_effort
			    bonus = 1.0
			    uses = 2
			    category = cv_tech
			}

			add_mastery_bonus = {
				name = POR_carrier_effort
				bonus = 0.2
				days = 240
				track = carriers
			}
		}
	}

	focus = {
		id = POR_atlantic_defense_strategy
		available = {
			OR = {
				has_full_control_of_state = 698
				has_full_control_of_state = 697
				has_full_control_of_state = 702
			}
		}
		prerequisite = { focus = POR_national_cruiser_production }
		icon = GFX_focus_generic_destroyer
		x = 0
		y = 2

		relative_position_id = POR_national_cruiser_production
		cost = 10
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 698 }
				698 = { #Azores
					add_building_construction = {
						type = coastal_bunker
						level = 2
						province = 1751
						instant_build = yes
					}

					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 697 }
				697 = { #Madeira
					add_building_construction = {
						type = coastal_bunker
						level = 1
						province = 3118
						instant_build = yes
					}

					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
			}

			if = {
				limit = { has_full_control_of_state = 702 }
				702 = { #Cape Verde
					add_building_construction = {
						type = coastal_bunker
						level = 1
						province = 13014
						instant_build = yes
					}

					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
			}
		}
	}

	focus = {
		id = POR_endless_sea
		available = {
			OR = {
				has_full_control_of_state = 321
				has_full_control_of_state = 729
				has_full_control_of_state = 721
			}
		}
		prerequisite = { focus = POR_atlantic_defense_strategy }
		icon = GFX_focus_generic_coastal_fort
		x = 0
		y = 1

		relative_position_id = POR_atlantic_defense_strategy
		cost = 20
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_tech_bonus = {
				name = FRA_fortification_focus
				bonus = 1
				uses = 1
				category = cat_fortification
			}
			custom_effect_tooltip = generic_skip_one_line_tt
			add_ideas = POR_endless_sea
 			if = {
				limit = { has_full_control_of_state = 321 }
	 			321 = { #Goa
					add_building_construction = {
						type = coastal_bunker
						level = 1
						province = 1273
						instant_build = yes
					}

					add_building_construction = {
						type = bunker
						level = 1
						province = 1273
						instant_build = yes
					}

					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 729 }
				729 = { #Macau
					add_building_construction = {
						type = coastal_bunker
						level = 1
						province = 4189
						instant_build = yes
					}

					add_building_construction = {
						type = bunker
						level = 1
						province = 4189
						instant_build = yes
					}

					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 721 }
				721 = { #Portuguese Timor
					add_building_construction = {
						type = coastal_bunker
						level = 1
						province = 12190
						instant_build = yes
					}

					add_building_construction = {
						type = bunker
						level = 1
						province = 12190
						instant_build = yes
					}

					add_building_construction = {
						type = air_base
						level = 1
						instant_build = yes
					}
				}
			}
		}
	}

	focus = {
		id = POR_army_reorganization
		prerequisite = {
		}
		icon = GFX_goal_POR_coa_army
		x = 7
		y = 0

		relative_position_id = POR_second_navy_reequipment
		cost = 10
		search_filters = {FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT}
		completion_reward = {
			remove_ideas = POR_unreliable_army
			army_experience	= 15
			add_stability = -0.05
		}
	}

	focus = {
		id = POR_metropolitan_army
		prerequisite = { focus = POR_army_reorganization }
		icon = GFX_focus_eng_move_to_secure_the_dominions
		x = -1
		y = 1

		relative_position_id = POR_army_reorganization
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			army_experience	= 20
			add_tech_bonus = {
				name = POR_metropolitan_army
			    bonus = 1.0
			    uses = 2
			    category = infantry_weapons
				category = armor
				category = artillery
			}
		}
	}

	focus = {
		id = POR_standardization
		prerequisite = { focus = POR_metropolitan_army }
		icon = GFX_focus_generic_rubber
		x = 0
		y = 1

		relative_position_id = POR_metropolitan_army
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_ideas = POR_standardization
		}
	}

	focus = {
		id = POR_defend_the_borders
		available = {
			OR = {
				has_full_control_of_state = 112
				has_full_control_of_state = 180
				has_full_control_of_state = 179
			}
		}
		prerequisite = { focus = POR_standardization }
		mutually_exclusive = { focus = POR_elastic_defense }
		icon = GFX_focus_generic_provoke_border_clashes
		x = -1
		y = 1

		relative_position_id = POR_standardization
		cost = 10
		completion_reward = {
		#Add coastal fort to each port
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = { #Lisbon
					add_building_construction = {
						type = coastal_bunker
						province = {
							all_provinces = yes
							limit_to_naval_base = yes
						}
						level = 1
						instant_build = yes
					}
					add_building_construction = {
					    type = bunker
					    province = {
					        all_provinces = yes
					        limit_to_border = yes
					    }
					    level = 1
					    instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = { #Porto
					add_building_construction = {
						type = coastal_bunker
						province = {
							all_provinces = yes
							limit_to_naval_base = yes
						}
						level = 1
						instant_build = yes
					}
					add_building_construction = {
					    type = bunker
					    level = 1
					    instant_build = yes
					    province = {
					        all_provinces = yes
					        limit_to_border = yes
					    }
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 179 }
				179 = { #Beja
					add_building_construction = {
						type = coastal_bunker
						province = {
							all_provinces = yes
							limit_to_naval_base = yes
						}
						level = 1
						instant_build = yes
					}
					add_building_construction = {
					    type = bunker
					    level = 1
					    instant_build = yes
					    province = {
					        all_provinces = yes
					        limit_to_border = yes
					    }
					}
				}
			}
		}
	}

	focus = {
		id = POR_elastic_defense
		available = {
			has_full_control_of_state = 112
		}
		prerequisite = { focus = POR_standardization }
		mutually_exclusive = { focus = POR_defend_the_borders }
		icon = GFX_goal_generic_defence
		x = 1
		y = 1

		relative_position_id = POR_standardization
		cost = 10
		completion_reward = {
			112 = { #Lisbon
				add_building_construction = {
				    type = bunker
				    level = 3
				    instant_build = yes
				    province = {
				        all_provinces = yes
				        limit_to_border = yes
				    }
				}

				add_building_construction = {
				    type = coastal_bunker
				    level = 2
				    instant_build = yes
				    province = 11805
				}
			}
		}
	}

	focus = {
		id = POR_tropas_paraquedistas
		prerequisite = { focus = POR_defend_the_borders focus = POR_elastic_defense }

		icon = GFX_focus_generic_paratrooper
		x = 1
		y = 1

		relative_position_id = POR_defend_the_borders
		cost = 10

		search_filters = {FOCUS_FILTER_RESEARCH}

		completion_reward = {
			add_tech_bonus = {
				name = POR_tropas_paraquedistas
				bonus = 2.0
				uses = 1
				category = para_tech
			}
			if = {
				limit = {
					has_dlc = "Arms Against Tyranny"
				}
				add_doctrine_cost_reduction = {
					cost_reduction = 0.5
					uses = 1
					category = special_forces_doctrine
				}
			}
			else = {
				add_tech_bonus = {
					name = special_forces_bonus
					bonus = 0.5
					uses = 1
					category = r56_special_forces_training_tech 
				}	
			}				
		}
	}

	focus = {
		id = POR_regimento_de_comandos
		prerequisite = { focus = POR_tropas_paraquedistas }
		icon = GFX_goal_generic_special_forces
		x = 0
		y = 1

		relative_position_id = POR_tropas_paraquedistas
		cost = 10

		search_filters = {FOCUS_FILTER_RESEARCH}

		completion_reward = {
			add_ideas = special_forces
			add_tech_bonus = {
				name = POR_regimento_de_comandos
				bonus = 1.0
				uses = 2
				category = r56_desert_infantry_tech
				category = r56_jaeger_infantry_tech
				category = r56_jungle_infantry_tech
				category = r56_marines_infantry_tech
				category = r56_mountain_infantry_tech
				category = r56_paratroops_infantry_tech	
				category = r56_shock_infantry_tech
			}
			add_tech_bonus = {
                name = special_forces_bonus
                bonus = 1.0
                uses = 1
                category = r56_special_forces_training_tech 
            }
			hidden_effect = {
				set_country_flag = cite_an_airborne_unit_flag
			}
			unlock_decision_tooltip = { decision = cite_an_airborne_unit show_effect_tooltip = yes }								
		}
	}

	focus = {
		id = POR_corpo_do_estado_maior
		prerequisite = { focus = POR_army_reorganization }
		icon = GFX_goal_generic_army_doctrines
		x = 1
		y = 1

		relative_position_id = POR_army_reorganization
		cost = 10
		completion_reward = {
			add_ideas = POR_corpo_do_estado_maior
			army_experience = 20
		}
	}

	focus = {
		id = POR_staff_wargames
		prerequisite = { focus = POR_corpo_do_estado_maior }
		icon = GFX_focus_generic_license_production
		x = 0
		y = 1

		relative_position_id = POR_corpo_do_estado_maior
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			add_doctrine_cost_reduction = {
				name = POR_staff_wargames
			    cost_reduction = 0.5
			    uses = 2
			    category = land_doctrine
			}
		}
	}

	focus = {
		id = POR_field_maneuvers
		prerequisite = { focus = POR_staff_wargames }
		icon = GFX_focus_generic_manpower
		x = 1
		y = 1

		relative_position_id = POR_staff_wargames
		cost = 10

		search_filters = {FOCUS_FILTER_RESEARCH}

		completion_reward = {
			army_experience = 15
			add_doctrine_cost_reduction = {
				name = POR_field_maneuvers
			    cost_reduction = 0.5
			    uses = 1
			    category = land_doctrine
			}
		}
	}

	focus = {
		id = POR_popular_front
		mutually_exclusive = { focus = POR_estado_novo}
		prerequisite = {
		}
		icon = GFX_goal_generic_socdem
		x = 9
		y = 0

		allow_branch = {	#56
			if = {
				limit = {
					has_game_rule = {
						rule = obsolete_focus_branches_visibility
						option = HIDE
					}
				}
				NOT = { has_completed_focus = POR_estado_novo }
			}
		}
		relative_position_id = POR_army_reorganization
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL}
		completion_reward = {
			mark_focus_tree_layout_dirty = yes	#56
			set_party_name = {
			    ideology = communism
			    long_name = POR_communism2_party_long
			    name = POR_communism2_party
			}

			add_popularity = {
			    ideology = communism
			    popularity = 0.05
			}
			add_popularity = {
			    ideology = democratic
			    popularity = 0.05
			}
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			add_timed_idea = {
				idea = POR_popular_front
				days = 1250
			}			
			custom_effect_tooltip = CHL_skip_one_line_tt	#56		
			add_political_power = 100
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_maria_lamas
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_henrique_caetano_de_sous	#56
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_joao_camoesas	#56
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = remove_political_advisor
			show_ideas_tooltip = POR_fernando_dos_santos_costa
			show_ideas_tooltip = POR_jose_adriano_pequito_rebelo
			#custom_effect_tooltip = remove_chief_of_army
			#show_ideas_tooltip = POR_rolao_preto		Commenting out because Speculoos removed this advisor role - This spams the error log.
		}
	}

	focus = {
		id = POR_nation_in_arms
		prerequisite = { focus = POR_popular_front }
		icon = GFX_focus_generic_attack_portugal
		x = -5
		y = 1

		relative_position_id = POR_popular_front
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_WAR_SUPPORT FOCUS_FILTER_MANPOWER}
		completion_reward = {
			add_popularity = {
			    ideology = communism
			    popularity = 0.05
			}
			add_war_support = 0.1
			add_ideas = POR_nation_in_arms
		}
	}

	focus = {
		id = POR_unify_leftist_youth_wings
		prerequisite = { focus = POR_nation_in_arms }
		icon = GFX_goal_generic_war_with_comintern
		x = -1
		y = 1

		relative_position_id = POR_nation_in_arms
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL}
		completion_reward = {
			add_popularity = {
			    ideology = communism
			    popularity = 0.05
			}
			add_ideas = POR_unified_youth_wings
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = available_political_advisor	#56
			show_ideas_tooltip = POR_miguel_russel	#56
		}
	}

	focus = {
		id = POR_nationalize_industry
		available = {
			OR = {
				has_full_control_of_state = 112
				has_full_control_of_state = 180
				has_full_control_of_state = 181
				has_full_control_of_state = 795
			}
		}

		bypass = {
			NOT = { has_full_control_of_state = 112 }
			NOT = { has_full_control_of_state = 180 }
			NOT = { has_full_control_of_state = 181 }
			NOT = { has_full_control_of_state = 795 }
		}
		prerequisite = { focus = POR_nation_in_arms }
		icon = GFX_goal_generic_soviet_construction
		x = 1
		y = 1

		relative_position_id = POR_nation_in_arms
		cost = 10
		search_filters = {FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = { #Lisbon
					add_extra_state_shared_building_slots = 2
					add_building_construction = {
						type = industrial_complex
						level = 2
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = { #Porto
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 181 }
				181 = { #Guarda
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 795 }
				795 = { #Santarem
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			add_stability = -0.20
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = available_political_advisor	#56
			show_ideas_tooltip = POR_manuel_da_silva_campos	#56
		}
	}

	focus = {
		id = POR_reorganization_of_the_communist_party
		available = {
			communism > 0.4
			NOT = {
				has_completed_focus = POR_allow_free_elections
			}
		}
		prerequisite = { focus = POR_nationalize_industry }
		prerequisite = { focus = POR_unify_leftist_youth_wings }
		icon = GFX_focus_generic_soviet_politics
		x = -1
		y = 1

		relative_position_id = POR_nationalize_industry
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_INDUSTRY FOCUS_FILTER_STABILITY}
		completion_reward = {
			SOV = {
				if = {
					limit = { has_government = communism }
					add_opinion_modifier = {
					    target = POR
					    modifier = POR_neutrality_opinion_communism
					}
				}
			}
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_bento_de_jesus_caraca
			remove_ideas = POR_unstable_republic
			if = {
				limit = {
					NOT = { has_government = communism }
				}
				set_politics = {
					ruling_party = communism
				}

				if = { #Low Stability triggers a Civil War
					limit = {
						has_stability < 0.4
					}
					set_temp_variable = { POR_communist_cw_opposition = party_popularity@neutrality }
					multiply_temp_variable = { POR_communist_cw_opposition = 0.8 }
					add_to_temp_variable = { POR_communist_cw_opposition = party_popularity@democratic }
					add_to_temp_variable = { POR_communist_cw_opposition = party_popularity@fascism }
					start_civil_war = {
						ideology = neutrality
						size = POR_communist_cw_opposition
						capital = 180
						states = { 181 }
					}
					if = {
						limit = {
							OR = {
								540 = {
									is_core_of = POR
								}
								544 = {
									is_core_of = POR
								}							
							}
						}
						add_ideas = POR_civil_war_surrender_debuff
					}					
				}
				else = {
					add_stability = -0.1
				}
				custom_effect_tooltip = POR_potential_civil_war_low_requirement_tt
			}
			else = {
				add_political_power = 120
				add_popularity = {
				    ideology = communism
				    popularity = 0.05
				}
			}
		}
	}

	focus = {
		id = POR_communist_secret_police
		icon = GFX_focus_SOV_military_purge
		cost = 10
		prerequisite = {
			focus = POR_reorganization_of_the_communist_party
		}
		available = {

		}
		relative_position_id = POR_reorganization_of_the_communist_party
		x = -2
		y = 1
		ai_will_do = {
			factor = 10
		}
		completion_reward = {
			if = {
				limit = {
					has_dlc = "La Resistance"
					has_intelligence_agency = yes
					NOT = {
						has_done_agency_upgrade = upgrade_interrogation_techniques
					}
				}
				upgrade_intelligence_agency = upgrade_interrogation_techniques
			}
			else_if = {
				limit = {
					has_dlc = "La Resistance"
					NOT = {
						has_intelligence_agency = yes
					}
				}
				create_intelligence_agency = yes
			}
						
			add_tech_bonus = {
				name = mp_tech_bonus_name
				bonus = 1
				uses = 2
				category = military_police_tech
			}
			
			if = {
				limit = {
					NOT = {
						has_idea = r56i_laws_security_balanced
						has_idea = r56i_laws_security_rights
						has_idea = r56i_laws_security_order
					}
				}
				custom_effect_tooltip = EFFECT_CHANGE_LAW_r56i_laws_social
				show_ideas_tooltip = r56i_laws_security_order
				hidden_effect = {
					add_ideas = r56i_laws_security_order
				}
				
			}
		}
		search_filters = {  FOCUS_FILTER_RESEARCH FOCUS_FILTER_ESPIONAGE }
	}

	focus = {
		id = POR_expand_the_intelligence_services
		icon = GFX_goal_generic_spy_connection
		cost = 5
		prerequisite = {
			focus = POR_communist_secret_police
		}
		available = {
			has_intelligence_agency = yes
			agency_upgrade_number > 4
		}
		relative_position_id = POR_communist_secret_police
		x = 0
		y = 2
		ai_will_do = {
			factor = 10
		}
		completion_reward = {
			add_ideas = GER_abwehr_contacts
		}
		search_filters = {  FOCUS_FILTER_ESPIONAGE }
	}

	focus = {
		id = POR_join_the_comintern
		available = {
			is_in_faction = no
			SOV = { is_faction_leader = yes }
			NOT = { has_war_with = SOV }
			has_government = communism
		}

		bypass = {
			is_in_faction_with = SOV
		}
		prerequisite = { focus = POR_reorganization_of_the_communist_party }
		mutually_exclusive = { focus = POR_the_popular_front_bloc focus = POR_align_against_the_comintern }
		icon = GFX_focus_SOV_socialism_in_one_country
		x = 0
		y = 3

		relative_position_id = POR_nation_in_arms
		cost = 10
		completion_reward = {
			SOV = {
				country_event = { id = generic.2 hours = 4 }
			}		
		}
	}

	focus = {
		id = POR_research_collaboration
		available = {
			is_in_faction_with = SOV
		}
		prerequisite = { focus = POR_join_the_comintern }
		icon = GFX_focus_generic_socialist_science
		x = -1
		y = 1

		relative_position_id = POR_join_the_comintern
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			SOV = { add_to_tech_sharing_group = comintern_research }
			add_to_tech_sharing_group = comintern_research
		}
	}

	focus = {
		id = POR_cooperate_with_french_militants
		available = {
			any_other_country = {
				has_government = fascism
				has_war_with = FRA
			}
		}

		bypass = {
			NOT = {
				any_other_country = {
					has_government = fascism
					has_war_with = FRA
				}
			}
		}
		prerequisite = { focus = POR_join_the_comintern  focus = POR_the_popular_front_bloc focus = POR_align_against_the_comintern}
		icon = GFX_focus_chi_reach_out_to_france
		x = 1
		y = 1

		relative_position_id = POR_join_the_comintern
		cost = 10
		completion_reward = {
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 1000
				}
				add_equipment_to_stockpile = {
					type = artillery_equipment
					amount = 1000
				}
			}

			send_equipment = {
			    equipment = infantry_equipment
			    amount = 1000
			    target = FRA
			}

			send_equipment = {
			    equipment = artillery_equipment
			    amount = 1000
			    target = FRA
			}

			add_ai_strategy = {
				type = befriend
				id = FRA
				value = 100
			}
			FRA = {
				add_ai_strategy = {
					type = befriend
					id = ROOT
					value = 100
				}
			}
		}
		search_filters = { FOCUS_FILTER_MILITARY_EQUIPMENT FOCUS_FILTER_POLITICAL }
	}

	focus = {
		id = POR_anti_fascism
		prerequisite = { focus = POR_cooperate_with_french_militants }
		icon = GFX_focus_generic_anti_fascist_diplomacy
		x = 0
		y = 1
		select_effect = {
			every_country = {
				limit = {
					has_government = fascism
					NOT = { is_in_faction_with = ROOT }
					OR = {
						is_major = yes
						is_neighbor_of = ROOT
					}
				}
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				OR = {
					faction_leader = {
						has_government = democratic
					}
					AND = {
						is_in_faction = no
						is_major = no
					}
				}
			}
		}

		available = {
			any_country = {
				has_government = fascism
				NOT = { is_in_faction_with = ROOT }
				OR = {
					is_major = yes
					is_neighbor_of = ROOT
				}
			}
			has_army_manpower = {
				size > 349999
			}			
		}

		relative_position_id = POR_cooperate_with_french_militants
		cost = 10
		completion_reward = {
			hidden_effect = {
				every_country = {
					limit = {
						has_government = fascism
						NOT = { is_in_faction_with = ROOT }
						OR = {
							is_major = yes
							is_neighbor_of = ROOT
						}
					}
					ROOT = {
						create_wargoal = {
							target = PREV
							type = topple_government
							expire = 0
						}
					}
				}
			}
			custom_effect_tooltip = POR_anti_fascism_tt
			every_country = { #TOOLTIP Support
				limit = {
					has_government = fascism
					NOT = { is_in_faction_with = ROOT }
					OR = {
						is_major = yes
						is_neighbor_of = ROOT
					}
				}
			}

			hidden_effect = {
				random_country = {
					limit = {
						has_government = fascism
						NOT = { is_in_faction_with = ROOT }
						OR = {
							is_major = yes
							is_neighbor_of = ROOT
						}
					}
					ROOT = {
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
	}

	focus = {
		id = POR_support_the_spanish_republic
		available = {
			SPR_scw_in_progress = yes
			if = {
				limit = {
					NOT = { has_global_flag = spanish_civil_war }
				}
				custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_country_exist_tt
				    country_exists = SPR
			    }
			    custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_at_peace_tt
					NOT = { has_war_with = SPR }
			    }
			}
		}

		bypass = {
			OR = {
				has_global_flag = scw_over
				if = {
					limit = { NOT = { has_global_flag = spanish_civil_war } }
					NOT = { country_exists = SPR }
				}
				else = {
					NOT = { country_exists = SPD }
				}
			}
		}
		prerequisite = { focus = POR_popular_front }
		mutually_exclusive = { focus = POR_strict_neutrality_in_the_spanish_civil_war focus = POR_support_the_spanish_nationalists focus = POR_a_royal_wedding }
		icon = GFX_goal_generic_spanish_civil_war_soldier
		x = 0
		y = 1

		relative_position_id = POR_popular_front
		cost = 10
		completion_reward = {
			if = {
				limit = {
					NOT = { has_global_flag = spanish_civil_war }
				}
				custom_effect_tooltip = POR_spanish_republic_tt
			}
			SPD = {
				add_opinion_modifier = {
				    target = POR
				    modifier = POR_helped_in_civil_war
				}
				add_manpower = 10000
			}
			add_ideas = POR_volunteers_in_the_war_republican
			add_manpower = -10000
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 2000
				}
				send_equipment = {
				    equipment = infantry_equipment
				    amount = 2000
				    target = SPD
				}
			}
			custom_effect_tooltip = POR_support_the_spanish_republic_effect_tooltip_tt
			set_rule = { can_send_volunteers = yes }
		}
		search_filters = { FOCUS_FILTER_MANPOWER FOCUS_FILTER_SPA_CIVIL_WAR }
	}

	focus = {
		id = POR_workers_of_iberia_unite
		available = {
			SPR_scw_in_progress = yes
			if = {
				limit = {
					NOT = { has_global_flag = spanish_civil_war }
				}
				custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_country_exist_tt
				    country_exists = SPR
			    }
			    custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_at_peace_tt
					NOT = { has_war_with = SPR }
			    }
			}
			else = {
				country_exists = SPD
				NOT = {has_war_with = SPD }
			}
			is_subject = no
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_support_the_spanish_republic }
		mutually_exclusive = { focus = POR_visit_the_front }
		icon = GFX_focus_por_workers_of_iberia
		x = -2
		y = 1

		relative_position_id = POR_support_the_spanish_republic
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL}
		completion_reward = {
			# Event that add NS to POR and SPD
			hidden_effect = {
				country_event = {
					id = lar_portugal_iberian_workers_united.1
					hours = 6
				}
				SPD = {
					country_event = {
						id = lar_portugal_iberian_workers_united.1
						hours = 6
					}
				}
			}
			custom_effect_tooltip = POR_iberian_workers_effect_tooltip_tt
			#Trigger civil war
			if = {
				limit = {
					NOT = { has_government = communism }
				}
				set_politics = {
					ruling_party = communism
				}
			}
			if = {
				limit = {
					has_civil_war = no
				}
				set_temp_variable = { POR_communist_cw_opposition = party_popularity@democratic }
				multiply_temp_variable = { POR_communist_cw_opposition = 0.8 }
				add_to_temp_variable = { POR_communist_cw_opposition = party_popularity@neutrality }
				add_to_temp_variable = { POR_communist_cw_opposition = party_popularity@fascism }
				hidden_effect = {
					start_civil_war = {
						ideology = neutrality
						size = POR_communist_cw_opposition
						capital = 180
						states = { 181 }
					}
				}
				if = {
					limit = {
						OR = {
							540 = {
								is_core_of = POR
							}
							544 = {
								is_core_of = POR
							}							
						}
					}
					add_ideas = POR_civil_war_surrender_debuff
				}				
				custom_effect_tooltip = POR_workers_of_iberia_unite_civil_war_tt
			}
			else = {
				add_stability = -0.2
			}
			hidden_effect = {
				set_country_flag = POR_supports_SPD_flag
			}
			#Communist Portugal joins SPD
			if = {
				limit = { country_exists = SPA }
				add_to_war = { targeted_alliance = SPD enemy = SPA hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPC }
				add_to_war = { targeted_alliance = SPD enemy = SPC hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPB }
				add_to_war = { targeted_alliance = SPD enemy = SPB hostility_reason = asked_to_join }
			}
			effect_tooltip = {
				give_military_access = SPD
				SPD = { give_military_access = ROOT }
			}
			hidden_effect = {
				#Grant military access
				diplomatic_relation = {
					country = SPD
					relation = military_access
					active = yes
				}
				SPD = {
					diplomatic_relation = {
						country = POR
						relation = military_access
						active = yes
					}
				}
			}
			#Non-Aligned Portugal joins SPA
			hidden_effect = {
				random_country = {
					limit = {
						original_tag = POR
						has_government = neutrality
					}
					set_country_flag = POR_non_aligned_portugal_supports_SPA_flag
					if = {
						limit = { country_exists = SPA }
						add_to_war = { targeted_alliance = SPA enemy = SPD hostility_reason = asked_to_join }
						if = {
							limit = { country_exists = SPC }
							add_to_war = { targeted_alliance = SPA enemy = SPC hostility_reason = asked_to_join }
						}
						if = {
							limit = { country_exists = SPB }
							add_to_war = { targeted_alliance = SPA enemy = SPB hostility_reason = asked_to_join }
						}
					}
				}
			}
			custom_effect_tooltip = POR_fascist_portugal_joins_scw_tt

			hidden_effect = {
				add_ai_strategy = {
					type = befriend
					id = SPD
					value = 100
				}
				SPD = {
					add_ai_strategy = {
						type = befriend
						id = ROOT
						value = 100
					}
				}
			}
		}
	}

	focus = {
		id = POR_the_iberian_socialist_union
		available = {
			has_government = communism
			has_global_flag = scw_over
			is_subject = no
			SPR = {
				exists = yes
				OR = {
					is_subject_of = ROOT
					AND = {
						is_subject = no	
						NOT = {
							has_war_with = ROOT
						}
					}
				}
			}
		}
		prerequisite = { focus = POR_workers_of_iberia_unite }
		icon = GFX_focus_generic_befriend_portugal
		x = 0
		y = 1

		relative_position_id = POR_workers_of_iberia_unite
		cost = 10
		search_filters = {FOCUS_FILTER_ANNEXATION}
		completion_reward = {
			if = {
				limit = {
					NOT = { has_global_flag = spanish_civil_war }
				}
				effect_tooltip = {
					custom_effect_tooltip = POR_the_iberian_socialist_union_cosmetic_name_tt
					hidden_effect = {
						every_state = {
							limit = {
								OR = {
									state = 118
									has_state_flag = SPR_core_of_spain_flag
								}
							}
							add_core_of = ROOT
						}
					}
					custom_effect_tooltip = POR_the_iberian_socialist_union_cores_tt
					custom_effect_tooltip = POR_the_iberian_socialist_union_annex_puppets_tt
					custom_effect_tooltip = POR_the_iberian_socialist_union_tt
					every_country = {
						limit = {
							OR = {
								tag = GLC
								tag = NAV
								tag = CAT
								tag = ADU
							}
							NOT = { has_war_with = ROOT }
							NOT = { is_subject_of = ROOT }
						}
						country_event = { id = lar_portugal_iberian_workers_united.2 hours = 6 }
					}
				}
			}
			else = {
				hidden_effect = {
					set_cosmetic_tag = ESU_POR_unified
				}
				custom_effect_tooltip = POR_the_iberian_socialist_union_cosmetic_name_tt
				#Get cores on all Spanish cores and Gibraltar
				hidden_effect = {
					every_state = {
						limit = {
							OR = {
								state = 118
								has_state_flag = SPR_core_of_spain_flag
							}
						}
						add_core_of = ROOT
					}
				}
				custom_effect_tooltip = POR_the_iberian_socialist_union_cores_tt
				if = { # Any Spanish Puppet will get annexed
					limit = {
						any_country = {
							OR = {
								original_tag = SPR
								tag = GLC
								tag = NAV
								tag = CAT
								tag = ADU
							}
							is_subject_of = ROOT
						}
					}
					hidden_effect = {
						every_country = {
							limit = {
								OR = {
									original_tag = SPR
									tag = GLC
									tag = NAV
									tag = CAT
									tag = ADU
								}
								is_subject_of = ROOT
							}
							ROOT = {
								annex_country = {
								    target = PREV
								    transfer_troops = yes
								}
							}
						}
					}
				}
				custom_effect_tooltip = POR_the_iberian_socialist_union_annex_puppets_tt
				# Event for annexation sent to independent Spanish tags
				every_country = {
					limit = {
						OR = {
							tag = SPD
							tag = GLC
							tag = NAV
							tag = CAT
							tag = ADU
						}
						NOT = { has_war_with = ROOT }
						NOT = { is_subject_of = ROOT }
					}
					country_event = { id = lar_portugal_iberian_workers_united.2 hours = 6 }
				}
			}
		}
	}

	focus = {
		id = POR_align_against_the_comintern
		icon = GFX_focus_ger_great_red_menace
		prerequisite = { focus = POR_the_iberian_socialist_union }
		mutually_exclusive = { focus = POR_the_popular_front_bloc focus = POR_join_the_comintern }
		x = -1
		y = 1
		relative_position_id = POR_the_iberian_socialist_union

		cost = 5

		ai_will_do = {
			factor = 5
		}

		available = {
			has_global_flag = scw_over
			has_government = communism
			is_in_faction = no
			any_other_country = {
					capital_scope = {
						is_on_continent = europe
					}
					NOT = {
						original_tag = SOV
					}
					is_faction_leader = yes
					has_government = communism
					NOT = {
						has_war_with = ROOT
					}
			}
		}

		bypass = {
			is_in_faction = yes
		}

		completion_reward = {
			if = {
				limit = {
					any_other_country = {
						capital_scope = {
							is_on_continent = europe
						}
						NOT = {
							original_tag = SOV
						}
						is_faction_leader = yes
						has_government = communism
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				r56_other_faction_invite_communism_NOT_SOV = yes
			}
			add_political_power = 50
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}

	focus = {
		id = POR_the_popular_front_bloc
		available = {
			has_global_flag = scw_over
			has_government = communism
		}
		prerequisite = { focus = POR_the_iberian_socialist_union }
		mutually_exclusive = { focus = POR_join_the_comintern focus = POR_align_against_the_comintern }
		icon = GFX_goal_aus_international
		x = 1
		y = 1

		relative_position_id = POR_the_iberian_socialist_union
		cost = 10
		completion_reward = {
			if = {
				limit = {
					any_other_country = {
						NOT = {
							original_tag = SOV
						}
						is_faction_leader = yes
						has_government = communism
						NOT = {
							has_war_with = ROOT
						}
					}
				}
				r56_other_faction_invite_communism_NOT_SOV = yes
			}
			else = {
				IF = {
					limit = {
						has_dlc = "No Compromise, No Surrender"
					}
					set_rule = { can_create_factions = yes }
					create_faction_from_template = faction_template_POR_popular_front_bloc
					add_faction_initiative = 1
				}
				ELSE = {
					set_rule = { can_create_factions = yes }
					create_faction_from_template = faction_template_POR_popular_front_bloc
				}
				every_other_country = {
					limit = {
						capital_scope = { is_on_continent = europe }
						has_government = communism
						is_in_faction = yes
					}
					add_opinion_modifier = {
						target = POR
						modifier = POR_iberian_communism
					}
				}
				every_other_country = {
					limit = {
						capital_scope = { is_on_continent = europe }
						has_government = communism
						is_in_faction = no
					}
					add_opinion_modifier = {
						target = POR
						modifier = POR_iberian_communism
					}
					hidden_effect = {
						country_event = generic.5
					}
					custom_effect_tooltip = POR_the_popular_front_bloc_tt
				}
				custom_effect_tooltip = POR_the_popular_front_bloc_explanatory_tt
			}			
			every_other_country = {
				limit = {
					capital_scope = { is_on_continent = europe }
					NOT = { has_government = communism }
					communism > 0.19
				}
				add_timed_idea = {
					idea = POR_iberian_communism_pressure
					days = 730
				}
			}
			# SPA Iberian Pact - either POR or SPA join a faction - the other must be added too.
			if = {
				limit = {
					has_country_flag = SPA_iberian_pact
				}
				save_event_target_as = iberian_pact_invitee
				every_other_country = {
					limit = {
						OR = {
							original_tag = POR
							original_tag = SPA
						}
						has_country_flag = SPA_iberian_pact
						NOT = { is_in_faction_with = ROOT }
						NOT = { is_in_faction = yes }
					}
					country_event = lar_spain.28
				}
			}
		}
	}

	focus = {
		id = POR_latin_american_communism
		available = {
			has_global_flag = scw_over
			has_government = communism
			OR = {
				country_exists = BRA country_exists = MEX
				country_exists = COL country_exists = ARG
				country_exists = PRU country_exists = VEN
				country_exists = CHL country_exists = GUA
				country_exists = ECU country_exists = CUB
				country_exists = BOL country_exists = HAI
				country_exists = DOM country_exists = HON
				country_exists = PAR country_exists = ELS
				country_exists = NIC country_exists = COS
				country_exists = PAN country_exists = URG
			}
		}
		prerequisite = { focus = POR_the_popular_front_bloc }
		icon = GFX_focus_por_latin_american_communism
		x = 0
		y = 1

		relative_position_id = POR_the_popular_front_bloc
		cost = 10
		completion_reward = {
			every_other_country = {
				limit = {
					OR = {
						TAG = BRA TAG = MEX
						TAG = COL TAG = ARG
						TAG = PRU TAG = VEN
						TAG = CHL TAG = GUA
						TAG = ECU TAG = CUB
						TAG = BOL TAG = HAI
						TAG = DOM TAG = HON
						TAG = PAR TAG = ELS
						TAG = NIC TAG = COS
						TAG = PAN TAG = URG
					}
					has_government = communism
				}
				add_opinion_modifier = {
					target = POR
					modifier = POR_iberian_communism
				}
			}
			every_other_country = {
				limit = {
					OR = {
						TAG = BRA TAG = MEX
						TAG = COL TAG = ARG
						TAG = PRU TAG = VEN
						TAG = CHL TAG = GUA
						TAG = ECU TAG = CUB
						TAG = BOL TAG = HAI
						TAG = DOM TAG = HON
						TAG = PAR TAG = ELS
						TAG = NIC TAG = COS
						TAG = PAN TAG = URG
					}
					NOT = { has_government = communism }
				}
				add_popularity = {
				    ideology = communism
				    popularity = 0.05
				}
				add_timed_idea = {
					idea = communist_influence
					days = 730
				}
			}
			add_ideas = POR_spread_communism_overseas
		}
	}

	focus = {
		id = POR_our_comrades_overseas
		available = {
			has_global_flag = scw_over
			has_government = communism
			any_country_of = {
				target = { BRA MEX COL ARG PRU VEN CHL GUA ECU CUB BOL HAI DOM HON PAR ELS NIC COS PAN URG }
				has_government = communism
			}
		}
		prerequisite = { focus = POR_latin_american_communism }
		icon = GFX_focus_hol_legacy_of_the_de_zeven_provincien_mutiny
		x = 0
		y = 1

		relative_position_id = POR_latin_american_communism
		cost = 10
		completion_reward = {
			every_other_country = {
				limit = {
					OR = {
						TAG = BRA TAG = MEX
						TAG = COL TAG = ARG
						TAG = PRU TAG = VEN
						TAG = CHL TAG = GUA
						TAG = ECU TAG = CUB
						TAG = BOL TAG = HAI
						TAG = DOM TAG = HON
						TAG = PAR TAG = ELS
						TAG = NIC TAG = COS
						TAG = PAN TAG = URG
					}
					has_government = communism
				}
				if = {
					limit = { is_in_faction = no }
					hidden_effect = {
						country_event = generic.5
					}
					custom_effect_tooltip = POR_the_popular_front_bloc_tt
				}
			}
			custom_effect_tooltip = POR_our_comrades_overseas_tt
		}
	}


	focus = {
		id = POR_visit_the_front
		available = {
			SPR_scw_in_progress = yes
			if = {
				limit = {
					NOT = { has_global_flag = spanish_civil_war }
				}
				custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_country_exist_tt
				    country_exists = SPR
			    }
			    custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_at_peace_tt
					NOT = { has_war_with = SPR }
			    }
			}
			else = {
				country_exists = SPD
				NOT = {has_war_with = SPD }
			}
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_support_the_spanish_republic }
		mutually_exclusive = { focus = POR_workers_of_iberia_unite}
		icon = GFX_focus_eng_special_air_service
		x = 2
		y = 1

		relative_position_id = POR_support_the_spanish_republic
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH FOCUS_FILTER_SPA_CIVIL_WAR }
		completion_reward = {
			add_doctrine_cost_reduction = {
				name = POR_visit_the_front
			    cost_reduction = 0.5
			    uses = 1
			    category = land_doctrine
			}
			add_tech_bonus = {
				name = POR_visit_the_front
			    bonus = 0.5
			    uses = 1
			    category = light_air
			}
			add_tech_bonus = {
				name = POR_visit_the_front
			    bonus = 0.5
			    uses = 1
			    category = cat_light_armor
			}
			army_experience = 20
			air_experience = 10

			hidden_effect = {
				add_ai_strategy = {
					type = befriend
					id = SPD
					value = 100
				}
				SPD = {
					add_ai_strategy = {
						type = befriend
						id = ROOT
						value = 100
					}
				}
			}
		}
	}

	focus = {
		id = POR_they_need_our_help

		select_effect = {
			if = {
				limit = {
					country_exists = SPA
					is_neighbor_of = SPA
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPA
					value = 100
				}
			}
			if = {
				limit = {
					country_exists = SPB
					is_neighbor_of = SPB
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPB
					value = 100
				}
			}
			if = {
				limit = {
					country_exists = SPC
					is_neighbor_of = SPC
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPC
					value = 100
				}
			}
		}

		available = {
			has_civil_war = no
			SPR_scw_in_progress = yes
			if = {
				limit = {
					NOT = { has_global_flag = spanish_civil_war }
				}
				custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_country_exist_tt
				    country_exists = SPR
			    }
			    custom_trigger_tooltip = {
				    tooltip = POR_spr_tooltip_at_peace_tt
					NOT = { has_war_with = SPR }
			    }
			}
			else = {
				country_exists = SPD
				NOT = {has_war_with = SPD }
			}
			has_government = communism
			is_subject = no
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_visit_the_front }
		icon = GFX_focus_intervention_spain_republic
		x = 0
		y = 2

		relative_position_id = POR_visit_the_front
		cost = 10
		completion_reward = {
			unlock_decision_tooltip = POR_fight_alongside_the_republic
			if = {
				limit = { country_exists = SPA }
				SPA = {
					country_event = { id = lar_portugal_spanish_civil_war.1 }
				}
			}
			if = {
				limit = { country_exists = SPB }
				SPB = {
					country_event = { id = lar_portugal_spanish_civil_war.1 }
				}
			}
			if = {
				limit = { country_exists = SPC }
				SPC = {
					country_event = { id = lar_portugal_spanish_civil_war.1 }
				}
			}
		}
		search_filters = { FOCUS_FILTER_MANPOWER FOCUS_FILTER_SPA_CIVIL_WAR }
	}

	focus = {	#56 - This whole focus has been reworked. It was previously a schizo attack Guanxi focus which makes no sense in a Communist path.
		id = POR_protect_chinese_civilians
		available = { 
			is_subject = no
			JAP = {
				NOT = { is_ally_with = ROOT }
				OR = {
					has_war_with = CHI
					has_war_with = PRC
				}
			} 
		}
		prerequisite = { focus = POR_they_need_our_help focus = POR_allow_free_elections focus = POR_the_popular_front_bloc }
		icon = GFX_focus_chi_united_front
		x = -1
		y = 1
		relative_position_id = POR_they_need_our_help
		offset = {	#56
			x = -7
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		cost = 5
		completion_reward = {
			add_war_support = 0.03
			send_embargo = JAP
			if = {
				limit = { 
					CHI = { has_war_with = JAP }
				}
				add_relation_rule_override = {
					target = CHI
					can_send_volunteers = yes 
				}
			}
			if = {
				limit = { 
					PRC = { has_war_with = JAP }
				}
				add_relation_rule_override = {
					target = PRC
					can_send_volunteers = yes 
				}
			}	
		}
	}

	focus = {
		id = POR_strict_neutrality_in_the_spanish_civil_war
		available = {
			SPR_scw_in_progress = yes
		}

		ai_will_do = {
			factor = 1
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_popular_front focus = POR_estado_novo }
		mutually_exclusive	= { focus = POR_support_the_spanish_republic focus = POR_support_the_spanish_nationalists focus = POR_a_royal_wedding }
		icon = GFX_goal_generic_neutrality_focus
		x = 5
		y = 0

		offset = {	#56
			x = -5
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		relative_position_id = POR_support_the_spanish_republic
		cost = 10
		completion_reward = {
			every_other_country = {
				add_opinion_modifier = {
				    target = POR
				    modifier = POR_neutrality_opinion_trade
				}
			}
			every_other_country = {
				limit = {
					has_government = democratic
				}
				add_opinion_modifier = {
				    target = POR
				    modifier = POR_neutrality_opinion_democratic
				}
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}

	focus = {
		id = POR_british_investment_in_mines
		available = {
			NOT = { has_government = communism }
			ENG = {
				exists = yes
				NOT = { has_war_with = ROOT }
				has_civil_war = no
				has_capitulated = no
				owns_state = 126 #Owns London
			}
		}

		bypass = {
			NOT = { country_exists = ENG }
		}
		prerequisite = { focus = POR_strict_neutrality_in_the_spanish_civil_war }
		icon = GFX_goal_generic_construct_civilian
		x = -1
		y = 1

		relative_position_id = POR_strict_neutrality_in_the_spanish_civil_war
		cost = 10
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				add_resource = {
				    type = tungsten
				    amount = 50
				    state = 112 #Lisbon
				}
			}
			add_tech_bonus = {
				name = POR_british_investment_in_mines
			    bonus = 1.0
			    uses = 2
			    category = industry
			}
			add_timed_idea = {
				idea = POR_british_influence
				days = 1460
			}

			hidden_effect = {
				add_ai_strategy = {
					type = befriend
					id = ENG
					value = 50
				}
				ENG = {
					add_ai_strategy = {
						type = befriend
						id = ROOT
						value = 50
					}
				}
			}
		}
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_RESEARCH FOCUS_FILTER_POLITICAL FOCUS_FILTER_TUNGSTEN}
	}

	focus = {
		id = POR_british_guns
		prerequisite = { focus = POR_strict_neutrality_in_the_spanish_civil_war }
		icon = GFX_goal_generic_military_sphere
		x = 1
		y = 1

		relative_position_id = POR_strict_neutrality_in_the_spanish_civil_war
		cost = 10
		completion_reward = {
			unlock_decision_tooltip = POR_buy_aa_in_britain
			unlock_decision_tooltip = POR_buy_at_in_britain
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}

	focus = {
		id = POR_british_industrial_investments
		available = {
			has_capitulated = no
			ENG = {
				exists = yes
				NOT = { has_war_with = ROOT }
				has_civil_war = no
				has_capitulated = no
				owns_state = 126 #Owns London
			}
		}

		bypass = {
			NOT = { country_exists = ENG }
		}
		prerequisite = { focus = POR_british_investment_in_mines focus = POR_british_guns focus = POR_visit_the_front }
		icon = GFX_focus_generic_industry_3
		x = 0
		y = 1

		relative_position_id = POR_british_investment_in_mines
		cost = 10
		completion_reward = {
			if = {
				limit = { has_full_control_of_state = 112 }
				112 = { #Lisbon
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 180 }
				180 = { #Porto
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 181 }
				181 = { #Guarda
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = { has_full_control_of_state = 179 }
				179 = { #Beja
					add_extra_state_shared_building_slots = 1
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
				}
			}
			if = {
				limit = {has_completed_focus = POR_estado_novo}
				remove_ideas = POR_estado_novo
			}

			hidden_effect = {
				add_ai_strategy = {
					type = befriend
					id = ENG
					value = 100
				}
				ENG = {
					add_ai_strategy = {
						type = befriend
						id = ROOT
						value = 100
					}
				}
			}
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = available_political_advisor	#56
			show_ideas_tooltip = POR_manuel_da_silva_campos	#56
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}

	focus = {
		id = POR_allow_free_elections
		available = {
			democratic > 0.5
			has_war = no
			if = {
				limit = {
					has_completed_focus = POR_popular_front
				}
				NOT = {
					has_completed_focus = POR_reorganization_of_the_communist_party
				}
			}
		}
		prerequisite = { focus = POR_british_industrial_investments }
		icon = GFX_goal_support_democracy
		x = 0
		y = 1

		relative_position_id = POR_british_industrial_investments
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_INDUSTRY FOCUS_FILTER_STABILITY}
		completion_reward = {
			every_other_country = {
				limit = {
					has_government = democratic
				}

				add_opinion_modifier = {
				    target = POR
				    modifier = POR_election_opinion_democratic
				}
			}
			remove_ideas = POR_unstable_republic
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			if = {
				limit = {
					has_idea = internationalism
				}
				remove_ideas = internationalism
			}
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_jaime_cortesao
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_vitorino_guimaraes	#56
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_manuel_gaspar_de_lemos	#56
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = available_theorist
			show_ideas_tooltip = POR_jose_manuel_sarmento_de_beires
			if = {
				limit = {
					has_completed_focus = POR_limited_self_rule
				}
				custom_effect_tooltip = available_political_advisor
				show_ideas_tooltip = POR_francisco_da_cunha_leal
			}
			show_unit_leaders_tooltip = POR_jose_mendes_dos_reis	#56 - Former create_country_leader 
			show_unit_leaders_tooltip = POR_armando_pereira_de_castro_agatao_lanca	#56 - Former create_country_leader 
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			if = {
				limit = {
					NOT = { has_government = democratic }
				}
				set_politics = {
					ruling_party = democratic
					elections_allowed = yes
				}

				if = { #Low Stability triggers a Civil War
					limit = {
						has_stability < 0.4
					}
					set_temp_variable = { POR_democratic_cw_opposition = party_popularity@neutrality }
					multiply_temp_variable = { POR_democratic_cw_opposition = 0.6 }
					add_to_temp_variable = { POR_democratic_cw_opposition = party_popularity@fascism }
					start_civil_war = {
						ideology = fascism
						size = POR_democratic_cw_opposition
						capital = 180
						states = { 181 }
					}
					if = {
						limit = {
							OR = {
								540 = {
									is_core_of = POR
								}
								544 = {
									is_core_of = POR
								}							
							}
						}
						add_ideas = POR_civil_war_surrender_debuff
					}					
				}
				else = {
					add_stability = -0.1
				}
				custom_effect_tooltip = POR_potential_civil_war_low_requirement_tt
			}
			else = {
				add_political_power = 120
				add_popularity = {
				    ideology = democratic
				    popularity = 0.05
				}
			}
		}
	}
	focus = {
		id = POR_securing_the_free_world
		available = {
			has_global_flag = scw_over
			threat > 0.4
			has_government = democratic
		}
		prerequisite = { focus = POR_allow_free_elections }

		icon = GFX_focus_generic_treaty
		x = 1
		y = 1

		offset = {	#56
			x = -2
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		relative_position_id = POR_allow_free_elections
		cost = 10
		completion_reward = {
			hidden_effect = {
				every_other_country = {
					limit = {
						capital_scope = {
							is_on_continent = europe
						}
						OR = {
							has_government = democratic
							has_government = neutrality
						}
						is_major = no
					}
					POR = {
						give_guarantee = PREV

						add_ai_strategy = {
							type = befriend
							id = PREV
							value = 100
						}
					}
				}
			}
			custom_effect_tooltip = portugal_guarantees_freedom_tt
			set_rule = { can_create_factions = yes }
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}

	focus = {
		id = POR_intervention_in_spain

		select_effect = {
			add_ai_strategy = {
				type = befriend
				id = SPD
				value = -100
			}
			add_ai_strategy = {
				type = alliance
				id = SPD
				value = -100
			}
			add_ai_strategy = {
				type = prepare_for_war
				id = SPD
				value = 100
			}
		}

		available = {
			has_global_flag = scw_over
			OR = {
				has_government = democratic
				has_government = communism
			}
			any_country_with_original_tag = {
				original_tag_to_check = SPR
				NOT = { has_government = ROOT }
			}
			has_civil_war = no
			has_army_manpower = {
				size > 99999
			}		
			has_civil_war = no				
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				has_completed_focus = POR_support_the_spanish_republic
				NOT = { has_completed_focus = POR_join_the_comintern }
			}
			modifier = {
				factor = 100
				has_completed_focus = POR_join_the_comintern
				SPD = { has_completed_focus = SPR_against_trotskyism_and_stalinism }
			}
		}
		prerequisite = { focus = POR_they_need_our_help focus = POR_allow_free_elections }
		icon = GFX_focus_focus_fra_intervention_spain
		relative_position_id = POR_they_need_our_help
		x = 1
		y = 1

		offset = {	#56
			x = -7
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		
		cost = 10
		completion_reward = {
			hidden_effect = {
				every_country = {
					limit = {
						original_tag = SPR
						NOT = { has_government = ROOT }
					}
					POR = {
						create_wargoal = {
						  	target = PREV
							expire = 0
						    type = topple_government
						}
					}
				}
			}
			custom_effect_tooltip = POR_intervention_in_spain_tt

			hidden_effect = {
				add_ai_strategy = {
					type = declare_war
					id = SPD
					value = 100
				}
			}
		}
		search_filters = { FOCUS_FILTER_SPA_CIVIL_WAR }
	}

	focus = {
		id = POR_join_the_allies
		available = {
			is_in_faction = no
			any_other_country = {
				NOT = { has_war_with = ROOT }
				is_faction_leader = yes
				is_major = yes
				has_government = democratic
				has_opinion = {
					target = ROOT
					value > -11
				}				
			}
			NOT = {
				any_other_country = {
					is_in_faction_with = ENG
					has_war_with = POR
				}
			}
		}

		bypass = {
			OR = {
				is_in_faction_with = ENG
				AND = {
					is_in_faction = yes
					any_other_country = {
						is_faction_leader = yes
						is_in_faction_with = ROOT
						has_government = democratic
					}
				}
			}
		}
		prerequisite = { focus = POR_allow_free_elections }
		icon = GFX_focus_chi_british_cooperation
		x = 0
		y = 2

		relative_position_id = POR_allow_free_elections
		cost = 10
		completion_reward = {
			if = {
				limit = {
					ENG = {
						is_faction_leader = yes
						has_government = democratic
						not = { has_war_with = ROOT }
					}
				}
				ENG = { country_event = { id = generic.2 hours = 4 } }
			}						
			else = {
				get_best_alliance_match_democratic_effect = yes
				var:best_leader = {
					country_event = { id = generic.2 hours = 4 }
				}
			}
		}
	}

	focus = {
		id = POR_research_sharing
		available = {
			is_in_faction_with = ENG
		}
		prerequisite = { focus = POR_join_the_allies focus = POR_honor_anglo_portuguese_alliance }
		icon = GFX_focus_research2
		x = 2
		y = 1

		offset = {	#56
			x = -3
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_popular_front
			}
		}
		relative_position_id = POR_join_the_allies
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			ENG = { add_to_tech_sharing_group = commonwealth_research }
			add_to_tech_sharing_group = commonwealth_research
		}
	}

	focus = {
		id = POR_oppose_germany

		will_lead_to_war_with = GER

		select_effect = {
			add_ai_strategy = {
				type = prepare_for_war
				id = GER
				value = 100
			}
		}

		available = {
			country_exists = GER
			GER = {
				has_government = fascism
				has_capitulated = no
			}
			has_army_manpower = {
				size > 249999
			}		
			has_civil_war = no
			r56_script_i_am_sane = yes	
		}
		prerequisite = { focus = POR_join_the_allies focus = POR_honor_anglo_portuguese_alliance }
		icon = GFX_focus_ger_oppose_hitler
		x = 5
		y = 1

		offset = {	#56
			x = -2
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_popular_front
			}
		}
		offset = {	#56
			x = -1
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		relative_position_id = POR_join_the_allies
		cost = 10
		completion_reward = {
			create_wargoal = {
				target = GER
				type = topple_government
				expire = 0
			}

			hidden_effect = {
				add_ai_strategy = {
					type = declare_war
					id = GER
					value = 100
				}
			}
		}
	}

	focus = {
		id = POR_iberian_summit
		available = {
			has_global_flag = scw_over
			has_war = no
			is_in_faction = no
			NOT = { has_government = communism }
			OR = {
				if = {
					limit = {
						NOT = { has_global_flag = spanish_civil_war }
					}
					custom_trigger_tooltip = {
					    tooltip = POR_spr_tooltip_country_exist_tt
					    country_exists = SPR
				    }
				    custom_trigger_tooltip = {
					    tooltip = POR_spr_tooltip_at_peace_tt
						NOT = { has_war_with = SPR }
				    }
				    SPR = {
				 	   has_completed_focus = SPR_maintain_the_second_republic
				    	has_government = democratic
				    }
				}
				else = {
					AND = {
						country_exists = SPD
						SPD = {
							has_war = no
							is_in_faction = no
							has_completed_focus = SPR_maintain_the_second_republic
							has_government = democratic
						}
					}
				}
				AND = {
					country_exists = SPA
					SPA = {
						has_war = no
						is_in_faction = no
						OR = {
							has_completed_focus = SPA_the_phalanx_ascendant
							AND = {
								has_completed_focus = SPA_unify_the_nationalist_front
								NOT = { has_completed_focus = SPA_the_iberian_pact }
							}
						}
					}
				}
			}
		}
		prerequisite = { focus = POR_allow_free_elections focus = POR_send_assistance }

		mutually_exclusive = { focus = POR_nationalist_intervention }

		icon = GFX_focus_por_iberian_summit
		x = 3
		y = 1

		offset = {	#56
			x = -2
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		relative_position_id = POR_allow_free_elections
		cost = 10
		completion_reward = {
			unlock_decision_tooltip = POR_iberian_summit_pro_axis
			unlock_decision_tooltip = POR_iberian_summit_pro_allies
		}
		search_filters = { FOCUS_FILTER_ALLIANCE }
	}

	focus = {
		id = POR_estado_novo
		mutually_exclusive = { focus = POR_popular_front}
		prerequisite = {
		}
		icon = GFX_focus_por_estado_novo
		x = 13
		y = 0

		allow_branch = {	#56
			if = {
				limit = {
					has_game_rule = {
						rule = obsolete_focus_branches_visibility
						option = HIDE
					}
				}
				NOT = { has_completed_focus = POR_popular_front }
			}
		}
		offset = {	#56
			x = -7
			y = 0
			trigger = {
				has_game_rule = {
					rule = obsolete_focus_branches_visibility
					option = HIDE
				}
				has_completed_focus = POR_estado_novo
			}
		}
		relative_position_id = POR_popular_front
		cost = 10
		completion_reward = {
			mark_focus_tree_layout_dirty = yes	#56
			add_ideas = POR_estado_novo
			add_political_power = 100
			custom_effect_tooltip = available_chief_of_army
			show_ideas_tooltip = POR_julio_botelho_moniz
			custom_effect_tooltip = remove_political_advisor
			show_ideas_tooltip = POR_alvaro_cunhal
		}
		search_filters = {FOCUS_FILTER_INDUSTRY FOCUS_FILTER_POLITICAL}
	}

	focus = {
		id = POR_support_the_spanish_nationalists
		available = {
			SPR_scw_in_progress = yes
			country_exists = SPA
			NOT = { has_war_with = SPA }
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_estado_novo }
		mutually_exclusive = { focus = POR_strict_neutrality_in_the_spanish_civil_war focus = POR_support_the_spanish_republic focus = POR_a_royal_wedding }
		icon = GFX_goal_support_fascism
		x = 0
		y = 1

		relative_position_id = POR_estado_novo
		cost = 10
		completion_reward = {
			SPA = {
				add_opinion_modifier = {
				    target = POR
				    modifier = POR_helped_in_civil_war
				}
				add_manpower = 10000
			}
			add_ideas = POR_volunteers_in_the_war_nationalist
			add_manpower = -10000
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 2000
				}
			}
			send_equipment = {
			    equipment = infantry_equipment
			    amount = 2000
			    target = SPA
			}
			set_rule = { can_send_volunteers = yes }
		}
		search_filters = { FOCUS_FILTER_RESEARCH FOCUS_FILTER_SPA_CIVIL_WAR }
	}

	focus = {
		id = POR_portuguese_legion
		available = {
			SPR_scw_in_progress = yes
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_support_the_spanish_nationalists }
		icon = GFX_focus_por_portuguese_legion
		x = 0
		y = 1

		relative_position_id = POR_support_the_spanish_nationalists
		cost = 10
		completion_reward = {
			add_ideas = por_portuguese_legion

			custom_effect_tooltip = generic_skip_one_line_tt

			add_tech_bonus = {
				name = POR_portuguese_legion
				bonus = 0.5
				uses = 1
				category = military_police_tech
			}	

		}
		search_filters = {FOCUS_FILTER_MANPOWER}
	}

	focus = {
		id = POR_observation_mission

		available = {
			SPR_scw_in_progress = yes
			country_exists = SPA
			NOT = { has_war_with = SPA }
		}

		bypass = {
			has_global_flag = scw_over
		}

		ai_will_do = {
			factor = 1.1
		}
		
		prerequisite = { focus = POR_portuguese_legion }
		icon = GFX_goal_generic_position_armies
		x = -4
		y = 1

		relative_position_id = POR_portuguese_legion
		cost = 10
		completion_reward = {
			add_doctrine_cost_reduction = {
				name = POR_observation_mission
			    cost_reduction = 0.5
			    uses = 1
			    category = air_doctrine
			}
			add_tech_bonus = {
				name = POR_observation_mission
			    bonus = 0.5
			    uses = 1
			    category = light_air
			}
			add_tech_bonus = {
				name = POR_observation_mission
			    bonus = 0.5
			    uses = 1
			    category = cat_light_armor
			}
			army_experience = 10
			air_experience = 20

			hidden_effect = {
				add_ai_strategy = {
					type = befriend
					id = SPA
					value = 100
				}
				SPA = {
					add_ai_strategy = {
						type = befriend
						id = POR
						value = 100
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_RESEARCH FOCUS_FILTER_SPA_CIVIL_WAR }
	}

	focus = {
		id = POR_send_assistance

		select_effect = {
			if = {
				limit = {
					country_exists = SPD
					is_neighbor_of = SPD
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPD
					value = 100
				}
			}
			if = {
				limit = {
					country_exists = SPB
					is_neighbor_of = SPB
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPB
					value = 100
				}
			}
			if = {
				limit = {
					country_exists = SPC
					is_neighbor_of = SPC
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPC
					value = 100
				}
			}
		}

		available = {
			has_civil_war = no
			SPR_scw_in_progress = yes
			country_exists = SPA
			NOT = { has_war_with = SPA }
			is_subject = no
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_observation_mission }
		icon = GFX_focus_intervention_spain_nationalists
		x = 0
		y = 1

		relative_position_id = POR_observation_mission
		cost = 10
		completion_reward = {
			unlock_decision_tooltip = POR_fight_alongside_the_nationalists
			if = {
				limit = { country_exists = SPD }
				SPD = {
					country_event = { id = lar_portugal_spanish_civil_war.2 }
				}
			}
			if = {
				limit = { country_exists = SPB }
				SPB = {
					country_event = { id = lar_portugal_spanish_civil_war.2 }
				}
			}
			if = {
				limit = { country_exists = SPC }
				SPC = {
					country_event = { id = lar_portugal_spanish_civil_war.2 }
				}
			}
		}
		search_filters = { FOCUS_FILTER_SPA_CIVIL_WAR }
	}

	focus = {
		id = POR_nationalist_intervention

		select_effect = {
			add_ai_strategy = {
				type = befriend
				id = SPA
				value = -100
			}
			add_ai_strategy = {
				type = alliance
				id = SPA
				value = -100
			}
			add_ai_strategy = {
				type = prepare_for_war
				id = SPA
				value = 100
			}
		}

		available = {	
			r56_script_i_am_sane = yes
			has_global_flag = scw_over
			SPA = {
				NOT = { has_government = ROOT }
				r56_script_target_is_sane = yes
			}
			has_civil_war = no
			has_army_manpower = {
				size > 179999
			}				
		}
		prerequisite = { focus = POR_send_assistance}

		mutually_exclusive = { focus = POR_iberian_summit }

		icon = GFX_goal_generic_major_war
		x = 0
		y = 1

	

		relative_position_id = POR_send_assistance
		cost = 10
		completion_reward = {
			hidden_effect = {
				every_country = {
					limit = {
						original_tag = SPR
						NOT = { has_government = ROOT }
					}
					POR = {
						create_wargoal = {
						  	target = PREV
							expire = 0
						    type = topple_government
						}
					}
				}
			}
			custom_effect_tooltip = POR_nationalist_intervention_tt

			hidden_effect = {
				add_ai_strategy = {
					type = declare_war
					id = SPA
					value = 100
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_strengthen_the_regime
		available = {
			has_country_leader = { character = POR_antonio_de_oliveira_salazar }
			has_manpower > 80000
			has_equipment = { support_equipment > 799 }
			has_equipment = { infantry_equipment > 799 }
		}

		ai_will_do = {
			factor = 1
		}
		prerequisite = { focus = POR_portuguese_legion }

		mutually_exclusive = { focus = POR_national_syndicalism }

		icon = GFX_goal_generic_political_pressure
		x = 4
		y = 0

		relative_position_id = POR_observation_mission
		cost = 10
		completion_reward = {
			add_manpower = -3000
			add_equipment_to_stockpile = {
				type = support_equipment
				amount = -800
				producer = POR
			}
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = -800
				producer = POR
			}
			add_stability = -0.1
			add_popularity = {
			    ideology = neutrality
				popularity = 0.10
			}
			swap_ideas = {
				remove_idea = POR_estado_novo
				add_idea = POR_estado_novo_2
			}
			#custom_effect_tooltip = remove_chief_of_army
			#show_ideas_tooltip = POR_rolao_preto		Commenting out because Speculoos removed this advisor role - This spams the error log.
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_luis_maria_lopes_da_fenseca	#56
		}
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_INDUSTRY}
	}

	focus = {
		id = POR_the_capital_of_espionage
		available = {
			owns_state = 112
			has_war = no
			OR = {
				AND = {
					ENG = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
					any_country = {
						is_major = yes
						has_war_with = ENG
					}
				}
				AND = {
					GER = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
					any_country = {
						is_major = yes
						has_war_with = GER
					}
				}
			}
		}
		prerequisite = { focus = POR_strengthen_the_regime }

		icon = GFX_goal_generic_intelligence_exchange
		x = -2
		y = 1

		relative_position_id = POR_strengthen_the_regime
		cost = 10
		completion_reward = {
			add_ideas = POR_the_capital_of_espionage
		}
		search_filters = { FOCUS_FILTER_ESPIONAGE }
	}

	focus = {
		id = POR_appease_monarchists
		prerequisite = { focus = POR_strengthen_the_regime }
		icon = GFX_goal_tfv_strengthen_commonwealth_ties
		x = 0
		y = 1

		relative_position_id = POR_strengthen_the_regime
		cost = 10
		completion_reward = {
			add_political_power = 70
			add_popularity = {
			    ideology = neutrality
				popularity = 0.05
			}
			swap_ideas = {
				remove_idea = POR_estado_novo_2
				add_idea = POR_estado_novo_3
			}
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_joao_de_azevedo_coutinho
			show_ideas_tooltip = POR_joao_francisco_de_barbosa_azevedo
		}
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_INDUSTRY}
	}

	focus = {
		id = POR_concordat_with_the_holy_see
		prerequisite = { focus = POR_appease_monarchists }
		icon = GFX_focus_por_concordat
		x = -1
		y = 1

		relative_position_id = POR_appease_monarchists
		cost = 10
		completion_reward = {
			add_political_power = 120
			swap_ideas = {
				remove_idea = POR_estado_novo_3
				add_idea = POR_estado_novo_4
			}
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_manuel_goncalves_cerejeira
		}
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY}
	}

	focus = {
		id = POR_honor_anglo_portuguese_alliance
		available = {
			is_in_faction = no
			has_war = no
			ENG = {
				exists = yes
				NOT = {
					has_war_with = ROOT
					any_other_country = {
						is_in_faction_with = ENG
						has_war_with = ROOT
					}
				}
			}
			any_country = {
				is_major = yes
				has_war_with = ENG
			}
		}


		prerequisite = { focus = POR_concordat_with_the_holy_see }

		mutually_exclusive = { focus = POR_proudly_alone }

		icon = GFX_goal_generic_alliance
		x = -1
		y = 1

		relative_position_id = POR_concordat_with_the_holy_see
		cost = 10
		completion_reward = {
			remove_ideas = POR_national_gold_reserves
			remove_ideas = POR_unstable_republic
			if = {
				limit = {
					ENG = {
						is_faction_leader = yes
						has_government = democratic
						NOT = { has_war_with = ROOT }
					}
				}
				ENG = { country_event = { id = generic.2 hours = 4 } }
			}			
			else = {
				get_best_alliance_match_democratic_effect = yes
				var:best_leader = {
					country_event = { id = generic.2 hours = 4 }
				}
			}
		}
		search_filters = { FOCUS_FILTER_STABILITY }
	}

	focus = {
		id = POR_national_gold_reserves
		available = {
			has_war = no
			OR = {
				AND = {
					ENG = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
					any_country = {
						is_major = yes
						has_war_with = ENG
					}
				}
				AND = {
					GER = {
						exists = yes
						NOT = { has_war_with = ROOT }
					}
					any_country = {
						is_major = yes
						has_war_with = GER
					}
				}
			}
		}
		prerequisite = { focus = POR_appease_monarchists }
		icon = GFX_focus_usa_reestablish_the_gold_standard
		x = 1
		y = 1

		relative_position_id = POR_appease_monarchists
		cost = 10
		completion_reward = {
			add_ideas = POR_national_gold_reserves
			ENG = {
				add_opinion_modifier = {
					target = POR
					modifier = POR_portuguese_trade
				}
			}
			GER = {
				add_opinion_modifier = {
					target = POR
					modifier = POR_portuguese_trade
				}
			}
			every_other_country = {
				limit = {
					NOT = { tag = GER }
					NOT = { tag = ENG }
					OR = {
						is_in_faction_with = ENG
						is_in_faction_with = GER
					}
				}
				add_opinion_modifier = {
					target = POR
					modifier = POR_portuguese_trade_minor
				}
			}
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_sebastiao_garcia_ramires	#56
		}
		search_filters = {FOCUS_FILTER_INDUSTRY}
	}

	focus = {
		id = POR_proudly_alone
		available = {
			has_government = neutrality
			has_war = no
		}

		prerequisite = { focus = POR_national_gold_reserves }
		prerequisite = { focus = POR_concordat_with_the_holy_see }

		mutually_exclusive = { focus = POR_honor_anglo_portuguese_alliance }

		icon = GFX_focus_por_salazar
		x = 2
		y = 1

		relative_position_id = POR_concordat_with_the_holy_see
		cost = 10
		completion_reward = {
			swap_ideas = {
				remove_idea = POR_estado_novo_4
				add_idea = POR_estado_novo_5
			}
			remove_ideas = POR_unstable_republic
		}
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_WAR_SUPPORT FOCUS_FILTER_INDUSTRY}
	}

	focus = {
		id = POR_the_eastern_menace

		will_lead_to_war_with = JAP

		select_effect = {
			add_ai_strategy = {
				type = prepare_for_war
				id = JAP
				value = 100
			}
		}

		available = {
			JAP = {
				exists = yes
				NOT = { has_war_with = ROOT }
				r56_script_target_is_sane = yes
			}
			r56_script_i_am_sane = yes	
		
			has_army_manpower = {
				size > 349999
			}		

			has_civil_war = no		
		}

		prerequisite = { focus = POR_proudly_alone }

		icon = GFX_focus_AST_war_japan
		x = -1
		y = 1

		relative_position_id = POR_proudly_alone
		cost = 10
		completion_reward = {
			create_wargoal = {
				target = JAP
				type = puppet_wargoal_focus
				expire = 0
			}

			hidden_effect = {
				add_ai_strategy = {
					type = declare_war
					id = JAP
					value = 100
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_national_syndicalism
		prerequisite = { focus = POR_portuguese_legion }

		mutually_exclusive = { focus = POR_strengthen_the_regime }

		icon = GFX_focus_generic_strike_at_democracy2
		x = 8
		y = 0

		ai_will_do = {
			factor = 0.5
		}

		relative_position_id = POR_observation_mission
		cost = 10
		completion_reward = {
			
			add_war_support = 0.1
			if = {
				limit = {
					is_ai = yes
				}
				add_stability = -0.10
				#add_political_power = 150
			}
			else = {
				add_stability = -0.2
			}
			add_ideas = POR_national_syndicalism

			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			#add_popularity = {
			#	ideology = fascism
			#	popularity = 0.05
			#}

			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			custom_effect_tooltip = available_political_advisor
			#show_ideas_tooltip = POR_jose_hipolito_raposo_2	Commenting out because Speculoos removed this advisor role - This spams the error log.
			show_ideas_tooltip = POR_alberto_monsaraz

			if = {
				limit = {
					amount_taken_ideas = {
						amount < 3
						slots = {
							political_advisor
						}
					}
				}
				add_ideas = POR_alberto_monsaraz
			}
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_alberto_pinheiro_torres	#56




		}
		search_filters = {FOCUS_FILTER_WAR_SUPPORT FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY}
	}

	focus = {
		id = POR_ditadura_militar
		available = {
			fascism > 0.4
			has_war = no
		}

		prerequisite = { focus = POR_national_syndicalism }
		icon = GFX_goal_generic_forceful_treaty
		x = 0
		y = 1

		relative_position_id = POR_national_syndicalism
		cost = 10
		completion_reward = {
			remove_ideas = POR_estado_novo
			every_country = {
				limit = {
					has_government = fascism
					is_major = yes
					capital_scope = {
						is_on_continent = europe
					}
				}
				add_opinion_modifier = {
				    target = POR
				    modifier = fascism_leanings_good
				}
			}
			if = {
				limit = {
					NOT = { has_government = fascism }
				}
				set_politics = {
					ruling_party = fascism
				}

				if = { #Low Stability triggers a Civil War
					limit = {
						has_stability < 0.6
					}
					add_popularity = { #should help the civil war a bit(?)
						ideology = fascism
						popularity = 0.05
					}					
					set_temp_variable = { POR_fascist_cw_opposition = party_popularity@neutrality }
					multiply_temp_variable = { POR_fascist_cw_opposition = 0.6 }
					add_to_temp_variable = { POR_fascist_cw_opposition = party_popularity@democratic }
					#remove communists from the civil war because everything I don't like is fascism anyway.
					#add_to_temp_variable = { POR_fascist_cw_opposition = party_popularity@communism }
					start_civil_war = {
						ideology = neutrality
						size = POR_fascist_cw_opposition
						capital = 180
						states = { 181 }
					}
					if = {
						limit = {
							OR = {
								540 = {
									is_core_of = POR
								}
								544 = {
									is_core_of = POR
								}							
							}
						}
						add_ideas = POR_civil_war_surrender_debuff
					}					
				}
				else = {
					add_stability = -0.2
				}
				custom_effect_tooltip = POR_potential_civil_war_high_requirement_tt
			}
			else = {
				add_political_power = 120
				add_popularity = {
				    ideology = fascism
				    popularity = 0.05
				}
			}
			custom_effect_tooltip = CHL_skip_one_line_tt	#56
			show_ideas_tooltip = POR_domingos_de_gusmao_araujo	#56
		}
		search_filters = {FOCUS_FILTER_POLITICAL}
	}

	focus = {
		id = POR_camisas_azuis
		available = {
			has_government = fascism
		}
		prerequisite = { focus = POR_ditadura_militar }
		icon = GFX_focus_generic_military_mission
		x = 0
		y = 1

		relative_position_id = POR_ditadura_militar
		cost = 10
		completion_reward = {
			add_ideas = POR_camisas_azuis
		}
		search_filters = {FOCUS_FILTER_WAR_SUPPORT}
	}

	focus = {
		id = POR_join_the_axis

		available = {
			is_in_faction = no
			is_subject = no
			has_government = fascism
			any_other_country = {
				is_major = yes
				has_government = fascism
				is_faction_leader = yes
				NOT = { has_war_with = ROOT }
				has_opinion = {
					target = ROOT
					value > 0
				}					
			}
		}	

		prerequisite = { focus = POR_camisas_azuis }
		mutually_exclusive = { focus = POR_the_fifth_empire }
		icon = GFX_focus_chi_mission_to_germany
		x = -1
		y = 1

		relative_position_id = POR_camisas_azuis
		cost = 10
		completion_reward = {
			if = {
				limit = {
					GER = {
						has_government = fascism
						is_faction_leader = yes
						has_capitulated = no
						NOT = { has_war_with = ROOT }
						exists = yes
					}
					NOT = {
						any_other_country = {
							is_in_faction_with = GER
							has_war_with = ROOT
						}
					}					
				}
				GER = {
					country_event = generic.2
				}
			}
			else = {
				get_best_alliance_match_fascism_effect = yes
				var:best_leader = {
					country_event = generic.2
				}
			}
			remove_ideas = POR_unstable_republic			
		}

		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_research_agreements
		available = {
			is_in_faction_with = GER
		}
		prerequisite = { focus = POR_join_the_axis }
		icon = GFX_goal_generic_scientific_exchange
		x = -1
		y = 1

		relative_position_id = POR_join_the_axis
		cost = 10
		search_filters = {FOCUS_FILTER_RESEARCH}
		completion_reward = {
			GER = { add_to_tech_sharing_group = axis_research }
			add_to_tech_sharing_group = axis_research
		}
	}

	focus = {
		id = POR_the_fifth_empire
		available = {
			has_government = fascism
		}
		prerequisite = { focus = POR_camisas_azuis }
		mutually_exclusive = { focus = POR_join_the_axis }
		icon = GFX_focus_por_the_fifth_empire
		x = 1
		y = 1

		relative_position_id = POR_camisas_azuis
		cost = 10
		search_filters = {FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			add_ideas = POR_the_fifth_empire
			remove_ideas = POR_unstable_republic
			if = {
				limit = { is_in_faction = yes }
				leave_faction = yes
			}
			set_rule = { can_create_factions = yes }
			set_rule = { can_join_factions = no }
			every_other_country = {
				limit = {
					NOT = { is_subject_of = ROOT }
				}
				add_opinion_modifier = {
					target = ROOT
					modifier = POR_the_fifth_empire_has_threatening_ambitions
				}
				send_embargo = ROOT
				custom_effect_tooltip = embargo_relation_tt
			}
			set_cosmetic_tag = POR_empire
			if = {
				limit = {
					has_government = fascism
				}
				add_country_leader_trait = father_of_the_empire
			}			
		}
	}

	focus = {
		id = POR_expand_the_chinese_territories

		select_effect = {
			every_country = {
				limit = {
					OR = {
						controls_state = 592
						controls_state = 594
						controls_state = 325
						controls_state = 613
						controls_state = 622
						controls_state = 604
						controls_state = 615
						controls_state = 611
						controls_state = 328
					}
				}
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		available = {
			729 = {
				state_is_fully_controlled_by_ROOT_or_subject = yes
			}
			r56_script_i_am_sane = yes
			has_army_manpower = {
				size > 249999
			}		
			has_civil_war = no			
		}
		prerequisite = { focus = POR_join_the_axis focus = POR_the_fifth_empire }
		icon = GFX_focus_usa_focus_on_asia
		x = -1
		y = 1

		relative_position_id = POR_the_fifth_empire
		cost = 10
		completion_reward = {
			hidden_effect = {
				592 = {
					owner =  {
						ROOT = {
							create_wargoal = {
							  	target = PREV
								expire = 0
							    type = annex_everything
							}
						}
					}
				}

				594 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				325 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				613 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				622 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				604 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				615 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				611 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}

				328 = {
					owner =  {
						ROOT = {
							#if = {
								#limit = {
									#NOT = { has_wargoal_against = PREV }
								#}
								create_wargoal = {
								  	target = PREV
									expire = 0
								    type = annex_everything
								}
							#}
						}
					}
				}
			}
			custom_effect_tooltip = POR_expand_the_chinese_territories_tt

			hidden_effect = {
				random_country = {
					limit = { controls_state = 592 }
					ROOT = {
						add_ai_strategy = {
							type = prepare_for_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}

	focus = {
		id = POR_deal_with_the_japanese_threat

		will_lead_to_war_with = JAP

		select_effect = {
			add_ai_strategy = {
				type = prepare_for_war
				id = JAP
				value = 100
			}
		}

		available = {
			r56_script_i_am_sane = yes
							
			JAP = {
				exists = yes
				NOT = { is_in_faction_with = ROOT }
				r56_script_target_is_sane = yes
			}
		}
		prerequisite = { focus = POR_the_fifth_empire }
		prerequisite = { focus = POR_recover_the_east_indies }
		icon = GFX_focus_attack_japan
		x = 1
		y = 1

		relative_position_id = POR_the_fifth_empire
		cost = 10
		completion_reward = {
			create_wargoal = {
				target = JAP
				type = annex_everything
				expire = 0
			}

			hidden_effect = {
				add_ai_strategy = {
					type = declare_war
					id = JAP
					value = 100
				}
			}
		}
		search_filters = {  FOCUS_FILTER_MANPOWER }
	}

	focus = {
		id = POR_refuse_the_naval_blockade
		available = {
			has_equipment = {
			  convoy > 150
			}
			ENG = { has_war = yes}
			NOT = {
				is_in_faction_with = ENG
			}
		}

		bypass = {
			ENG = {
				OR = {
					exists = no
					has_capitulated = yes
					has_war_with = ROOT
				}
			}
		}
		prerequisite = { focus = POR_national_syndicalism focus = POR_the_return_of_duarte }

		icon = GFX_goal_generic_navy_anti_submarine
		x = 3
		y = 1

		relative_position_id = POR_national_syndicalism
		cost = 10
		completion_reward = {
			every_other_country = {
				limit = {
					has_war_with = ENG
				}

				country_event = {
					id = lar_portugal_naval_blockade.1
				}
			}
			ENG = {
				country_event = {
					id = lar_portugal_naval_blockade.3
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_anglo_portuguese_alliance
				}
			}
			remove_opinion_modifier = {
					target = ENG
					modifier = POR_anglo_portuguese_alliance
			}
		}
		search_filters = {  FOCUS_FILTER_POLITICAL }
	}

	focus = {
		id = POR_mapa_cor_de_rosa

		select_effect = {
			every_country = {
				limit = {
					OR = {
						controls_state = 770
						controls_state = 545
						controls_state = 771
					}
				}
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		available = {
		}

		bypass = {
			AND = {
				owns_state = 770
				owns_state = 545
				owns_state = 771
			}
		}
		prerequisite = { focus = POR_refuse_the_naval_blockade }
		icon = GFX_focus_por_the_pink_map
		x = 0
		y = 1

		relative_position_id = POR_refuse_the_naval_blockade
		cost = 10
		completion_reward = {
			add_state_claim = 770 #Malawi
			add_state_claim = 545 #Rhodesia
			add_state_claim = 771 #Zambia

			hidden_effect = {
				random_country = {
					limit = {
						OR = {
							controls_state = 770
							controls_state = 545
							controls_state = 771
						}
					}
					ROOT = {
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY FOCUS_FILTER_MANPOWER }
	}

	focus = {
		id = POR_recover_the_east_indies

		available = {
			has_army_manpower = {
				size > 249999
			}		
			has_civil_war = no
			r56_script_i_am_sane = yes				
		}

		bypass = {
			owns_state = 336
			owns_state = 1142
		}
		prerequisite = { focus = POR_mapa_cor_de_rosa }
		icon = GFX_focus_RAJ_seek_help_from_germany
		x = 0
		y = 1

		relative_position_id = POR_mapa_cor_de_rosa
		cost = 10
		completion_reward = {
			add_state_claim = 336 # Singapore
			add_state_claim = 1142 # Dutch Timor

			hidden_effect = {
				random_country = {
					limit = { controls_state = 336 }
					ROOT = {
						add_ai_strategy = {	# Was in select_effect but you dont get a wargoal or anything so theres no reason to prepare this early
							type = prepare_for_war
							id = PREV
							value = 100
						}
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
				random_country = {
					limit = { controls_state = 1142 }
					ROOT = {
						add_ai_strategy = {	# Was in select_effect but you dont get a wargoal or anything so theres no reason to prepare this early
							type = prepare_for_war
							id = PREV
							value = 100
						}
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT }
	}

	focus = {
		id = POR_recover_brazil

		will_lead_to_war_with = BRA

		select_effect = {
			random_country = {
				limit = { controls_state = 500 }
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		available = {
			has_army_manpower = {
				size > 249999
			}		
			has_civil_war = no
			r56_script_i_am_sane = yes				
		}

		bypass = {
			owns_state = 500
		}
		prerequisite = { focus = POR_mapa_cor_de_rosa }

		mutually_exclusive = { focus = POR_the_kingdom_reunited focus = POR_luso_monarchist_cooperation }

		icon = GFX_focus_por_recover_brazil
		x = 1
		y = 2

		relative_position_id = POR_mapa_cor_de_rosa
		cost = 10
		completion_reward = {
			add_state_claim = 500 #Rio

			hidden_effect = {
				random_country = {
					limit = { controls_state = 500 }
					ROOT = {
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_a_royal_wedding
		prerequisite = { focus = POR_estado_novo }

		mutually_exclusive = { focus = POR_support_the_spanish_nationalists focus = POR_strict_neutrality_in_the_spanish_civil_war focus = POR_support_the_spanish_republic }

		icon = GFX_focus_generic_royal_wedding
		x = 13
		y = 0
		
		ai_will_do = {
			factor = 0.2
			modifier = {
				factor = 0
				BRA = {
					is_ai = no 
				}
			}
			modifier = {
				add = 1
				AND = {	
					has_global_flag = rt56_old_school
					BRA = {
						is_ai = yes
					}
				}
			}
		}

		relative_position_id = POR_support_the_spanish_nationalists
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_INDUSTRY}
		completion_reward = {
			hidden_effect = {
				news_event = { id = lar_news.25 days = 3 random_days = 5 }
			}
			add_political_power = 120
			unlock_decision_tooltip = POR_stir_monarchist_sentiment_in_brazil
			unlock_decision_tooltip = POR_stir_monarchist_sentiment_in_portugal
			custom_effect_tooltip = available_political_advisor
			show_ideas_tooltip = POR_joao_de_azevedo_coutinho
			show_ideas_tooltip = POR_joao_francisco_de_barbosa_azevedo
		}
	}

	focus = {
		id = POR_the_return_of_duarte
		prerequisite = { focus = POR_a_royal_wedding }
		icon = GFX_focus_generic_monarchy_1
		x = 0
		y = 2

		relative_position_id = POR_a_royal_wedding
		cost = 10
		completion_reward = {
			set_party_name = {
			    ideology = neutrality
			    long_name = POR_monarchy_party_long
			    name = POR_monarchy_party
			}

			add_popularity = {
			    ideology = neutrality
			    popularity = -0.20
			}

			add_popularity = {
			    ideology = democratic
			    popularity = 0.10
			}

			add_popularity = {
			    ideology = fascism
			    popularity = 0.10
			}

			add_stability = -0.20
		}
		search_filters = { FOCUS_FILTER_STABILITY }
	}

	focus = {
		id = POR_support_a_spanish_monarchy_in_the_war

		available = {
			SPR_scw_in_progress = yes
			country_exists = SPB
			NOT = { has_war_with = SPB }
		}

		bypass = {
			has_global_flag = scw_over
		}

		prerequisite = { focus = POR_the_return_of_duarte }
		icon = GFX_focus_spa_supremacy_of_the_communion
		x = 3
		y = 1

		relative_position_id = POR_the_return_of_duarte
		cost = 10
		completion_reward = {
			SPB = {
				add_opinion_modifier = {
				    target = POR
				    modifier = POR_helped_in_civil_war
				}
				add_manpower = 10000
			}
			add_ideas = POR_volunteers_in_the_war_carlist
			add_manpower = -10000
			hidden_effect = {
				add_equipment_to_stockpile = {
					type = infantry_equipment
					amount = 2000
				}
			}
			send_equipment = {
			    equipment = infantry_equipment
			    amount = 2000
			    target = SPB
			}
			set_rule = { can_send_volunteers = yes }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}

	focus = {
		id = POR_assist_the_requetes
		available = {
			SPR_scw_in_progress = yes
			country_exists = SPB
			NOT = { has_war_with = SPB }
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_support_a_spanish_monarchy_in_the_war }
		icon = GFX_goal_generic_military_deal
		x = 0
		y = 1

		relative_position_id = POR_support_a_spanish_monarchy_in_the_war
		cost = 10
		completion_reward = {
			add_tech_bonus = {
				name = POR_assist_the_requetes
			    bonus = 1.0
			    uses = 1
			    category = mountaineers_tech
			}
			add_doctrine_cost_reduction = {
				name = POR_assist_the_requetes
				cost_reduction = 0.35
			    uses = 1
			    category = air_doctrine
			}
			add_doctrine_cost_reduction = {
				name = POR_assist_the_requetes
			    cost_reduction = 0.35
			    uses = 1
			    category = land_doctrine
			}
			army_experience = 15
			air_experience = 15

			hidden_effect = {
				add_ai_strategy = {
					type = befriend
					id = SPB
					value = 100
				}
				SPB = {
					add_ai_strategy = {
						type = befriend
						id = ROOT
						value = 100
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_RESEARCH }
	}

	focus = {
		id = POR_join_the_carlist_fight

		select_effect = {
			if = {
				limit = {
					country_exists = SPA
					is_neighbor_of = SPA
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPA
					value = 100
				}
			}
			if = {
				limit = {
					country_exists = SPD
					is_neighbor_of = SPD
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPD
					value = 100
				}
			}
			if = {
				limit = {
					country_exists = SPC
					is_neighbor_of = SPC
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = SPC
					value = 100
				}
			}
		}

		available = {
			has_civil_war = no
			SPR_scw_in_progress = yes
			country_exists = SPB
			NOT = { has_war_with = SPB }
			is_subject = no
		}

		bypass = {
			has_global_flag = scw_over
		}
		prerequisite = { focus = POR_assist_the_requetes }
		icon = GFX_focus_spa_no_compromise_on_carlist_ideals
		x = 0
		y = 1

		relative_position_id = POR_assist_the_requetes
		cost = 10
		completion_reward = {
			unlock_decision_tooltip = POR_fight_alongside_the_carlists
			if = {
				limit = { country_exists = SPA }
				SPA = {
					country_event = { id = lar_portugal_spanish_civil_war.3 }
				}
			}
			if = {
				limit = { country_exists = SPD }
				SPD = {
					country_event = { id = lar_portugal_spanish_civil_war.3 }
				}
			}
			if = {
				limit = { country_exists = SPC }
				SPC = {
					country_event = { id = lar_portugal_spanish_civil_war.3 }
				}
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY FOCUS_FILTER_STABILITY }
	}

	focus = {
		id = POR_the_royal_iberian_alliance
		available = {
			is_in_faction = no
			has_country_leader = { #r56 - removed old name = "" references
				character = POR_dom_duarte_nuno
				ruling_only = yes
			}
			has_global_flag = scw_over
			has_completed_focus = POR_restoration_of_the_monarchy
			country_exists = SPB
			NOT = { has_war_with = SPB }
			SPB = { has_completed_focus = SPA_restore_the_monarchy }
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 100
				has_idea = POR_volunteers_in_the_war_carlist
			}
			modifier = {
				factor = 2
				has_opinion = {
					target = SPB
					value > 30
				}
			}
		}
		prerequisite = { focus = POR_join_the_carlist_fight }
		mutually_exclusive = { focus = POR_remember_olivenca }
		icon = GFX_goal_tfv_strengthen_commonwealth_ties
		x = 0
		y = 1

		relative_position_id = POR_join_the_carlist_fight
		cost = 10
		completion_reward = {
			SPB = {
				country_event = { id = lar_portugal_royal_iberian_alliance.1 hours = 6 }
			}
		}
	}

	focus = { #R56 added focus
		id = POR_invite_andorra
		text = ITA_invite_andorra
		available = {
			has_government = neutrality
			country_exists = ADR
			NOT = { has_war_with = ADR }
			ADR = { is_in_faction = no is_subject = no has_government = neutrality }
		}

		allow_branch = {
			has_game_rule = {
				rule = micronation_annexation_status
				option = SHOW_MICRONATIONS
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 2
				has_opinion = {
					target = ADR
					value > 30
				}
			}
		}
		prerequisite = { focus = POR_the_royal_iberian_alliance }
		icon = GFX_focus_generic_befriend_andorra
		x = 1
		y = 1
		search_filters = { FOCUS_FILTER_ALLIANCE }
		relative_position_id = POR_the_royal_iberian_alliance
		cost = 3
		completion_reward = {
			ADR = {
				country_event = { id = generic.5 hours = 6 }
			}
		}
	}

	focus = {
		id = POR_promote_the_monarchist_cause_in_portugal
		prerequisite = { focus = POR_the_return_of_duarte }
		icon = GFX_focus_generic_monarchy_2
		x = 1
		y = 1

		relative_position_id = POR_the_return_of_duarte
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL}
		completion_reward = {
			add_timed_idea = {
			    idea = POR_monarchists_on_the_rise2
			    days = 730
			}
		}
	}

	focus = {
		id = POR_monarchist_uprising_in_brazil
		available = {
			BRA = { is_ai = yes } #RT56 RP
		}

		bypass = {
			OR = {
				NOT = { country_exists = BRA }
				BRA = {
					OR = {
						has_country_leader = { character = BRA_pedro_henrique ruling_only = yes }
						has_capitulated = yes 
					} 	
				}
			}
		}
		prerequisite = { focus = POR_the_return_of_duarte }
		icon = GFX_focus_por_reclaim_crown_jewel
		x = -2
		y = 1

		relative_position_id = POR_the_return_of_duarte
		cost = 10
		completion_reward = {
			if = {
				limit = {
					BRA = {
						is_ai = yes
					}
				}
				BRA = {
					country_event = lar_portugal_promote_monarchist_cause.7
					effect_tooltip = {
						add_timed_idea = {
							idea = POR_monarchists_on_the_rise
							days = 730
						}
						set_party_name = { 
							ideology = neutrality
							long_name = BRA_monarchy_party_long
							name = BRA_monarchy_party
						}
						set_party_name = { 
							ideology = fascism
							long_name = BRA_antimonarchist_coalition_long
							name = BRA_antimonarchist_coalition
						}
						if = {
							limit = {
								OR = {
									has_government = neutrality
									has_government = democratic
									has_government = communism
								} 
							}
							add_popularity = {
								ideology = fascism
								popularity = 0.8
							}
							set_politics = {
								ruling_party = fascism
							}
						}
						hidden_effect = {
							retire_country_leader = yes
						}
	
						BRA_getulio_vargas = {
							remove_country_leader_role = {
								ideology = despotism
							}
							add_country_leader_role = {
								country_leader = {
									expire = "1954.8.24"
									ideology = fascism_ideology
									traits = {
										anti_communist
									}
								}
								promote_leader = yes
							}
						}
						promote_character = BRA_arlindo_veiga_dos_santos
					}
				}
				custom_effect_tooltip = POR_cannot_destabilize_brazil_player_tt
			}
			else = {
				create_wargoal = {
					target = BRA
					type = annex_everything
				}
				if = {
					limit = {
						is_faction_leader = yes
					}
					BRA = {
						country_event = generic.5
					}
				}
				unlock_national_focus = POR_the_empire_of_brazil
			}
		}
	}
	focus = {
		id = POR_the_empire_of_brazil

		select_effect = {
			if = {
				limit = {
					has_war = no
				}
				add_ai_strategy = {
					type = prepare_for_war
					id = BRA
					value = 100
				}
			}
		}

		available = {
			is_subject = no
			if = {
				limit = {
					BRA = {
						has_country_leader = { character = BRA_pedro_henrique ruling_only = yes }
					}					
				}
				has_country_leader = { #r56 - removed old name = "" references
					character = POR_dom_duarte_nuno
					ruling_only = yes
				}
			}			
		}

		bypass = {
			OR = {
				NOT = { country_exists = BRA }
				BRA = { has_capitulated = yes }
				is_in_faction_with = BRA
				BRA = {
					has_country_leader = { character = BRA_pedro_henrique ruling_only = no }
				}
			}
		}
		relative_position_id = POR_monarchist_uprising_in_brazil
		prerequisite = { focus = POR_monarchist_uprising_in_brazil }
		icon = GFX_goal_BRA_monarchy
		x = 0
		y = 1

		cost = 10
		completion_reward = {
			if = {
				limit = {
					BRA = {
						has_country_leader = { character = BRA_pedro_henrique ruling_only = yes }
						is_in_faction = yes
					}

				}
				BRA = {
					FACTION_LEADER = {
						country_event = { id = generic.2 }	
					}
				}
				
				remove_ideas = POR_unstable_monarchy

			}
			if = {
				limit = {
					BRA = {
						has_country_leader = { character = BRA_pedro_henrique ruling_only = yes }
						is_in_faction = no
					}
				}
				set_rule = { can_create_factions = yes }
				IF = {
					limit = {
						has_dlc = "No Compromise, No Surrender"
					}
					set_rule = { can_create_factions = yes }
					create_faction_from_template = {
						template = faction_template_POR_lisbon_treaty
						name = POR_lisbon_pact
					}
					add_faction_initiative = 1
				}
				ELSE = {
					set_rule = { can_create_factions = yes }
					create_faction = POR_lisbon_pact
				}

				BRA = {
					country_event = { id = generic.5 }
					add_ai_strategy = {
						type = alliance
						id = "POR"
						value = 200
					}						
				}				
				remove_ideas = POR_unstable_monarchy

			}
			else = {
				if = {
					limit = {
						BRA = {
							OR = {
								has_country_flag = POR_brazil_supports_fascist_coalition_flag
								AND = {
									NOT = { has_government = neutrality }
									OR = {
										has_stability < 0.5
										neutrality < 0.7
									}
								}
							}
						}
					}
					BRA = { country_event = lar_portugal_promote_monarchist_cause.3 }
				}
				else = {
					BRA = { country_event = lar_portugal_promote_monarchist_cause.4 }
				}
				custom_effect_tooltip = POR_the_empire_of_brazil_potential_civil_war_tt
	
				hidden_effect = {
					every_country = {
						limit = {
							original_tag = BRA
							has_government = neutrality
						}
						add_ai_strategy = {
							type = befriend
							id = ROOT
							value = 100
						}
						ROOT = {
							add_ai_strategy = {
								type = befriend
								id = PREV
								value = 100
							}
						}
					}
				}
			}			
		}
	}

	focus = {
		id = POR_restoration_of_the_monarchy
		available = {
			has_government = neutrality
		}
		prerequisite = { focus = POR_promote_the_monarchist_cause_in_portugal }
		icon = GFX_focus_rom_royal_dictatorship
		x = 0
		y = 1

		relative_position_id = POR_promote_the_monarchist_cause_in_portugal
		cost = 10
		completion_reward = {
			remove_ideas = POR_estado_novo
			swap_ideas = {
				remove_idea = POR_unstable_republic
				add_idea = POR_unstable_monarchy
			}
			if = { #Low Stability triggers a Civil War
				limit = {
					has_stability < 0.4
					is_ai = no
				}
				set_temp_variable = { POR_monarchist_cw_opposition = party_popularity@fascism }
				add_to_temp_variable = { POR_monarchist_cw_opposition = party_popularity@communism }
				add_to_temp_variable = { POR_monarchist_cw_opposition = party_popularity@democratic }
				start_civil_war = {
					ideology = fascism
					size = POR_monarchist_cw_opposition
					capital = 180
					states = { 181 }
				}
				if = {
					limit = {
						OR = {
							540 = {
								is_core_of = POR
							}
							544 = {
								is_core_of = POR
							}							
						}
					}
					add_ideas = POR_civil_war_surrender_debuff
				}				
			}
			#Civil war suddenly easier for the AI, should allow a restoration as currently they fail every single time.
			if = { #Low Stability triggers a Civil War
				limit = {
					has_stability < 0.4
					is_ai = yes
				}
				set_temp_variable = { POR_monarchist_cw_opposition = party_popularity@fascism }
				add_to_temp_variable = { POR_monarchist_cw_opposition = party_popularity@communism }
				#add_to_temp_variable = { POR_monarchist_cw_opposition = party_popularity@democratic }
				start_civil_war = {
					ideology = fascism
					size = POR_monarchist_cw_opposition
					capital = 180
					states = { 181 }
				}
				if = {
					limit = {
						OR = {
							540 = {
								is_core_of = POR
							}
							544 = {
								is_core_of = POR
							}							
						}
					}
					add_ideas = POR_civil_war_surrender_debuff
				}				
			}			
			else = {
				add_stability = -0.1
			}
			set_country_flag = KOP_kingdom_of_portugal_flag
			set_cosmetic_tag = KOP_kingdom_portugal
			add_country_leader_role = {	#56 - Former create_country_leader
				character = POR_dom_duarte_nuno
				promote_leader = yes
				country_leader = {
					id = -1
					desc = POR_king_duarte_nuno_desc
					expire = "1976.12.24"
					ideology = constitutional_monarchy
					traits = { constitutional_monarch_minor }
				}
			}
			show_unit_leaders_tooltip = POR_joao_de_almeida	#56 - Former create_unit_leader 
			custom_effect_tooltip = POR_potential_civil_war_low_requirement_tt
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_INDUSTRY FOCUS_FILTER_STABILITY }
	}
	
	focus = {  #RT56 RP
		id = POR_rt56rp_legitimise_the_monarchy
		prerequisite = { focus = POR_restoration_of_the_monarchy }

		icon = GFX_focus_generic_monarchy_1
		x = 0
		y = 1

		relative_position_id = POR_restoration_of_the_monarchy
		
		cost = 2.9
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_INDUSTRY FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT FOCUS_FILTER_ANNEXATION}
		completion_reward = {
			remove_ideas = POR_unstable_monarchy
			set_rule = { can_create_factions = yes }
		}
	}

	focus = {
		id = POR_the_kingdom_reunited
		available = {
			has_government = neutrality
			OR = {
				AND = {
					country_exists = BRA
					BRA = {
						has_government = neutrality
						has_civil_war = no
						NOT = { has_war_with = ROOT }
					}
					NOT = {
						any_enemy_country = {
							is_in_faction_with = BRA
						}
					}
				}
				AND = {
					NOT = { country_exists = BRA }
					owns_state = 500
				}
			}
		}
		prerequisite = { focus = POR_restoration_of_the_monarchy }
		prerequisite = { focus = POR_the_empire_of_brazil }

		mutually_exclusive = { focus = POR_recover_brazil focus = POR_luso_monarchist_cooperation }

		icon = GFX_focus_por_the_kingdom_reunited
		x = -1
		y = 2

		relative_position_id = POR_the_empire_of_brazil
		cost = 10
		search_filters = {FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_INDUSTRY FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT FOCUS_FILTER_ANNEXATION}
		completion_reward = {
			#remove_ideas = POR_unstable_monarchy #RT56 RP - moved to new focus
			add_ideas = POR_the_portuguese_empire
			if = {
				limit = {
					country_exists = BRA
				}
				BRA = {
					country_event = { id = lar_portugal_promote_monarchist_cause.2 hours = 6 }
				}
			}
			#set_rule = { can_create_factions = yes } #RT56 RP - moved to new focus
		}
	}
	focus = {
		id = POR_luso_monarchist_cooperation
		available = {
			is_in_faction_with = BRA
		}

		ai_will_do = {
			factor = 5
			modifier = {
				factor = 50
				has_idea = POR_unstable_monarchy
			}

		}

		prerequisite = { focus = POR_restoration_of_the_monarchy }
		prerequisite = { focus = POR_the_empire_of_brazil }
		mutually_exclusive = { focus = POR_the_kingdom_reunited focus = POR_recover_brazil }
		icon = GFX_goal_tfv_strengthen_commonwealth_ties
		x = -2
		y = 2

		relative_position_id = POR_restoration_of_the_monarchy
		cost = 10
		completion_reward = {
			#if = { #RT56 RP - moved to new focus
			#	limit = {
			#		has_idea = POR_unstable_monarchy
			#	}
			#	remove_ideas = POR_unstable_monarchy
			#}
			add_stability = 0.05
			add_ideas = POR_luso_monarchist_cooperation
			BRA = {
				add_stability = 0.05
				add_ideas = POR_luso_monarchist_cooperation
			}
			
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT }
	}
	focus = {
		id = POR_luso_imperial_and_royal_armies
		available = {
			is_in_faction_with = BRA
			NOT = {
				has_idea = POR_unreliable_army
			}
		}

		ai_will_do = {
			factor = 5

		}

		prerequisite = { focus = POR_luso_monarchist_cooperation }
		
		icon = GFX_focus_generic_military_academy
		x = 0
		y = 1

		relative_position_id = POR_luso_monarchist_cooperation
		cost = 10
		completion_reward = {
			add_ideas = POR_luso_monarchist_military_cooperation
			every_army_leader = {
				add_planning = 1
			}
			every_navy_leader = {
				add_coordination = 1
			}
			BRA = {
				add_ideas = POR_luso_monarchist_military_cooperation
				every_army_leader = {
					add_planning = 1
				}
				every_navy_leader = {
					add_coordination = 1
				}				
			}

		}
		search_filters = { FOCUS_FILTER_MANPOWER FOCUS_FILTER_WAR_SUPPORT }
	}	
	focus = {
		id = POR_remember_olivenca
		available = {
		}

		ai_will_do = {
			factor = 1
			modifier = {
				factor = 10
				has_opinion = {
					target = SPB
					value < 0
				}
			}
			modifier = {
				factor = 2
				has_government = neutrality
				SPB = { NOT = { has_government = neutrality } }
			}
		}

		bypass = {
			owns_state = 171
			owns_state = 290
		}
		prerequisite = { focus = POR_rt56rp_legitimise_the_monarchy } #RT56 RP
		mutually_exclusive = { focus = POR_the_royal_iberian_alliance }
		icon = GFX_focus_por_remember_olivenca
		x = 0
		y = 2

		relative_position_id = POR_restoration_of_the_monarchy
		cost = 10
		completion_reward = {
			add_state_claim = 171
			add_state_claim = 290

			hidden_effect = {
				random_country = {
					limit = { controls_state = 171 }
					ROOT = {
						add_ai_strategy = {
							type = prepare_for_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_deal_with_fascism

		select_effect = {
			random_country = {
				limit = {
					has_government = fascism
					NOT = { is_in_faction_with = ROOT }
					OR = {
						is_major = yes
						is_neighbor_of = ROOT
					}
				}
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		available = {
			any_country = {
				has_government = fascism
				NOT = { is_in_faction_with = ROOT }
				OR = {
					is_major = yes
					is_neighbor_of = ROOT
				}
			}
			r56_script_i_am_sane = yes
			has_army_manpower = {
				size > 249999
			}		
			has_civil_war = no			
		}

		prerequisite = { focus = POR_remember_olivenca focus = POR_the_royal_iberian_alliance }
		icon = GFX_focus_attack_germany
		x = 1
		y = 1

		relative_position_id = POR_remember_olivenca

		cost = 10
		completion_reward = {
			hidden_effect = {
				every_country = {
					limit = {
						has_government = fascism
						NOT = { is_in_faction_with = ROOT }
						OR = {
							is_major = yes
							is_neighbor_of = ROOT
						}
					}
					ROOT = {
						create_wargoal = {
							target = PREV
							type = annex_everything
							expire = 0
						}
					}
				}
			}
			custom_effect_tooltip = POR_deal_with_fascism_tt
			every_country = { #TOOLTIP Support
				limit = {
					has_government = fascism
					NOT = { is_in_faction_with = ROOT }
					OR = {
						is_major = yes
						is_neighbor_of = ROOT
					}
				}
			}

			hidden_effect = {
				random_country = {
					limit = {
						has_government = fascism
						NOT = { is_in_faction_with = ROOT }
						OR = {
							is_major = yes
							is_neighbor_of = ROOT
						}
					}
					ROOT = {
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_latin_america

		will_lead_to_war_with = PAR
		will_lead_to_war_with = URG
		will_lead_to_war_with = ARG

		select_effect = {
			random_country = {
				limit = { controls_state = 300 }
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
			random_country = {
				limit = { controls_state = 301 }
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
			random_country = {
				limit = { controls_state = 510 }
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		available = {
			r56_script_i_am_sane = yes
			PAR = {
				r56_script_target_is_sane = yes
			}
			URG = {
				r56_script_target_is_sane = yes
			}
			ARG = {
				r56_script_target_is_sane = yes
			}						

		}


		bypass = {
			OR = {
				AND = {
					owns_state = 300
					owns_state = 1060
					owns_state = 1059
					owns_state = 301
					owns_state = 510
				}
				BRA = {
					is_in_faction_with = ROOT
					owns_state = 300
					owns_state = 1060
					owns_state = 1059
					owns_state = 301
					owns_state = 510					
				}
			}

		}
		prerequisite = { focus = POR_the_kingdom_reunited focus = POR_recover_brazil }

		icon = GFX_focus_por_recover_latin_america
		x = -1
		y = 1

		relative_position_id = POR_the_kingdom_reunited
		cost = 10
		completion_reward = {
			if = {
				limit = {
					BRA = {
						is_in_faction_with = ROOT
					}
				}
				BRA = {
					add_state_claim = 300
					add_state_claim = 1060
					add_state_claim = 1059
					add_state_claim = 301
					add_state_claim = 510
				}

			}
			else = {
				add_state_claim = 300
				add_state_claim = 1060
				add_state_claim = 1059
				add_state_claim = 301
				add_state_claim = 510
			}
			
			#As much as it would be cool to see them press their claim it's a receipe for disaster.
			#hidden_effect = {
			#	random_country = {
			#		limit = { controls_state = 300 }
			#		ROOT = {
			#			add_ai_strategy = {
			#				type = declare_war
			#				id = PREV
			#				value = 100
			#			}
			#		}
			#	}
			#	random_country = {
			#		limit = { controls_state = 301 }
			#		ROOT = {
			#			add_ai_strategy = {
			#				type = declare_war
			#				id = PREV
			#				value = 100
			#			}
			#		}
			#	}
			#	random_country = {
			#		limit = { controls_state = 510 }
			#		ROOT = {
			#			add_ai_strategy = {
			#				type = declare_war
			#				id = PREV
			#				value = 100
			#			}
			#		}
			#	}
			#}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}

	focus = {
		id = POR_the_communist_threat

		select_effect = {
			every_country = {
				limit = {
					has_government = communism
					NOT = { is_in_faction_with = ROOT }
					OR = {
						is_major = yes
						is_neighbor_of = ROOT
					}
				}
				ROOT = {
					add_ai_strategy = {
						type = prepare_for_war
						id = PREV
						value = 100
					}
				}
			}
		}

		available = {
			r56_script_i_am_sane = yes
			any_country = {
				has_government = communism
				NOT = { is_in_faction_with = ROOT }
				OR = {
					is_major = yes
					is_neighbor_of = ROOT
				}
			}
			has_army_manpower = {
				size > 249999
			}		
			has_civil_war = no				
		}
		prerequisite = { focus = POR_latin_america focus = POR_proudly_alone }

		icon = GFX_focus_ger_great_red_menace
		x = -8
		y = 1

		relative_position_id = POR_latin_america
		cost = 10
		completion_reward = {
			hidden_effect = {
				every_country = {
					limit = {
						has_government = communism
						NOT = { is_in_faction_with = ROOT }
						OR = {
							is_major = yes
							is_neighbor_of = ROOT
						}
					}
					if = {
						limit = {
							ROOT = { has_cosmetic_tag = KPB_kingdom_portugal_and_brazil } #Non-Aligned Duarte Nuno (Monarchist)
						}
						ROOT = {
							create_wargoal = {
								target = PREV
								type = puppet_wargoal_focus
								expire = 0
							}
						}
					}
					else_if = {
						limit = {
							ROOT = { has_government = neutrality }  #Non-Aligned Salazar (Even in Monarchist branch if Duarte Nuno is not ruler yet)
						}
							ROOT = {
								create_wargoal = {
									target = PREV
									type = topple_government
									expire = 0
								}
							}
					}
					else = { #Fascist Preto
						ROOT = {
							create_wargoal = {
								target = PREV
								type = annex_everything
								expire = 0
							}
						}
					}
				}
			}
			custom_effect_tooltip = POR_the_communist_threat_tt
			every_country = {
				limit = {
					has_government = communism
					NOT = { is_in_faction_with = ROOT }
					OR = {
						is_major = yes
						is_neighbor_of = ROOT
					}
				}
			}

			hidden_effect = {
				every_country = {
					limit = {
						has_government = communism
						NOT = { is_in_faction_with = ROOT }
						OR = {
							is_major = yes
							is_neighbor_of = ROOT
						}
					}
					ROOT = {
						add_ai_strategy = {
							type = declare_war
							id = PREV
							value = 100
						}
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}
}
