/* === GLOBAL VARIABLES === */
:root {
  --bg: #0d1117;       
  --text: #e6edf3;     
  --accent: #00d400;   
  --nav-bg: #161b22;   
  --border: rgba(255, 255, 255, 0.08);
}

/* === RESET & BASE === */
* {
  box-sizing: border-box; /* FONDAMENTALE per il responsive */
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  overflow-y: auto;
}

/* === NAVIGATION BAR === */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  gap: 1rem;
}

/* NUOVO: Nascondi il tasto hamburger su desktop */
.mobile-toggle {
  display: none;
}

/* Container dei bottoni */
.top-nav nav {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  padding: 3px;
  border-radius: 8px;
  flex-wrap: nowrap; 
}

.top-nav nav a {
  color: var(--text);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.top-nav nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

.top-nav nav a.active {
  background: rgba(0, 212, 0, 0.15);
  color: var(--accent);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.top-nav nav a i {
  font-style: normal;
  font-weight: 800;
  margin-right: 2px;
}

/* === SOCIAL ICONS === */
.social-icons {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-shrink: 0;
}

.social-icons img {
  width: 22px;
  height: 22px;
  opacity: 0.7;
  filter: grayscale(100%);
  transition: all 0.2s ease;
}

.social-icons a:hover img {
  opacity: 1;
  filter: none;
  transform: scale(1.1);
}

/* === MAIN LAYOUT WRAPPER === */
main.content {
  padding-top: 4rem;    
  padding-bottom: 3rem;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* === FOOTER === */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: #8b949e;
  z-index: 1500;
}

.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* === RESPONSIVE (MOBILE - MENU A TENDINA) === */
@media (max-width: 768px) {
  
  /* 1. Reset della navbar: torna orizzontale e compatta */
  .top-nav {
    flex-direction: row; /* Importante: icone e hamburger sulla stessa riga */
    height: 3.5rem;      /* Altezza standard */
    padding: 0 1rem;
    align-items: center;
  }

  /* 2. Mostra e stila il tasto Hamburger */
  .mobile-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px; height: 30px;
    z-index: 2001; /* Sopra a tutto */
  }

  .mobile-toggle span {
    display: block; width: 100%; height: 2px;
    background: #fff; border-radius: 2px; transition: all 0.3s;
  }

  /* Animazione Hamburger -> X quando ha la classe .open */
  .mobile-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .mobile-toggle.open span:nth-child(2) { opacity: 0; }
  .mobile-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

  /* 3. Il Menu diventa una tendina a scomparsa */
  .top-nav nav {
    position: fixed;
    top: 3.5rem; /* Subito sotto la header */
    left: 0; width: 100%;
    flex-direction: column;
    align-items: center;
    
    background: rgba(13, 17, 23, 0.98); /* Sfondo scuro */
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    gap: 1rem;
    
    /* Stato Nascosto */
    transform: translateY(-150%);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    z-index: 1999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  }

  /* Stato Visibile (aggiunto da JS) */
  .top-nav nav.show {
    transform: translateY(0);
    opacity: 1;
  }

  /* Link grandi per il touch */
  .top-nav nav a {
    width: 90%; justify-content: center; padding: 1rem; font-size: 1.1rem;
    background: rgba(255,255,255,0.03);
  }

  /* 4. Reset del padding main (non serve più 150px perché il menu è chiuso) */
  main.content {
    padding-top: 4rem; 
  }

  /* 5. Le icone social restano a destra */
  .social-icons {
    margin-left: auto;
    justify-content: flex-end;
    padding-top: 0;
  }
}