/*
 * EL FIT — site header: one sticky row with logo, sections, language, account, Telegram.
 * Own class names (site-header, site-nav, logo…) so the old layered header rules in
 * style.css don't apply. Phones/tablets: logo + burger, menu opens as a panel.
 */

.site-header {
  --h-bg: #121a16;
  --h-line: #e9be5026;
  --h-text: #f3ecd8;
  --h-muted: #b9b39f;
  --h-gold: #e9be50;
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--h-bg) 94%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--h-line);
  font-family: var(--efit-font);
}

.site-header-inner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: var(--page-max, 1440px);
  min-height: 72px;
  margin: 0 auto;
  padding: 0 var(--gutter, 32px);
}

/* ---------- logo (bigger, with the gold shimmer of the original wordmark) ---------- */

.logo {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 3px;
  padding: 7px 15px 8px;
  border: 1px solid #e9be5066;
  border-radius: 14px;
  background: linear-gradient(160deg, #213028, #141c18);
  box-shadow: 0 0 0 1px #00000040 inset, 0 6px 18px #00000040;
  text-decoration: none;
  line-height: 1;
  flex: none;
  overflow: hidden;
  transition: border-color .25s, box-shadow .25s;
}
.logo:hover { border-color: var(--h-gold); box-shadow: 0 0 18px #e9be5033; }
.logo-el,
.logo-fit {
  font-family: ELMontserrat, Montserrat, Arial, sans-serif;
  background: linear-gradient(110deg, #d9ac43 0%, #f3d98f 30%, #fff6d6 45%, #f3d98f 60%, #d9ac43 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: logo-shimmer 5s ease-in-out infinite;
}
.logo-el { font-size: 36px; font-weight: 800; letter-spacing: -.045em; }
.logo-fit { font-size: 15px; font-weight: 500; font-style: italic; margin-top: -1px; }
/* soft light sweeping across the badge */
.logo::after {
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(105deg, transparent 42%, #fff3c41f 50%, transparent 58%);
  transform: translateX(-60%);
  animation: logo-sweep 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes logo-shimmer { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
@keyframes logo-sweep { 0%, 55% { transform: translateX(-60%); } 85%, 100% { transform: translateX(60%); } }

/* ---------- menu (desktop: inline) ---------- */

.site-menu {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 10px;
  color: var(--h-text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.site-nav a[hidden] { display: none; }
.site-nav a:hover { background: #ffffff0d; color: #fff; }
.site-nav a[aria-current="page"] { background: var(--h-gold); color: #1d211b; }
.site-nav .nav-art { display: inline-flex; color: var(--h-gold); }
.site-nav a[aria-current="page"] .nav-art { color: #1d211b; }
.site-nav .nav-art svg { width: 18px; height: 18px; }
.site-nav [data-menu-count],
.site-nav [data-basket-count] {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e56e28;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-sizing: border-box;
}

.site-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* language */
.site-header .language-switch {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--h-line);
  border-radius: 10px;
}
.site-header .language-switch a {
  min-width: 0;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--h-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
}
.site-header .language-switch a[aria-current="true"],
.site-header .language-switch a[aria-current="page"] { background: #e9be5026; color: var(--h-gold); }
.site-header .language-switch a:hover { color: var(--h-text); }

/* account: name + avatar circle; the avatar opens a small menu with "Вийти" */
.site-header .header-account:empty { display: none; }
.site-header .header-account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.account-name {
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--h-text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.account-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid #e9be5099;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #f6dc94, #c99a35);
  color: #1d211b;
  font: 800 16px/1 ELMontserrat, Montserrat, Arial, sans-serif;
  cursor: pointer;
  flex: none;
  box-shadow: 0 4px 14px #0000004d;
  transition: transform .2s, box-shadow .2s;
}
.account-avatar:hover,
.account-avatar[aria-expanded="true"] { transform: scale(1.06); box-shadow: 0 0 0 4px #e9be5033, 0 4px 14px #0000004d; }
.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 70;
  display: grid;
  gap: 10px;
  min-width: 220px;
  padding: 14px;
  border: 1px solid var(--h-line);
  border-radius: 14px;
  background: #18211c;
  box-shadow: 0 16px 34px #00000066;
}
.account-menu[hidden] { display: none; }
.account-menu-email {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--h-muted);
  font-size: 13px;
}
.account-logout {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--h-gold);
  color: #1d211b;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.account-logout:hover { filter: brightness(1.06); }
.account-link {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--h-line);
  border-radius: 10px;
  color: var(--h-text);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.account-link:hover { background: #ffffff0d; color: #fff; }

/* burger */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--h-line);
  border-radius: 10px;
  background: none;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  border-radius: 2px;
  background: var(--h-gold);
  transition: transform .25s, opacity .2s;
}
.site-header.menu-open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
.site-header.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Medium screens: compact nav — labels only, no icons — so the language switch stays on screen */
@media (max-width: 1600px) and (min-width: 1281px) {
  .site-nav a { padding: 9px 9px; gap: 6px; font-size: 13px; }
  .site-nav .nav-art { display: none; }
  .account-name { max-width: 120px; font-size: 14px; }
}

/* ---------- tablets & phones: burger + panel ---------- */

@media (max-width: 1280px) {
  .site-header-inner { min-height: 64px; gap: 12px; }
  .menu-toggle { display: flex; }
  .site-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px var(--gutter, 12px) 20px;
    background: var(--h-bg);
    border-bottom: 1px solid var(--h-line);
    box-shadow: 0 18px 30px #0000004d;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
  }
  .site-header.menu-open .site-menu { display: flex; }
  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .site-nav a {
    min-width: 0;
    padding: 13px 12px;
    border: 1px solid var(--h-line);
    font-size: 15px;
    white-space: normal;
  }
  .site-nav .nav-art { flex: none; }
  .site-nav .nav-label { min-width: 0; overflow-wrap: anywhere; }
  .site-tools {
    flex-wrap: wrap;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--h-line);
  }
  .site-header .header-account { order: -1; flex-basis: 100%; flex-direction: row-reverse; justify-content: flex-end; }
  .account-name { max-width: none; flex: 1; }
  .site-header .header-account { flex-wrap: wrap; }
  .account-menu { position: static; flex-basis: 100%; min-width: 0; padding: 0; border: 0; background: none; box-shadow: none; }
  .account-menu-email { display: none; }
  .site-header .language-switch a { padding: 7px 12px; font-size: 13px; }
}
@media (max-width: 380px) {
  .site-nav { grid-template-columns: 1fr; }
}

/* ---------- floating Telegram bot button (bottom right, above everything) ---------- */

.tg-float {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  font-family: var(--efit-font);
}
.tg-fab,
.tg-bubble { pointer-events: auto; }
.tg-fab {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #f6dc94, #d4a23c 70%);
  color: #18211c;
  box-shadow: 0 10px 26px #0000005c, 0 0 0 6px #e9be5026;
  animation: tg-spin 7s ease-in-out infinite;
  transition: transform .2s;
}
.tg-fab:hover { animation-play-state: paused; transform: scale(1.07); }
.tg-fab svg { width: 28px; height: 28px; margin-left: -2px; }
/* once in a while: a full turn with a little bounce */
@keyframes tg-spin {
  0%, 78% { transform: rotate(0) scale(1); }
  88% { transform: rotate(200deg) scale(1.08); }
  96% { transform: rotate(355deg) scale(1.02); }
  100% { transform: rotate(360deg) scale(1); }
}

.tg-bubble {
  position: relative;
  display: grid;
  gap: 3px;
  max-width: 240px;
  padding: 12px 34px 12px 14px;
  border: 1px solid #e9be5059;
  border-radius: 16px 16px 4px 16px;
  background: #18211c;
  color: #f3ecd8;
  box-shadow: 0 14px 30px #00000059;
  font-size: 13px;
  line-height: 1.35;
  animation: tg-bubble-in .5s ease-out both .8s;
}
.tg-bubble strong { color: #e9be50; font-size: 14px; }
.tg-bubble::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #18211c;
  border-right: 1px solid #e9be5059;
  border-bottom: 1px solid #e9be5059;
  transform: rotate(45deg);
}
.tg-bubble-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #b9b39f;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.tg-bubble-close:hover { color: #fff; background: #ffffff14; }
.tg-float.bubble-hidden .tg-bubble { display: none; }
@keyframes tg-bubble-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .tg-float { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .tg-fab { width: 54px; height: 54px; }
  .tg-bubble { max-width: 210px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-fab, .logo-el, .logo-fit, .logo::after { animation: none; }
}
