/* ------------------------------------------------------------------
   Вьетнамец v9. Страница /calc/: бюджет переезда, месяц жизни, визаран.
   Токены, шапка, кнопки, сегменты и подвал — из home.css, здесь только своё.
   Результат — «справка»: бумага с прямыми углами и контуром ink,
   сверху полоса hat с итогом (как подложка календаря и табло курса).
   ------------------------------------------------------------------ */

.nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px;
}

/* ---------- вступление ---------- */
.intro { padding: clamp(16px, 4vw, 56px) 0 clamp(36px, 5vw, 64px); }
.intro + .sec { border-top: 2px solid var(--ink); }
.intro h1 { font-size: clamp(2.6rem, 1.6rem + 4vw, 5rem); line-height: 0.92; }
.intro__lead { margin-top: 16px; font-size: clamp(17px, 15px + 0.4vw, 20px); color: var(--ink-2); max-width: 46ch; }
.jump { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.jump .btn { min-height: 44px; padding: 0 18px; font-size: 15px; }

/* ---------- раздел калькулятора ---------- */
/* Заголовок и картинка-сцена рядом; на телефоне подпись уходит под них на всю ширину. */
.calc__head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 24px; align-items: end;
  grid-template-areas: "title scene" "lead scene";
  grid-template-rows: 1fr auto;   /* лишняя высота картинки уходит над заголовком, а не между ним и подписью */
  margin-bottom: clamp(24px, 3vw, 40px);
}
.calc__head h2 { grid-area: title; }
.calc__head .sec__lead { grid-area: lead; max-width: 60ch; }
.calc__scene { grid-area: scene; width: clamp(88px, 12vw, 160px); height: auto; }
@media (max-width: 640px) {
  .calc__head { grid-template-areas: "title scene" "lead lead"; }
}

.calc__grid { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 980px) {
  .calc__grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 56px; align-items: start; }
  /* справка длиннее формы: пока читаешь статьи, переключатели остаются под рукой */
  .calc__form { position: sticky; top: 24px; }
}

.calc__form { display: grid; gap: 22px; align-content: start; margin: 0; }
.calc__form .seg span { transition: background-color 160ms ease, color 160ms ease; }
.calc__form .seg label { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .calc__form .seg input:not(:checked) + span:hover { background: var(--wall-2); }
}
.calc__form .seg input:active + span { transform: scale(0.97); }

/* ---------- справка с итогом ---------- */
.bill { background: var(--sheet); border: 2px solid var(--ink); box-shadow: var(--shadow); min-width: 0; }
.bill__top {
  background: var(--hat); color: var(--on-hat);
  padding: 18px clamp(16px, 2.4vw, 26px) 20px;
  border-bottom: 2px solid var(--ink);
}
.bill__lead { font-weight: 600; font-size: 15px; }
.bill__total {
  font-family: var(--display); font-weight: 800; line-height: 0.95; letter-spacing: -0.01em;
  font-size: clamp(2.6rem, 2rem + 2.4vw, 4rem); margin-top: 6px;
}
.bill__rub { font-family: var(--display); font-weight: 700; font-size: clamp(1.45rem, 1.2rem + 0.8vw, 1.9rem); line-height: 1.1; margin-top: 6px; }
.bill__rub small { font-family: var(--text); font-weight: 600; font-size: 16px; }
.bill__rub:empty, .bill__year:empty { display: none; }
.bill__year { margin-top: 8px; font-weight: 600; font-size: 15px; }

.bill__body { padding: 4px clamp(16px, 2.4vw, 26px) 22px; }
.bill__items { list-style: none; margin: 0; padding: 0; }
.bill__items:empty { display: none; }
.bill__item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.bill__item:last-child { border-bottom: 0; }
.bill__name { font-weight: 600; font-size: 16px; line-height: 1.35; }
.bill__src { grid-column: 1 / -1; font-size: 13px; font-weight: 400; line-height: 1.4; color: var(--ink-3); }
.bill__sum { font-weight: 600; font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.bill__warn { margin-top: 14px; padding: 10px 12px; background: var(--red-wash); font-size: 14px; font-weight: 600; }
.bill__warn:empty { display: none; }
.bill__rate { margin-top: 18px; padding-top: 14px; border-top: 2px solid var(--ink); font-size: 15px; line-height: 1.45; }
.bill__rate:empty { display: none; }
.bill__rate b { font-weight: 600; }
.bill__note { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.bill__note:empty { display: none; }
.bill__items + .bill__note { margin-top: 16px; }
.bill__save { margin-top: 18px; }
.bill__save[hidden] { display: none; }
.bill__save svg { width: 20px; height: 20px; flex: none; }
.bill__save[disabled] { opacity: 0.5; cursor: progress; }

/* первый расчёт ещё не пришёл */
.bill.is-wait .bill__total { font-size: clamp(1.8rem, 1.5rem + 1vw, 2.4rem); opacity: 0.55; }
/* пересчёт по новым ответам: старые цифры приглушаем, пока не придут новые */
.bill__total, .bill__rub, .bill__year, .bill__items { transition: opacity 160ms ease; }
.bill.is-busy .bill__total, .bill.is-busy .bill__rub, .bill.is-busy .bill__year, .bill.is-busy .bill__items { opacity: 0.45; }
/* сервер не ответил: вместо итога человеческая фраза */
.bill.is-off .bill__lead { display: none; }
.bill.is-off .bill__total { font-size: clamp(1.8rem, 1.5rem + 1vw, 2.4rem); line-height: 1.05; }
.bill.is-off .bill__rub { font-family: var(--text); font-weight: 600; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .bill__total, .bill__rub, .bill__year, .bill__items, .calc__form .seg span { transition: none; }
}

/* ---------- подвал ---------- */
.foot__grid { align-items: center; }
.foot__note { margin-top: 0; }
