/* Latency Lab - общая оболочка всех сайтов: фон, шапка, логотип, меню продуктов, бургер, кнопки, подвал.
 * Канон: site/assets/shell.css (https://latencylab.ru/assets/shell.css), нужен tokens.css перед ним.
 * Копия для Parser: site/parser/static/shell.css - python scripts/sync_site_shared.py.
 * Поведение бургера - lab-shell.js. Сайт переопределяет только своё (Map: шапка поверх карты, Status: ширина). */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

/* Клавиатурный фокус видно, клик мышью - без рамки */
:focus {
  outline: none;
}

:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* ---- фон: сетка и свечение ---- */
.bg-grid,
.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.bg-grid {
  background-image:
    linear-gradient(rgba(79, 140, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 140, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.bg-glow {
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 229, 168, 0.14), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(79, 140, 255, 0.16), transparent 30%),
    radial-gradient(circle at 50% 80%, var(--accent-a08), transparent 35%);
}

/* ---- шапка ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  min-height: var(--header-h);
  padding-block: 0.65rem;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex-shrink: 0;
}

.header__title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.08rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.header__eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.2;
}

.header__tagline {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(42vw, 280px);
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

/* ---- логотип ---- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.logo__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  /* 64 px webp (2x для 32 px) вместо 512 px png; путь относительно этого файла */
  background: url("logo-bot-64.webp?v=20261030") center / cover no-repeat;
  box-shadow: var(--glow-accent);
  flex-shrink: 0;
}

.logo__text span {
  color: var(--accent);
}

/* ---- меню продуктов ---- */
.nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
}

.nav a {
  position: relative;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a.active,
.nav a[aria-current="page"] {
  color: var(--accent);
}

.nav a.active,
.nav a[aria-current="page"] {
  font-weight: 600;
}

/* ---- бургер ---- */
.burger {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  cursor: pointer;
}

.burger span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: var(--radius-pill);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.burger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger.open span:nth-child(2) {
  opacity: 0;
}

.burger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- кнопки: база ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--grad-primary);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  box-shadow: var(--shadow-accent);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 229, 168, 0.28);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--accent-a40);
  box-shadow: none;
}

.btn--sm {
  padding: 0.55rem 0.95rem;
  font-size: 0.9rem;
}

/* ---- подвал ---- */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
}

.footer__brand {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}

.footer__brand .logo__text {
  color: var(--text);
  font-weight: 800;
}

.footer__note {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.footer__products {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover,
.footer__products a[aria-current="page"] {
  color: var(--accent);
}

.footer__legal {
  margin: 0;
}

.footer__legal a {
  color: var(--accent);
}

.footer__legal a:hover {
  opacity: 0.8;
}

/* Компактный подвал в одну строку (Map: под картой на весь экран) */
.footer--compact {
  padding: 0.4rem 0;
  font-size: 0.78rem;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
}

.footer--compact .footer__inner {
  width: auto;
  padding-inline: 1.25rem;
  gap: 0.25rem 1.25rem;
}

/* ---- узкий экран: меню под бургером ---- */
@media (max-width: 900px) {
  .header__tagline {
    display: none;
  }

  .header__actions {
    margin-left: auto;
  }

  .burger {
    display: inline-flex;
  }

  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-left: 0;
    background: var(--menu-bg);
    border-bottom: 1px solid var(--line);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
    padding: 0.5rem 1rem 1rem;
    z-index: 60;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
  }

  .nav a:last-child {
    border-bottom: none;
  }

  .footer--compact .footer__products {
    display: none;
  }
}

@media (max-width: 560px) {
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer--compact .footer__inner {
    flex-direction: row;
    align-items: center;
  }

  /* на телефоне под картой - одна строка: только © и правила */
  .footer--compact .footer__brand {
    display: none;
  }
}
