/* ============================================================
   HARIZMA — общий стиль сайта
   Один файл на все страницы. Правится здесь, применяется везде.

   Палитра взята из логотипа: бирюза круга, оранжевый обводки,
   чёрный футболки, серо-лавандовый бегемота.
   Тема одна — светлая. Тёмная убрана намеренно: сайт должен
   выглядеть одинаково у всех, независимо от настроек телефона.
   ============================================================ */

:root {
  --paper:        #F5F7F8;
  --card:         #FFFFFF;
  --ink:          #0F1519;
  --ink-2:        #55626A;
  --ink-3:        #8A959C;
  --line:         #DCE3E6;
  --line-2:       #EAEFF1;

  /* фирменные */
  --teal:         #0B7C85;
  --teal-bright:  #1BB4BC;
  --teal-soft:    #E4F4F5;

  --orange:       #B4560F;
  --orange-bright:#EE8B2C;
  --orange-soft:  #FCEDE0;

  /* цвет текущей категории — переопределяется на строке списка */
  --cat:          #0B7C85;
  --cat-bright:   #1BB4BC;
  --cat-soft:     #E4F4F5;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans:  "Golos Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, Consolas, Menlo, monospace;

  --measure: 68ch;
  --s1: 0.4rem; --s2: 0.75rem; --s3: 1.25rem; --s4: 2rem;
  --s5: 3.25rem; --s6: 5rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

.shell { max-width: 780px; margin: 0 auto; padding: 0 var(--s3); }

/* категория страницы-инструкции */
body.cash { --cat: #B4560F; --cat-bright: #EE8B2C; --cat-soft: #FCEDE0; }

a { color: var(--teal); }
:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 3px; }
strong { font-weight: 600; }

/* ============ марка ============ */

.mark { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; }
.mark img { display: block; width: auto; }
.mark-name {
  font-family: var(--sans); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink);
}

/* ============ экран выбора ============ */

.screen { min-height: 100svh; display: flex; flex-direction: column; }

.screen-top { padding: var(--s3) 0; }
.screen-top .mark img { height: 30px; }
.screen-top .mark-name { font-size: 0.88rem; }

.screen-mid { flex: 1 1 auto; display: flex; align-items: center; padding: var(--s4) 0 var(--s5); }
.screen-mid .shell { width: 100%; display: flex; flex-direction: column; gap: var(--s4); }

.screen-intro { display: flex; align-items: center; gap: var(--s3); }
.screen-intro img { display: block; height: clamp(84px, 17vw, 116px); width: auto; flex: none; }
.screen-intro .words { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.screen-intro h1 {
  margin: 0; font-family: var(--sans); font-weight: 700;
  font-size: clamp(2.1rem, 8vw, 3.1rem); line-height: 1;
  letter-spacing: -0.01em; text-transform: uppercase;
}
.screen-intro p { margin: 0; color: var(--ink-2); font-size: clamp(0.95rem, 2.4vw, 1.08rem); }

/* ============ список материалов ============ */

.list { display: flex; flex-direction: column; gap: var(--s2); }

.list-item {
  --cat: #0B7C85; --cat-bright: #1BB4BC; --cat-soft: #E4F4F5;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.2rem var(--s3);
  padding: var(--s3);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--cat-bright);
  border-radius: 8px;
  text-decoration: none; color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.list-item.cash { --cat: #B4560F; --cat-bright: #EE8B2C; --cat-soft: #FCEDE0; }
.list-item:hover, .list-item:focus-visible {
  background: var(--cat-soft);
  border-color: var(--cat-bright);
  transform: translateX(2px);
  outline: none;
}

.list-badge {
  grid-row: 1 / span 4;
  width: 2.6rem; height: 2.6rem; border-radius: 7px;
  background: var(--cat-bright); color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.85rem; font-weight: 600;
}

.list-cat {
  grid-column: 2; margin: 0 0 0.1rem;
  font-family: var(--mono); font-size: 0.63rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--cat);
}

.list-item h2 {
  grid-column: 2; margin: 0;
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.08rem, 2.5vw, 1.3rem); line-height: 1.3;
  letter-spacing: -0.012em; text-wrap: balance;
}

.list-item p {
  grid-column: 2; margin: 0.15rem 0 0;
  color: var(--ink-2); font-size: 0.95rem; line-height: 1.5;
}

.route {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.03em;
  color: var(--cat); display: flex; flex-wrap: wrap; gap: 0.35em; align-items: center;
}
.route .arr { color: var(--ink-3); }
.list-item .route { grid-column: 2; margin-top: 0.5rem; }

.list-arrow {
  grid-column: 3; grid-row: 1 / span 4; align-self: center;
  font-family: var(--mono); font-size: 1.1rem; color: var(--line);
  transition: color 0.15s ease, transform 0.15s ease;
}
.list-item:hover .list-arrow, .list-item:focus-visible .list-arrow {
  color: var(--cat-bright); transform: translateX(3px);
}

@media (max-width: 560px) {
  .list-item { grid-template-columns: 2.4rem minmax(0, 1fr); gap: 0.2rem var(--s2); padding: var(--s3) var(--s2); }
  .list-badge { width: 2.2rem; height: 2.2rem; font-size: 0.76rem; }
  .list-arrow { display: none; }
  .route { font-size: 0.7rem; }
  .screen-intro { gap: var(--s2); }
}

.screen-foot { border-top: 1px solid var(--line); }
.screen-foot .shell {
  padding-top: var(--s3); padding-bottom: var(--s3);
  display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.05em; color: var(--ink-3);
}

/* ============ шапка на странице инструкции ============ */

.topbar { border-bottom: 1px solid var(--line); background: var(--card); }
.topbar .shell { display: flex; align-items: center; padding-top: var(--s2); padding-bottom: var(--s2); }
.topbar .mark img { height: 30px; }
.topbar .mark-name { font-size: 0.88rem; }
.topbar .mark:hover .mark-name { color: var(--teal); }

/* ============ статья ============ */

/* боковые отступы берём те же, что у .shell — короткая запись padding
   их затирала, и на телефоне текст прилипал к краю */
.article { padding: var(--s4) var(--s3) var(--s6); display: flex; flex-direction: column; }
.article .back {
  align-self: flex-start;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none;
  display: inline-flex; gap: 0.5em; align-items: center; margin-bottom: var(--s4);
}
.article .back::before { content: "←"; }
.article .back:hover, .article .back:focus-visible { color: var(--teal); outline: none; }

.article-kicker {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--cat);
  margin: 0 0 var(--s2);
}
.article h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.9rem, 5.5vw, 2.9rem); line-height: 1.1;
  letter-spacing: -0.025em; margin: 0; max-width: 20ch; text-wrap: balance;
}
.article .lede {
  margin: var(--s3) 0 0; max-width: 56ch; font-size: 1.12rem;
  color: var(--ink-2); line-height: 1.55;
}

.article-body { display: flex; flex-direction: column; gap: var(--s5); margin-top: var(--s5); }
.article-body section { display: flex; flex-direction: column; gap: var(--s3); }
.article-body h2 {
  font-family: var(--serif); font-weight: 600; font-size: 1.45rem;
  letter-spacing: -0.015em; margin: 0;
  padding-bottom: var(--s2); border-bottom: 2px solid var(--cat-soft);
  text-wrap: balance;
}
.article-body p { margin: 0; max-width: var(--measure); }
.article-body ul { margin: 0; padding-left: 1.2em; max-width: var(--measure);
                   display: flex; flex-direction: column; gap: 0.4rem; }
.article-body li::marker { color: var(--cat-bright); }

/* пары «что — что» */
.pairs {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--line-2); border: 1px solid var(--line-2);
  border-radius: 8px; overflow: hidden;
}
.pair {
  background: var(--card); padding: 0.8rem 1rem;
  display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 2.4fr);
  gap: 0.25rem 1.25rem; align-items: baseline; font-size: 0.97rem;
}
.pair b { font-weight: 600; }
.pair span { color: var(--ink-2); }
@media (max-width: 560px) { .pair { grid-template-columns: 1fr; } }

/* два варианта рядом */
.split {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px; background: var(--line-2);
  border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
}
.split > div { background: var(--card); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.split h3 {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--cat); margin: 0; font-weight: 600;
}
.split p { margin: 0; font-size: 0.96rem; color: var(--ink-2); }

/* крупные факты */
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px; background: var(--line-2);
  border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
}
.facts > div { background: var(--card); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.facts b {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
}
.facts .big {
  font-family: var(--serif); font-size: 1.65rem; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.15; color: var(--cat);
}
.facts p { margin: 0; font-size: 0.91rem; color: var(--ink-2); }

/* шаги */
.steps { display: flex; flex-direction: column; counter-reset: step; }
.step {
  display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: var(--s3);
  padding: var(--s3) 0; border-bottom: 1px solid var(--line-2);
}
.step:first-child { border-top: 1px solid var(--line-2); }
.step::before {
  counter-increment: step; content: counter(step);
  font-family: var(--mono); font-size: 0.9rem; font-weight: 600;
  color: var(--cat); padding-top: 0.2rem; font-variant-numeric: tabular-nums;
}
.step-body { display: flex; flex-direction: column; gap: var(--s1); min-width: 0; }
.step h3 { font-family: var(--sans); font-size: 1.01rem; font-weight: 600; margin: 0; }
.step p { margin: 0; color: var(--ink-2); font-size: 0.96rem; max-width: var(--measure); }

/* выноска */
.callout {
  background: var(--cat-soft); border-left: 3px solid var(--cat-bright);
  border-radius: 0 8px 8px 0; padding: var(--s3);
  max-width: var(--measure); font-size: 0.98rem;
}
.callout b { color: var(--cat); }

/* подвал статьи */
.sitefoot { border-top: 1px solid var(--line); }
.sitefoot .shell {
  padding-top: var(--s3); padding-bottom: var(--s4);
  display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.05em; color: var(--ink-3);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   ФОРМАТ СТАТЬИ
   Одинаковый для всех инструкций: полоса чтения, кнопка назад,
   «коротко», оглавление, нумерованные разделы.
   ============================================================ */

/* полоса прочитанного */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--cat-bright); z-index: 50;
  transition: width 0.08s linear;
}

/* шапка статьи — липкая, кнопка «назад» слева */
.topbar { position: sticky; top: 0; z-index: 40; }
.topbar .shell { gap: var(--s3); }

.backbtn {
  flex: none;
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cat-soft); color: var(--cat);
  border: 1px solid transparent;
  text-decoration: none; font-size: 1.05rem; line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.backbtn:hover, .backbtn:focus-visible {
  border-color: var(--cat-bright); transform: translateX(-2px); outline: none;
}
.backbtn-label {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-3); text-decoration: none;
  white-space: nowrap;
}
.backbtn-label:hover { color: var(--cat); }
@media (max-width: 560px) { .backbtn-label { display: none; } }

/* один раз качнуть стрелку, чтобы её заметили */
@keyframes nudge {
  0%, 60%, 100% { transform: translateX(0); }
  70% { transform: translateX(-5px); }
  80% { transform: translateX(0); }
  90% { transform: translateX(-3px); }
}
.backbtn.hint { animation: nudge 1.6s ease 0.5s 1; }

/* коротко — одинаковая шапка фактов на каждой статье */
.brief {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px; background: var(--line-2);
  border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
  margin-top: var(--s4);
}
.brief > div { background: var(--card); padding: var(--s3); display: flex; flex-direction: column; gap: 0.25rem; }
.brief b {
  font-family: var(--mono); font-size: 0.63rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
}
.brief span { font-size: 1.02rem; font-weight: 600; color: var(--cat); line-height: 1.3; }
.brief small { font-size: 0.86rem; color: var(--ink-2); line-height: 1.45; }

/* оглавление */
.toc {
  margin-top: var(--s4);
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  padding: var(--s3) 0;
  display: flex; flex-direction: column; gap: var(--s2);
}
.toc b {
  font-family: var(--mono); font-size: 0.63rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
}
.toc ol { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
.toc a {
  display: inline-flex; gap: 0.5em; align-items: baseline;
  font-size: 0.93rem; color: var(--ink-2); text-decoration: none;
}
.toc a:hover, .toc a:focus-visible { color: var(--cat); outline: none; }
.toc a i {
  font-style: normal; font-family: var(--mono); font-size: 0.75rem;
  color: var(--cat); font-weight: 600;
}

/* нумерованные разделы */
.article-body { counter-reset: sec; }
.article-body section { counter-increment: sec; scroll-margin-top: 5rem; }
.article-body h2 {
  display: flex; align-items: baseline; gap: 0.7rem;
  border-bottom: none; padding-bottom: 0;
}
.article-body h2::before {
  content: counter(sec);
  flex: none;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  color: #FFFFFF; background: var(--cat-bright);
  min-width: 1.7rem; height: 1.7rem; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  transform: translateY(-0.15em);
}
.article-body section > h2 + * { margin-top: 0; }

/* ============ переходы между страницами ============ */

@keyframes slide-in-right { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes slide-in-left  { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
@keyframes slide-out-left { to { opacity: 0; transform: translateX(-34px); } }
@keyframes slide-out-right{ to { opacity: 0; transform: translateX(34px); } }

.anim-in-right { animation: slide-in-right 0.32s cubic-bezier(.2,.7,.3,1) both; }
.anim-in-left  { animation: slide-in-left  0.32s cubic-bezier(.2,.7,.3,1) both; }
.leaving-left  { animation: slide-out-left  0.24s ease-in both; }
.leaving-right { animation: slide-out-right 0.24s ease-in both; }

@media (prefers-reduced-motion: reduce) {
  .anim-in-right, .anim-in-left, .leaving-left, .leaving-right, .backbtn.hint {
    animation: none !important;
  }
  .progress { transition: none; }
}

/* марка уезжает вправо, слева — возврат к списку */
.topbar .mark { margin-left: auto; }

@media (max-width: 620px) {
  /* на узком экране «коротко» ставим в столбик, иначе остаётся пустая ячейка */
  .brief { grid-template-columns: 1fr; }
  .toc ol { flex-direction: column; gap: 0.5rem; }
}
