/* Boldy design system
   Paper, ink, one accent. The period after "Болды" is the only ornament. */

/* ---------- tokens ---------- */
:root {
  /* colour */
  --paper:        #EDEDE8;  /* page ground: office paper, cooled down */
  --surface:      #FFFFFF;  /* sheets, cards */
  --surface-sunk: #F6F6F3;  /* input wells, quiet blocks */
  --ink:          #14161B;  /* primary text */
  --ink-soft:     #5B616B;  /* secondary text */
  --ink-faint:    #8E939B;  /* labels, meta */
  --rule:         #DCDCD5;  /* hairlines */
  --rule-strong:  #B7B7AE;  /* emphasised hairlines */
  --accent:       #223AC4;  /* ultramarine ink: actions, links, the dot */
  --accent-deep:  #16268A;  /* pressed */
  --accent-tint:  #E7E9F9;  /* accent wash */
  --valid:        #1B6B4A;  /* certificate is valid */
  --spent:        #8A5A12;  /* invitation used or expired */

  /* type */
  --font-text: 'Golos Text', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-xs:   0.75rem;    /* 12 — mono labels */
  --t-sm:   0.8438rem;  /* 13.5 — meta */
  --t-base: 1rem;       /* 16 — body */
  --t-md:   1.0625rem;  /* 17 — reading body */
  --t-lg:   1.1875rem;  /* 19 — lead */
  --t-xl:   1.5rem;     /* 24 */
  --t-2xl:  2rem;       /* 32 */
  --t-3xl:  2.75rem;    /* 44 */
  --t-hero: clamp(3rem, 11cqw, 5.5rem);

  /* space */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  --radius:    5px;
  --radius-lg: 8px;
  --measure:   38rem;   /* single-column reading width */
  --measure-wide: 60rem;

  --shadow-sheet: 0 1px 2px rgba(20,22,27,.05), 0 12px 32px -16px rgba(20,22,27,.22);
}

/* ---------- base ---------- */
[hidden] { display: none !important; }
.boldy {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--t-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.boldy *, .boldy *::before, .boldy *::after { box-sizing: border-box; }
.boldy p, .boldy h1, .boldy h2, .boldy h3, .boldy dl, .boldy dd, .boldy ul, .boldy ol, .boldy figure { margin: 0; }
.boldy ul, .boldy ol { padding: 0; list-style: none; }
.boldy a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
.boldy a:hover { text-decoration: underline; }
.boldy :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ---------- type roles ---------- */
.b-hero      { font-size: var(--t-hero); font-weight: 600; letter-spacing: -.035em; line-height: .95; }
.b-title     { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -.022em; line-height: 1.14; }
.b-title-sm  { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.018em; line-height: 1.2; }
.b-lead      { font-size: var(--t-lg); line-height: 1.45; color: var(--ink); }
.b-body      { font-size: var(--t-md); line-height: 1.6; color: var(--ink); }
.b-soft      { color: var(--ink-soft); }
.b-faint     { color: var(--ink-faint); }
.b-sm        { font-size: var(--t-sm); }
.b-kk        { font-family: var(--font-text); font-weight: 500; letter-spacing: -.01em; }

/* mono label: the utility voice — codes, counts, section marks */
.b-label {
  font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint);
}
.b-code {
  font-family: var(--font-mono); font-weight: 500; letter-spacing: .1em;
  font-variant-ligatures: none;
}

/* ---------- the signature: the period ---------- */
/* "Болды." — the word means "enough / that's it". The period is the brand mark,
   and the same dot doubles as the step indicator: filled = done. */
.b-dot { color: var(--accent); }
.b-dots { display: flex; align-items: center; gap: 7px; }
.b-dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: transparent; border: 1.5px solid var(--rule-strong);
}
.b-dots i.is-done    { background: var(--accent); border-color: var(--accent); }
.b-dots i.is-current { border-color: var(--accent); border-width: 2px; background: transparent; box-shadow: 0 0 0 3px var(--accent-tint); }

/* ---------- surfaces ---------- */
.b-sheet {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sheet);
}
.b-pad   { padding: var(--s7); }
.b-pad-s { padding: var(--s5); }
.b-hr    { height: 1px; background: var(--rule); border: 0; }

/* ---------- buttons ---------- */
.boldy .b-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 500; letter-spacing: -.005em;
  padding: 13px 22px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.boldy .b-btn--primary { background: var(--accent); color: #fff; }
.boldy .b-btn--primary:hover { background: var(--accent-deep); }
.boldy .b-btn--quiet { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.boldy .b-btn--quiet:hover { border-color: var(--ink); }
.boldy .b-btn--link { background: none; padding: 0; color: var(--accent); border: 0; }
.boldy .b-btn--link:hover { text-decoration: underline; }
.boldy .b-btn--wide { width: 100%; }
.boldy .b-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- spec list: fact rows separated by hairlines ---------- */
.b-spec { border-top: 1px solid var(--rule); }
.b-spec > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4);
  padding: 13px 0; border-bottom: 1px solid var(--rule);
}
.b-spec dt { color: var(--ink-soft); font-size: var(--t-sm); }
.b-spec dd { text-align: right; }
.b-spec--prose dd { text-align: left; max-width: 34ch; }

/* ---------- steps: a real sequence, so it is numbered ---------- */
.b-steps { border-top: 1px solid var(--rule); }
.b-step {
  display: grid; grid-template-columns: 2.4rem 1fr auto; gap: var(--s4);
  align-items: baseline; padding: 15px 0; border-bottom: 1px solid var(--rule);
}
.b-step__n { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-faint); letter-spacing: .08em; }
.b-step__t { font-weight: 500; }
.b-step__m { font-size: var(--t-sm); color: var(--ink-faint); font-family: var(--font-mono); letter-spacing: .04em; }
.b-step.is-done .b-step__t { color: var(--ink-soft); }
.b-step.is-final .b-step__t { color: var(--ink); }
.b-step.is-final .b-step__n { color: var(--accent); }
/* итоговое задание закрывает список: вместо номера — та же точка, что и в знаке */
.b-step__mark { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---------- cards: programs, closed by default ---------- */
.b-card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3);
  min-height: 100%;
}
.b-card__t { font-size: var(--t-lg); font-weight: 600; letter-spacing: -.015em; }
.b-card__d { color: var(--ink-soft); font-size: var(--t-sm); line-height: 1.5; flex: 1; }

/* ---------- badges ---------- */
.b-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 3px; border: 1px solid var(--rule);
  color: var(--ink-soft); background: var(--surface-sunk);
}
.b-badge--invite { color: var(--accent); background: var(--accent-tint); border-color: transparent; }
.b-badge--valid  { color: var(--valid); background: #E6F2EC; border-color: transparent; }
.b-badge--spent  { color: var(--spent); background: #F6EEE0; border-color: transparent; }

/* ---------- fields ---------- */
.b-field { display: flex; flex-direction: column; gap: var(--s2); }
.b-field textarea, .b-field input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 13px 14px; width: 100%; resize: vertical; line-height: 1.5;
}
.b-field textarea::placeholder, .b-field input::placeholder { color: var(--ink-faint); }
.b-field textarea:focus, .b-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
.b-hint { font-size: var(--t-sm); color: var(--ink-faint); }

/* ---------- notes: the check result, never a scolding ---------- */
.b-note { border-left: 2px solid var(--rule-strong); padding: 2px 0 2px var(--s4); }
.b-note--ok   { border-color: var(--valid); }
.b-note--redo { border-color: var(--spent); }

/* ---------- page scaffolding ---------- */
.b-page   { min-height: 100%; min-width: 0; display: flex; flex-direction: column; container-type: inline-size; container-name: page; }
.b-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s5) var(--s7); border-bottom: 1px solid var(--rule);
}
.b-wordmark { font-weight: 600; font-size: var(--t-lg); letter-spacing: -.02em; }
.b-main   { flex: 1; padding: var(--s8) var(--s7); }
.b-narrow { max-width: var(--measure); margin: 0 auto; }
.b-wide   { max-width: var(--measure-wide); margin: 0 auto; }
.b-center { display: flex; align-items: center; justify-content: center; min-height: 100%; }
.b-foot   { padding: var(--s5) var(--s7); border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: var(--t-sm); }

.boldy .b-stack   > * + * { margin-top: var(--s4); }
.boldy .b-stack-s > * + * { margin-top: var(--s2); }
.boldy .b-stack-l > * + * { margin-top: var(--s6); }
.b-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.b-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }

@container page (max-width: 720px) {
  .b-topbar, .b-main, .b-foot { padding-left: var(--s4); padding-right: var(--s4); }
  .b-main { padding-top: var(--s6); padding-bottom: var(--s6); }
  .b-pad { padding: var(--s5); }
  .b-grid3 { grid-template-columns: 1fr; }
  .b-hero { font-size: clamp(2.5rem, 14cqw, 4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .boldy * { transition: none !important; animation: none !important; }
}

/* ---------- layout primitives ---------- */
.b-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s7); align-items: start; }
.b-split--wide { grid-template-columns: 1.35fr 1fr; }
.b-grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s4); }
.b-quote {
  background: var(--surface-sunk); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--s4) var(--s5); font-size: var(--t-sm); line-height: 1.6; color: var(--ink-soft);
}
.boldy .b-quote p + p { margin-top: var(--s3); }
.b-list { border-top: 1px solid var(--rule); }
.b-list__row {
  display: grid; grid-template-columns: 6.5rem 1fr auto; gap: var(--s4);
  align-items: center; padding: 13px 0; border-bottom: 1px solid var(--rule);
}
@container page (max-width: 900px) { .b-split, .b-split--wide { grid-template-columns: 1fr; gap: var(--s6); } }
@container page (max-width: 720px) {
  .b-grid2 { grid-template-columns: 1fr; }
  .b-list__row { grid-template-columns: 1fr auto; }
  .b-list__row > :nth-child(2) { grid-column: 1 / -1; order: 3; }
}

/* ---------- урок: три фазы ---------- */
/* Показ → Практика → Вопросы. Это настоящая последовательность, поэтому фазы
   пронумерованы и названы, а не показаны процентами. */
.b-phases { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.b-phase { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--ink-faint); }
.b-phase::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  border: 1.5px solid var(--rule-strong); background: transparent;
}
.b-phase.is-done { color: var(--ink-soft); }
.b-phase.is-done::before { background: var(--accent); border-color: var(--accent); }
.b-phase.is-current { color: var(--ink); font-weight: 500; }
.b-phase.is-current::before { border-color: var(--accent); border-width: 2px; box-shadow: 0 0 0 3px var(--accent-tint); }

/* ---------- терминал: собственная поверхность предмета обучения ---------- */
:root { --term-bg: #15171C; --term-ink: #E4E6EC; --term-dim: #8B919C; --term-accent: #8FA0FF; --term-ok: #6FD3A6; }
.b-term {
  background: var(--term-bg); color: var(--term-ink); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7;
  padding: var(--s4) var(--s5); overflow-x: auto;
}
.b-term pre { margin: 0; font: inherit; white-space: pre-wrap; word-break: break-word; }
.b-term b { color: var(--term-accent); font-weight: 500; }
.b-term s { text-decoration: none; color: var(--term-dim); }
.b-term em { font-style: normal; color: var(--term-ok); }
.b-term__bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 9px var(--s5); background: #1D2027; border-radius: var(--radius) var(--radius) 0 0;
  font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .1em;
  text-transform: uppercase; color: var(--term-dim);
}
.b-term__bar + .b-term { border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- показ по кадрам ---------- */
.b-demo { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.b-demo__stage { padding: var(--s5); }
.b-demo__nav {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); background: var(--surface-sunk); flex-wrap: wrap;
}
.b-demo__count { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .1em; color: var(--ink-faint); white-space: nowrap; }
.b-annot { border-left: 2px solid var(--accent); padding-left: var(--s4); }

/* ---------- проверка ответа ---------- */
.b-checking { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: var(--t-sm); }
.b-checking i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: b-pulse 1.1s ease-in-out infinite; }
@keyframes b-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .b-checking i { animation: none; opacity: .6; } }

/* ---------- три вопроса: проверка себя, а не отметка ---------- */
.b-q { border-top: 1px solid var(--rule); padding: var(--s5) 0; }
.b-q:last-child { border-bottom: 1px solid var(--rule); }
.b-q__t { font-weight: 500; }
.b-opts { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }
.b-opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 14px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; font-size: var(--t-sm); line-height: 1.5;
}
.b-opt:hover { border-color: var(--rule-strong); }
.b-opt input { margin: 3px 0 0; accent-color: var(--accent); }
.b-opt.is-right { border-color: var(--valid); background: #E6F2EC; }
.b-opt.is-wrong { border-color: var(--spent); background: #F6EEE0; }
.b-opt__why { display: block; margin-top: 5px; color: var(--ink-soft); }

/* ---------- разметка разбора: подсветка частей и легенда ---------- */
.b-mark { background: var(--accent-tint); color: inherit; border-radius: 3px; padding: 2px 5px; margin-right: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.b-mark sup { font-family: var(--font-mono); font-size: .6em; font-weight: 500; color: var(--accent); vertical-align: super; margin-left: 3px; }
.b-legend { display: flex; flex-direction: column; gap: 9px; }
.b-legend li { display: flex; gap: 11px; align-items: baseline; font-size: var(--t-sm); color: var(--ink-soft); }
.b-legend i { font-family: var(--font-mono); font-style: normal; font-size: var(--t-xs); color: var(--accent); min-width: 10px; }

/* ---------- подача материала: блоки, из которых автор собирает показ ---------- */
.boldy .b-read > * + * { margin-top: var(--s5); }
.b-read h2 { font-size: var(--t-lg); font-weight: 600; letter-spacing: -.015em; }
.b-read h2 + p { margin-top: var(--s3); }
.b-read p { font-size: var(--t-md); line-height: 1.62; max-width: 62ch; }

/* нумерованная последовательность внутри текста */
.b-ol { counter-reset: b-n; display: flex; flex-direction: column; gap: var(--s3); }
.b-ol li { counter-increment: b-n; display: grid; grid-template-columns: 1.7rem 1fr; gap: var(--s3); font-size: var(--t-md); line-height: 1.55; }
.b-ol li::before {
  content: counter(b-n, decimal-leading-zero);
  font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-faint); padding-top: .35em;
}

/* схема экрана чужого продукта: рисуем сами, чужие снимки не подделываем */
.b-scheme { border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.b-scheme__bar {
  display: flex; align-items: center; gap: var(--s3); padding: 9px var(--s4);
  border-bottom: 1px solid var(--rule); background: var(--surface-sunk);
  font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint);
}
.b-scheme__body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); }
.b-scheme__field {
  border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  padding: var(--s4); color: var(--ink-soft); font-size: var(--t-sm); min-height: 74px;
}
.b-scheme__row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.b-scheme__chip {
  border: 1px solid var(--rule); border-radius: 3px; padding: 5px 10px;
  font-size: var(--t-sm); color: var(--ink-soft); background: var(--surface-sunk);
}

/* выноска: цифра, на которую ссылается текст рядом */
.b-pin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%; background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; flex: none;
}
.b-pins { display: flex; flex-direction: column; gap: var(--s3); }
.b-pins li { display: grid; grid-template-columns: 19px 1fr; gap: var(--s3); align-items: start; font-size: var(--t-sm); line-height: 1.5; }

/* пара «так не работает / так работает» */
.b-vs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.b-vs__card { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); padding: var(--s4); }
.b-vs__t { font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: .1em; text-transform: uppercase; }
.b-vs__card--bad  .b-vs__t { color: var(--spent); }
.b-vs__card--good .b-vs__t { color: var(--valid); }
.b-vs__card p { margin-top: var(--s3); font-size: var(--t-sm); line-height: 1.55; }

/* итог урока */
.b-recap { border-top: 2px solid var(--ink); padding-top: var(--s4); }
.b-recap ul { display: flex; flex-direction: column; gap: var(--s3); margin-top: var(--s4); }
/* Голый текст рядом с <b> становился отдельной ячейкой грида и рассыпался
   по одному слову в строку. Маркер выносим из потока — содержимое остаётся цельным. */
.b-recap li { position: relative; padding-left: var(--s5); font-size: var(--t-md); line-height: 1.5; }
.b-recap li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

@container page (max-width: 720px) { .b-vs { grid-template-columns: 1fr; } }

/* ---------- лонгрид с раскрытием ---------- */
/* Урок разворачивается кусками: на экране всегда ровно одно следующее действие.
   Кнопка подписана следующим шагом, а не словом «Далее». */
.b-reveal {
  background: var(--surface-sunk); border-radius: var(--radius-lg);
  padding: var(--s5); display: flex; justify-content: center;
}
.boldy .b-block > * + * { margin-top: var(--s5); }
.b-block + .b-block { margin-top: var(--s7); }

/* готовый пример — то, что можно скопировать и отправить как есть */
.b-example {
  background: var(--surface-sunk); border-radius: var(--radius);
  padding: var(--s4) var(--s5); font-size: var(--t-md); line-height: 1.6;
}
.b-example b { font-weight: 600; }

/* что улучшить — ровно одно изменение за шаг */
.b-improve { border-left: 2px solid var(--accent); padding-left: var(--s4); font-size: var(--t-md); line-height: 1.6; }
.b-improve b { font-weight: 600; }

/* самооценка: человек сам говорит, как получилось */
.b-selfcheck { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); padding: var(--s5); }
.b-selfcheck__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-top: var(--s5); }
.b-count { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-faint); }

/* ---------- сегментный прогресс по урокам ---------- */
.b-segments { display: flex; gap: 6px; }
.b-segments i { height: 3px; flex: 1; border-radius: 2px; background: var(--rule); }
.b-segments i.is-done { background: var(--accent); }

/* ---------- раскрывающийся блок: длинный ответ прячем до спроса ---------- */
.b-fold { border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--surface); }
.b-fold + .b-fold { margin-top: var(--s3); }
.b-fold > summary {
  cursor: pointer; padding: var(--s4) var(--s5); font-weight: 500;
  list-style: none; display: flex; gap: 11px; align-items: center;
}
.b-fold > summary::-webkit-details-marker { display: none; }
.b-fold > summary::before { content: "▸"; color: var(--ink-faint); font-size: 11px; }
.b-fold[open] > summary::before { content: "▾"; }
.b-fold__body { padding: var(--s4) var(--s5) var(--s5); border-top: 1px solid var(--rule); }
.boldy .b-fold__body > * + * { margin-top: var(--s3); }
.b-fold__body p { font-size: var(--t-sm); line-height: 1.6; color: var(--ink-soft); }
