/* =============================================
   TESSERACTS – Foglio di stile principale
   =============================================
   Colori principali:
     - Nero:        #0a0a0a, #111111
     - Viola neon:  #8a2be2, #a855f7, #7e22ce
   Font:
     - Orbitron (titoli)
     - Rajdhani (testo)
   ============================================= */

/* ---------- Reset e base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: #0a0a0a;
    color: #e0e0e0;
    font-family: 'Rajdhani', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    /* Sfondo con leggero gradiente radiale viola */
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a0a 70%);
}

/* ---------- Navigazione ---------- */

/* Contenitore fisso in alto a destra */
.nav-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
}

/* === Icona Hamburger === */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: rgba(17, 17, 17, 0.8);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.hamburger:hover {
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

/* Le tre linee dell'hamburger */
.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #a855f7;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Animazione apertura: la linea centrale scompare,
   le altre due ruotano a formare una X */
.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* === Menu a tendina === */
.dropdown-menu {
    position: absolute;
    top: 55px;
    right: 0;
    min-width: 240px;
    background: rgba(17, 17, 17, 0.92);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 0 20px rgba(168, 85, 247, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.5);
    /* Nascosto di default con animazione */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Stato aperto */
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.dropdown-menu ul {
    list-style: none;
    padding: 0.5rem 0;
}

.dropdown-menu li {
    border-bottom: 1px solid rgba(168, 85, 247, 0.1);
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu a {
    display: block;
    padding: 0.85rem 1.5rem;
    color: #d4d4d4;
    text-decoration: none;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
}

.dropdown-menu a:hover {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.08);
    padding-left: 1.8rem;
}

/* ---------- Contenuto principale ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    width: 100%;
}

/* === Titolo "Tesseracts" === */
.title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(3rem, 10vw, 7rem);
    color: #a855f7;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    /* Effetto glow pulsante */
    text-shadow:
        0 0 10px rgba(168, 85, 247, 0.6),
        0 0 30px rgba(168, 85, 247, 0.4),
        0 0 60px rgba(168, 85, 247, 0.2),
        0 0 100px rgba(138, 43, 226, 0.15);
    animation: titleGlow 3s ease-in-out infinite alternate;
    margin-bottom: 0.3rem;
}

/* Animazione pulsazione del glow */
@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 10px rgba(168, 85, 247, 0.5),
            0 0 30px rgba(168, 85, 247, 0.3),
            0 0 60px rgba(168, 85, 247, 0.15);
        filter: brightness(1);
    }
    100% {
        text-shadow:
            0 0 15px rgba(168, 85, 247, 0.8),
            0 0 40px rgba(168, 85, 247, 0.5),
            0 0 80px rgba(168, 85, 247, 0.3),
            0 0 120px rgba(138, 43, 226, 0.2);
        filter: brightness(1.15);
    }
}

/* Sottotitolo */
.subtitle {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    font-weight: 300;
    color: rgba(168, 85, 247, 0.6);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

/* === Contenitore Canvas Three.js === */
.canvas-container {
    width: 100%;
    max-width: 600px;
    height: 400px;
    position: relative;
}

.canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ---------- Footer ---------- */
.footer {
    width: 100%;
    text-align: center;
    padding: 1.5rem;
}

/*
   Link "Accesso Famiglia"
   Punta a family.tesseracts.ai, ospitato in un
   container Docker separato con autenticazione.
*/
.family-link {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    color: rgba(168, 85, 247, 0.4);
    text-decoration: none;
    letter-spacing: 0.1em;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.family-link:hover {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.08);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

/* ---------- Responsive ---------- */

/* Tablet */
@media (max-width: 768px) {
    .canvas-container {
        height: 300px;
        max-width: 90%;
    }

    .nav-container {
        top: 1rem;
        right: 1rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .canvas-container {
        height: 250px;
    }

    .dropdown-menu {
        min-width: 200px;
        right: -0.5rem;
    }

    .subtitle {
        letter-spacing: 0.15em;
    }
}
