/* Страница инструкций /how-to — без общего лейаута, поэтому шрифт и сброс свои */

@font-face {
  font-family: 'Montserrat';
  src: url('../../webfonts/Montserrat-Regular.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../../webfonts/Montserrat-Medium.woff') format('woff');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../../webfonts/Montserrat-SemiBold.woff') format('woff');
  font-weight: 600;
  font-display: swap;
}

:root {
  --ht-bg: #f6f6f4;
  --ht-surface: #ffffff;
  --ht-ink: #2b3233;
  --ht-muted: #667374;
  --ht-line: #e1e6e6;
  --ht-accent: #06c8d2;
  --ht-accent-ink: #053b3f;
  --ht-accent-text: #0a7f86;
  --ht-accent-soft: #e2f8f9;
  --ht-warn-soft: #fff3d9;
  --ht-warn-ink: #7a4a00;
  --ht-focus: #fff6d6;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ht-bg);
  color: var(--ht-ink);
  font: 400 16px/1.55 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[hidden] { display: none !important; }

.how-to a { color: var(--ht-accent-text); }
.how-to a:focus-visible,
.how-to button:focus-visible,
.how-to summary:focus-visible { outline: 2px solid var(--ht-accent-text); outline-offset: 2px; }

.how-to__icon { width: 20px; height: 20px; flex: none; }

/* ---------- Шапка ---------- */
.how-to__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1112px;
  margin: 0 auto;
  padding: 14px 16px;
}
.how-to__logo { display: block; line-height: 0; }
.how-to__logo img { height: 36px; width: auto; }
.how-to__to-site { font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.how-to__to-site::after { content: ' →'; }
.how-to__to-site:hover { text-decoration: underline; }
/* Роль в шапке — только на компьютере и только внутри инструкции */
.how-to__header-role { display: none; }

.how-to__main { max-width: 1112px; margin: 0 auto; padding: 0 16px 64px; }

/* ---------- Переключатель ---------- */
.how-to__seg {
  display: inline-flex;
  max-width: 100%;
  background: var(--ht-surface);
  border: 1px solid var(--ht-line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.how-to__seg-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  border: 0;
  background: transparent;
  color: var(--ht-ink);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.how-to__seg-btn:hover { background: var(--ht-bg); }
.how-to__seg-btn[aria-selected="true"] { background: var(--ht-accent); color: var(--ht-accent-ink); font-weight: 600; }

/* ---------- Стартовый экран ---------- */
.how-to__home { max-width: 760px; margin: 0 auto; padding-top: 12px; }
.how-to__title { font-size: 28px; line-height: 1.2; font-weight: 600; margin: 0 0 6px; }
.how-to__lead { margin: 0 0 20px; color: var(--ht-muted); max-width: 64ch; }
.how-to__cards { display: grid; gap: 10px; margin-top: 16px; }
.how-to__card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--ht-surface);
  border: 1px solid var(--ht-line);
  border-radius: 16px;
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.how-to .how-to__card { color: var(--ht-ink); }
.how-to__card:hover { border-color: var(--ht-accent); }
.how-to__card:active { transform: scale(.99); }
.how-to__card > .how-to__icon { color: var(--ht-muted); }
.how-to__card-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--ht-accent-soft);
  color: var(--ht-accent-text);
  display: grid;
  place-items: center;
}
.how-to__card-icon .how-to__icon { width: 22px; height: 22px; }
.how-to__card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.how-to__card-title { font-weight: 600; line-height: 1.3; }
.how-to__card-hint { font-size: 14px; color: var(--ht-muted); }

/* ---------- Экран инструкции ---------- */
.how-to__bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -16px 16px;
  padding: 10px 16px;
  background: var(--ht-bg);
  border-bottom: 1px solid var(--ht-line);
}
.how-to__bar-back {
  flex: none;
  width: 40px;
  height: 40px;
  margin-left: -8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.how-to .how-to__bar-back { color: var(--ht-ink); }
.how-to__bar-back:hover { background: var(--ht-surface); }
.how-to__bar-text { flex: 1; min-width: 0; }
.how-to__bar-title { font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.how-to__bar-sub { font-size: 13px; color: var(--ht-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.how-to__bar-change {
  flex: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ht-accent-text);
  background: none;
  border: 0;
  padding: 10px 0 10px 8px;
  cursor: pointer;
}

.how-to__nav { display: none; }

.how-to__topic-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* На телефоне выбор платформы спрятан под «Изменить» в шапке темы */
.how-to__dev-wrap { display: none; margin-bottom: 14px; }
.how-to__dev-wrap--open { display: block; }
.how-to__dev-wrap .how-to__seg { display: flex; }
.how-to__dev-wrap .how-to__seg-btn { flex: 1; padding: 8px 4px; font-size: 13px; }
.how-to__content .how-to__lead { font-size: 14px; margin-bottom: 16px; }

.how-to__steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.how-to__step {
  background: var(--ht-surface);
  border: 1px solid var(--ht-line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 14px;
  scroll-margin-top: 76px;
  transition: background .4s;
}
.how-to__step--focus { background: var(--ht-focus); }
.how-to__step-body { min-width: 0; }
.how-to__step-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.how-to__step-num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ht-accent);
  color: var(--ht-accent-ink);
  font-size: 14px;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.how-to__step-title { flex: 1; margin: 0; padding-top: 2px; font-size: 17px; line-height: 1.35; font-weight: 600; }
.how-to__step-link {
  flex: none;
  width: 36px;
  height: 36px;
  margin: -4px -6px 0 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ht-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.how-to__step-link:hover { background: var(--ht-bg); color: var(--ht-accent-text); }
.how-to__step-link .how-to__icon { width: 18px; height: 18px; }
.how-to__step-body p { margin: 0; max-width: 64ch; }
.how-to__step-body p + p { margin-top: 8px; }
.how-to .ui { font-weight: 600; }

.how-to__rule {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ht-warn-soft);
  color: var(--ht-warn-ink);
  font-size: 14px;
  font-weight: 500;
}
.how-to__rule .how-to__icon { width: 18px; height: 18px; margin-top: 2px; }

/* Запись экрана: нажатие открывает её крупнее */
.how-to__media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--ht-line);
  border-radius: 12px;
  background: var(--ht-bg);
  overflow: hidden;
  cursor: zoom-in;
  line-height: 0;
}
.how-to__media img { display: block; width: 100%; height: auto; }
.how-to__media--phone { max-width: 240px; margin: 0 auto; }
.how-to__media-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  color: var(--ht-ink);
  display: grid;
  place-items: center;
}
.how-to__media-zoom .how-to__icon { width: 16px; height: 16px; }

.how-to__note {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--ht-accent-soft);
  font-size: 15px;
}
.how-to__note ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }

.how-to__end { margin-top: 20px; display: grid; gap: 12px; justify-items: start; }
.how-to__btn {
  display: inline-block;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--ht-line);
  background: var(--ht-surface);
  text-decoration: none;
  cursor: pointer;
}
.how-to .how-to__btn { color: var(--ht-ink); }
.how-to__btn:hover { border-color: var(--ht-accent); }
.how-to__btn--primary { background: var(--ht-accent); border-color: var(--ht-accent); }
.how-to .how-to__btn--primary { color: var(--ht-accent-ink); }
.how-to__btn--primary:hover { filter: brightness(.96); }
.how-to__support { margin: 0; font-size: 14px; color: var(--ht-muted); }

.how-to__empty {
  background: var(--ht-surface);
  border: 1px solid var(--ht-line);
  border-radius: 16px;
  padding: 20px 16px;
}
.how-to__empty p { margin: 0 0 12px; }
.how-to__empty-title { font-weight: 600; font-size: 17px; }
.how-to__empty-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Частые вопросы ---------- */
.how-to__faq { max-width: 760px; margin: 48px auto 0; scroll-margin-top: 16px; }
.how-to__h2 { font-size: 22px; line-height: 1.25; font-weight: 600; margin: 0 0 12px; }
.how-to__faq-item { background: var(--ht-surface); border: 1px solid var(--ht-line); border-radius: 14px; padding: 14px 16px; }
.how-to__faq-item + .how-to__faq-item { margin-top: 8px; }
.how-to__faq-item summary { cursor: pointer; font-weight: 600; }
.how-to__faq-item p { margin: 8px 0 0; max-width: 66ch; }
.how-to__faq .how-to__support { margin-top: 16px; }

/* ---------- Запись экрана во весь экран ---------- */
.how-to__zoom {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(20, 28, 29, .86);
  display: grid;
  place-items: center;
  padding: 56px 12px 12px;
  cursor: zoom-out;
}
.how-to__zoom-img { max-width: 100%; max-height: calc(100vh - 68px); max-height: calc(100dvh - 68px); width: auto; height: auto; border-radius: 10px; background: #fff; }
/* Записи с компьютера сняты шириной 720 px — растягиваем до ширины окна */
.how-to__zoom-img[src*="/web-"] { width: min(100%, 1200px); object-fit: contain; }
.how-to__zoom-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.how-to__toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 11;
  transform: translate(-50%, 16px);
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ht-ink);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.how-to__toast--show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Планшет и компьютер ---------- */
@media (min-width: 600px) {
  .how-to__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how-to__title { font-size: 34px; }
  /* Запись с телефона встаёт справа от текста шага */
  .how-to__step--phone { grid-template-columns: minmax(0, 1fr) 220px; align-items: start; }
  .how-to__step--phone .how-to__media { margin: 0; }
}

@media (min-width: 900px) {
  .how-to__header { padding: 18px 24px; }
  .how-to__logo img { height: 40px; }
  .how-to__main { padding: 0 24px 80px; }
  .how-to__home { padding-top: 32px; }

  .how-to__header-role { display: block; margin-left: auto; }
  .how-to--home .how-to__header-role { display: none; }

  /* Шапка темы с «Изменить» нужна только на телефоне */
  .how-to__bar { display: none; }
  .how-to__layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; padding-top: 16px; }
  .how-to__nav { display: grid; gap: 2px; position: sticky; top: 16px; }
  .how-to__nav-item {
    display: block;
    width: 100%;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    text-decoration: none;
    padding: 10px 14px;
    border: 0;
    border-radius: 12px;
    background: none;
    cursor: pointer;
  }
  .how-to .how-to__nav-item { color: var(--ht-ink); }
  .how-to__nav-item:hover { background: var(--ht-surface); }
  .how-to__nav-item[aria-current="page"] { background: var(--ht-accent); font-weight: 600; }
  .how-to .how-to__nav-item[aria-current="page"] { color: var(--ht-accent-ink); }
  .how-to__nav-item--faq { margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--ht-line); border-radius: 0; }
  .how-to .how-to__nav-item--faq { color: var(--ht-muted); }
  .how-to__nav-item--faq:hover { background: none; text-decoration: underline; }

  .how-to__topic-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 8px; }
  .how-to__topic-title { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; font-size: 26px; line-height: 1.25; font-weight: 600; margin: 0; }
  .how-to__dev-wrap { display: block; margin: 0; }
  .how-to__dev-wrap .how-to__seg { display: inline-flex; }
  .how-to__dev-wrap .how-to__seg-btn { flex: none; padding: 8px 16px; font-size: 14px; }

  .how-to__step { padding: 20px; scroll-margin-top: 16px; }
  .how-to__step--phone { grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; }
  .how-to__faq { margin-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .how-to__card, .how-to__step, .how-to__toast { transition: none; }
}
