

        <script defer fetchpriority="low" src="{{scripts_dir}}/cdn.min.js?v={{version}}"></script>
    
        {% if wp_head_footer.wp_footer  is not empty %}
        {{ wp_head_footer.wp_footer }}
        {% endif %}




            </div>{# boxed-container #}


            </div>
            
        </main> {# main-container #}
        <footer class="bg-[#222222] min-h-64 flex items-center justify-center" style="background-image: linear-gradient(to bottom, #292929 0%, #0a0a0a 100%)">
                    
            {% if not ((post.meta.tipologia.slug and post.meta.tipologia.slug == "offerte") or (post.tags and ("offerte" in post.tags or "offerta" in post.tags))) %}
            {{ adv.FOOTER }}
            {% endif %}


            <div class="w-full">

                <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 items-center justify-center lg:justify-between boxed">
                    
                    {% include "templates/components/logo/logo_footer.twig" %}
                    
                    {% include "templates/components/common/social-footer.twig" %}
                </div>
 
        
                <div class="text-[#868686] text-sm text-center mt-8 mb-4">
                    2008 - {{ "now"|date('Y') }} HDnetwork srl (parte del gruppo <a class=" font-medium hover:underline" target="_blank" href="https://www.blazemedia.it">BlazeMedia</a>) - P.IVA 06183350484
                </div>



                <nav class="footer__main__nav ">
                    <ul class="text-sm text-center mb-8">
                        {% for item in menus.about %}
                            <li class="inline-block mr-4 last-of-type:mr-0 mb-2 text-[#868686] px-4 lg:px-0">                                
                                <a class="nav-link" href="{{ item.url }}">{{ item.title }}</a>
                            </li>
                        {% endfor %} 
                    </ul>
                </nav>


            </div>

            {% if type starts with 'single_' %}
                <link
                    fetchpriority="low"
                    rel="preload"
                    href="{{styles_dir}}/styles/format_styles.css?ver={{version}}"
                    as="style"
                    onload="this.onload=null;this.rel='stylesheet'"
                />
                <noscript>
                    <link rel="stylesheet" type="text/css" href="{{styles_dir}}/styles/format_styles.css?ver={{version}}" />
                </noscript>
            {% endif %}


            <script>
                document.addEventListener('alpine:init', () => {
                  Alpine.data('timeAgoComponent', (timestamp) => ({
                    time: '', // Variabile che contiene il testo del tempo relativo
                    timestamp, // Il timestamp passato alla funzione
              
                    // Funzione che calcola il tempo relativo
                    timeAgo() {
                      if (this.timestamp === null || this.timestamp === 'null' || this.timestamp === undefined) {
                        return ''; // Messaggio quando non esiste il timestamp
                      }
              
                      const now = Math.floor(Date.now() / 1000);
                      const diff = now - this.timestamp; // differenza in secondi
                      const minutes = Math.floor(diff / 60);
                      const hours = Math.floor(minutes / 60);
                      const days = Math.floor(hours / 24);
              
                      if (minutes < 1) return 'poco fa';
                      if (minutes < 2) return 'un minuto fa';
                      if (minutes < 3) return '2 minuti fa';
                      if (minutes < 60) return `${minutes} minuti fa`;
                      if (hours < 2) return `un'ora fa`;
                      if (hours < 24) return `${hours} ore fa`;
                      if (days === 1) return 'ieri';
                      if (days <= 2) return `${days} giorni fa`;
                      return this.formatDate(new Date(this.timestamp * 1000));
                    },

                    // Funzione per formattare la data come "giorno mese"
                    formatDate(date) {
                        const options = { day: 'numeric', month: 'long' };
                        const currentYear = new Date().getFullYear();
                        if (date.getFullYear() !== currentYear) {
                            options.year = 'numeric'; // Include the year if different from the current year
                        }
                        return date.toLocaleDateString('it-IT', options); // Formattazione in italiano
                    },
              
                    // Funzione chiamata all'inizializzazione per aggiornare il testo relativo
                    updateTime() {
                      this.time = this.timeAgo();
                    }
                  }));
                });
              </script>

        </footer>
    </body>
</html>
