FR 1307 then FR 394 at Madrid
Napoli → Madrid → Ibiza
Timetable, Madrid time
12:55FR 1307 from Napoli at the gate
06:40FR 394 to Ibiza leaves the gate
17 h 45 apart on the timetable, overnight
FR 394 leaves 17 h 45 after FR 1307 arrives on the timetable: more than half a day, so not a connection we count.