/* ========== BASE STILI GLOBALI ========== */
html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #fff;
  color: #000;
  overflow-x: hidden; /* previene scrollbar orizzontali globali */
}

/* ========== NAV SEMPRE IN ALTO (sopra header) ========== */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  /* Gradiente semi-trasparente con blur */
  /*background:    linear-gradient(      135deg,      rgba(24, 26, 28, 0.88) 0%,      rgba(39, 105, 233, 0.82) 50%,      rgba(255, 255, 255, 0.20) 100%    );*/
  /*background-color: rgba(24, 26, 28, 0.80);*/
  /*background: #000000;
  background: linear-gradient(90deg,rgba(0, 0, 0, 0.95) 0%, rgba(9, 9, 121, 0.6) 45%, rgba(0, 212, 255, 0.2) 100%);*/
  background: #000000;
  background: linear-gradient(90deg,rgba(0, 0, 0, 0.95) 0%, rgba(36, 115, 245, 0.8) 52%, rgba(84, 184, 251, 0.6) 100%);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
  backdrop-filter: saturate(120%) blur(3px);
  padding: 1px;
  text-align: center;
  z-index: 2000;
  box-shadow: 2px 2px 24px rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid #005;
}


/* ===== No-cookie panel: stile coerente con il tuo nav ===== */
#no-cookie-panel {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4000; /* sopra al resto */
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  /* Gradiente e glass come il nav */
  background:
    linear-gradient(
      135deg,
      rgba(24, 26, 28, 0.88) 0%,
      rgba(39, 105, 233, 0.82) 50%,
      rgba(255, 255, 255, 0.20) 100%
    );
  background-color: rgba(24, 26, 28, 0.80);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
  backdrop-filter: saturate(120%) blur(6px);
  border: 1px solid rgba(0, 0, 85, 0.7);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 240ms ease, transform 240ms ease;
}

#no-cookie-panel.ncp-show {
  opacity: 1;
  transform: translateY(0);
}

#no-cookie-panel.ncp-hide {
  opacity: 0;
  transform: translateY(16px);
}

#no-cookie-panel .ncp-inner {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

#no-cookie-panel p {
  margin: 0;
  color: #ffffff;
  font-size: 0.98rem;
  line-height: 1.5;
  text-align: left;
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}

#ncp-ok {
  background-color: #54b8fb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.35);
  transition: background-color 180ms ease;
}

#ncp-ok:hover,
#ncp-ok:focus-visible {
  background-color: #1478ab;
  outline: none;
}

/* Rispetto a utenti che preferiscono meno animazioni */
@media (prefers-reduced-motion: reduce) {
  #no-cookie-panel {
    transition: none;
  }
}

/* Mobile: full-width morbido */
@media (max-width: 480px) {
  #no-cookie-panel {
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-radius: 10px;
  }
  #no-cookie-panel .ncp-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  #ncp-ok {
    width: 100%;
    text-align: center;
  }
}


@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  nav {
    background:
      linear-gradient(
        135deg,
        rgba(24, 26, 28, 0.92) 0%,
        rgba(39, 105, 233, 0.86) 50%,
        rgba(255, 255, 255, 0.24) 100%
      );
    background-color: rgba(24, 26, 28, 0.88);
  }
}

.navdiv {
  width: 100%;
  height: 76px; /*100%;*/
}

footer a {
    color: #fff !important;
    font-weight: bold !important;
  }
  footer a:hover {
    color: #aee9ff !important;
  }


/* ========== MENU HAMBURGER ========== */
#menu-toggle {
  display: block;
  position: absolute;
  top: 18px;
  right: 14px;
  background-color: #54b8fb;
  border: none;
  padding: 12px;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
  transition: background-color 0.2s ease-in-out;
  z-index: 3002; /* sempre sopra tutto */
}

#menu-toggle:hover {
  background-color: #1478ab;
}

#menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: #fff;
  margin-bottom: 5px;
  border-radius: 1px;
}

/* ========== MENU A COMPARSA ========== */
#menu {
  display: none;
  position: absolute;
  top: calc(100% - 60px);
  right: 0;
  width: 220px;
  max-width: 95vw; /* evita scrollbar orizzontale */
  /*background-color: rgba(24, 26, 28, 0.92);*/
  background: linear-gradient(135deg, rgba(20, 20, 72, 0.95) 0%,rgba(84, 184, 251, 0.90) 100%);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.7);
  padding: 10px 0;
  max-height: calc(100vh - var(--nav-h, 64px) - 16px);
  overflow-y: auto;
  overflow-x: hidden; /* blocca scrollbar orizzontale */
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  opacity: 0;
  transform: translateY(-10px);
  z-index: 3001;
  box-sizing: border-box;
  -webkit-backdrop-filter: saturate(120%) blur(4px);
  backdrop-filter: saturate(120%) blur(4px);
}

#menu.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

#menu li {
  list-style: none;
  margin: 2px 0;
}

#menu a {
  display: block;
  box-sizing: border-box;
  width: 100%;
  color: #fff;
  text-decoration: none;
  font-variant: small-caps;
  font-size: 1.1em;
  padding: 10px 12px;
  border-radius: 6px;
  text-align: left;
  transition: background 0.2s ease-in-out, padding-left 0.2s ease-in-out;
  white-space: normal;
  word-wrap: break-word;
}

#menu a:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #aaf9ff;
  padding-left: 16px;
}

/* Rimozione stile pill originale nel menu a tendina */
#menu .blink,
#menu .active,
#menu .mysize {
  width: 100% !important;
  height: auto !important;
  background: transparent !important;
  color: #fff !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 10px 12px !important;
}

/* ========== HEADER (ora sotto il nav) ========== */
header {
  background-color: #3498db;
  background-image: url("sforosfo.webp");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  color: #fff;
  text-align: center;
  height: 480px;
  padding: 1em;
  margin-top: 0px;
}

h1 {
  margin-top: 0;
  font-size: 2.4em;
  color: white;
  /*text-shadow: 3px 3px 18px #000;*/
 text-shadow: 0px 0px 12px #000, 0px 0px 20px #000, 0px 0px 20px #000;
}

h2 {
  margin-top: 0;
  font-size: 2em;
}

h3 {
  margin-top: 0;
  font-size: 1.8em;
}

h4 {
  margin-top: 0;
  font-size: 1.3em;
}

/* ========== CONTENUTO PRINCIPALE ========== */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2em;
  margin-top: 20px;
}

section {
  background-color: #f9f9f9;
  padding: 2em;
  margin-bottom: 20px;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.4);
  border-bottom: 6px solid #1478bb;
  border-top: 1px solid #1478bb;
  border-left: 1px solid #1478bb;
  border-right: 1px solid #1478bb;
  border-radius: 8px;
  width: 90%;
}

p {
  margin-top: 0;
  font-size: 1.2em;
  text-align: justify;
  line-height: 1.8em;
  width: 80%;
  margin: 1.4em auto;
}

.definizioni {
  font-size: 1.1em;
  text-align: justify;
  line-height: 1.6em;
  font-style: italic;
  width: 75%;
  margin: 1.5em auto;
  box-shadow: 2px 2px 5px grey;
  padding: 20px;
  border-radius: 8px;
  background-color: #fffef4;
}

img {
  width: 90%;
  height: auto;
  display: block;
  margin: 1em auto;
}

.codice {
  background-color: #fffcdb;
  color: #080892;
  padding: 0.8em;
  border-radius: 5px;
  position: relative;
  box-shadow: 2px 2px 3px grey;
  width: 75%;
  display: block;
  margin: 1.5em auto;
}

.codice pre {
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 1.4em;
  text-align: left;
}

.copia-codice {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: #3498db;
  color: #fff;
  border: none;
  border-radius: 20%;
  box-shadow: 2px 2px 3px grey;
  padding: 2px 3px;
  font-size: 12px;
  cursor: pointer;
}

.copia-codice:hover {
  background-color: #1478ab;
}

/* ========== BOTTONI DI NAVIGAZIONE ========== */
.pagebut {
  margin: 1em auto;
  max-width: 120px;
  background-color: #1478ab;
  border-radius: 8px;
  box-shadow: 2px 2px 3px grey;
  color: #fff;
  border: none;
  padding: 12px 16px;
  font-size: 20px;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  line-height: 0.55em;
  text-align: center;
}

.pagebut:hover {
  background-color: #54b8fb;
}

.downbut {
  margin: 1em auto;
  max-width: 350px;
  background-color: #1478ab;
  border-radius: 8px;
  box-shadow: 2px 2px 3px grey;
  color: #fff;
  border: none;
  padding: 12px 16px;
  font-size: 22px;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  line-height: 0.55em;
  text-align: center;
}

.downbut:hover {
  background-color: #54b8fb;
}

/* ========== PULSANTI FISSI ========== */
#torna-in-cima {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #1478ab;
  border-radius: 20%;
  box-shadow: 2px 2px 3px white;
  color: #fff;
  border: none;
  padding: 2px 12px;
  font-size: 32px;
  cursor: pointer;
  display: none;
  z-index: 3000;
}

#torna-in-cima:hover {
  background-color: #54b8fb;
}

.index {
  position: fixed;
  bottom: 20px;
  right: 80px;
  background-color: #1478ab;
  border-radius: 8px;
  box-shadow: 2px 2px 3px white;
  color: #fff;
  border: none;
  padding: 9px 12px;
  font-size: 20px;
  cursor: pointer;
  display: block;
}

.index:hover {
  background-color: #54b8fb;
}

/* ========== FOOTER ========== */
footer {
  /*background-color: #2356b8;*/
  background: #000040;
  background: linear-gradient(180deg,rgba(0, 0, 64, 1) 30%, rgba(35, 105, 234, 1) 100%);
  color: #fff;
  padding: 1em;
  text-align: center;
  clear: both;
}

.stripe { 
  display: block; 
  background: linear-gradient(135deg, rgba(20, 20, 72, 0.95) 0%,rgba(84, 184, 251, 0.90) 100%); 
  padding: 2px; 
  text-align: center; 
  height: 4px; 
  clear: both; 
}

.myhead {
  /*auto: 100%;*/
  max-width: 340px;
  width: 60%;
  display: block;
  margin-left: 120px;
  margin-top:-2px;

}

/* offset automatico per ancore */
[id] {
  scroll-margin-top: calc(var(--nav-h, 64px) + 20px);
}

/* ========== SOMMARIO ========== */
.footer-summary {
  background-color: #f7f7f7;
  padding: 20px;
  border-top: 1px solid #ddd;
}

.summary-columns {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.summary-column {
  flex-basis: 20%;
  margin: 10px;
}

.summary-column h3 {
  margin-top: 0;
}

.summary-column ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.summary-column li {
  margin-bottom: 10px;
}

.summary-column a {
  text-decoration: none;
  color: #03225c;
}

.summary-column a:hover {
  color: #135a97;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .summary-column {
    flex-basis: 40%;
  }
  body, html {
    overflow-x: hidden !important;
  }
  #menu {
    right: 0;
    left: auto;
    width: 220px;
    max-width: 90vw;
  }
}

@media (max-width: 480px) {
  .summary-column {
    flex-basis: 100%;
  }
}

@media only screen and (max-width: 768px) {
  main {
    margin-top: 60px;
  }

  h1 {
    font-size: 1.3em;
  }

  p {
    width: 100%;
  }

  img {
    width: 100%;
  }

  .codice {
    width: 100%;
  }

  section {
    width: 100%;
  }

  .myhead {
    margin-left: 20px;
    max-width: 260px;
  }

  #menu-toggle span {
    width: 18px;
    margin-bottom: 3px;
  }

  #menu-toggle {
    right: 24px;
    padding: 10px;
  }

  main, section, .definizioni, .codice {
    max-width: 100%;
  }
}

/* --- Sottolineatura dinamica + evidenziazione voce attiva --- */
/* rendiamo i link contenitori posizionati per il ::after */
#menu a,
nav ul li a {
  position: relative;
  overflow: visible;
}

/* base: il pseudo-elemento esiste ma parte chiuso */
#menu a::after,
nav ul li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 4px;
  height: 2px;
  width: 0;
  background-color: #aee9ff;
  border-radius: 2px;
  transition: width 0.25s ease-in-out;
}

/* hover: linea che si espande */
#menu a:hover::after,
nav ul li a:hover::after {
  width: 100%;
  background-color: #ffffff; /* <-- più chiaro */
}

/* stato attivo: colore + linea piena */
#menu a.active,
nav ul li a.active {
  color: #aee9ff;
  font-weight: bold;
  text-decoration: none;
}

#menu a.active::after,
nav ul li a.active::after {
  width: 100%;
}


/* === Compact headers (non-home): centered titles, smaller height === */
body:not(.home) header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 240px;
  padding-top: 1.2em;
  text-align: center;
}

body:not(.home) header h1 {
  font-size: 1.8em;
  margin: 0.3em 0;
  text-align: center;
  font-weight: 500;
}

body:not(.home) header h2 {
  font-size: 1.4em;
  margin: 0.2em 0;
  text-align: center;
  font-weight: 500;
}

/* Home rimane invariata */

