/* Arka Web - Stili Principali */

/* Font Family */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
}

/* Reset globale per prevenire overflow */
* {
    box-sizing: border-box;
}

/* Stili per le bandierine lingua */
.language-flag {
    display: inline-block;
    transition: all 0.3s ease;
}

.language-flag img {
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.language-flag:hover img {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.language-flag.opacity-50:hover img {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    position: relative;
}

/* Container responsive senza overflow forzato */
.container {
    max-width: 100%;
}

/* Gradient animato per hero */
.gradient-animation {
    background: linear-gradient(-45deg, #1e3a8a, #dc2626, #1e3a8a, #dc2626);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Parallax */
.parallax {
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Three.js canvas */
#three-canvas, #cta-canvas {
    pointer-events: none;
}

#interactive-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Sticky header shadow */
.header-scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Card hover effect */
.service-card {
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* 3D Flip Cards */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
    height: 500px;
    max-width: 100%;
    /* Rimuovo overflow hidden per permettere il flip completo */
    /* overflow: hidden; */
    /* Aggiungo padding per dare spazio al flip */
    padding: 20px 0;
    margin: -20px 0;
}

/* iPad landscape specific - aumenta altezza */
@media (min-width: 1024px) and (max-width: 1366px) {
    .flip-card {
        height: 575px;
    }
}

/* Stile per i link CTA nelle card */
.flip-card a {
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    /*margin-top: 0.5rem;*/
}

.flip-card a:hover {
    transform: translateX(5px);
}

/* Fix per Chrome mobile - logo */
@supports (-webkit-appearance: none) {
    .brand img {
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        max-width: calc(100% - 10px);
    }
}

/* Tablet specific styles */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Altezza fissa per tutte le card */
    .flip-card {
        height: 680px;
        margin-bottom: 2rem;
    }

    .flip-card-front, .flip-card-back {
        font-size: 0.9rem;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .flip-card h3 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .flip-card ul {
        font-size: 0.85rem;
        flex-grow: 1;
    }

    .flip-card p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* Link CTA sempre in fondo */
    .flip-card a {
        margin-top: auto;
        padding-top: 1rem;
    }

    /* Assicura spazio sufficiente per la sezione */
    #servizi {
        overflow: visible;
        padding-bottom: 4rem;
    }

    #servizi .grid {
        /*margin-bottom: 2rem;*/
    }
}

/* Responsive mobile - Regole unificate per max-width: 768px */
@media (max-width: 768px) {
    .flip-card {
        height: auto;
        min-height: 450px; /* Unisco min-height dal secondo blocco */
        padding: 0;
        margin: 0 0 30px 0;
        position: relative;
        perspective: none;
    }

    /* Disabilita il flip su mobile */
    .flip-card:hover .flip-card-inner {
        transform: none;
    }

    .flip-card-inner {
        position: relative;
        width: 100%;
        height: auto;
        transform: none !important;
        transition: none;
    }

    .flip-card-front {
        position: relative;
        padding: 1.5rem;
        padding-bottom: 2rem;
        height: auto;
        width: 100%;
        display: block;
        backface-visibility: visible;
        margin-bottom: 1rem;
        background-color: #f9fafb;
        border-radius: 0.5rem;
    }

    .flip-card-back {
        position: relative;
        transform: none;
        padding: 1.5rem;
        height: auto;
        width: 100%;
        display: block;
        backface-visibility: visible;
        text-align: center;
    }

    /* Riduco font size su mobile */
    .flip-card h3 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .flip-card-back h3 {
        font-size: 1.75rem;
    }

    .flip-card-back p {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .flip-card p {
        margin-bottom: 0.75rem;
    }

    .flip-card ul {
        margin-bottom: 1rem;
    }

    /* Fix per il contenitore grid su mobile */
    #servizi .grid {
        overflow: visible;
        padding: 0 10px;
        gap: 30px;
        position: relative;
    }

    /* Nascondi le animazioni di flip iniziali su mobile */
    .initial-flip-1, .initial-flip-2, .initial-flip-3 {
        animation: none !important;
    }

    /* Regole aggiuntive per mobile (precedentemente nel secondo blocco) */
    .gradient-animation {
        background-size: 600% 600%;
    }

    /* Previeni overflow orizzontale */
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
        max-width: 100vw;
    }

    /* Fix container e sezioni su mobile */
    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    section {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Three.js canvas non deve causare overflow */
    #three-canvas, #cta-canvas {
        max-width: 100vw;
        width: 100% !important;
        left: 0;
        right: 0;
    }

    /* Fix mobile menu */
    #mobile-menu {
        max-width: 100vw;
        right: 0;
        position: fixed !important;
        top: 0 !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    /* Fix text overflow */
    h1, h2, h3, h4, h5, h6, p {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Fix buttons */
    .hero-buttons a {
        max-width: 100%;
        white-space: normal;
    }

    /* Fix per Chrome SVG bug */
    .brand {
        overflow: visible;
        flex-shrink: 0;
    }

    .logo-img {
        width: auto !important;
        height: 64px !important;
        max-width: none !important;
        display: block;
        overflow: visible !important;
    }
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: left;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.flip-card-front {
    background-color: #f9fafb;
}

.flip-card-back {
    background: linear-gradient(135deg, #1e3a8a 0%, #dc2626 100%);
    color: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Contenitore servizi con overflow visibile per le flip cards */
#servizi .grid {
    overflow: visible;
}

/* Animazione iniziale per mostrare il retro */
@keyframes initial-flip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(0deg); }
}

.flip-card-inner.initial-flip-1 {
    animation: initial-flip 2s ease-in-out 0.5s;
}

.flip-card-inner.initial-flip-2 {
    animation: initial-flip 2s ease-in-out 0.8s;
}

.flip-card-inner.initial-flip-3 {
    animation: initial-flip 2s ease-in-out 1.1s;
}

/* Mobile menu styles */
#mobile-menu {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    background-color: white !important;
    z-index: 9999 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

#mobile-menu.menu-open {
    transform: translateX(0);
}

/* Overlay per menu mobile */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Email protection - nasconde lo span vuoto prima del caricamento JS */
.email-protected:empty::after {
    content: "Caricamento...";
    color: #9ca3af;
    font-style: italic;
}

/* Rimosso - accorpato con l'altro @media (max-width: 768px) più sopra */

/* Media query per dispositivi molto piccoli */
@media (max-width: 375px) {
    /* Riduci ulteriormente i font size */
    h1 {
        font-size: 1.75rem !important;
        line-height: 2.25rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }

    /* Padding ridotto */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Bottoni più piccoli */
    .hero-buttons a {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }

    /* Flip cards su schermi molto piccoli */
    .flip-card {
        margin-bottom: 25px;
    }

    .flip-card-front, .flip-card-back {
        padding: 1.25rem;
    }

    .flip-card ul {
        font-size: 0.875rem;
    }

    #servizi .grid {
        gap: 25px;
    }

    /* Mantieni dimensioni logo su schermi piccoli */
    .logo-img {
        height: 56px !important;
    }
}
/* Clearfix */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Waves animation styles */
.waves-container {
    width: 100%;
    height: 150px;
}

.waves {
    position: absolute;
    width: 100%;
    height: 100%;
    bottom: 0;
}

/* Animazioni onde - mare più mosso */
@keyframes wave-motion-1 {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(-25px) translateY(-30px);
    }
    50% {
        transform: translateX(-50px) translateY(25px);
    }
    75% {
        transform: translateX(-25px) translateY(-20px);
    }
}

@keyframes wave-motion-2 {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    33% {
        transform: translateX(30px) translateY(-35px);
    }
    66% {
        transform: translateX(-30px) translateY(30px);
    }
}

@keyframes wave-motion-3 {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    50% {
        transform: translateX(40px) translateY(-25px);
    }
}

.waves-container svg {
    width: 200%;
    position: relative;
    left: -50%;
}

.wave-1 {
    animation: wave-motion-1 8s ease-in-out infinite;
    transform-origin: center;
}

.wave-2 {
    animation: wave-motion-2 6s ease-in-out infinite;
    transform-origin: center;
}

.wave-3 {
    animation: wave-motion-3 10s ease-in-out infinite;
    transform-origin: center;
}

/* Lighthouse decoration styles */
.lighthouse-decoration {
    position: relative;
    height: 0;
}

/* Effetto 3D per il fascio del faro */
.lighthouse-beam-base {
    transform-style: preserve-3d;
}

.lighthouse-beam-3d {
    transform-style: preserve-3d;
    transform-origin: 200px 145px;
}

/* Migliora contrasto form su sfondo */
#contatti form {
    background-color: transparent;
    backdrop-filter: none;
    box-shadow: none;
    border: none;
}

/* Box info contatti */
#contatti .grid > div:first-child {
    background-color: transparent;
    backdrop-filter: none;
    padding: 2rem;
    border-radius: 0;
    box-shadow: none;
}

/* Migliora leggibilità testi su sfondo */
#contatti h2, #contatti h3 {
    color: #111827;
}

#contatti p, #contatti span, #contatti label {
    color: #374151;
}

/* Input del form con trasparenza */
#contatti input, #contatti textarea, #contatti select {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(209, 213, 219, 0.5);
}

#contatti input:focus, #contatti textarea:focus, #contatti select:focus {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(220, 38, 38, 0.5);
}
