/* ════════════════════════════════════════════════════════════════════
   TinyFile — общая шапка сайта.

   Один компонент на все страницы: главная, /mini-app, /guide,
   /video-compressor и их локали. Разметка одинаковая везде, поэтому
   при переходе между страницами меню не прыгает.

   Переменные namespace'нуты (--hdr-*), чтобы шапка выглядела
   одинаково независимо от палитры конкретной страницы.

   Разметка-контракт:
     header.header
       .header-left     → .hamburger + .logo-area
       nav.nav-links    → шесть ссылок, у текущей .is-active
       .header-right    → .locale-picker + a.btn-header
     .mobile-menu#mobile-menu → те же ссылки + CTA + .mobile-lang-row
   ════════════════════════════════════════════════════════════════════ */

:root {
  --hdr-text: #0B1222;
  --hdr-text-2: #5A6A7E;
  --hdr-accent: #6ED581;
  --hdr-accent-dark: #319540;
  --hdr-accent-glow: rgba(110, 213, 129, 0.35);
  --hdr-accent-soft: rgba(110, 213, 129, 0.08);
  --hdr-accent-pill: rgba(110, 213, 129, 0.14);
  --hdr-bg: rgba(250, 252, 254, 0.8);
  --hdr-overlay: rgba(250, 252, 254, 0.92);
  --hdr-border: rgba(0, 0, 0, 0.04);
  --hdr-border-soft: rgba(0, 0, 0, 0.08);
  --hdr-hover: rgba(0, 0, 0, 0.04);
  --hdr-gradient: linear-gradient(135deg, #319540, #31AA48, #249B76);
  --hdr-logo-gradient: linear-gradient(135deg, #0B1222, #2D4356);
}

html.dark {
  --hdr-text: #E8EDF4;
  --hdr-text-2: #94A3B8;
  --hdr-accent-dark: #6ED581;
  --hdr-bg: rgba(11, 18, 34, 0.85);
  --hdr-overlay: rgba(11, 18, 34, 0.92);
  --hdr-border: rgba(255, 255, 255, 0.06);
  --hdr-border-soft: rgba(255, 255, 255, 0.1);
  --hdr-hover: rgba(255, 255, 255, 0.06);
  --hdr-logo-gradient: linear-gradient(135deg, #E2E8F0, #94A3B8);
}

/* ── Шапка ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px clamp(16px, 5vw, 80px);
  height: 65px;
  background: var(--hdr-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--hdr-border);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.logo-area img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.logo-area span {
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 22px;
  background: var(--hdr-logo-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Навигация ── */
.nav-links {
  display: flex;
  gap: 8px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.nav-links a {
  color: var(--hdr-text-2);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 10px;
  transition: all 0.25s;
}

.nav-links a:hover {
  color: var(--hdr-text);
  background: var(--hdr-hover);
}

.nav-links a.is-active {
  color: var(--hdr-accent-dark);
  background: var(--hdr-accent-pill);
  font-weight: 600;
}

/* ── CTA ── */
.btn-header {
  background: var(--hdr-gradient);
  color: #FFFFFF;
  border: none;
  padding: 0 16px;
  height: 40px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px var(--hdr-accent-glow);
}

.btn-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--hdr-accent-glow);
}

/* ── Переключатель языка ── */
.locale-picker { position: relative; }

.locale-btn {
  background: none;
  border: 1px solid var(--hdr-border-soft);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.locale-btn:hover { background: var(--hdr-hover); }

.locale-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--hdr-overlay);
  border: 1px solid var(--hdr-border-soft);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.04);
  z-index: 200;
  min-width: 160px;
}

.locale-dropdown.open { display: block; }

.locale-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--hdr-text);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.locale-dropdown button:hover { background: var(--hdr-accent-soft); }

/* ── Гамбургер ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--hdr-text);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ── Мобильное меню ── */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--hdr-overlay);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 99;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
  font-family: 'Manrope', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--hdr-text);
  text-decoration: none;
  padding: 12px 32px;
  border-radius: 14px;
  transition: background 0.2s;
}

.mobile-menu a:hover { background: var(--hdr-accent-soft); }

.mobile-menu a.is-active {
  color: var(--hdr-accent-dark);
  background: var(--hdr-accent-pill);
}

.mobile-lang-row { display: flex; gap: 16px; margin-top: 16px; }

.mobile-lang {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--hdr-border-soft);
  background: none;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.mobile-lang:hover { background: var(--hdr-accent-soft); }

/* ── Адаптив ──
   ≤1300px — пункты ужимаются, шесть штук перестают помещаться раньше
   всего в русской локали (самые длинные подписи).
   ≤1240px — меню уезжает в гамбургер. */
@media (max-width: 1300px) {
  .nav-links { gap: 4px; }
  .nav-links a { padding: 8px 10px; font-size: 14px; }
  .header-left, .header-right { gap: 16px; }
}

@media (max-width: 1240px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .locale-picker { display: none !important; }
  .header-left .logo-area {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  .logo-area img { display: none; }
  .btn-header { font-size: 0; padding: 0 16px; }
  .btn-header::after {
    content: var(--mobile-btn-text, 'Start Bot');
    font-size: 16px;
  }
}

@media (max-width: 1024px) {
  .header { padding: 14px 32px; }
}

@media (max-width: 640px) {
  .header { padding: 14px 20px; }
  .mobile-menu a { font-size: 22px; }
}
