/* Хаб Академии (/{язык}/academy). Подключается после article.css: токены, шапка, карточки .art, финальный блок — оттуда.
   Первый экран — сетка hero статей; справа вместо мини-отчёта маршрут «С чего начать». Ниже темы, словарь, проверка токена. */

/* ---------- первый экран ---------- */
.hub-hero .hero-act { gap: 16px; }
.hub-s { padding-left: 18px; }
/* поиск — служебное поле: фокус тихий (светлее фон), лаймовое кольцо только у форм проверки токена */
.hub-s:focus-within { border-color: var(--line-2); box-shadow: none; background: var(--surface); }
.pal-dark .hub-s:focus-within { background: #1A1A1A; }
.hub-s .sbar-in svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.hub-s .sbar-in input { padding: 0 12px; text-overflow: ellipsis; }
.hub-s input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.hub-x { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border: 0; border-radius: 14px; background: none; color: var(--muted); cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.hub-x[hidden] { display: none; }
.hub-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hub-x:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .hub-x:hover { background: var(--surface); color: var(--ink); } }
.hub-meta { margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 20px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.hub-ready a { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.hub-ready .ico { font-size: 15px; transition: transform .2s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .hub-ready a:hover .ico { transform: translateX(3px); } }

/* ---------- маршрут «С чего начать»: та же тёмная карточка, что мини-отчёт в статьях ---------- */
/* deslop-ignore-next-line 21 — вложенные элементы с фоном (строки) вынесены на −8 px, их радиус 18 = 32 − 14 */
.route { position: relative; margin: 0; background: #000000; color: #FFFFFF; border-radius: 32px; padding: 22px 22px 18px; display: flex; flex-direction: column; min-width: 0; }
.pal-dark .route { box-shadow: 0 0 0 1px #2A2A2A; }
.route-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.route-k { margin: 0; font-size: 26px; line-height: 1.1; letter-spacing: -.025em; }
.route-s { margin: 0; font-size: 13.5px; color: #8F8F8F; white-space: nowrap; }
.route-bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin: 16px 0 8px; }
.route-bar i { height: 7px; border-radius: 3px; background: #2B2B2B; transition: background-color .3s ease; }
.route-bar i.on { background: var(--lime); }
.route-l { list-style: none; margin: 0; padding: 0; }
.route-l li + li { border-top: 1px solid #222222; }
.route-l a { display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; gap: 14px; align-items: center; min-height: 64px; padding: 9px 8px; margin: 0 -8px; border-radius: 18px;  /* 32 − (22 − 8): скругление вложено в карточку */ color: inherit; text-decoration: none; transition: background-color .15s ease; }
.route-l a:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .route-l a:hover { background: #161616; } }
.route-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #CFCFCF; box-shadow: inset 0 0 0 1.5px #3A3A3A; transition: background-color .2s ease, color .2s ease; }
.route-tx { display: grid; gap: 3px; min-width: 0; }
.route-tx b { font-size: 16px; font-weight: 600; line-height: 1.3; }
.route-tx small { font-size: 13px; line-height: 1.3; color: #8F8F8F; }
.route-l .ok-i { width: 20px; height: 20px; fill: none; stroke: var(--lime); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity .2s ease; }
.route-l a.is-read .ok-i { opacity: 1; }
.route-l a.is-read .route-n { background: var(--lime); color: #000000; box-shadow: none; }
.route-l a.is-read .route-tx b { color: #BDBDBD; }
/* следующий непрочитанный — как подсвеченная строка в мини-отчёте */
.route-l a.is-next { background: rgba(204, 255, 0, .08); box-shadow: inset 0 0 0 1px rgba(204, 255, 0, .35); }
.route-l a.is-next .route-n { color: var(--lime); box-shadow: inset 0 0 0 1.5px var(--lime); }
.route-f { margin-top: 16px; display: grid; gap: 10px; }
.route-go { width: 100%; height: 54px; }
.route-p { margin: 0; text-align: center; font-size: 13.5px; color: #8F8F8F; font-variant-numeric: tabular-nums; }
.route-hint { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #222222; font-size: 12.5px; line-height: 1.45; color: #6E6E6E; }

/* ---------- темы и навигация по ним ---------- */
.hub-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.chip { display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 9px 0 18px; border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background-color .15s ease; }
.chip span { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .chip:hover { background: var(--surface-2); } .chip:hover span { background: var(--surface); } }

.topic, .hub-gl { margin-top: var(--rhythm); scroll-margin-top: calc(var(--hdr) + 20px); }
.hub + .topic { margin-top: 56px; }
.topic-h { margin-bottom: 26px; }
.topic-r { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.topic-h h2 { margin: 0; font-size: clamp(30px, 3.2vw, 46px); line-height: 1.02; letter-spacing: -.032em; }
.topic-n { font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.topic-h p { margin: 12px 0 0; max-width: 40em; font-size: 17px; line-height: 1.55; color: var(--muted); }

.hub-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hub-g .art { position: relative; }
/* время и дата прижаты к низу вместе с «Читать»: в одном ряду карточек они на одной линии, как бы ни отличались описания */
.art .meta { margin-top: auto; padding: 16px 14px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.art .mi { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.art .mi .ico { font-size: 15px; flex: none; }
.hub-g .art .go { margin-top: 0; padding-top: 10px; }
/* «Прочитано» — в строке типа, а не поверх обложки: не закрывает схему */
.hub-g .art .type { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rd-b { display: none; align-items: center; gap: 4px; height: 24px; padding: 0 10px 0 7px; border-radius: 999px; background: var(--lime); color: #000000; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.rd-b .ok-i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.art.is-read .rd-b { display: inline-flex; }

/* плитка продукта — только в пустом месте ряда: data-s3 / data-s2 = сколько колонок свободно в последнем ряду при 3 / 2 колонках (0 — ряд полный, плитки нет) */
.hub-tile { container-type: inline-size; display: flex; min-height: 100%; border-radius: var(--r-lg); background: var(--lime); color: #000000; text-decoration: none; transition: background-color .2s ease; }
.hub-g > .hub-tile[data-s3="0"] { display: none; }
.hub-g > .hub-tile[data-s3="2"] { grid-column: span 2; }
.tile-in { width: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 30px 30px 28px; }
.tile-tx { display: grid; gap: 10px; align-content: start; }
.tile-k { font-size: 14px; font-weight: 600; color: var(--lime-mut); }
.tile-tx b { font-size: clamp(24px, 2.3vw, 32px); line-height: 1.08; letter-spacing: -.025em; }
.tile-p { max-width: 30em; font-size: 16px; line-height: 1.5; color: #1F2600; }
.hub-tile .btn { align-self: flex-start; flex: none; }
.hub-tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .hub-tile:hover { background: var(--lime-2); } }
@container (min-width: 560px) {
  /* плитка на два столбца: текст и кнопка слева, фрагмент продукта справа */
  .tile-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); grid-template-areas: "tx fig" "btn fig"; align-items: end; column-gap: 32px; }
  .tile-tx { grid-area: tx; align-self: start; }
  .tile-fig { grid-area: fig; }
  .hub-tile .btn { grid-area: btn; }
}

/* фрагмент продукта в плитке — тёмная мини-карточка, как маршрут и отчёт в статьях; данные — из тех же виджетов статей */
.tile-fig { border-radius: 20px; background: #000000; color: #FFFFFF; padding: 14px 16px 10px; font-size: 13px; line-height: 1.3; }
.tile-fig p { margin: 0; }
.tf-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #BDBDBD; }
.tf-live { width: 8px; height: 8px; border-radius: 2px; background: var(--lime); flex: none; }
.tf-l { list-style: none; margin: 0; padding: 0; }
.tf-radar .tf-l { overflow: hidden; }  /* новая пара выезжает из-под заголовка, а не поверх него */
.tf-l li + li { border-top: 1px solid #222222; }
.tile-fig .rd-a { width: 26px; height: 26px; font-size: 11.5px; }
.tile-fig .tag { color: #FFFFFF; font-size: 12.5px; gap: 6px; }
.tile-fig .tag::before { width: 7px; height: 7px; }
.tile-fig .tag.ok { --c: #25C26E; } .tile-fig .tag.wr { --c: #FFB020; } .tile-fig .tag.bd { --c: #F0475E; }

/* радар: три самые свежие пары, возраст тикает, раз в несколько секунд сверху приходит новая */
.tf-radar .tf-l li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 8px 0; }
.tf-radar .tf-l li:nth-child(n + 4) { display: none; }
.tf-radar .tf-l li.out { display: grid; }
.tf-radar .rd-a { grid-row: 1 / 3; }
.tf-radar li b { font-weight: 700; font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-radar .tf-t { grid-column: 2; font-size: 12px; color: #8F8F8F; font-variant-numeric: tabular-nums; }
.tf-radar .tag { grid-column: 3; grid-row: 1 / 3; justify-self: end; }

/* проверка: оценка, полоса сегментов и три строки отчёта */
.tf-sc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; column-gap: 6px; }
.tf-sc b { font-size: 34px; line-height: .9; letter-spacing: -.045em; }
.tf-sc span { font-size: 12.5px; color: #8F8F8F; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-sc em { align-self: center; padding: 4px 9px; border-radius: 999px; background: #FFB020; color: #000000; font-size: 12px; font-style: normal; font-weight: 700; white-space: nowrap; }
.tf-segs { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 2px; margin: 10px 0 4px; }
.tf-segs i { height: 5px; border-radius: 2px; background: #2B2B2B; }
.tf-segs i.on { background: #FFB020; }
.tf-check .tf-l li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; color: #CFCFCF; }
.tf-check .tf-l span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-check .tf-l b { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.tf-check .tf-l b::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; flex: none; }
.tf-check b.s-ok { color: #25C26E; } .tf-check b.s-wr { color: #FFB020; } .tf-check b.s-bd { color: #F0475E; } .tf-check b.s-nt { color: #FFFFFF; }

/* тренды: объём по пятиминуткам, последние — всплеск */
.tf-trend .tf-h, .tf-check .tf-h { color: #FFFFFF; font-weight: 700; margin-bottom: 10px; }
.tf-trend .tf-h b { margin-left: auto; color: var(--lime); font-size: 24px; line-height: 1; letter-spacing: -.03em; }
.tf-bars { display: flex; align-items: flex-end; gap: 3px; height: 88px; padding-bottom: 4px; border-bottom: 1px solid #2B2B2B; margin-bottom: 4px; }
.tf-bars i { flex: 1; height: var(--h); border-radius: 3px 3px 1px 1px; background: #3A3A3A; transform-origin: 50% 100%; }
.tf-bars i.hot { background: var(--lime); }

/* появление, когда плитка в кадре */
.js .tile-fig .tf-bars i { transform: scaleY(.06); transition: transform .55s var(--ease-out); transition-delay: calc(var(--i) * 28ms); }
.js .tile-fig.in .tf-bars i { transform: none; }
.js .tf-check .tf-l li, .js .tf-radar .tf-l li { opacity: 0; transform: translateY(6px); transition: opacity .35s var(--ease-out), transform .35s var(--ease-out); }
.js .tile-fig.in .tf-l li { opacity: 1; transform: none; }
.js .tile-fig.in .tf-l li:nth-child(2) { transition-delay: 90ms; }
.js .tile-fig.in .tf-l li:nth-child(3) { transition-delay: 180ms; }

/* ---------- словарь ---------- */
.gl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.gl-i { display: flex; flex-direction: column; gap: 10px; padding: 24px 24px 22px; border-radius: var(--r-md); background: var(--surface); scroll-margin-top: calc(var(--hdr) + 20px); transition: box-shadow .3s ease; }
.gl-i dt { font-size: 20px; line-height: 1.2; letter-spacing: -.015em; }
.gl-i dd { margin: 0; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.gl-i p { margin: 0; font-size: 15.5px; line-height: 1.55; color: var(--muted); }
.gl-i a { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 600; color: var(--ink); text-decoration: none; }
.gl-i a .ico { font-size: 15px; transition: transform .2s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .gl-i a:hover .ico { transform: translate(2px, -2px); } }
.gl-i:target { box-shadow: inset 0 0 0 2px var(--lime-deep); }

/* ---------- поиск ---------- */
html.hub-q .hub-nav, html.hub-q .topic, html.hub-q .hub-gl { display: none; }
.hub-res { margin-top: 32px; }
.hub-res[hidden] { display: none; }
.res-t { margin: 0 0 18px; font-size: 24px; letter-spacing: -.02em; }
.res-g:empty, .res-l:empty { display: none; }
.res-l { margin-top: 24px; display: grid; gap: 8px; }
.res-g + .res-l { margin-top: 28px; }
.res-h { margin: 6px 0 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.res-a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 60px; padding: 12px 18px; border-radius: 18px; background: var(--surface); color: var(--ink); text-decoration: none; transition: background-color .15s ease; }
.res-a .k { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.res-a b { display: block; font-size: 16px; font-weight: 600; line-height: 1.35; }
.res-a small { display: block; margin-top: 2px; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.res-a .ico { font-size: 16px; color: var(--muted); }
.res-a mark { background: rgba(204, 255, 0, .6); color: inherit; border-radius: 3px; padding: 0 1px; }
.pal-dark .res-a mark { background: rgba(204, 255, 0, .28); }
.res-a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .res-a:hover { background: var(--surface-2); } }
.res-e { padding: 28px 30px; border-radius: var(--r-lg); background: var(--surface); }
.res-e[hidden] { display: none; }
.res-e-t { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.res-e-s { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.res-e-s button { height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.res-e-s button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .res-e-s button:hover { background: var(--line); } }

/* ---------- адаптив ---------- */
@media (max-width: 560px) {
  /* в статьях форма проверки на телефоне — поле и кнопка под ним; поиску хаба нужна одна строка с крестиком внутри */
  .hub-s.sbar { flex-wrap: nowrap; height: 56px; padding: 0 4px 0 16px; gap: 0; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2) !important; }
  .pal-dark .hub-s.sbar { background: #000000 !important; }
  .hub-s.sbar:focus-within { background: var(--surface) !important; }
  .pal-dark .hub-s.sbar:focus-within { background: #1A1A1A !important; }
  .hub-s .sbar-in { flex: 1 1 auto; height: 100%; border: 0; border-radius: 0; background: none; }
  .pal-dark .hub-s .sbar-in { background: none; }
  .hub-s .sbar-in:focus-within, .pal-dark .hub-s .sbar-in:focus-within { box-shadow: none; }
  .hub-s .sbar-in input { font-size: 16px; }
}
@media (max-width: 1024px) {
  .hero-a .route { max-width: 520px; }
  .hub-g, .gl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-g > .hub-tile[data-s3] { display: flex; grid-column: auto; }
  .hub-g > .hub-tile[data-s2="0"] { display: none; }
}
@media (max-width: 640px) {
  .hub-g, .gl { grid-template-columns: minmax(0, 1fr); }
  .hub-g > .hub-tile[data-s2] { display: none; }  /* в одну колонку пустых мест нет; к проверке ведёт финальный блок */
  .hero-a .route { max-width: none; }
  /* темы — лента чипов с прокруткой, без переноса в несколько строк */
  .hub-nav { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gut)); padding: 2px var(--gut); scrollbar-width: none; }
  .hub-nav::-webkit-scrollbar { display: none; }
  .hub + .topic { margin-top: 44px; }
  .topic-h p { font-size: 16px; }
  .tile-in { padding: 24px 22px 22px; }
  .gl-i { padding: 20px 20px 18px; }
  .res-a { grid-template-columns: minmax(0, 1fr) auto; }
  .res-a .k { grid-column: 1 / -1; justify-self: start; }
  .route { padding: 18px 16px 14px; border-radius: 26px; }
  .route-l a { min-height: 60px; gap: 12px; }
}
@media (max-width: 400px) {
  .hub-meta { flex-direction: column; align-items: flex-start; }
  .route-k { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .js .tile-fig .tf-bars i, .js .tf-check .tf-l li, .js .tf-radar .tf-l li { transform: none; opacity: 1; transition: none; }
  .route-bar i, .route-n, .route-l .ok-i, .hub-tile, .gl-i, .chip, .res-a { transition: none; }
}
