/* Базовые стили: сброс, каркас, шапка, таббар, футер, заставка, тосты. */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100dvh;
  font: 16px/1.55 var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.2; }

/* иконки: символы в спрайте контурные (stroke); .i--fill — заливка */
.ic {
  width: 1.15em; height: 1.15em;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em; flex-shrink: 0;
}
.ic.i--fill { fill: currentColor; stroke: none; }
.i--sm { width: .95em; height: .95em; }
.i--lg { width: 1.9em; height: 1.9em; }

/* прячем спрайт иконок */
body > svg[aria-hidden="true"] { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ряды карточек скроллятся внутри себя — страница по горизонтали не едет */
.row { overflow: hidden; }
.row__track { overscroll-behavior-x: contain; }
main, .container { min-width: 0; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #04121a;
  font-weight: 700; transition: top .2s;
}
.skip-link:focus { top: 12px; }

#main { display: block; min-height: 60vh; outline: none; }

/* ---------- шапка ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex; align-items: center; gap: 18px;
  min-height: 66px;
}
.nav__start { display: flex; align-items: center; gap: 20px; min-width: 0; }
.nav__center { flex: 1; display: flex; justify-content: center; min-width: 0; }
.nav__end { display: flex; align-items: center; gap: 8px; }

.logo { display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0; }
.logo__mark { width: 26px; height: 26px; flex-shrink: 0; display: block; }
.logo__mark .tri { transform-origin: 24px 24px; }
.logo__word {
  font: 700 1.06rem/1 var(--font-display); letter-spacing: -.02em; white-space: nowrap;
}
.logo__word sup {
  font: 600 .58rem/1 var(--font-mono); color: var(--accent);
  text-transform: uppercase; letter-spacing: .1em; margin-left: 3px; position: relative; top: -.55em;
}

.nav__links { display: flex; align-items: center; gap: 4px; position: relative; }
.nav__link {
  padding: 8px 13px; border-radius: 999px; font-size: .92rem; font-weight: 600;
  color: var(--fg-muted); white-space: nowrap; transition: color .18s, background .18s;
}
.nav__link:hover { color: var(--fg); background: rgba(255,255,255,.05); }
.nav__link.is-active { color: #04121a; background: var(--accent); }
.nav__short { display: none; }
.nav__indicator { display: none; }

.nav__search {
  display: flex; align-items: center; gap: 9px; width: min(420px, 100%);
  padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); color: var(--fg-muted); text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .2s, color .2s;
}
.nav__search:hover { color: var(--fg); box-shadow: inset 0 0 0 1px var(--accent); }
.nav__search-label { flex: 1; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__search-short { display: none; }
.nav__search kbd {
  font: 500 .7rem/1 var(--font-mono); padding: 4px 7px; border-radius: 6px;
  background: var(--bg-3); color: var(--fg-muted); box-shadow: inset 0 0 0 1px var(--line);
}

/* аккаунт в шапке */
.acct { display: flex; align-items: center; }
.acct__btn, .acct__link {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px;
  border: 0; border-radius: 999px; cursor: pointer; background: var(--bg-2);
  color: var(--fg); font-size: .88rem; font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line);
}
.acct__btn:hover, .acct__link:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.acct__avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121a; font-weight: 800; font-size: .82rem;
}

/* ---------- таббар (мобильный) ---------- */
.tabbar {
  position: fixed; inset: auto 0 0; z-index: 45;
  display: none;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__inner { display: grid; grid-auto-flow: column; }
.tabbar__inner > a, .tabbar__inner > button {
  display: grid; place-items: center; gap: 3px; padding: 9px 4px;
  border: 0; background: none; color: var(--fg-muted); font-size: .68rem; font-weight: 600;
  cursor: pointer;
}
.tabbar__inner > a.is-active, .tabbar__inner > button.is-active { color: var(--accent); }

/* ---------- футер ---------- */
.footer { margin-top: 56px; padding: 40px 0 28px; border-top: 1px solid var(--line); background: var(--bg-2); }
.footer__grid { display: grid; gap: 26px; grid-template-columns: 1.6fr repeat(3, 1fr); }
.footer__about { color: var(--fg-muted); font-size: .88rem; margin: 12px 0 0; max-width: 34ch; }
.footer h4 { margin: 0 0 10px; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer li a, .footer .link { color: var(--fg); font-size: .9rem; background: none; border: 0; padding: 0; cursor: pointer; }
.footer li a:hover, .footer .link:hover { color: var(--accent); }
.footer__bottom {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between;
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--fg-muted); font-size: .78rem;
}

/* ---------- заставка ---------- */
#intro {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center; gap: 16px;
  background: var(--bg);
  transition: opacity .4s ease, visibility .4s;
}
#intro[hidden] { display: none; }
#intro.is-out { opacity: 0; visibility: hidden; }
#intro svg { width: 90px; height: 90px; }
#intro .intro__logo { font: 800 1.5rem/1 var(--font-display); color: var(--fg); letter-spacing: -.02em; }

/* ---------- тосты ---------- */
#toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 110; display: grid; gap: 8px; width: min(92vw, 430px);
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-radius: 14px;
  background: var(--bg-3); box-shadow: var(--shadow), 0 0 0 1px var(--line);
  font-size: .9rem;
  animation: toastIn .26s var(--ease);
}
.toast.is-out { opacity: 0; transform: translateY(8px); transition: .3s; }
.toast__action { margin-left: auto; border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------- адаптив ---------- */
@media (max-width: 1080px) {
  .nav__search { width: 100%; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .nav__center { order: 3; flex-basis: 100%; margin-bottom: 10px; }
  .nav__inner { flex-wrap: wrap; padding-block: 10px; }
  .nav__links { display: none; }
  .tabbar { display: block; }
  body { padding-bottom: 62px; }
  .footer { padding-bottom: 78px; }
}
@media (max-width: 560px) {
  .nav__search kbd { display: none; }
  .nav__search-full { display: none; }
  .nav__search-short { display: inline; }
  .logo__word { font-size: .98rem; }
  .footer__grid { grid-template-columns: 1fr; }
}
