/* FarmyPoint — intestazioni scelte dall'amministratore (app/src/Testata.php, Layout::TESTATA, admin/layout.php).
   Caricato da Site::page solo quando è scelto uno stile diverso da «Come sempre». data-lh su <html>:
   1 Essenziale · 2 Due livelli · 3 Ricerca in primo piano · 4 Capsula flottante · 5 Come sempre + menu telefono.
   Da 900 px in su l'intestazione completa; sotto, in ogni stile, logo + preferiti + menu a scomparsa (.st-drawer). */

:root { --h-acc: var(--brand); }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { --h-acc: var(--brand-on-dark); } }
html[data-theme="dark"] { --h-acc: var(--brand-on-dark); }

.st-hi { flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Elementi comuni agli stili 1–4 ---------- */
.st-h .st-head-in { gap: 20px; }
.st-hnav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
.st-hnav a { position: relative; color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 600; white-space: nowrap; }
.st-hnav a:hover, .st-hnav a[aria-current='page'] { color: var(--ink); }
.st-hact { display: flex; align-items: center; gap: 10px; }
.st-hnav + .st-hact { margin-left: 8px; }

.st-hfaq, .st-hfav, .st-hico, .st-hset-btn, .st-hmenubtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 10px;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; background: transparent;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; white-space: nowrap;
}
.st-hfaq:hover, .st-hfaq[aria-current='page'], .st-hfav:hover, .st-hico:hover, .st-hset-btn:hover, .st-hset-btn[aria-expanded='true'], .st-hmenubtn:hover { border-color: var(--h-acc); color: var(--h-acc); }
.st-hfav[aria-current='page'] { color: var(--h-acc); border-color: var(--h-acc); }
.st-hfav[aria-current='page'] .st-hi { fill: currentColor; }
.st-hfav-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st-hbadge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}
.st-hfav .st-hbadge { position: absolute; top: 3px; right: 2px; border: 2px solid var(--surface); line-height: 14px; }
.st-hico .st-hi { fill: currentColor; stroke: none; }
.st-hset { position: relative; }
.st-hset-code { font-size: 14px; }

.st-hres {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px;
  font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap; background: var(--brand); color: #fff; border: 1px solid var(--brand);
}
.st-hres:hover { filter: brightness(1.08); }

/* Menu «Lingua, tema e aiuto» */
.st-hmenu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 280px; padding: 10px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px rgba(0, 0, 0, .16);
}
.st-hpref-t { display: block; margin: 8px 6px 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.st-seg { display: flex; gap: 2px; padding: 3px; margin: 0 2px 6px; border-radius: 11px; background: var(--muted-bg, var(--bg)); }
.st-seg a, .st-seg button {
  flex: 1; min-height: 36px; display: grid; place-items: center; padding: 0 6px; border: 0; border-radius: 8px; background: transparent;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--text-2); text-decoration: none; cursor: pointer;
}
.st-seg a:hover, .st-seg button:hover { color: var(--h-acc); }
.st-seg a[aria-current='true'], .st-seg button[aria-pressed='true'] { background: var(--surface); color: var(--h-acc); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.st-hmenu-help {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 6px; padding: 12px 8px; border: 0; border-top: 1px solid var(--line);
  background: transparent; font: inherit; font-size: 14px; font-weight: 650; color: var(--text); text-align: left; cursor: pointer; border-radius: 0 0 10px 10px;
}
.st-hmenu-help:hover { color: var(--h-acc); }

/* ---------- 1 Essenziale ---------- */
.st-h1 .st-hnav a[aria-current='page']::after { content: ''; position: absolute; left: 0; right: 0; bottom: -22px; height: 3px; border-radius: 3px; background: var(--h-acc); }

/* ---------- 2 Due livelli ---------- */
[data-lh="2"] .st-head { top: -36px; }
.st-htop { background: var(--hero, #0c2a28); color: #d5dfdc; }
.st-htop-in { max-width: 1240px; height: 36px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.st-htop-tag { margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-htop-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; background: transparent; font: inherit; font-weight: 600; color: inherit; cursor: pointer; border-radius: 6px; }
.st-htop-link:hover { color: #fff; }
.st-htop-theme .st-hi { fill: currentColor; stroke: none; }
.st-htop-theme[aria-pressed='true'] { color: #fff; }
.st-htop .st-lang a { color: #d5dfdc; padding: 4px 6px; }
.st-htop .st-lang a:hover { color: #fff; }
.st-htop .st-lang a[aria-current='true'] { color: #fff; background: rgba(255, 255, 255, .14); }
.st-h2 .st-hnav { margin-left: 32px; margin-right: auto; }
.st-h2 .st-hnav a[aria-current='page']::after { content: ''; position: absolute; left: 0; right: 0; bottom: -22px; height: 3px; border-radius: 3px; background: var(--h-acc); }
.st-h2 .st-hfav { border-color: transparent; padding: 0 12px; }
.st-h2 .st-hfav-l { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.st-h2 .st-hfav .st-hbadge { position: static; border: 0; line-height: 18px; }
.st-h2 .st-hres { background: transparent; color: var(--h-acc); border-color: var(--line); }
.st-h2 .st-hres:hover { border-color: var(--h-acc); filter: none; }

/* ---------- 3 Ricerca in primo piano ---------- */
.st-hsearch {
  flex: 0 1 360px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--muted-bg, var(--bg)); color: var(--text-2); font-size: 15px; text-decoration: none; min-width: 0;
}
.st-hsearch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-hsearch .st-hi { color: var(--h-acc); }
.st-hsearch:hover { border-color: var(--h-acc); }
.st-h3 .st-hnav { gap: 22px; }
.st-h3 .st-hres { width: 44px; padding: 0; }

/* ---------- 4 Capsula flottante ---------- */
[data-lh="4"] .st-head { background: transparent; border-bottom: 0; backdrop-filter: none; padding: 10px 16px 0; }
.st-h4 .st-head-in {
  height: calc(var(--head-h) - 4px); padding: 0 8px 0 24px; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(0, 0, 0, .10);
}
.st-h4 .st-hnav { margin: 0 auto; gap: 2px; padding: 4px; border-radius: 999px; background: var(--muted-bg, var(--bg)); }
.st-h4 .st-hnav a { padding: 8px 16px; border-radius: 999px; }
.st-h4 .st-hnav a[aria-current='page'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.st-h4 .st-hnav + .st-hact { margin-left: 0; }
.st-h4 .st-hfaq, .st-h4 .st-hfav, .st-h4 .st-hico, .st-h4 .st-hset-btn { border-color: transparent; border-radius: 999px; }
.st-h4 .st-hres { border-radius: 999px; }

/* ---------- Gruppo di icone (Layout::AZIONI, data-ha): aiuto, contatti, preferiti e lingua accostati ---------- */
.st-h[data-ha] .st-hact, .st-hcap { gap: 2px; }
.st-h[data-ha] .st-hres { margin-left: 10px; }
.st-h[data-ha] :is(.st-hfaq, .st-hfav, .st-hico, .st-hset-btn) { min-width: 40px; padding: 0 8px; }
.st-h[data-ha] .st-hset-code { font-weight: 800; }
/* 2 Sigla della lingua */
.st-h[data-ha="2"] .st-hset-btn { gap: 2px; }
/* 3 Barra unica */
.st-hcap { display: flex; align-items: center; padding: 3px; border-radius: 14px; background: color-mix(in srgb, var(--h-acc) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--h-acc) 14%, var(--line)); }
.st-hcap :is(.st-hfaq, .st-hfav, .st-hico, .st-hset-btn) { height: 38px; border-radius: 10px; }
.st-h4 .st-hcap { border-radius: 999px; }
.st-h4 .st-hcap :is(.st-hfaq, .st-hfav, .st-hico, .st-hset-btn) { border-radius: 999px; }
/* 4 Due gruppi */
.st-hsep { width: 1px; height: 24px; margin: 0 6px; background: var(--line); }
.st-hset-tondo { display: grid; place-items: center; width: 24px; height: 24px; border: 1.7px solid currentColor; border-radius: 50%; font-size: 10.5px; letter-spacing: .02em; }
/* 5 Con etichette: la scritta sotto l'icona (per i preferiti è il nome già presente, reso visibile) */
.st-h[data-ha="5"] :is(.st-hfaq, .st-hfav, .st-hset-btn) { flex-direction: column; gap: 2px; height: 50px; min-width: 58px; padding: 0 6px; }
.st-h[data-ha="5"] .st-hfav-l { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.st-hlbl, .st-h[data-ha="5"] .st-hfav-l { font-size: 11px; font-weight: 650; line-height: 1; color: var(--text-2); }
.st-h[data-ha="5"] .st-hfav .st-hbadge { top: 0; right: 8px; }
.st-h[data-ha] :is(.st-hfaq, .st-hfav, .st-hset-btn):hover .st-hlbl, .st-h[data-ha="5"] .st-hfav:hover .st-hfav-l,
.st-h[data-ha] [aria-current='page'] :is(.st-hlbl, .st-hfav-l) { color: inherit; }

/* ---------- «Per le farmacie» (Layout::FARMACIE, data-hf) ---------- */
.st-h .st-hfarm { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.st-h .st-hnav a.st-hfarm::after { display: none; }
html body .st-h .st-hfarm { color: var(--h-acc); }
.st-hfarm .st-hi { color: var(--h-acc); }
/* 1 e 5: pulsante contornato (la 5 accanto all'area riservata) */
.st-h:is([data-hf="1"], [data-hf="5"]) .st-hfarm { height: 44px; padding: 0 14px; border: 1.5px solid color-mix(in srgb, var(--h-acc) 45%, var(--line)); border-radius: 12px; font-size: 15px; font-weight: 700; }
.st-h[data-hf="5"] .st-hfarm { padding: 0 16px; border-color: var(--h-acc); margin-left: 10px; }
.st-h[data-hf="5"] .st-hfarm + .st-hres { margin-left: 8px; }
.st-h[data-hf="5"] .st-hact { margin-left: auto; }
.st-h:is([data-hf="1"], [data-hf="5"]) .st-hfarm:hover, .st-h:is([data-hf="1"], [data-hf="5"]) .st-hfarm[aria-current='page'] { border-color: var(--h-acc); background: color-mix(in srgb, var(--h-acc) 8%, transparent); }
/* 2 Pillola lilla con freccia */
.st-h[data-hf="2"] .st-hfarm { height: 40px; padding: 0 16px 0 14px; border-radius: 999px; background: color-mix(in srgb, var(--h-acc) 11%, transparent); }
.st-h[data-hf="2"] .st-hfarm:hover, .st-h[data-hf="2"] .st-hfarm[aria-current='page'] { background: color-mix(in srgb, var(--h-acc) 18%, transparent); }
.st-hfarm-ar { font-size: 18px; line-height: 1; font-weight: 700; }
/* 3 Sottolineata con freccia */
html body .st-h[data-hf="3"] .st-hfarm { color: var(--ink); }
.st-h[data-hf="3"] .st-hfarm { gap: 7px; }
.st-hfarm-t { text-decoration: underline; text-decoration-color: var(--h-acc); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.st-h[data-hf="3"] .st-hfarm-ar { color: var(--h-acc); font-size: 16px; transition: transform .15s ease; }
.st-h[data-hf="3"] .st-hfarm:hover .st-hfarm-ar { transform: translateX(3px); }
/* 4 Due righe */
html body .st-h[data-hf="4"] .st-hfarm { color: var(--ink); }
.st-h[data-hf="4"] .st-hfarm { gap: 10px; }
.st-hfarm-tile { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: color-mix(in srgb, var(--h-acc) 12%, transparent); }
.st-hfarm-tx { display: flex; flex-direction: column; line-height: 1.15; }
.st-hfarm-tx small { font-size: 12px; font-weight: 600; color: var(--text-2); }
.st-hfarm-tx strong { font-size: 15px; color: var(--h-acc); }
.st-h[data-hf="4"] .st-hfarm:hover .st-hfarm-tile { background: color-mix(in srgb, var(--h-acc) 20%, transparent); }
/* Capsula flottante: le pagine sono pillole, la voce resta nella sua forma */
.st-h4 .st-hnav a.st-hfarm { padding-top: 0; padding-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .st-h[data-hf="3"] .st-hfarm-ar { transition: none; } }

/* ---------- Pulsante del menu e menu a scomparsa (tutti gli stili, solo telefono) ---------- */
.st-hmenubtn { display: none; }
html.st-drawer-on { overflow: hidden; }
.st-drawer { position: fixed; inset: 0; z-index: 95; }
.st-drawer-bg { position: absolute; inset: 0; background: rgba(8, 20, 20, .45); opacity: 0; transition: opacity .18s ease; }
.st-drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); display: flex; flex-direction: column; padding: 14px 18px 18px;
  background: var(--surface); color: var(--text); box-shadow: -10px 0 30px rgba(0, 0, 0, .2); overflow-y: auto; transform: translateX(102%); transition: transform .22s ease;
}
.st-drawer-open .st-drawer-bg { opacity: 1; }
.st-drawer-open .st-drawer-panel { transform: none; }
.st-drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.st-drawer-head .st-logo { font-size: 22px; }
.st-drawer-x { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); cursor: pointer; border-radius: 12px; }
.st-drawer-nav { display: grid; margin: 14px 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.st-drawer-nav a { display: flex; align-items: center; gap: 14px; min-height: 52px; font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none; }
.st-drawer-nav a:hover, .st-drawer-nav a[aria-current='page'] { color: var(--h-acc); }
.st-drawer .st-hpref-t { margin: 12px 0 6px; }
.st-drawer .st-seg { margin: 0 0 4px; }
.st-drawer-res {
  margin-top: auto; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 12px; margin-bottom: 4px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 700; text-decoration: none;
}
.st-drawer-panel > .st-hpref { margin-bottom: 20px; }
@media (prefers-reduced-motion: reduce) { .st-drawer-panel, .st-drawer-bg { transition: none; } }

/* ---------- Telefono e schermi stretti ---------- */
@media (max-width: 899px) {
  .st-hmenubtn { display: inline-flex; }
  .st-htop, .st-hnav, .st-hsearch, .st-hset, .st-hico, .st-hfaq, .st-hres, .st-hsep, .st-h .st-hfarm { display: none; }
  .st-hcap { display: contents; }
  .st-hcap .st-hfav { height: 44px; border-radius: 12px; }
  .st-h[data-ha="5"] .st-hfav { flex-direction: row; height: 44px; min-width: 44px; }
  .st-h[data-ha="5"] .st-hfav-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .st-h[data-ha="5"] .st-hfav .st-hbadge { top: 3px; right: 2px; }
  [data-lh="2"] .st-head { top: 0; }
  .st-h .st-head-in { gap: 8px; }
  .st-hact, .st-hnav + .st-hact, .st-h4 .st-hnav + .st-hact { margin-left: auto; gap: 6px; }
  .st-h2 .st-hfav { padding: 0 10px; border-color: var(--line); }
  .st-h2 .st-hfav-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .st-h2 .st-hfav .st-hbadge { position: absolute; top: 3px; right: 2px; border: 2px solid var(--surface); line-height: 14px; }
  [data-lh="4"] .st-head { padding: 8px 10px 0; }
  .st-h4 .st-head-in { padding: 0 6px 0 16px; }
  /* 5: intestazione di sempre, sul telefono solo logo, preferiti e menu */
  [data-lh="5"] .st-head .st-lang, [data-lh="5"] .st-head .st-helpbtn, [data-lh="5"] .st-head .st-reserved,
  [data-lh="5"] .st-head .st-themebtn, [data-lh="5"] .st-head .st-navlink { display: none; }
  [data-lh="5"] .st-head .st-hmenubtn { display: inline-flex; }
}
@media (min-width: 900px) and (max-width: 1080px) {
  .st-hnav { gap: 16px; }
  .st-h4 .st-hnav a { padding: 8px 10px; }
  .st-h2 .st-htop-tag { display: none; }
  .st-hsearch { flex-basis: 240px; }
  .st-h1 .st-hres span, .st-h4 .st-hres span { font-size: 14px; }
}

/* ---------- Icone senza riquadro (Layout::ICONE, predefinito): sfondo lilla chiaro al passaggio e nella pagina aperta ---------- */
.st-hplain .st-hfaq, .st-hplain .st-hfav, .st-hplain .st-hico, .st-hplain .st-hset-btn, .st-hplain .st-hmenubtn,
.st-h2.st-hplain .st-hfav { border-color: transparent; }
.st-hplain .st-hfaq:hover, .st-hplain .st-hfaq[aria-current='page'], .st-hplain .st-hfav:hover, .st-hplain .st-hfav[aria-current='page'],
.st-hplain .st-hico:hover, .st-hplain .st-hset-btn:hover, .st-hplain .st-hset-btn[aria-expanded='true'], .st-hplain .st-hmenubtn:hover {
  border-color: transparent; background: color-mix(in srgb, var(--h-acc) 12%, transparent);
}

/* Colori dei link: in site.css «html:not([data-theme="light"]) a» colora tutti i link nel tema scuro e vincerebbe su
   queste regole; qui solo il colore, con la specificità che serve. */
html body .st-h .st-logo { color: var(--ink); }
html body .st-hnav a { color: var(--text-2); }
html body .st-hnav a:hover, html body .st-hnav a[aria-current='page'] { color: var(--ink); }
html body .st-hfav, html body .st-hfaq { color: var(--ink); }
html body .st-hfav:hover, html body .st-hfav[aria-current='page'], html body .st-hfaq:hover, html body .st-hfaq[aria-current='page'] { color: var(--h-acc); }
html body .st-hres, html body .st-drawer-res { color: #fff; }
html body .st-h2 .st-hres { color: var(--h-acc); }
html body .st-hsearch { color: var(--text-2); }
html body .st-seg a { color: var(--text-2); }
html body .st-seg a:hover, html body .st-seg a[aria-current='true'] { color: var(--h-acc); }
html body .st-htop .st-lang a { color: #d5dfdc; }
html body .st-htop .st-lang a:hover, html body .st-htop .st-lang a[aria-current='true'] { color: #fff; }
html body .st-drawer-nav a { color: var(--ink); }
html body .st-drawer-nav a:hover, html body .st-drawer-nav a[aria-current='page'] { color: var(--h-acc); }
html body .st-drawer-head .st-logo { color: var(--ink); }

/* ---------- Icone di servizio attenuate (aiuto, contatti, preferiti, lingua, tema): lilla sfumato e più piccole, per lasciare
   il primo piano a «Per le farmacie» e all'area riservata. 70% del colore del marchio sullo sfondo: contrasto ≥ 3:1 (WCAG 1.4.11).
   Al passaggio del mouse e nella pagina aperta tornano del colore pieno. ---------- */
html body .st-h :is(.st-hfaq, .st-hfav, .st-hico, .st-hset-btn) { color: color-mix(in srgb, var(--h-acc) 70%, var(--surface)); }
html body .st-h :is(.st-hfaq, .st-hfav, .st-hico, .st-hset-btn):is(:hover, [aria-current='page'], [aria-expanded='true']) { color: var(--h-acc); }
.st-h :is(.st-hfaq, .st-hfav, .st-hico, .st-hset-btn) > .st-hi { width: 18px; height: 18px; stroke-width: 1.5; }
.st-h[data-hf="5"] .st-hfarm { margin-left: 18px; }
/* Le scritte accanto alle icone (sigla della lingua, «Preferiti») restano nel grigio del testo: il lilla sfumato non basta per il testo (4.5:1). */
html body .st-h :is(.st-hset-code, .st-hfav-l) { color: var(--text-2); }
html body .st-h :is(.st-hfav, .st-hset-btn):is(:hover, [aria-current='page'], [aria-expanded='true']) :is(.st-hset-code, .st-hfav-l) { color: inherit; }

/* Menu a scomparsa: le pagine del progetto (missione, territorio, innovazione), sotto le voci principali */
.st-drawer-sub { display: grid; margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.st-drawer-sub p { margin: 4px 0 2px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.st-drawer-sub a { display: flex; align-items: center; min-height: 44px; font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; }
.st-drawer-sub a:hover, .st-drawer-sub a[aria-current='page'] { color: var(--h-acc); }
html body .st-drawer-sub a { color: var(--ink); }
html body .st-drawer-sub a:hover, html body .st-drawer-sub a[aria-current='page'] { color: var(--h-acc); }
