/* Header sito — editorial EVIL (omogeneo con home + footer) */

body.evil-theme {
  --home-amber: #f59e0b;
  --home-accent: #00ff9c;
}

header {
  background: linear-gradient(
    180deg,
    rgba(6, 8, 14, 0.94) 0%,
    rgba(6, 8, 14, 0.82) 100%
  ) !important;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12) !important;
  box-shadow:
    0 1px 0 rgba(245, 158, 11, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-container {
  max-width: 1120px;
  padding: 0.85rem clamp(1rem, 3vw, 1.75rem);
}

.logo-section {
  margin-left: clamp(0.5rem, 2vw, 1.5rem);
  display: flex;
  align-items: center;
  gap: clamp(0.45rem, 1.5vw, 0.75rem);
  flex-shrink: 0;
  min-width: min-content;
  overflow: visible;
}

/* Zip/HTML vecchi: nasconde doppio "EVIL" se presenti wordmark + .logo */
.logo-section:has(.header-evil-wordmark) .logo {
  display: none !important;
}

/* EVIL accanto al logo — stesso stile del titolo hero home (editorial, bianco) */
.header-evil-wordmark,
.header-evil-title,
.logo-section .logo,
header .logo-section a.header-evil-wordmark {
  margin: 0;
  font-family: ui-sans-serif, system-ui, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
  font-size: clamp(1.65rem, 4.2vw, 2.35rem);
  font-weight: 900;
  font-synthesis: weight;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: #fff !important;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none !important;
  display: inline-block;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.header-evil-wordmark:hover {
  opacity: 0.92;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.35));
}

/* Home: wordmark = stesso stile del titolo hero (.home-hero--editorial .home-title) */
body.home-page header {
  position: sticky;
  top: 0;
  z-index: 1001;
}

body.home-page header .header-evil-wordmark {
  color: #fff !important;
  background: none;
  -webkit-text-fill-color: currentColor;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  letter-spacing: -0.03em;
  line-height: 0.9;
  font-weight: 900;
  text-shadow: none;
  filter: none;
  animation: none;
}

body.home-page header .header-evil-wordmark:hover {
  opacity: 0.92;
  filter: none;
}

@media (max-width: 480px) {
  .header-evil-wordmark,
  .header-evil-title,
  .logo-section .logo {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
  }
}

.img-btn img {
  filter: drop-shadow(0 4px 14px rgba(245, 158, 11, 0.22));
  transition: filter 0.35s ease, transform 0.35s ease;
}

.img-btn:hover img {
  filter: drop-shadow(0 6px 22px rgba(0, 255, 156, 0.35));
}

.img-btn.is-matrix-active img {
  filter: drop-shadow(0 0 16px rgba(0, 255, 156, 0.55)) drop-shadow(0 0 28px rgba(245, 158, 11, 0.25));
  animation: headerLogoMatrixPulse 1.4s ease-in-out infinite;
}

@keyframes headerLogoMatrixPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .img-btn.is-matrix-active img {
    animation: none;
  }
}

/* Nav — mono editoriale */
header nav a {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 0.45rem 0.35rem;
  position: relative;
  transition: color 0.25s ease;
}

header nav a::after {
  content: '';
  position: absolute;
  left: 0.35rem;
  right: 0.35rem;
  bottom: 0.15rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--home-amber, #f59e0b), transparent);
  transform: scaleX(0);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

header nav a:hover {
  color: #f8fafc;
}

header nav a:hover::after {
  transform: scaleX(1);
}

header nav li:hover .dropdown {
  display: block;
}

.dropdown {
  background: rgba(8, 12, 22, 0.96) !important;
  border: 1px dashed rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.dropdown a {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #94a3b8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: color 0.2s ease, background 0.2s ease, padding-left 0.2s ease;
}

.dropdown a:hover {
  background: rgba(245, 158, 11, 0.08) !important;
  color: #f8fafc !important;
  padding-left: 1.25rem !important;
}

/* ─── Auth — stesso linguaggio dei CTA editoriali (home hero) ─── */
.auth-buttons {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.auth-btn {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background 0.28s ease,
    color 0.25s ease;
}

/* Luce che attraversa il bottone (come spotlight home) */
.auth-btn::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -80%;
  width: 55%;
  height: 140%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255, 255, 255, 0.14) 50%,
    transparent 70%
  );
  transform: skewX(-16deg);
  pointer-events: none;
  transition: left 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-btn:hover::before {
  left: 130%;
}

.auth-btn:hover {
  transform: translateY(-2px);
}

.auth-btn:active {
  transform: translateY(0);
}

/* Registrati — outline vetro (come CTA secondario hero) */
.auth-btn.login {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.auth-btn.login:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(0, 255, 156, 0.42);
  color: #fff;
  box-shadow: 0 8px 26px rgba(0, 255, 156, 0.14);
}

/* Accedi — ambra piena (come CTA primario hero) */
.auth-btn.account {
  background: var(--home-amber, #f59e0b);
  color: #1a1208;
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.28);
}

.auth-btn.account::before {
  background: linear-gradient(
    105deg,
    transparent 25%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 75%
  );
}

.auth-btn.account:hover {
  background: #fbbf24;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.42);
}

/* Logout */
.auth-btn.logout {
  background: rgba(255, 255, 255, 0.04);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.28);
}

.auth-btn.logout:hover {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fff;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.18);
}

/* Nasconde markup legacy terminale se ancora in cache */
.auth-btn__scan,
.auth-btn__orbit,
.auth-btn__frame,
.auth-btn__caret,
.auth-btn__prompt {
  display: none !important;
}

.user-name {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #00ff9c !important;
  border: 1px dashed rgba(0, 255, 156, 0.25);
  border-radius: 999px;
  padding: 0.5rem 0.85rem !important;
}

.user-name:hover {
  background: rgba(0, 255, 156, 0.1) !important;
  border-color: rgba(0, 255, 156, 0.45);
  text-shadow: 0 0 16px rgba(0, 255, 156, 0.4);
}

/* Hamburger */
.hamburger-btn {
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.hamburger-btn:hover {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.hamburger-btn span {
  background: linear-gradient(90deg, #f59e0b, #00ff9c) !important;
}

@media (max-width: 992px) {
  header nav {
    background: rgba(8, 12, 22, 0.98) !important;
    border: 1px dashed rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-btn::before {
    display: none;
  }

  .auth-btn:hover {
    transform: none;
  }
}
