/* Emmepost: strumenti per i visitatori. Usa le variabili colore del tema (--em-*). */

/* Fascia sotto il menu (desktop) e pulsante accanto all'hamburger (mobile) */
.em-toolsbar{display:none}
.em-toolsmenu{display:block}

@media (min-width:1241px){
 /* Con la fascia sotto il menu il pulsante serve solo su schermi piccoli; con il pulsante nell'intestazione resta sempre. */
 .em-toolsmenu:not(.em-toolsmenu--all){display:none}
 .em-toolsmenu--all{position:relative}
 .em-toolsmenu--all .em-toolsmenu__list{left:auto;right:0;width:max-content;min-width:300px;max-width:min(380px,90vw)}
 .em-toolsbar{display:flex;align-items:center;flex-wrap:wrap;gap:.5rem .6rem;padding:.55rem 0;box-sizing:border-box;border-top:1px solid var(--em-line);background:var(--em-warm);box-shadow:0 0 0 100vmax var(--em-warm);clip-path:inset(0 -100vmax)}
}

.em-toolsbar__t{margin-right:.4rem;font-size:.82rem;font-weight:700;color:var(--em-mute)}
.em-tool-btn{display:inline-flex;align-items:center;gap:.45rem;min-height:36px;padding:.35rem .95rem;border:1px solid var(--em-line);border-radius:999px;background:#fff;color:var(--em-ink);font:inherit;font-size:.9rem;font-weight:600;line-height:1.2;cursor:pointer;transition:border-color .2s,color .2s}
.em-tool-btn svg{flex:none;color:var(--em-ott)}
.em-tool-btn:hover{border-color:var(--em-ott);color:var(--em-ott)}
.em-tool-btn:focus-visible,.em-toolsmenu__btn:focus-visible,.em-toolsmenu__list button:focus-visible,.em-tooldlg button:focus-visible{outline:2px solid var(--em-ott);outline-offset:2px}

/* Pulsante mobile: stessa altezza e stile dell'hamburger */
.em-toolsmenu__btn{display:inline-flex;align-items:center;gap:.45rem;height:44px;padding:0 .9rem;border:1px solid var(--em-line);border-radius:12px;background:#fff;color:var(--em-ink);font:inherit;font-size:.95rem;font-weight:700;cursor:pointer;transition:border-color .2s}
.em-toolsmenu__btn svg{flex:none;color:var(--em-ott)}
.em-toolsmenu__btn:hover,.em-toolsmenu__btn[aria-expanded=true]{border-color:var(--em-ott)}
.em-header__right .em-toolsmenu{margin-right:.5rem}
@media (max-width:479px){
 .em-header__right .em-toolsmenu{margin-right:.4rem}
 .em-toolsmenu__btn{width:44px;justify-content:center;padding:0}
 .em-toolsmenu__lab{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
}

/* Tendina: stessa posizione e aspetto del menu principale su mobile */
.em-toolsmenu__list{position:absolute;left:0;right:0;top:calc(100% + .5rem);z-index:60;display:flex;flex-direction:column;margin:0;padding:.5rem;list-style:none;background:#fff;border:1px solid var(--em-line);border-radius:16px;box-shadow:0 22px 44px -22px rgba(11,16,19,.4)}
.em-toolsmenu__list[hidden]{display:none}
.em-toolsmenu__list li{margin:0}
.em-toolsmenu__list button{display:flex;align-items:center;gap:.8rem;width:100%;padding:.8rem 1rem;border:0;border-radius:10px;background:none;color:var(--em-ink);font:inherit;text-align:left;cursor:pointer}
.em-toolsmenu__list button:hover{background:var(--em-warm);color:var(--em-ott)}
.em-toolsmenu__list svg{flex:none;width:22px;height:22px;color:var(--em-ott)}
.em-toolsmenu__txt{display:flex;flex-direction:column;gap:.1rem}
.em-toolsmenu__txt strong{font-size:1.05rem}
.em-toolsmenu__txt small{font-size:.85rem;color:var(--em-mute)}

html.em-tool-open{overflow:hidden}

/* Finestre */
.em-tooldlg{box-sizing:border-box;width:min(700px,calc(100vw - 1.5rem));max-height:calc(100vh - 1.5rem);max-height:calc(100dvh - 1.5rem);padding:0;border:0;border-radius:20px;background:#fff;color:var(--em-ink);box-shadow:0 30px 80px -20px rgba(11,16,19,.55);overflow:hidden}
.em-tooldlg[open]{display:flex;flex-direction:column}
.em-tooldlg::backdrop{background:rgba(11,16,19,.55)}
.em-tooldlg__in{display:flex;flex-direction:column;min-height:0;max-height:inherit}
.em-tooldlg__h{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1rem 1rem 1.5rem;border-bottom:1px solid var(--em-line)}
.em-tooldlg__h h2{margin:0;font-size:1.25rem;line-height:1.25}
.em-tooldlg__x{flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:1px solid var(--em-line);border-radius:12px;background:#fff;color:var(--em-ink);cursor:pointer;transition:border-color .2s}
.em-tooldlg__x:hover{border-color:var(--em-ott);color:var(--em-ott)}
.em-tooldlg__b{overflow-y:auto;padding:1.25rem 1.5rem 1.5rem;overscroll-behavior:contain}
.em-tooldlg__intro{margin:0 0 1.1rem;color:var(--em-mute)}
.em-tooldlg__note{margin:1rem 0 0;font-size:.85rem;color:var(--em-mute)}

/* Campi */
.em-tf__l{display:block;margin:0 0 .35rem;font-size:.9rem;font-weight:700}
.em-tf{display:block;box-sizing:border-box;width:100%;margin:0;padding:.7rem .85rem;border:1px solid var(--em-line);border-radius:12px;background:#fff;color:var(--em-ink);font:inherit;font-size:1rem;line-height:1.5;-webkit-appearance:none;appearance:none;transition:border-color .2s,box-shadow .2s}
textarea.em-tf{min-height:9rem;resize:vertical}
.em-tf:focus{outline:none;border-color:var(--em-ott);box-shadow:0 0 0 4px var(--em-tintb)}
.em-tf--out{background:var(--em-warm)}
.em-tfrow{display:grid;grid-template-columns:1fr 1fr;gap:.9rem;margin-bottom:.9rem}
.em-tfrow>div{min-width:0}
.em-tfield{margin-bottom:.9rem}
@media (max-width:560px){.em-tfrow{grid-template-columns:1fr}}

/* Pulsanti */
.em-tool-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.6rem}
.em-tbtn{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:.45rem 1.05rem;border:1px solid var(--em-ott);border-radius:999px;background:var(--em-ott);color:#fff;font:inherit;font-size:.9rem;font-weight:700;cursor:pointer;transition:background .2s,border-color .2s}
.em-tbtn:hover{background:var(--em-ott-d);border-color:var(--em-ott-d)}
.em-tbtn:disabled{opacity:.5;cursor:not-allowed}
.em-tbtn--ghost{background:#fff;color:var(--em-ott-d);border-color:var(--em-line)}
.em-tbtn--ghost:hover{background:var(--em-warm);border-color:var(--em-ott);color:var(--em-ott-d)}

/* Risultati */
.em-tres{margin-top:1.25rem;padding-top:1.1rem;border-top:1px solid var(--em-line)}
.em-tres__empty{margin:0;color:var(--em-mute)}
.em-score{display:flex;flex-wrap:wrap;align-items:baseline;gap:.3rem .6rem}
.em-score__n{font-size:2.6rem;font-weight:800;line-height:1;color:var(--em-ott-d)}
.em-score__of{color:var(--em-mute);font-weight:600}
.em-score__lab{margin-left:.4rem;font-size:1.1rem;font-weight:700}
.em-meter{height:10px;margin:.7rem 0;border-radius:999px;background:var(--em-line);overflow:hidden}
.em-meter>i{display:block;height:100%;width:0;border-radius:999px;background:var(--em-ott);transition:width .3s ease}
.em-tres p{margin:.4rem 0}
.em-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:.6rem;margin:1rem 0 0}
.em-stat{display:flex;flex-direction:column-reverse;gap:.1rem;margin:0;padding:.7rem .9rem;border-radius:12px;background:var(--em-warm)}
.em-stat dt{font-size:.82rem;color:var(--em-mute)}
.em-stat dd{margin:0;font-size:1.4rem;font-weight:800;line-height:1.2;overflow-wrap:anywhere}
.em-tres__long{margin-top:1.1rem}
.em-tres__long ol{margin:.4rem 0 0;padding-left:1.25rem}
.em-tres__long li{margin:.35rem 0;font-size:.95rem}
.em-time{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.6rem}
.em-time>div{padding:.9rem 1rem;border-radius:12px;background:var(--em-tint)}
.em-time small{display:block;font-size:.82rem;color:var(--em-mute)}
.em-time strong{display:block;font-size:1.6rem;font-weight:800;line-height:1.2;color:var(--em-ott-d)}

/* Meta tag */
.em-mt-head{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;margin-bottom:.35rem}
.em-mt-head .em-tf__l{margin:0}
.em-mt-head .em-tbtn{min-height:34px;padding:.25rem .85rem;font-size:.85rem}
.em-mt-count{margin:.35rem 0 0;font-size:.85rem;font-weight:600;color:var(--em-mute)}
.em-mt-count.is-ok{color:var(--em-ott-d)}
.em-mt-count.is-warn{color:#8A5A00}
.em-mt-count.is-bad{color:#A12B2B}
.em-mt-notes{margin:1rem 0 0;padding-left:1.25rem;font-size:.92rem}
.em-mt-notes li{margin:.25rem 0}
.em-serp{margin-top:1.1rem;padding:.9rem 1rem;border:1px solid var(--em-line);border-radius:12px;background:#fff}
.em-serp__k{margin:0 0 .5rem;font-size:.78rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--em-mute)}
.em-serp__u{margin:0;font-size:.82rem;color:var(--em-mute);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.em-serp__t{margin:.15rem 0;font-size:1.15rem;font-weight:500;line-height:1.3;color:#1a0dab;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.em-serp__d{margin:0;font-size:.92rem;line-height:1.5;color:#3c4043;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}

@media (max-width:560px){
 .em-tooldlg{border-radius:16px}
 .em-tooldlg__h{padding:.75rem .75rem .75rem 1rem}
 .em-tooldlg__b{padding:1rem 1rem 1.25rem}
 .em-score__n{font-size:2.2rem}
}
@media (prefers-reduced-motion:reduce){.em-meter>i,.em-tf,.em-tool-btn,.em-tbtn{transition:none}}
