/* HENNIO-PAESE-LINGUA-1 — un solo bottone «🇮🇹 Italia · IT ▾».
   Colori e caratteri della testata: crema #FBF6F1, cipria #E9C9C1,
   rosa antico #9C6B63, cacao #3B2A26. Il pannello, sul computer, è una
   tendina attaccata al bottone (mai una finestra a tutta pagina); sul
   telefono sale dal basso. */

/* La testata crea uno stacking context (z-index 30): quando il pannello è
   aperto lo alziamo sopra il banner cookie (z-index 110), altrimenti «Salva»
   finirebbe sotto la barra dei consensi. */
.hn3-head.hnpl-head-open { z-index: 1000; }

.hnpl {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--hn3-ink, #3B2A26);
  z-index: 60;
}
.hnpl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--hn3-blush, #E9C9C1);
  border-radius: 999px;
  background: #fff;
  color: var(--hn3-ink, #3B2A26);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.hnpl-btn:hover,
.hnpl-btn[aria-expanded="true"] {
  background: var(--hn3-soft, #F3E6E0);
  border-color: #d9b5ad;
}
.hnpl-btn:focus-visible,
.hnpl-panel a:focus-visible,
.hnpl-panel button:focus-visible {
  outline: 2px solid var(--hn3-thread, #9C6B63);
  outline-offset: 2px;
}
.hnpl-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1px rgba(59, 42, 38, .12);
}
.hnpl-dot { color: var(--hn3-muted, #6B5A55); font-weight: 400; }
.hnpl-caret {
  font-size: 10px;
  color: var(--hn3-thread, #9C6B63);
  transform: translateY(-1px);
}
.hnpl-btn-country { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

.hnpl-panel {
  position: absolute;
  z-index: 120;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  padding: 14px;
  background: #fff;
  color: var(--hn3-ink, #3B2A26);
  border: 1px solid var(--hn3-blush, #E9C9C1);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(59, 42, 38, .18);
  animation: hnpl-fade .14s ease-out;
}
.hnpl-panel[hidden],
.hnpl-backdrop[hidden] { display: none; }
.hnpl-backdrop { display: none; }

.hnpl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.hnpl-title {
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--hn3-ink, #3B2A26);
}
.hnpl-x {
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--hn3-muted, #6B5A55);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.hnpl-x:hover { background: var(--hn3-soft, #F3E6E0); color: var(--hn3-ink, #3B2A26); }

.hnpl-group + .hnpl-group { margin-top: 12px; }
.hnpl-group-title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--hn3-thread, #9C6B63);
}
.hnpl-countries,
.hnpl-langs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
}
.hnpl-country,
.hnpl-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 8px;
  box-sizing: border-box;
  border-radius: 9px;
  color: var(--hn3-ink, #3B2A26) !important;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none !important;
}
.hnpl-country:hover,
.hnpl-lang:hover { background: var(--hn3-soft, #F3E6E0); }
.hnpl-country[aria-current="true"],
.hnpl-lang[aria-current="true"] {
  background: var(--hn3-soft, #F3E6E0);
  font-weight: 600;
}
.hnpl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hnpl-check {
  margin-left: auto;
  color: var(--hn3-thread, #9C6B63);
  font-size: 13px;
  visibility: hidden;
}
.hnpl-country[aria-current="true"] .hnpl-check,
.hnpl-lang[aria-current="true"] .hnpl-check { visibility: visible; }

.hnpl-foot { margin-top: 14px; }
.hnpl-save {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--hn3-thread, #9C6B63);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.hnpl-save:hover { background: #8a5c55; }

/* Piè di pagina: stesso bottone in cima, tendina che si apre verso l'alto. */
.hn3-footer-choice {
  max-width: 1360px;
  margin: 0 auto;
  padding: 18px 40px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--hn3-blush, #E9C9C1);
}
.hn3-footer-choice::before {
  content: 'hennio';
  font-family: 'Libre Caslon Text', Georgia, serif;
  font-size: 16px;
  font-style: italic;
  color: var(--hn3-thread, #9C6B63);
}
.hnpl--footer { margin-bottom: 16px; }
.hnpl--footer .hnpl-panel {
  top: auto;
  bottom: calc(100% + 8px);
}

@keyframes hnpl-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sotto i 1100 px il menu e il bottone restano sulla stessa riga: il menu
   scorre, il bottone resta fermo a destra. La testata non prende una riga in
   più a causa del selettore. */
@media (max-width: 1100px) {
  .hn3-menubar {
    flex-wrap: nowrap;
    height: 46px;
    min-height: 46px;
    padding-top: 0;
    padding-bottom: 0;
    overflow: visible;
    row-gap: 0;
  }
  .hn3-nav { order: 0; flex: 1 1 auto; min-width: 0; overflow-x: auto; }
  .hnpl--head { order: 0; margin-left: auto; }
  .hn3-trust { display: none; }
}

@media (max-width: 720px) {
  .hnpl-btn { min-height: 44px; padding: 0 9px; font-size: 11.5px; gap: 5px; }
  .hnpl-btn-country { max-width: 96px; }
  .hn3-footer-choice { padding: 16px 16px 0; }
  .hnpl--footer { margin-bottom: 14px; }

  /* Pannello dal basso, come chiesto per il telefono. */
  .hnpl-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(59, 42, 38, .38);
  }
  .hnpl[data-open] .hnpl-backdrop { display: block; }
  .hnpl-panel,
  .hnpl--footer .hnpl-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-width: none;
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 16px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    animation: hnpl-up .2s ease-out;
  }
  .hnpl-title { font-size: 20px; }
  .hnpl-country,
  .hnpl-lang { font-size: 14px; }
}

@media (max-width: 380px) {
  .hnpl-btn-country { max-width: 82px; }
  .hnpl-countries,
  .hnpl-langs { grid-template-columns: 1fr 1fr; }
}

@keyframes hnpl-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

body.hnpl-open { overflow: hidden; }
