/* Аватар «Траектории»: инициалы на мягком градиенте и золотая орбита у собственного аватара.
   Разметка — templates/core/_avatar.html (тег {% avatar %}), цвета пар — core/avatar.py.
   Размер задаётся одной переменной --av (24…96px): шрифт, обводка и орбита считаются от неё. */

:root { --av-gold: #e5a50f; --av-edge: rgb(255 255 255 / .12); --av-edge-out: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --av-gold: var(--gold); --av-edge: rgb(255 255 255 / .18); --av-edge-out: rgb(255 255 255 / .05); } }
:root[data-theme="dark"] { --av-gold: var(--gold); --av-edge: rgb(255 255 255 / .18); --av-edge-out: rgb(255 255 255 / .05); }

.av {
  --av: 34px;
  position: relative; flex: none; display: inline-grid; place-items: center; vertical-align: middle;
  width: var(--av); height: var(--av); border-radius: 50%;
  /* Блик сверху слева гаснет к середине и почти не трогает контраст букв */
  background:
    radial-gradient(90% 90% at 26% 16%, rgb(255 255 255 / .13), rgb(255 255 255 / 0) 52%),
    linear-gradient(140deg, var(--av-from, #4a5a70), var(--av-to, #2b3442));
  /* Волосяная кромка: в тёмной теме круг не растворяется в фоне */
  box-shadow: inset 0 0 0 1px var(--av-edge), 0 0 0 1px var(--av-edge-out);
  color: #fff; font: 600 calc(var(--av) * .4) / 1 var(--f-display); letter-spacing: -.02em;
  font-feature-settings: normal; text-transform: none; user-select: none; -webkit-user-select: none;
}
.av[data-n="2"] { font-size: calc(var(--av) * .37); letter-spacing: -.04em; }
/* Заглавные Onest сидят чуть выше середины строки: опускаем на долю кегля */
.av-i { display: block; transform: translate(-.02em, .04em); text-shadow: 0 1px 1px rgb(8 14 26 / .12); }

/* ——— Орбита: дуга по пути полёта к золотой точке, как в логотипе ———
   Окружность длиной 100 (pathLength): видна часть [0, 100 − dashoffset], голова — у точки справа сверху. */
.av-o { position: absolute; left: 50%; top: 50%; width: calc(var(--av) * 1.26); height: calc(var(--av) * 1.26);
  transform: translate(-50%, -50%); overflow: visible; pointer-events: none; fill: none; }
.av-track { stroke: var(--accent); opacity: 0; transition: opacity 240ms ease-out; }
.av-arc { stroke: var(--av-gold); stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 71; opacity: .78;
  transition: stroke-dashoffset 240ms cubic-bezier(.22, .61, .36, 1), opacity 240ms ease-out; }
.av-dot { fill: var(--av-gold); stroke: none !important; }

/* Наведение и фокус на кнопке аккаунта: дуга дотягивается дальше */
:is(a, button, summary):is(:hover, :focus-visible) > .av-orbit .av-arc { stroke-dashoffset: 56; opacity: 1; }
/* Меню открыто: орбита замыкается в кольцо */
details[open] > summary > .av-orbit .av-arc { stroke-dashoffset: 0; opacity: 1; transition-duration: 320ms; }
/* Вы на странице аккаунта: под дугой проступает тонкая дорожка орбиты цветом действия */
.av.current .av-track { opacity: .5; }
.av.current:not(.av-orbit) { box-shadow: inset 0 0 0 1px var(--av-edge), 0 0 0 2px var(--surface, var(--bg)), 0 0 0 3.5px var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .av-arc, .av-track { transition: none; }
  /* Без движения: при наведении дуга остаётся как есть; открытое меню по-прежнему отмечено кольцом */
  :is(a, button, summary):is(:hover, :focus-visible) > .av-orbit .av-arc { stroke-dashoffset: 71; opacity: .78; }
  details[open] > summary > .av-orbit .av-arc { stroke-dashoffset: 0; opacity: 1; }
}
@media (forced-colors: active) { .av { forced-color-adjust: none; border: 1px solid CanvasText; } }

/* ——— Где стоит аватар ——— */
/* Кнопка аккаунта в шапке: круг 34px, кольцу фокуса — место вокруг орбиты */
.account > summary { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.account > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Шапка меню аккаунта: крупный аватар, рядом имя и почта */
.account-who { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; }
.account-who-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-who-text b { overflow: hidden; text-overflow: ellipsis; }

/* Человек в строке списка: аватар слева, текст справа */
.person { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; }
.person.top { align-items: start; }
.person > .av { margin-top: 1px; }
.thread-row > .av + .m-body { flex: 1 1 auto; }
.thread-row > .av { align-self: center; }
.iv-row:has(> .av) { grid-template-columns: 76px auto minmax(0, 1fr) auto; }
.hub-row.person { display: grid; }
.hub-row.person > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card h2.person { display: flex; align-items: center; gap: 12px; }
@media (max-width: 720px) {
  .iv-row:has(> .av) { grid-template-columns: 64px auto minmax(0, 1fr); }
  .iv-row:has(> .av) .iv-tag { grid-column: 3; }
}

/* Переписка: аватар собеседника у нижнего края его реплики, со стороны «хвостика» */
.chat li.has-av { position: relative; margin-left: 40px; }
.chat li.has-av > .av { position: absolute; left: -40px; bottom: 0; }
.stf-who { column-gap: 18px; }
