/* ──────────────────────────────────────────────────────────────────────────
   Каталог (courses.html) и годовая траектория (trajectory.html).
   Тот же лист, что на главной: клетка 24px, красная черта поля, синие чернила.
   Красная ручка только у строк, где есть проверка. Подключается после style.css.
   ────────────────────────────────────────────────────────────────────────── */

.cat p, .tj p { max-width: 40em; }

/* ── Каталог: первый лист ─────────────────────────────────────────────────── */

.cat-hero {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: 72px; row-gap: 48px; padding: 48px 0; align-items: end;
}
.cat-hero h1 { margin: 0 0 24px; }
.cat-intro p { color: var(--ink-soft); }
.cat-intro .cta { margin-top: 48px; }
.cat-hero .epi { padding-bottom: 72px; }

/* ── Каталог: реестр программ строками ───────────────────────────────────── */

.cat-list { padding: 24px 0 48px; }
.cat-bar {
  position: sticky; top: 72px; z-index: 5;
  margin: 0 -12px 24px; padding: 12px;
  background: var(--paper);
}
.cat-rows { border-bottom: 2px solid var(--ink); }

.cat .cat-row {
  display: grid; grid-template-columns: 168px minmax(0, 1fr) 264px; column-gap: 24px;
  padding: 23px 0 24px; border-top: 1px solid var(--grid-strong);
}
.cat .cat-row:first-child { border-top: 2px solid var(--ink); padding-top: 22px; }
.cat .cat-row.is-hidden { display: none; }
.cat .cat-row .tag { grid-column: 1; grid-row: 1; margin: 0; font: 600 24px/24px var(--font-hand); color: var(--ink-soft); }

.row-main { grid-column: 2; min-width: 0; }
.row-main h2 { font-size: 22px; line-height: 24px; font-weight: 700; letter-spacing: 0; max-width: 30em; }
.row-main .program-type { margin: 0; font-size: 14px; line-height: 24px; color: var(--ink-soft); }
.row-main .row-desc { margin: 24px 0 0; }

/* тематический план: строки модулей, короткий штрих чернилами слева */
.cat .plan { list-style: none; margin: 24px 0 0; padding: 0; font-size: 16px; line-height: 24px; color: var(--ink-soft); max-width: 40em; }
.cat .plan li { position: relative; padding-left: 24px; }
.cat .plan li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 10px; height: 1.5px; background: var(--ink-soft); border-radius: 1px; }

.row-side { grid-column: 3; display: grid; align-content: start; justify-items: start; }
.row-side p { margin: 0; }
.row-side .hours { font-weight: 800; font-size: 26px; line-height: 48px; margin-top: -12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-side .term { font-size: 15px; line-height: 24px; color: var(--ink-soft); }
.row-side .checkline { margin-top: 24px; position: relative; font: 600 23px/24px var(--font-hand); color: var(--ink-soft); }
.row-side .checkline.chk { color: var(--pen); padding-left: 24px; }
.row-side .checkline.chk::before {
  content: ""; position: absolute; left: 4px; top: 3px; width: 6px; height: 13px;
  border-right: 2.5px solid var(--pen); border-bottom: 2.5px solid var(--pen); transform: rotate(40deg);
}
.row-side .by-plan { font-size: 14px; line-height: 24px; color: var(--ink-soft); }
.row-side .btn { margin-top: 24px; }

.cat .individual-cta { margin: 0 0 72px; }

/* ── Траектория: первый лист ─────────────────────────────────────────────── */

.tj-hero {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  column-gap: 72px; row-gap: 24px; padding: 48px 0; align-items: start;
}
.tj-hero h1 { margin: 0 0 48px; }
.tj-hero .tj-text p { color: var(--ink-soft); }
.tj-hero .tj-text p:first-child { color: var(--ink); font-size: 18px; }

.tj .sec-lead { margin: 0; }

/* ── Лестница: план с отступами, как оглавление в тетради ────────────────── */

.ladder { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.rung {
  --d: 0;
  position: relative; display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: 24px;
  margin-left: calc(var(--d) * 48px); padding: 23px 0 24px; border-bottom: 1px solid var(--grid-strong);
}
.rung:nth-child(2) { --d: 1; } .rung:nth-child(3) { --d: 2; } .rung:nth-child(4) { --d: 3; } .rung:nth-child(5) { --d: 4; }
/* скобка-уголок от уровня выше */
.rung + .rung::before {
  content: ""; position: absolute; left: -36px; top: -1px; width: 24px; height: 36px;
  border-left: 1.5px solid var(--ink-soft); border-bottom: 1.5px solid var(--ink-soft); border-radius: 0 0 0 6px;
}
.rung h3 { font-size: 22px; line-height: 24px; }
.rung .size { display: block; margin-top: 0; font: 600 23px/24px var(--font-hand); color: var(--ink-soft); }
.rung p { margin: 0; }
.rung .sees { margin-top: 24px; position: relative; font-size: 15px; line-height: 24px; color: var(--ink-soft); }
.rung .sees.chk { padding-left: 24px; }
.rung .sees.chk::before {
  content: ""; position: absolute; left: 4px; top: 3px; width: 6px; height: 13px;
  border-right: 2.5px solid var(--pen); border-bottom: 2.5px solid var(--pen); transform: rotate(40deg);
}
/* внизу лестницы одна единица: вклеенный листок */
.rung:last-child { border: 2px solid var(--ink); border-radius: 8px; padding: 22px; margin-top: 24px; background: var(--paper); }
.rung:last-child::before { top: -26px; height: 60px; }

/* ── Год на развороте ────────────────────────────────────────────────────── */

.spread {
  position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px;
  padding: 22px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper);
}
.spread::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--grid-strong); box-shadow: 3px 0 0 var(--grid); }
.page-half { display: grid; align-content: start; }
.stage { padding: 0 0 24px; }
.stage + .stage { padding-top: 23px; border-top: 1px solid var(--grid-strong); }
.stage h3 { font-size: 22px; line-height: 24px; }
.stage .hrs { margin: 0; font: 600 23px/24px var(--font-hand); color: var(--ink-soft); }
.stage ul { list-style: none; margin: 24px 0 0; padding: 0; font-size: 16px; line-height: 24px; }
.stage li { position: relative; padding-left: 24px; }
.stage li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 10px; height: 1.5px; background: var(--ink); border-radius: 1px; }

/* полоса года: клетка = 4 ак. ч, четыре ступени штриховкой разной плотности */
.cells { display: grid; grid-template-columns: repeat(40, minmax(0, 1fr)); margin: 48px 0 0; border: 1.5px solid var(--ink); }
.cells i { display: block; height: 24px; border-right: 1px solid var(--grid-strong); transition: background-color .2s ease; }
.cells i:last-child { border-right: 0; }
/* штриховка карандашом: плитки svg, как штрих в тетради */
.cells i.s1 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M0 6L6 0M-1 1L1 -1M5 7L7 5' stroke='%234a5b8c' stroke-width='1.1' fill='none'/%3E%3C/svg%3E"); }
.cells i.s2 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Cpath d='M0 0L6 6M-1 5L1 7M5 -1L7 1' stroke='%234a5b8c' stroke-width='1.1' fill='none'/%3E%3C/svg%3E"); }
.cells i.s3 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Cpath d='M2 0V4' stroke='%234a5b8c' stroke-width='1.1' fill='none'/%3E%3C/svg%3E"); }
.cells i.s4 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Cpath d='M0 4L4 0M-1 1L1 -1M3 5L5 3' stroke='%2324306e' stroke-width='1.1' fill='none'/%3E%3C/svg%3E"); }
.cells i.end { border-right: 2px solid var(--ink); }
.tj .cells-sum { margin: 0; max-width: none; display: grid; grid-template-columns: 10fr 10fr 8fr 12fr; font: 600 23px/48px var(--font-hand); color: var(--ink-soft); }
.cells-sum span:last-child { color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .year:has(.stage[data-s="1"]:hover) .cells i.s1,
  .year:has(.stage[data-s="2"]:hover) .cells i.s2,
  .year:has(.stage[data-s="3"]:hover) .cells i.s3,
  .year:has(.stage[data-s="4"]:hover) .cells i.s4 { background-color: var(--pen-wash); }
}
.tj-total { margin-top: 24px; color: var(--ink-soft); font-size: 16px; }

/* ── Ставки и ритм ───────────────────────────────────────────────────────── */

.rates { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--grid-strong); }
.rates > div { padding: 22px 0 24px; }
.rates { column-gap: 48px; }
.rates > div + div { position: relative; }
.rates > div + div::before { content: ""; position: absolute; left: -24px; top: 0; bottom: 0; width: 1px; background: var(--grid-strong); }
.rates h3 { margin: 0 0 24px; }
.rates ul { list-style: none; margin: 0; padding: 0; font-size: 16px; line-height: 24px; }
.rates li { position: relative; padding-left: 24px; }
.rates li + li { margin-top: 12px; }
.rates li::before { content: ""; position: absolute; left: 2px; top: 12px; width: 10px; height: 1.5px; background: var(--ink); border-radius: 1px; }

/* три примера ритма: строки расчёта, как решение в тетради */
.rhythms { margin-top: 48px; border-top: 2px solid var(--ink); }
.rhythm { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr); column-gap: 24px; padding: 23px 0 24px; border-bottom: 1px solid var(--grid-strong); }
.rhythm h3 { margin: 0 0 24px; }
.rhythm p { margin: 0; font-size: 16px; color: var(--ink-soft); }
.calc { font-size: 17px; line-height: 24px; font-variant-numeric: tabular-nums; color: var(--ink); }
.calc strong { font-weight: 800; text-decoration: underline double; text-decoration-color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.rhythm .pay { align-self: end; font-size: 15px; }
.tj-note { margin-top: 24px; font-size: 15px; color: var(--ink-soft); }

/* почему понемногу: термин на полях строки */
.why { margin: 0; border-top: 2px solid var(--ink); }
.why > div { display: grid; grid-template-columns: 288px minmax(0, 1fr); column-gap: 24px; padding: 12px 0 11px; border-bottom: 1px solid var(--grid-strong); }
.why dt { font: 600 25px/24px var(--font-hand); color: var(--ink); }
.why dd { margin: 0; color: var(--ink-soft); }
.tj-cite { margin-top: 24px; font-size: 15px; color: var(--ink-soft); }

/* таблица норм: строки на клетке */
.law { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 24px; border-top: 2px solid var(--ink); }
.law th, .law td { text-align: left; vertical-align: top; padding: 11px 12px 12px 0; border-bottom: 1px solid var(--grid-strong); }
.law th { font: 600 23px/24px var(--font-hand); color: var(--ink-soft); }
.law td:first-child { width: 55%; padding-right: 48px; }
.law td:last-child { color: var(--ink-soft); font-size: 15px; }
.law a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 4px; overflow-wrap: anywhere; }

.tj-lead { color: var(--ink); }
.tj .steps { margin-bottom: 48px; }
.tj .steps li > span:not(.num) { color: var(--ink-soft); }
.tj-cta { display: flex; flex-wrap: wrap; gap: 24px 12px; padding-bottom: 72px; }

/* ── Ширины ─────────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .cat-hero, .tj-hero { grid-template-columns: minmax(0, 1fr); }
  .cat-hero .epi { padding-bottom: 0; }
  .cat .cat-row { grid-template-columns: 144px minmax(0, 1fr); }
  .row-side { grid-column: 2; margin-top: 24px; grid-template-columns: auto minmax(0, 1fr); column-gap: 24px; align-items: center; }
  .row-side .hours { margin-top: 0; }
  .row-side .checkline, .row-side .by-plan, .row-side .btn { grid-column: 1 / -1; }
  .rung { grid-template-columns: 200px minmax(0, 1fr); }
  .rung:nth-child(n) { margin-left: calc(var(--d) * 24px); }
  .rung + .rung::before { left: -18px; width: 12px; }
  .rhythm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rhythm .pay { grid-column: 1 / -1; margin-top: 24px; }
  .why > div { grid-template-columns: 216px minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .cat .cat-row { grid-template-columns: minmax(0, 1fr); }
  .cat .cat-row .tag, .row-main, .row-side { grid-column: 1; }
  .row-main h2 { margin-top: 0; }
  .spread { grid-template-columns: minmax(0, 1fr); padding: 22px 16px; }
  .spread::before { display: none; }
  .page-half + .page-half { padding-top: 23px; border-top: 1px solid var(--grid-strong); }
  .rates { grid-template-columns: minmax(0, 1fr); }
  .rates > div + div::before { left: 0; right: 0; bottom: auto; width: auto; height: 1px; }
  .rhythm { grid-template-columns: minmax(0, 1fr); }
  .rhythm .calc { margin-top: 24px; }
  .why > div { grid-template-columns: minmax(0, 1fr); }
  .law, .law tbody, .law tr, .law td { display: block; width: 100%; }
  .law thead { display: none; }
  .law tr { padding: 11px 0 12px; border-bottom: 1px solid var(--grid-strong); }
  .law td, .law td:first-child { width: 100%; padding: 0; border: 0; }
  .law td:last-child { margin-top: 12px; }
}

@media (max-width: 560px) {
  .cat-bar .filters { gap: 8px; }
  .cat-bar .filter { padding: 10px 12px; font-size: 15px; }
  .row-side { grid-template-columns: minmax(0, 1fr); }
  .row-side .btn { width: 100%; }
  .cat .individual-cta { margin-bottom: 48px; }
  .rung:nth-child(n) { margin-left: 0; }
  .rung + .rung::before { display: none; }
  .rung, .rung:last-child { grid-template-columns: minmax(0, 1fr); }
  .rung:last-child { padding: 22px 16px; }
  .rung > div { margin-top: 24px; }
  .tj .cells-sum { font-size: 17px; }
  .tj-cta .btn { width: 100%; }
}

@media (max-width: 760px) { .cat-bar { position: static; } }
