/* A8 — Unica intestazione REFTHE. Le sezioni cambiano solo il colore d'accento. */
html body > header.refthe-header {
  --header-accent: #174f4a;
  --header-paper: #f7f6f1;
  --header-ink: #152f31;
  --header-muted: #627472;
  --header-rule: rgba(21, 47, 49, .18);
  --header-signal: #ef6c32;
  position: relative !important;
  inset: auto !important;
  z-index: 90 !important;
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--header-rule) !important;
  border-radius: 0 !important;
  background: color-mix(in srgb, var(--header-paper) 96%, white 4%) !important;
  color: var(--header-ink) !important;
  box-shadow: 0 8px 24px rgba(20, 57, 55, .055) !important;
  overflow: visible !important;
  backdrop-filter: blur(16px);
}

html body > header.refthe-header[data-section="library"],
html body > header.refthe-header[data-section="guides"] { --header-accent: #245f9f; }
html body > header.refthe-header[data-section="tools"],
html body > header.refthe-header[data-section="calculators"] { --header-accent: #b46b12; }
html body > header.refthe-header[data-section="inverter"] { --header-accent: #6752a3; }
html body > header.refthe-header[data-section="faults"] { --header-accent: #1d6d60; }

.refthe-header, .refthe-header * { box-sizing: border-box; }
.refthe-header__inner {
  width: min(1440px, calc(100% - 32px));
  min-height: 82px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
}
.refthe-header__brand {
  display: inline-flex !important;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  color: #172123 !important;
  text-decoration: none !important;
}
.refthe-header__brand img { width: 174px !important; height: auto !important; display: block; }
.refthe-header__brand span { font: 700 14px/1.25 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; color: #5b6d6c; }
html body > header.refthe-header .refthe-header__nav {
  position: static !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
html body > header.refthe-header .refthe-header__nav a {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  min-height: 48px;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--header-ink) !important;
  background: transparent !important;
  font: 760 15px/1.2 system-ui, sans-serif !important;
  letter-spacing: .025em;
  text-decoration: none !important;
  white-space: nowrap;
}
html body > header.refthe-header .refthe-header__nav a + a::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  bottom: 15px;
  width: 1px;
  background: var(--header-rule);
}
html body > header.refthe-header .refthe-header__nav a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 5px;
  height: 3px;
  border-radius: 999px;
  background: var(--header-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .18s ease;
}
html body > header.refthe-header .refthe-header__nav a:hover,
html body > header.refthe-header .refthe-header__nav a:focus-visible { color: var(--header-accent) !important; background: transparent !important; }
html body > header.refthe-header .refthe-header__nav a:hover::after,
html body > header.refthe-header .refthe-header__nav a:focus-visible::after,
html body > header.refthe-header .refthe-header__nav a[aria-current="page"]::after { transform: scaleX(1); }
html body > header.refthe-header .refthe-header__nav a[aria-current="page"] { color: var(--header-accent) !important; background: transparent !important; box-shadow: none !important; }
.refthe-header__menu {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid rgba(23,79,74,.3);
  border-radius: 10px;
  background: var(--header-paper);
  color: #123b3a;
  font: 800 15px/1 system-ui, sans-serif;
}
html body > .refthe-header .site-locale-flags {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 5px !important;
  display: flex !important;
  justify-content: flex-end;
  gap: 2px !important;
  border: 1px solid rgba(23,79,74,.16) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.72) !important;
  box-shadow: none !important;
}
html body > .refthe-header .site-locale-flags a { min-width: 44px !important; min-height: 44px !important; display: inline-flex !important; align-items: center; justify-content: center; border-radius: 7px !important; }
html body > .refthe-header .site-locale-flags a[aria-current="true"] { outline: 2px solid var(--header-accent); outline-offset: -2px; }

.refthe-header__sections {
  width: 100%;
  margin: 0 !important;
  padding: 0 max(16px, calc((100% - 1440px) / 2)) !important;
  border-top: 1px solid var(--header-rule) !important;
  background: rgba(255,255,255,.5) !important;
}
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) {
  display: flex !important;
  align-items: stretch;
  justify-content: center;
  gap: 0 !important;
  overflow-x: auto;
  scrollbar-width: none;
}
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks)::-webkit-scrollbar { display: none; }
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a {
  --item-accent: var(--header-accent);
  position: relative;
  flex: 0 0 auto;
  min-height: 56px !important;
  padding: 0 24px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-right: 1px solid var(--header-rule) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--header-ink) !important;
  font-size: 15px !important;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none !important;
  box-shadow: none !important;
}
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a:first-child { border-left: 1px solid var(--header-rule) !important; }
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: var(--item-accent);
  transform: scaleX(.24);
  transform-origin: left center;
  opacity: .72;
  transition: transform .2s ease, opacity .2s ease;
}
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a:hover,
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a:focus-visible { color: var(--item-accent) !important; background: color-mix(in srgb, var(--item-accent) 5%, transparent) !important; }
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a:hover::after,
.refthe-header__sections:is(.gallery-nav, .calc-bookmarks) a:focus-visible::after { transform: scaleX(1); opacity: 1; }
.refthe-header__sections .gallery-nav__object--fault { --item-accent: #1d6d60 !important; }
.refthe-header__sections .gallery-nav__object--library,
.refthe-header__sections .gallery-nav__object--guide { --item-accent: #245f9f !important; }
.refthe-header__sections .gallery-nav__object--tools,
.refthe-header__sections .gallery-nav__object--calc { --item-accent: #b46b12 !important; }
.refthe-header__sections .gallery-nav__object--inverter { --item-accent: #6752a3 !important; }
.refthe-header__sections .gallery-nav__object--app { --item-accent: var(--header-signal) !important; }

/* Editorial strip: final override for the legacy bookmark-card skin. The
 * links, order and destinations stay untouched; only their presentation is
 * flattened into one navigation line. */
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a {
  height: auto !important;
  max-height: none !important;
  flex-direction: row !important;
  overflow: visible !important;
  border: 0 !important;
  border-right: 1px solid var(--header-rule) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  backdrop-filter: none !important;
}
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a:first-child {
  border-left: 1px solid var(--header-rule) !important;
}
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a::before {
  content: none !important;
  display: none !important;
}
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a::after {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  inset: auto 24px 0 24px !important;
  width: auto !important;
  height: 4px !important;
  border-radius: 4px 4px 0 0 !important;
  background: var(--item-accent) !important;
  box-shadow: none !important;
  opacity: .72 !important;
  transform: scaleX(.24) !important;
  transform-origin: left center !important;
}
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a:hover,
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a:focus-visible {
  background: color-mix(in srgb, var(--item-accent) 5%, transparent) !important;
  box-shadow: none !important;
  transform: none !important;
}
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a:hover::after,
html body > header.refthe-header .refthe-header__sections:is(.gallery-nav, .calc-bookmarks) > a:focus-visible::after {
  opacity: 1 !important;
  transform: scaleX(1) !important;
}

html body > header.refthe-header nav.refthe-header__nav#primary-nav > a {
  isolation: auto !important;
  min-width: 0 !important;
  min-height: 48px !important;
  padding: 0 14px !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--header-ink) !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  transform: none !important;
  backdrop-filter: none !important;
}
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a::before {
  content: "" !important;
  position: absolute !important;
  inset: 15px auto 15px 0 !important;
  display: block !important;
  width: 1px !important;
  height: auto !important;
  border-radius: 0 !important;
  background: var(--header-rule) !important;
  box-shadow: none !important;
  opacity: 1 !important;
}
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a:first-child::before {
  content: none !important;
  display: none !important;
}
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a::after {
  content: "" !important;
  position: absolute !important;
  inset: auto 14px 5px 14px !important;
  display: block !important;
  width: auto !important;
  height: 3px !important;
  border-radius: 999px !important;
  background: var(--header-accent) !important;
  opacity: 1 !important;
  transform: scaleX(0) !important;
  transform-origin: left center !important;
}
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a:hover,
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a:focus-visible,
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a[aria-current="page"] {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--header-accent) !important;
  transform: none !important;
}
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a:hover::after,
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a:focus-visible::after,
html body > header.refthe-header nav.refthe-header__nav#primary-nav > a[aria-current="page"]::after {
  transform: scaleX(1) !important;
}

@media (min-width: 1101px) {
  html body > header.refthe-header--portal .refthe-header__nav { display: none !important; }
  .refthe-header--portal .refthe-header__inner { grid-template-columns: minmax(190px, 1fr) auto; }
}

@media (max-width: 1100px) {
  .refthe-header__inner { min-height: 76px; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; }
  .refthe-header__brand img { width: 148px !important; }
  .refthe-header__brand span { font-size: 12px; }
  .refthe-header__menu { display: inline-flex; }
  html body > header.refthe-header .refthe-header__nav {
    display: none !important;
    position: absolute !important;
    top: calc(100% - 1px) !important;
    left: 16px !important;
    right: 16px !important;
    z-index: 10;
    padding: 10px !important;
    border: 1px solid rgba(23,79,74,.18) !important;
    border-radius: 14px !important;
    background: var(--header-paper) !important;
    box-shadow: 0 18px 36px rgba(20,57,55,.18) !important;
  }
  html body > header.refthe-header .refthe-header__nav.is-open { display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr)); }
  html body > header.refthe-header .refthe-header__nav a { min-height: 48px; }
  html body > header.refthe-header .refthe-header__nav a + a::before { display: none; }
  html body > header.refthe-header .refthe-header__nav a::after { left: 12px; right: 12px; bottom: 3px; }
  html body > header.refthe-header nav.refthe-header__nav#primary-nav > a::before { content: none !important; display: none !important; }
  html body > header.refthe-header nav.refthe-header__nav#primary-nav > a::after { inset: auto 12px 3px 12px !important; }
  html body > header.refthe-header .refthe-header__sections { display: none !important; }
}

@media (max-width: 560px) {
  .refthe-header__inner { width: min(100% - 20px, 1440px); grid-template-columns: minmax(0,1fr) auto; }
  .refthe-header__brand img { width: 128px !important; }
  .refthe-header__brand span { font-size: 11px; }
  html body > .refthe-header .site-locale-flags { grid-column: 1 / -1; justify-self: end; margin: -8px 0 8px !important; }
  html body > .refthe-header .site-locale-flags a { min-width: 42px !important; min-height: 44px !important; }
  html body > header.refthe-header .refthe-header__nav.is-open { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .refthe-header__nav a, .refthe-header__menu { transition: background-color .18s ease, color .18s ease, box-shadow .18s ease; }
}

/* One route navigator only: the editorial header replaces the old card gateway.
   The CSS guard also covers stale cached scripts during an update. */
html body > header.refthe-header + .entry-switch {
  display: none !important;
}
