/* ============================================================
   styles.css — Knowledge Base
   Все компоненты. Зависит от tokens.css.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap&subset=cyrillic,cyrillic-ext,latin");

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg-canvas); }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background:
    radial-gradient(circle at 1px 1px, var(--border-subtle) 1px, transparent 0) 0 0 / 32px 32px,
    var(--bg-canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss03";
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-bg); color: var(--text-primary); }

/* Scrollbar — тонкая, под темy */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 2px solid var(--bg-canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ---------- Layout shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--layout-sidebar) 1fr;
  min-height: 100vh;
}
.app__main { display: flex; flex-direction: column; min-width: 0; }
.page {
  flex: 1;
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: var(--s-7) var(--s-7) var(--s-9);
}
.page--narrow { max-width: 920px; }
.page--article {
  display: grid;
  grid-template-columns: minmax(0, var(--layout-content)) var(--layout-toc);
  gap: var(--s-7);
  align-items: start;
  max-width: 1140px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--layout-topbar);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in oklch, var(--bg-canvas) 80%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}
.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  color: var(--text-primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar__crumbs { flex-shrink: 0; }
.topbar__mark {
  width: 22px; height: 22px;
  border-radius: var(--r-input);
  background: var(--accent);
  color: var(--text-on-accent);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: 11px;
  letter-spacing: -0.02em;
}
.topbar__divider {
  width: 1px; height: 18px;
  background: var(--border-subtle);
  margin: 0 var(--s-2);
}
.topbar__crumbs {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
}
.topbar__crumbs a { color: var(--text-secondary); transition: color var(--t-fast); }
.topbar__crumbs a:hover { color: var(--text-primary); }
.topbar__crumbs span.current { color: var(--text-primary); }
.topbar__spacer { flex: 1; }
.topbar__search {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  height: 32px;
  padding: 0 6px 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-button);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  min-width: 240px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.topbar__search:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.topbar__search svg { color: var(--text-tertiary); flex-shrink: 0; }
.topbar__search span { flex: 1; }
.topbar__search .kbd { margin-left: auto; }
.topbar__theme {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-button);
  color: var(--text-secondary);
  transition: all var(--t-fast);
}
.topbar__theme:hover { color: var(--text-primary); background: var(--bg-surface); border-color: var(--border-strong); }
.topbar__avatar {
  width: 28px; height: 28px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: grid; place-items: center;
  color: var(--text-secondary);
  font-size: var(--fs-12);
  font-weight: var(--fw-semibold);
}

/* ---------- KBD ---------- */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; min-width: 18px; padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  padding: var(--s-5) 0 var(--s-6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar__brand {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar__brand-mark {
  width: 28px; height: 28px;
  border-radius: var(--r-button);
  background: var(--accent);
  color: var(--text-on-accent);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  font-size: var(--fs-12);
}
.sidebar__brand-name {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  letter-spacing: -0.005em;
}
.sidebar__brand-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar__cmdk {
  margin: var(--s-4) var(--s-4) var(--s-2);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: 32px;
  padding: 0 6px 0 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-button);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--t-fast);
}
.sidebar__cmdk:hover { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-secondary); }
.sidebar__cmdk svg { flex-shrink: 0; }
.sidebar__cmdk span { flex: 1; }
.sidebar__nav { padding: var(--s-3) var(--s-3); flex: 1; }
.sidebar__group { margin-bottom: var(--s-4); }
.sidebar__group-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  padding: var(--s-2) var(--s-3) var(--s-2);
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 6px var(--s-3);
  border-radius: var(--r-button);
  color: var(--text-secondary);
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.sidebar__item:hover { background: var(--bg-surface); color: var(--text-primary); }
.sidebar__item.is-active {
  background: var(--accent-bg);
  color: var(--text-primary);
}
.sidebar__item.is-active::before {
  content: "";
  position: absolute;
  left: -3px; top: 7px; bottom: 7px;
  width: 2px;
  background: var(--accent);
  border-radius: 99px;
}
.sidebar__icon {
  width: 16px; height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.sidebar__item.is-active .sidebar__icon { color: var(--accent); }
.sidebar__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.sidebar__sub {
  list-style: none;
  padding: 2px 0 var(--s-2) var(--s-6);
  margin: 0 0 0 var(--s-4);
  border-left: 1px solid var(--border-subtle);
}
.sidebar__sub li > a {
  display: block;
  padding: 4px var(--s-3);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  border-radius: var(--r-input);
  font-weight: var(--fw-regular);
}
.sidebar__sub li > a:hover { color: var(--text-primary); background: var(--bg-surface); }
.sidebar__sub li > a.is-active { color: var(--accent-text); font-weight: var(--fw-medium); }
.sidebar__footer {
  margin-top: auto;
  padding: var(--s-4) var(--s-5) 0;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar__footer a { color: var(--text-tertiary); }
.sidebar__footer a:hover { color: var(--text-secondary); }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  margin-bottom: var(--s-5);
}
.breadcrumb a { color: var(--text-secondary); transition: color var(--t-fast); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb__sep { color: var(--text-tertiary); user-select: none; opacity: 0.5; }
.breadcrumb__current { color: var(--text-primary); font-weight: var(--fw-medium); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 7px 13px;
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  border-radius: var(--r-button);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-elevated); border-color: var(--text-tertiary); }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg-surface); color: var(--text-primary); }
.btn--sm { padding: 4px 10px; font-size: var(--fs-12); }

/* ============================================================
   CALLOUTS
   ============================================================ */
.callout {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4) var(--s-3) var(--s-4);
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  margin: var(--s-4) 0;
  position: relative;
}
.callout::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  border-radius: 99px 0 0 99px;
}
.callout__icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.callout__icon svg { width: 16px; height: 16px; }
.callout__body { min-width: 0; font-size: var(--fs-14); line-height: 1.55; color: var(--text-secondary); }
.callout__title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-14);
  color: var(--text-primary);
  margin: 0 0 2px;
  letter-spacing: -0.005em;
}
.callout__body p { margin: 0; }
.callout__body p + p { margin-top: var(--s-2); }
.callout__body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-elevated);
  padding: 1px 5px;
  border-radius: var(--r-input);
}

.callout--info::before    { background: var(--accent); }
.callout--info .callout__icon { color: var(--accent-text); }
.callout--success::before { background: var(--success); }
.callout--success .callout__icon { color: var(--success); }
.callout--warning::before { background: var(--warning); }
.callout--warning .callout__icon { color: var(--warning); }
.callout--danger::before  { background: var(--danger); }
.callout--danger .callout__icon { color: var(--danger); }
.callout--tip::before     { background: var(--text-tertiary); }
.callout--tip .callout__icon { color: var(--text-secondary); }
.callout--quote {
  background: transparent;
  border-color: transparent;
  border-left: 2px solid var(--border-strong);
  border-radius: 0;
  padding-left: var(--s-4);
  grid-template-columns: 1fr;
}
.callout--quote::before { display: none; }
.callout--quote .callout__icon { display: none; }
.callout--quote .callout__body {
  font-size: var(--fs-16);
  color: var(--text-secondary);
  font-style: italic;
}
.callout--quote .callout__title { font-style: normal; color: var(--text-primary); margin-bottom: var(--s-1); }

/* ============================================================
   CTA-CARDS
   ============================================================ */
.cta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3);
}
.cta-grid--2 { grid-template-columns: repeat(2, 1fr); }
.cta-grid--3 { grid-template-columns: repeat(3, 1fr); }

.cta-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5) var(--s-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  transition: all var(--t-fast);
  text-decoration: none;
  color: inherit;
  position: relative;
  min-height: 132px;
}
.cta-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}
.cta-card__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-1);
}
.cta-card__tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.cta-card__title {
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.25;
  color: var(--text-primary);
  text-wrap: pretty;
}
.cta-card__desc {
  font-size: var(--fs-14);
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
  text-wrap: pretty;
}
.cta-card__meta {
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.cta-card__meta strong { color: var(--text-secondary); font-weight: var(--fw-medium); }
.cta-card__arrow {
  width: 14px; height: 14px;
  color: var(--text-tertiary);
  transition: transform var(--t-fast), color var(--t-fast);
}
.cta-card:hover .cta-card__arrow { transform: translateX(2px); color: var(--accent); }

/* Section-card на главной для крупных разделов */
.cta-card--section {
  padding: var(--s-5);
  min-height: 168px;
}
.cta-card--section .cta-card__title { font-size: var(--fs-25); }

/* Featured (Quiz / Tutor) */
.cta-card--feature {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  border-color: var(--border-strong);
  min-height: 156px;
}
.cta-card--feature .cta-card__icon-wrap {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-button);
  color: var(--accent);
}
.cta-card--feature .cta-card__progress {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.cta-card--feature .cta-card__progress strong {
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.cta-card__progressbar {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
  margin-top: var(--s-2);
}
.cta-card__progressbar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}

/* ============================================================
   HOME — Hero & section blocks
   ============================================================ */
.home-hero {
  display: grid;
  gap: var(--s-4);
  padding: var(--s-6) 0 var(--s-7);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-7);
}
.home-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.home-hero__title {
  font-size: var(--fs-39);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: var(--fw-semibold);
  margin: 0;
  max-width: 22ch;
  text-wrap: balance;
  color: var(--text-primary);
}
.home-hero__desc {
  font-size: var(--fs-16);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 64ch;
  margin: 0;
  text-wrap: pretty;
}

.block { margin-bottom: var(--s-7); }
.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.block__title {
  font-size: var(--fs-12);
  font-family: var(--font-mono);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  margin: 0;
}
.block__hint {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
}

/* Continue-row (последние читал) */
.continue-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
}
.continue-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  transition: all var(--t-fast);
}
.continue-card:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.continue-card__breadcrumb {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.continue-card__title {
  font-size: var(--fs-16);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  letter-spacing: -0.005em;
  line-height: 1.3;
  text-wrap: pretty;
}
.continue-card__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-1);
}
.continue-card__progress {
  flex: 1;
  height: 2px;
  background: var(--bg-elevated);
  border-radius: 99px;
  overflow: hidden;
}
.continue-card__progress > span {
  display: block; height: 100%;
  background: var(--accent);
}

/* ============================================================
   SECTION page — header & article list
   ============================================================ */
.section-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-6);
  align-items: end;
  padding: var(--s-3) 0 var(--s-6);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-6);
}
.section-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: var(--s-2);
}
.section-hero__title {
  font-size: var(--fs-31);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--s-3);
  text-wrap: balance;
  color: var(--text-primary);
}
.section-hero__desc {
  font-size: var(--fs-16);
  color: var(--text-secondary);
  margin: 0;
  max-width: 64ch;
  line-height: 1.55;
}
.section-hero__stats {
  display: flex;
  gap: var(--s-5);
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-hero__stats div { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.section-hero__stats strong {
  font-family: var(--font-sans);
  font-size: var(--fs-25);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Group label inside a section */
.group {
  margin-bottom: var(--s-6);
}
.group__head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  padding-bottom: var(--s-2);
}
.group__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  padding: 3px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
}
.group__label--accent { color: var(--accent-text); border-color: var(--accent-soft); background: var(--accent-bg); }
.group__title {
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-primary);
}
.group__desc {
  font-size: var(--fs-14);
  color: var(--text-secondary);
  margin: 0 0 var(--s-3);
}

/* Article list */
.article-list { display: grid; gap: 1px; background: var(--border-subtle); border: 1px solid var(--border-subtle); border-radius: var(--r-card); overflow: hidden; }
.article-list__item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface);
  transition: background var(--t-fast);
}
.article-list__item:hover { background: var(--bg-elevated); }
.article-list__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  width: 24px;
  text-align: center;
}
.article-list__main { min-width: 0; }
.article-list__title {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  margin: 0 0 2px;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.article-list__desc {
  font-size: var(--fs-12);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-list__tags { display: flex; gap: 6px; }
.article-list__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.chip--accent { color: var(--accent-text); background: var(--accent-bg); border-color: var(--accent-soft); }
.chip--success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.chip--warning { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.chip--danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

/* Filters */
.filters {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.filters__group {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-button);
  padding: 2px;
  gap: 2px;
}
.filters__chip {
  padding: 4px 9px;
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  border-radius: 4px;
  border: none;
  background: transparent;
  transition: all var(--t-fast);
  font-family: inherit;
}
.filters__chip:hover { color: var(--text-primary); }
.filters__chip.is-active { background: var(--bg-elevated); color: var(--text-primary); }
.filters__spacer { flex: 1; }
.filters__count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ============================================================
   ARTICLE page
   ============================================================ */
.article-header {
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
}
.article-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-3);
}
.article-eyebrow__chip {
  background: var(--accent-bg);
  color: var(--accent-text);
  padding: 2px 7px;
  border-radius: var(--r-input);
}
.article-title {
  font-size: var(--fs-39);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--s-3);
  text-wrap: balance;
  color: var(--text-primary);
}
.article-lede {
  font-size: var(--fs-20);
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 var(--s-4);
  max-width: 64ch;
  text-wrap: pretty;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.article-meta__item { display: inline-flex; align-items: center; gap: 6px; }
.article-meta__sep { width: 3px; height: 3px; border-radius: 99px; background: var(--text-tertiary); opacity: 0.5; }
.article-meta__action {
  margin-left: auto;
}

/* Article body */
.article-body { font-size: var(--fs-16); line-height: var(--lh-body); color: var(--text-primary); }
.article-body > * + * { margin-top: var(--s-4); }
.article-body h2 {
  font-size: var(--fs-25);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.015em;
  margin: var(--s-7) 0 var(--s-3);
  scroll-margin-top: 80px;
  color: var(--text-primary);
  text-wrap: balance;
}
.article-body h3 {
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  margin: var(--s-5) 0 var(--s-2);
  scroll-margin-top: 80px;
}
.article-body p { margin: 0; text-wrap: pretty; color: var(--text-primary); }
.article-body p + p { margin-top: var(--s-3); }
.article-body a:not(.cta-card) {
  color: var(--accent-text);
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color var(--t-fast);
}
.article-body a:not(.cta-card):hover { border-bottom-color: var(--accent); }
.article-body ul, .article-body ol { padding-left: var(--s-5); margin: var(--s-3) 0 var(--s-4); }
.article-body li { margin-bottom: 6px; color: var(--text-primary); }
.article-body li::marker { color: var(--text-tertiary); }
.article-body strong { font-weight: var(--fw-semibold); color: var(--text-primary); }
.article-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  padding: 1px 6px;
  color: var(--text-primary);
}
.article-body pre {
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: var(--s-4);
  border-radius: var(--r-card);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-14);
  line-height: 1.55;
  margin: var(--s-4) 0;
  position: relative;
}
.article-body pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.article-body pre .code-copy {
  position: absolute;
  top: 8px; right: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  color: var(--text-tertiary);
  cursor: pointer;
}
.article-body pre .code-copy:hover { color: var(--text-primary); border-color: var(--border-strong); }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-14);
  margin: var(--s-4) 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  overflow: hidden;
}
.article-body th, .article-body td {
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--border-subtle);
}
.article-body tr:last-child td { border-bottom: none; }
.article-body th {
  font-weight: var(--fw-semibold);
  background: var(--bg-sunken);
  font-size: var(--fs-12);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
}
.article-body tbody tr:nth-child(2n) td { background: var(--bg-sunken); }
.article-body hr { border: none; border-top: 1px solid var(--border-subtle); margin: var(--s-6) 0; }

/* Inline-quiz блок в статье */
.inline-quiz {
  margin: var(--s-6) 0;
  padding: var(--s-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.inline-quiz__icon {
  width: 40px; height: 40px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-button);
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.inline-quiz__main { flex: 1; min-width: 0; }
.inline-quiz__title { font-size: var(--fs-16); font-weight: var(--fw-semibold); margin: 0; color: var(--text-primary); }
.inline-quiz__desc { font-size: var(--fs-14); color: var(--text-secondary); margin: 2px 0 0; }

/* ============================================================
   TOC (right column)
   ============================================================ */
.toc {
  position: sticky;
  top: calc(var(--layout-topbar) + var(--s-5));
  font-size: var(--fs-12);
}
.toc__title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  margin: 0 0 var(--s-3);
}
.toc__list { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--border-subtle); }
.toc__list li { line-height: 1.4; }
.toc__list a {
  display: block;
  padding: 5px var(--s-3);
  color: var(--text-tertiary);
  transition: all var(--t-fast);
  border-left: 1px solid transparent;
  margin-left: -1px;
  font-size: var(--fs-12);
}
.toc__list a:hover { color: var(--text-primary); }
.toc__list a.is-active {
  color: var(--accent-text);
  border-left-color: var(--accent);
  font-weight: var(--fw-medium);
}
.toc__list .toc__nested { padding-left: var(--s-4); border: none; margin-top: 0; }
.toc__list .toc__nested a { font-size: var(--fs-12); color: var(--text-tertiary); }
.toc__aside {
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.toc__aside a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.toc__aside a:hover { color: var(--text-primary); }

/* ============================================================
   ⌘K MODAL
   ============================================================ */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: oklch(0% 0 0 / 0.6);
  display: grid;
  place-items: start center;
  padding-top: 12vh;
  z-index: var(--z-modal);
  backdrop-filter: blur(2px);
}
.cmdk {
  width: 100%;
  max-width: 620px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-modal);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.cmdk__search {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.cmdk__search svg { color: var(--text-tertiary); flex-shrink: 0; }
.cmdk__input {
  flex: 1;
  border: none; outline: none; background: none;
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  color: var(--text-primary);
}
.cmdk__input::placeholder { color: var(--text-tertiary); }
.cmdk__esc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 3px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  background: var(--bg-elevated);
}
.cmdk__list {
  list-style: none;
  margin: 0;
  padding: var(--s-1);
  overflow-y: auto;
  max-height: 440px;
}
.cmdk__group {
  padding: var(--s-3) var(--s-3) var(--s-1);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
}
.cmdk__item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-button);
  cursor: pointer;
  transition: background var(--t-fast);
}
.cmdk__item:hover,
.cmdk__item.is-active {
  background: var(--bg-elevated);
}
.cmdk__item-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  color: var(--text-tertiary);
}
.cmdk__item.is-active .cmdk__item-icon { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-bg); }
.cmdk__item-text { min-width: 0; }
.cmdk__item-title {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmdk__item-title mark {
  background: var(--accent-bg);
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
  padding: 0 1px;
  border-radius: 2px;
}
.cmdk__item-path {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.cmdk__item-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.cmdk__footer {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 8px var(--s-4);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.cmdk__footer-item { display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   BENTO — главная (плотная сетка с реальными данными в карточках)
   ============================================================ */
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s-3);
}
.bento > * { min-width: 0; }
.bento .col-3 { grid-column: span 3; }
.bento .col-4 { grid-column: span 4; }
.bento .col-5 { grid-column: span 5; }
.bento .col-6 { grid-column: span 6; }
.bento .col-7 { grid-column: span 7; }
.bento .col-8 { grid-column: span 8; }
.bento .col-12 { grid-column: span 12; }

/* Generic тёмная карточка */
.b-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: var(--s-4) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast), background var(--t-fast);
  position: relative;
  overflow: hidden;
}
a.b-card:hover { border-color: var(--border-strong); background: var(--bg-elevated); }
.b-card__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  margin-bottom: var(--s-1);
}
.b-card__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.b-card__title {
  font-size: var(--fs-20);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.012em;
  line-height: 1.2;
  margin: 0;
  color: var(--text-primary);
  text-wrap: pretty;
}
.b-card__desc {
  font-size: var(--fs-14);
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.b-card__foot {
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.b-card__foot strong { color: var(--text-secondary); font-weight: var(--fw-medium); }
.b-card__arrow {
  width: 14px; height: 14px;
  color: var(--text-tertiary);
  transition: transform var(--t-fast), color var(--t-fast);
}
a.b-card:hover .b-card__arrow { transform: translateX(2px); color: var(--accent); }

/* Featured «продолжить читать» */
.b-card--feature {
  background:
    radial-gradient(120% 80% at 100% 0%, var(--accent-bg) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-tint) 0%, var(--bg-surface) 100%);
  border-color: var(--border-strong);
  min-height: 280px;
}
.b-card--feature::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--border-subtle) 1px, transparent 0);
  background-size: 18px 18px;
  opacity: 0.5;
  pointer-events: none;
  mask-image: linear-gradient(180deg, transparent 0%, black 30%, black 100%);
}
.b-card--feature > * { position: relative; z-index: 1; }
.b-card--feature .b-card__title { font-size: var(--fs-25); letter-spacing: -0.018em; }

/* STAT row — 4 цифры в шапке */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  overflow: hidden;
  background: var(--bg-surface);
}
.stat {
  padding: var(--s-4) var(--s-5);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  min-width: 0;
}
.stat:last-child { border-right: none; }
.stat__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
}
.stat__value {
  font-size: var(--fs-31);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
  white-space: nowrap;
}
.stat__unit {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  letter-spacing: 0;
}
.stat__delta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--success);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.stat__delta--down { color: var(--danger); }
.stat__delta--flat { color: var(--text-tertiary); }
.stat__sparkline {
  position: absolute;
  inset: auto var(--s-3) var(--s-3) auto;
  width: 56px; height: 18px;
  opacity: 0.65;
  pointer-events: none;
}

/* Mini list of articles inside section card */
.mini-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.mini-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-14);
}
.mini-list li:last-child { border-bottom: none; }
.mini-list__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  width: 22px;
  text-align: right;
}
.mini-list__title { color: var(--text-primary); text-wrap: pretty; line-height: 1.4; min-width: 0; }
.mini-list__title strong { font-weight: var(--fw-medium); }
.mini-list__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.mini-list__dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 99px;
  background: var(--border-strong);
  margin-right: 6px;
}
.mini-list__dot--read { background: var(--success); }
.mini-list__dot--progress { background: var(--accent); }

/* Activity strip — горизонтальная плотная сводка за период */
.activity {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-5);
  align-items: center;
  padding: var(--s-3) var(--s-5);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
}
.activity__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
}
.activity__bars {
  display: grid;
  grid-template-columns: repeat(28, 1fr);
  gap: 3px;
  height: 28px;
  align-items: end;
}
.activity__bar {
  background: var(--bg-elevated);
  border-radius: 1px;
  min-height: 2px;
}
.activity__bar--accent { background: var(--accent); }
.activity__bar--soft   { background: var(--accent-soft); }
.activity__legend {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex; gap: var(--s-4);
}
.activity__legend strong { color: var(--text-primary); font-weight: var(--fw-semibold); font-family: var(--font-sans); font-size: var(--fs-14); }

/* Quiz / Tutor sparkline-card */
.b-card--practice .b-card__title { font-size: var(--fs-20); }
.b-card--practice .practice-chart {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
  height: 56px;
  align-items: end;
  margin: 6px 0 var(--s-2);
}
.b-card--practice .practice-chart > span {
  background: var(--accent-soft);
  border-radius: 2px;
  position: relative;
}
.b-card--practice .practice-chart > span.high { background: var(--accent); }
.b-card--practice .practice-chart > span.miss { background: var(--bg-elevated); border: 1px solid var(--border-subtle); }

.b-card--tutor .tutor-card {
  margin-top: var(--s-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  padding: var(--s-3);
  font-size: var(--fs-14);
  color: var(--text-secondary);
  position: relative;
}
.b-card--tutor .tutor-card::before {
  content: "Q";
  position: absolute;
  top: -1px; right: -1px;
  width: 22px; height: 22px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: 0 var(--r-input) 0 var(--r-input);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-bold);
  color: var(--accent-text);
  display: grid; place-items: center;
}

/* Section-card on home — с мини-списком статей внутри */
.b-card--section { min-height: 320px; }
.b-card--section .b-card__title { font-size: var(--fs-25); letter-spacing: -0.018em; }
.b-card--section .b-card__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: var(--s-1);
}

/* Hero, перекраиваем для двухколоночности */
.home-hero--wide {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
  gap: var(--s-6);
  align-items: end;
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-5);
}
.home-hero--wide .home-hero__title { font-size: var(--fs-49); line-height: 1.02; max-width: 14ch; }
.home-hero--wide .home-hero__desc { font-size: var(--fs-16); max-width: 56ch; }
.home-hero__meta {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding-bottom: 8px;
}
.home-hero__meta-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  column-gap: var(--s-3);
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.home-hero__meta-row:last-child { border-bottom: none; }
.home-hero__meta-row svg { color: var(--accent); flex-shrink: 0; }
.home-hero__meta-row .meta-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.home-hero__meta-row .meta-text > span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.home-hero__meta-row strong {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  letter-spacing: -0.005em;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-hero__meta-row .meta-hint {
  color: var(--text-tertiary);
  font-size: 11px;
  white-space: nowrap;
}

/* Tiny tag inside cards */
.dotline { display: inline-flex; align-items: center; gap: 6px; }
.dotline::before {
  content: ""; width: 6px; height: 6px; border-radius: 99px; background: var(--accent);
}

/* SVG sparkline inline */
.sparkline-svg { width: 100%; height: 32px; }
.sparkline-svg path { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.sparkline-svg circle { fill: var(--accent); }

@media (max-width: 1200px) {
  .home-hero--wide { grid-template-columns: 1fr; align-items: start; gap: var(--s-5); }
  .home-hero--wide .home-hero__title { max-width: 22ch; font-size: var(--fs-39); }
}
@media (max-width: 1100px) {
  .bento .col-3, .bento .col-4 { grid-column: span 6; }
  .bento .col-5, .bento .col-7 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .bento .col-3, .bento .col-4, .bento .col-5, .bento .col-6, .bento .col-7, .bento .col-8 { grid-column: span 12; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat { border-bottom: 1px solid var(--border-subtle); }
  .stat:nth-child(2n) { border-right: none; }
  .stat:nth-last-child(-n+2) { border-bottom: none; }
}

/* ============================================================
   HOME PAGE — 2-col layout с rail (как section)
   ============================================================ */
.page--home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s-7);
  max-width: var(--layout-max);
  align-items: start;
}
.page--home > .home-main { min-width: 0; }
.home-rail {
  position: sticky;
  top: calc(var(--layout-topbar) + var(--s-5));
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* About / philosophy block */
.about-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: var(--s-6) var(--s-6);
  margin-bottom: var(--s-7);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 1fr;
  gap: var(--s-7);
  align-items: start;
}
.about-block__head {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.about-block__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
}
.about-block__title {
  font-size: var(--fs-25);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.018em;
  margin: 0;
  line-height: 1.2;
  text-wrap: balance;
}
.about-block__lede {
  font-size: var(--fs-16);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.55;
  max-width: 56ch;
}
.about-block__pillars {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--s-3);
}
.about-block__pillar {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--s-3);
  font-size: var(--fs-14);
  line-height: 1.5;
}
.about-block__pillar-mark {
  width: 28px; height: 28px;
  border-radius: var(--r-input);
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-bold);
}
.about-block__pillar-name { color: var(--text-primary); font-weight: var(--fw-semibold); }
.about-block__pillar-desc { color: var(--text-secondary); font-size: var(--fs-13); display: block; }

/* Today's plan in rail */
.rail-plan { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.rail-plan li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: var(--s-2);
  align-items: center;
  font-size: var(--fs-13);
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.rail-plan li:last-child { border-bottom: none; }
.rail-plan__checkbox {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  display: grid; place-items: center;
}
.rail-plan li.is-done .rail-plan__checkbox {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.rail-plan li.is-done .rail-plan__name { color: var(--text-tertiary); text-decoration: line-through; }
.rail-plan li.is-active .rail-plan__checkbox {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.rail-plan__name { color: var(--text-primary); min-width: 0; }
.rail-plan li.is-active .rail-plan__name { font-weight: var(--fw-semibold); }
.rail-plan__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Achievements grid */
.rail-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.rail-badge {
  aspect-ratio: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-input);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-bold);
  color: var(--text-tertiary);
  text-align: center;
  line-height: 1.1;
  padding: 4px;
  position: relative;
}
.rail-badge.is-unlocked {
  background: var(--accent-bg);
  border-color: var(--accent-soft);
  color: var(--accent-text);
}
.rail-badge.is-locked { opacity: 0.45; }
.rail-badge[title]:hover { border-color: var(--border-strong); }

/* Profile mini-card */
.rail-profile {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.rail-profile__avatar {
  width: 40px; height: 40px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: grid; place-items: center;
  color: var(--text-secondary);
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
}
.rail-profile__name { font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--text-primary); }
.rail-profile__meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }

@media (max-width: 1100px) {
  .page--home { grid-template-columns: minmax(0, 1fr); }
  .home-rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .home-rail > .rail-card { flex: 1 1 240px; }
  .about-block { grid-template-columns: 1fr; padding: var(--s-5); gap: var(--s-5); }
}

/* ============================================================
   SECTION DASHBOARD — горизонтальная сводка под hero
   ============================================================ */
.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  background: var(--bg-surface);
  overflow: hidden;
  margin-bottom: var(--s-5);
}
.dashboard__col {
  padding: var(--s-4) var(--s-5);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.dashboard__col:last-child { border-right: none; }
.dashboard__col-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.dashboard__col-title a { color: var(--text-tertiary); }
.dashboard__col-title a:hover { color: var(--text-primary); }
.dashboard .rail-topics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

@media (max-width: 1100px) {
  .dashboard { grid-template-columns: 1fr; }
  .dashboard__col { border-right: none; border-bottom: 1px solid var(--border-subtle); }
  .dashboard__col:last-child { border-bottom: none; }
  .dashboard .rail-topics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .dashboard .rail-topics { grid-template-columns: 1fr; }
}

/* ============================================================
   SECTION PAGE — 2-col layout with right rail
   ============================================================ */
.page--section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--s-7);
  max-width: var(--layout-max);
  align-items: start;
}
.page--section > .section-main { min-width: 0; }
.section-rail {
  position: sticky;
  top: calc(var(--layout-topbar) + var(--s-5));
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.rail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.rail-card__title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-tertiary);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.rail-card__title a { color: var(--text-tertiary); }
.rail-card__title a:hover { color: var(--text-primary); }

.rail-progress {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.rail-progress__big {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  font-size: var(--fs-31);
  line-height: 1;
  color: var(--text-primary);
}
.rail-progress__big span {
  font-size: var(--fs-14);
  color: var(--text-tertiary);
  font-weight: var(--fw-regular);
  letter-spacing: 0;
}
.rail-progress__bar {
  height: 6px;
  background: var(--bg-sunken);
  border-radius: 99px;
  overflow: hidden;
}
.rail-progress__bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.rail-progress__meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* По темам — мини-бары точности */
.rail-topics { display: flex; flex-direction: column; gap: var(--s-2); }
.rail-topic {
  display: grid;
  grid-template-columns: 1fr 40px auto;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-13);
}
.rail-topic__name { color: var(--text-primary); font-weight: var(--fw-medium); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-topic__bar {
  height: 4px;
  background: var(--bg-sunken);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}
.rail-topic__bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
}
.rail-topic__bar.high > span { background: var(--success); }
.rail-topic__bar.mid > span { background: var(--accent); }
.rail-topic__bar.low > span { background: var(--warning); }
.rail-topic__bar.miss > span { background: var(--danger); }
.rail-topic__pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: right;
}

/* Next-up — большая ссылочная карточка */
.rail-next {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--s-3);
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-input);
  text-decoration: none;
  color: inherit;
}
.rail-next__eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text);
  font-weight: var(--fw-semibold);
}
.rail-next__title {
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.rail-next__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: 2px;
}

/* Related — список ссылок на смежные разделы */
.rail-related { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.rail-related li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 6px 0;
  font-size: var(--fs-13);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.rail-related li:last-child > a { border-bottom: none; }
.rail-related li > a:hover { color: var(--text-primary); }
.rail-related li > a span { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }

/* Section-hero для широкого варианта */
.section-hero--wide {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 320px;
  gap: var(--s-6);
  align-items: end;
  padding: var(--s-3) 0 var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-5);
}
.section-hero--wide .section-hero__title { font-size: var(--fs-39); }
.section-hero--wide .section-hero__quick {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
}
.section-hero--wide .section-hero__quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.section-hero--wide .section-hero__quick-row:last-child { border-bottom: none; }
.section-hero--wide .section-hero__quick-row strong {
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-14);
  letter-spacing: -0.005em;
}

@media (max-width: 1100px) {
  .page--section { grid-template-columns: minmax(0, 1fr); }
  .section-rail { position: static; flex-direction: row; flex-wrap: wrap; }
  .section-rail > .rail-card { flex: 1 1 240px; }
  .section-hero--wide { grid-template-columns: 1fr; align-items: start; }
}

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 1100px) {
  .page--article { grid-template-columns: minmax(0, 1fr); max-width: var(--layout-content); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .page { padding: var(--s-5) var(--s-4) var(--s-7); }
  .home-hero__title { font-size: var(--fs-31); }
  .article-title { font-size: var(--fs-31); }
  .section-hero { grid-template-columns: 1fr; }
  .section-hero__stats { text-align: left; }
  .continue-row { grid-template-columns: 1fr; }
  .cta-grid--3, .cta-grid--2 { grid-template-columns: 1fr; }
  .topbar__search { min-width: 0; flex: 1; }
  .topbar__crumbs { display: none; }
}

/* ============================================================
   READ TOGGLE — кнопка «отметить прочитанным» в topbar
   ============================================================ */
.read-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-button);
  font-family: var(--font-sans);
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}
.read-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.read-toggle svg { stroke: currentColor; }
.read-toggle.is-read {
  background: var(--success-soft, color-mix(in oklch, var(--success) 14%, transparent));
  border-color: var(--success);
  color: var(--success);
}
.read-toggle.is-read:hover {
  background: var(--success-soft, color-mix(in oklch, var(--success) 22%, transparent));
  color: var(--success);
}
.read-toggle__label { letter-spacing: -0.005em; }
@media (max-width: 720px) {
  .read-toggle__label { display: none; }
  .read-toggle { padding: 6px; }
}
