/* Mavzular katalogi.
 *
 * Ranglar faqat tokens.css dan — bu yerda hex yo'q. Motion primitivlari
 * (.motion-control, .motion-surface) motion.css da.
 *
 * Ikki ustun: bo'limlar (chap) va tanlangan bo'limning mavzulari (o'ng).
 * 900px dan tor ekranda `data-topics-view` bittasini ko'rsatadi.
 */

.topics-page {
  width: min(100% - 40px, var(--content-width));
  margin: auto;
  padding: 52px 0 100px;
}

.topics-hero { max-width: 720px; }
.topics-hero h1 {
  margin: 8px 0 12px;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: -.045em;
}
.topics-lede {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 68ch;
}

/* ─── Qidiruv ───────────────────────────────────────────────────────────── */
.topics-toolbar {
  margin: 30px 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  background: var(--surface-structural);
  box-shadow: var(--shadow-card);
}
.topics-search { display: grid; gap: 8px; }
.topics-search-label { font-weight: 700; font-size: 14px; }
.topics-search input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-interactive);
  color: var(--text-primary);
}
.topics-search input:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ─── Joylashuv ─────────────────────────────────────────────────────────── */
.topics-layout {
  display: grid;
  grid-template-columns: minmax(280px, 5fr) minmax(0, 7fr);
  gap: 20px;
  align-items: start;
}

.topics-panel-heading {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.02em;
}
.topics-panel-heading:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 4px; border-radius: 6px; }

/* ─── Bo'limlar ─────────────────────────────────────────────────────────── */
.topics-sections-panel {
  position: sticky;
  top: calc(var(--header-height) + 12px);
  display: grid;
  gap: 12px;
}
.section-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  /* Bo'limlar 27 ta — ustun o'z ichida aylanadi, sahifa emas. */
  max-height: calc(100vh - var(--header-height) - 96px);
  overflow-y: auto;
  padding-right: 4px;
}
.section-card {
  width: 100%;
  min-height: 64px;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-interactive);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.section-card:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.section-card[aria-current="true"] {
  border-color: var(--accent);
  background: var(--surface-selected);
}
.section-card.is-planned { color: var(--text-secondary); }
@media (hover: hover) and (pointer: fine) {
  .section-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
  .section-card[aria-current="true"]:hover { background: var(--surface-selected); }
}
.section-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.section-index { color: var(--text-tertiary); font-size: 12px; font-weight: 750; letter-spacing: .1em; }
.section-kind {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--canvas-raised);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
}
.section-title { font-weight: 720; font-size: 15px; letter-spacing: -.01em; }
.section-subtitle { color: var(--text-secondary); font-size: 13px; line-height: 1.4; }
.section-meta { display: grid; gap: 6px; margin-top: 4px; }
.section-count { color: var(--text-tertiary); font-size: 12px; font-weight: 700; }
.section-progress {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}
.section-progress-bar { display: block; height: 100%; background: var(--accent); }

/* ─── Mavzular ──────────────────────────────────────────────────────────── */
.topics-list-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-panel);
  background: var(--surface-structural);
  box-shadow: var(--shadow-card);
}
.topics-back { display: none; justify-self: start; }
.topics-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.topics-panel-meta { color: var(--text-tertiary); font-size: 13px; }
.topics-hint, .topics-status { margin: 0; color: var(--text-secondary); line-height: 1.55; }
.topics-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.topics-status[role="alert"] { color: var(--danger); }

.topic-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.topic-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-interactive);
  color: var(--text-primary);
  text-decoration: none;
}
a.topic-row:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  a.topic-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
}
.topic-row.is-planned { color: var(--text-secondary); background: var(--canvas-raised); }
.topic-id { color: var(--text-tertiary); font-size: 12px; font-weight: 750; letter-spacing: .06em; }
.topic-body { display: grid; gap: 3px; min-width: 0; }
.topic-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.topic-section { color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.topic-covers {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topic-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--canvas-raised);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.topic-status.is-ready { background: var(--surface-selected); color: var(--accent-strong); }
.topic-icon { display: inline-grid; place-items: center; }

/* ─── Mobil ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topics-page { width: min(100% - 28px, 720px); padding: 28px 0 96px; }
  .topics-layout { display: block; }
  .topics-sections-panel { position: static; }
  .section-list { max-height: none; overflow: visible; padding-right: 0; }
  .topics-back { display: inline-flex; }
  [data-topics-view="sections"] .topics-list-panel { display: none; }
  [data-topics-view="topics"] .topics-sections-panel { display: none; }
  .topic-row { grid-template-columns: auto minmax(0, 1fr); }
  .topic-status { grid-column: 2; justify-self: start; }
}
