/* ============================================================
   tech.css — страница технического разбора (/tech/)

   Pixel-perfect типографика и сетка в дизайн-системе ClickShot.
   ============================================================ */

html, body { overflow-x: clip; }

/* ===== ПРОГРЕСС ЧТЕНИЯ ===== */

.bl-reading-progress {
  position: fixed;
  z-index: 80;
  bottom: 22px;
  left: max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 7px;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--white) 17%, transparent);
  border-radius: var(--r-pill, 999px);
  background: color-mix(in srgb, var(--ink-950) 94%, transparent);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--ink-950) 25%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(12px) scale(.96);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.bl-reading-progress.is-visible { opacity: 1; transform: translateY(0) scale(1); }
.bl-reading-progress-ring {
  width: 34px;
  height: 34px;
  overflow: visible;
  transform: rotate(-90deg);
}
.bl-reading-progress-ring-track,
.bl-reading-progress-ring-value { fill: none; stroke-width: 3.5; }
.bl-reading-progress-ring-track { stroke: color-mix(in srgb, var(--white) 18%, transparent); }
.bl-reading-progress-ring-value {
  stroke: var(--lime);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset .22s var(--ease-out);
}
.bl-reading-progress-copy { display: grid; gap: 1px; line-height: 1; }
.bl-reading-progress-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
}
.bl-reading-progress-caption { font-size: 10px; color: var(--ink-400); }

/* --- Раскладка: липкий сайдбар + колонка контента ---------------- */

.tech-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px;
  padding: 56px 0 88px;
  align-items: start;
}

.tech-toc {
  position: sticky;
  top: 96px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 8px;
  border-left: 2px solid var(--ink-150);
}

.tech-toc-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin: 0 0 14px 16px;
}

.tech-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tech-toc a {
  display: block;
  padding: 7px 0 7px 16px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  border-bottom: none !important;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-500);
  text-decoration: none;
  border-radius: 0 var(--r-2) var(--r-2) 0;
  transition: color var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out),
              background var(--dur-2) var(--ease-out);
}

.tech-toc a:hover {
  color: var(--ink-950);
  background: var(--ink-50);
  border-bottom: none !important;
}

.tech-toc a.is-active {
  color: var(--ink-950);
  border-left-color: var(--lime);
  background: var(--ink-50);
  font-weight: 600;
  border-bottom: none !important;
}

/* На компактных десктопах 960–1120px */
@media (max-width: 1120px) and (min-width: 921px) {
  .tech-layout {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 36px;
  }
  .tech-toc a {
    font-size: 12.5px;
    padding: 6px 0 6px 12px;
  }
  .tech-toc-label {
    margin-left: 12px;
  }
}

/* Мобильная версия и планшеты <= 920px (как в блоге) */
@media (max-width: 920px) {
  .tech-layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 36px 0 64px;
  }
  .tech-body {
    order: 1;
    gap: 44px;
  }
  .tech-toc {
    order: 2;
    position: static;
    border-left: none;
    border-top: 1px solid var(--ink-200);
    padding-top: 24px;
    padding-right: 0;
    max-height: none;
  }
  .tech-toc-label {
    margin-left: 0;
    margin-bottom: 12px;
  }
  .tech-toc ol {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .tech-toc a {
    padding: 7px 14px;
    margin-left: 0;
    border: 1px solid var(--ink-200);
    border-radius: var(--r-pill, 999px);
    font-size: 13px;
    background: var(--white);
  }
  .tech-toc a:hover {
    background: var(--ink-100);
    border-color: var(--ink-300);
  }
  .tech-toc a.is-active {
    background: var(--ink-950);
    color: var(--white);
    border-color: var(--ink-950);
  }
}

/* --- Колонка контента (Pixel Perfect) ---------------------------- */

.tech-body {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 56px;
}

.tech-section {
  display: grid;
  gap: 16px;
  scroll-margin-top: 96px;
  min-width: 0;
  width: 100%;
}

.tech-section > h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--ink-950);
  margin: 0 0 10px;
  width: 100%;
  max-width: 100%;
}

.tech-num {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
  color: var(--ink-400);
  margin-right: 12px;
}

.tech-section > h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink-950);
  margin: 16px 0 0;
}

.tech-section > p,
.tech-section > ul,
.tech-section > ol {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.tech-section > p {
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--ink-700);
}

.tech-section strong {
  color: var(--ink-950);
  font-weight: 600;
}

.tech-section > ul,
.tech-section > ol {
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.tech-section li {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-700);
}

.tech-section li::marker { color: var(--ink-400); }

.tech-section code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--ink-100);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--ink-900);
  border: 1px solid var(--ink-200);
}

/* --- Премиальные блоки кода с копированием ---------------------- */

.tech-code {
  margin: 14px 0 20px;
  border-radius: var(--r-3, 10px);
  overflow: hidden;
  background: var(--ink-950);
  border: 1px solid var(--ink-800);
  box-shadow: var(--shadow-1);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.tech-code-head {
  background: #141414;
  color: var(--ink-300);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tech-code-lang {
  color: var(--lime);
  font-weight: 600;
  text-transform: uppercase;
}

.tech-code-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-pill, 999px);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-200);
  transition: all var(--dur-2) var(--ease-out);
}
.tech-code-copy:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.3);
}
.tech-code-copy.is-done {
  color: var(--ink-950);
  background: var(--lime);
  border-color: var(--lime);
  font-weight: 700;
}

.tech-code pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  max-width: 100%;
  background: transparent;
}

.tech-code pre code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  white-space: pre;
}

/* --- Пайплайн диаграмма (Pixel Perfect) -------------------------- */

.tech-pipe-scroll {
  overflow-x: auto;
  padding: 4px 0 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.tech-pipe {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(135px, 1fr);
  gap: 10px;
  width: 100%;
  min-width: 680px;
}

.tech-stage {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-3);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.tech-stage-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-950);
}

.tech-stage-what {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-600);
}

.tech-stage.is-ai {
  border-color: var(--ink-950);
  background: var(--lime-100);
}

.tech-stage.is-muted {
  background: var(--ink-50);
  opacity: 0.7;
}

/* --- Врезки ------------------------------------------------------ */

.tech-note {
  background: var(--cream);
  border-radius: var(--r-3);
  padding: var(--s-5) var(--s-6);
  display: grid;
  gap: var(--s-2);
  max-width: 72ch;
}

.tech-note-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-600);
}

.tech-note p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-800);
}

.tech-note--dark {
  background: var(--ink-950);
}

.tech-note--dark .tech-note-tag { color: var(--lime); }
.tech-note--dark p { color: var(--ink-200); }
.tech-note--dark code {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-100);
}

/* --- Таблицы ----------------------------------------------------- */

.tech-table-scroll { overflow-x: auto; }

.tech-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  background: var(--white);
  border: var(--border-hair);
  border-radius: var(--r-3);
  overflow: hidden;
}

.tech-table th,
.tech-table td {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: var(--border-hair);
  vertical-align: top;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-700);
}

.tech-table th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  background: var(--ink-50);
}

.tech-table tbody tr:last-child td { border-bottom: none; }
.tech-table td:first-child { color: var(--ink-950); font-weight: 500; }

/* --- Карточки шагов подкаста ------------------------------------- */

.tech-cards {
  display: grid;
  gap: var(--s-4);
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
}

.tech-card {
  background: var(--white);
  border: var(--edge-border-w) solid var(--edge-border-color);
  border-radius: var(--edge-radius);
  box-shadow: var(--edge-shadow);
  padding: var(--s-5);
  display: grid;
  gap: var(--s-2);
  align-content: start;
}

.tech-card-step {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.tech-card h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--ink-950);
}

.tech-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-600);
}

/* --- Список грабель ---------------------------------------------- */

.tech-lessons {
  display: grid;
  gap: 0;
  counter-reset: tech-lesson;
  max-width: 78ch;
}

.tech-lesson {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-5) 0;
  border-bottom: var(--border-hair);
}

.tech-lesson:first-child { padding-top: 0; }

.tech-lesson::before {
  counter-increment: tech-lesson;
  content: counter(tech-lesson, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-400);
  padding-top: 4px;
}

.tech-lesson-body { display: grid; gap: var(--s-2); }

.tech-lesson-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--ink-950);
}

.tech-lesson-body p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-600);
}

/* --- Подвал разбора ---------------------------------------------- */

.tech-outro {
  margin-top: var(--s-4);
  padding-top: var(--s-6);
  border-top: var(--border-hair);
  max-width: 68ch;
}

.tech-outro p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink-500);
}

/* --- Блок скачивания скилла ---------------------------------------- */

.tech-download {
  background: var(--ink-950);
  border-radius: var(--r-5);
  padding: var(--s-8);
  display: grid;
  gap: var(--s-5);
  margin-top: var(--s-4);
}

.tech-download-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--lime);
  margin: 0;
}

.tech-download h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(20px, 2.6vw, 26px);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--white);
  margin: 0;
  max-width: 24ch;
}

.tech-download p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-300);
  max-width: 62ch;
}

.tech-download code {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink-100);
}

.tech-download-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
}

.tech-download-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-500);
}

.tech-download-files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tech-download-files li {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-400);
  border: 1px solid var(--ink-800);
  border-radius: var(--r-2);
  padding: 5px 10px;
}
