/* Header e menu laterale condivisi da index e pagine articolo. */
#sito-header {
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(52,73,94,.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  border-bottom: 3px solid var(--accent);
  height: 64px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

#menuBtn,
#menuChiudi {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  border-radius: 10px;
}

#menuBtn:hover,
#menuBtn:focus-visible {
  background: rgba(255,255,255,.15);
}

/* Nuova testata tipografica condivisa. */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}

.logo-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #e0574a);
  font: 900 22px/1 'Merriweather', serif;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transform: rotate(-4deg);
  transition: transform .25s;
}

.logo-testo {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-palmi {
  font-family: 'Merriweather', serif;
  font-weight: 900;
  font-size: 22px;
  letter-spacing: .3px;
}

.logo-news {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.78);
}

.logo-news::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.35);
}

@media (hover:hover) and (pointer:fine) {
  .logo:hover .logo-mark {
    transform: rotate(0);
  }
}

#menuOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 40;
}

#menuOverlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#menuLaterale {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--card);
  color: var(--text);
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
  transform: translateX(-100%);
  transition: transform .3s ease, visibility 0s linear .3s;
  visibility: hidden;
  z-index: 50;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#menuLaterale.is-open {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

.menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent);
}

.menu-top h2 {
  font-family: 'Merriweather', serif;
  font-size: 18px;
  color: var(--primary);
}

#menuChiudi {
  color: var(--text);
}

.menu-label {
  padding: 16px 20px 6px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.menu-link,
#themeToggle,
#commentaSito {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: 600 16px/1.5 'Open Sans', sans-serif;
  text-align: left;
}

.menu-link {
  border-left: 4px solid transparent;
}

#themeToggle {
  border-left: 0;
}

.menu-link:hover,
.menu-link:focus-visible,
#themeToggle:hover,
#themeToggle:focus-visible,
#commentaSito:hover,
#commentaSito:focus-visible {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
}

.menu-link.on {
  border-left-color: var(--accent);
  color: var(--primary);
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
}

.menu-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

#themeToggle {
  width: 100%;
  justify-content: flex-start;
}

.theme-switch {
  width: 42px;
  height: 24px;
  margin-left: auto;
  padding: 3px;
  display: flex;
  align-items: center;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text-muted) 45%, transparent);
  transition: background-color .25s;
}

.theme-switch::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(0);
  transition: transform .25s;
}

#themeToggle[aria-checked="true"] .theme-switch {
  background: var(--accent);
}

#themeToggle[aria-checked="true"] .theme-switch::after {
  transform: translateX(18px);
}

dialog#commentiSito {
  width: min(560px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
}

dialog#commentiSito::backdrop {
  background: rgba(0,0,0,.5);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dialog-head h2 {
  font-family: 'Merriweather', serif;
  color: var(--primary);
  font-size: 20px;
}

.dialog-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 400px) {
  .logo-mark { width: 34px; height: 34px; }
  .logo-palmi { font-size: 20px; }
  .logo-news { font-size: 9.5px; letter-spacing: 4px; }
}

@media (max-width: 768px) {
  dialog#commentiSito {
    width: 94vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  #menuOverlay,
  #menuLaterale,
  .theme-switch,
  .theme-switch::after {
    transition: none;
  }
}
