/* Главная finarus.ru (tools/portal/home.py). Токены, шапка, подвал, кнопки и карточки
   статей (.arts/.art) — из site.css; здесь только блоки главной, префикс hm-:
   .hero/.head/.section в site.css заняты страницей /prilozhenie/. */

.hm { max-width: 1120px; margin: 0 auto; padding: 44px clamp(18px, 4vw, 40px) 72px; display: flex; flex-direction: column; gap: 72px; }
.hm-sec { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.hm-sec--tight { gap: 0; }

/* ── Герой ─────────────────────────────────────────────── */
.hm-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.hm-hero h1 { font-family: 'Unbounded', 'Golos Text', sans-serif; font-weight: 700; letter-spacing: -0.03em; line-height: 1.08;
  font-size: clamp(30px, 4.2vw, 50px); text-wrap: balance; }
.hm-hero h1 em { font-style: normal; color: var(--accent); }
.hm-lead { font-size: 18px; color: var(--ink-2); margin-top: 16px; max-width: 34em; }

.hm-search { position: relative; margin-top: 26px; display: flex; align-items: center; gap: 10px; background: var(--card);
  border-radius: var(--r-md); padding: 7px 7px 7px 16px; box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.hm-search:focus-within { box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--accent); }
.hm-search > svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.hm-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); }
.hm-search input::placeholder { color: var(--ink-3); }
.hm-search input::-webkit-search-cancel-button { cursor: pointer; }
.hm-sres { position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20; background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.hm-sres[hidden] { display: none; }
.hm-sres a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--r-sm); }
.hm-sres a:hover, .hm-sres a.is-on { background: var(--tint); }
.hm-sres b { font-weight: 600; font-size: 15.5px; }
.hm-sres small { font-size: 12.5px; color: var(--ink-3); }
.hm-sres mark { background: var(--tint-2); color: inherit; border-radius: 3px; }
.hm-sres p { padding: 10px 12px; font-size: 14.5px; color: var(--ink-2); }
.hm-sres__all { color: var(--accent); font-weight: 600; font-size: 14.5px; }

.hm-quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hm-quick a { font-size: 14px; padding: 7px 13px; border-radius: 99px; background: var(--tint); color: var(--ink-2); transition: color .2s, background .2s; }
.hm-quick a:hover { background: var(--tint-2); color: var(--accent); }

.hm-today { background: var(--night); color: #FFFFFF; border-radius: var(--r-xl); padding: 24px; display: flex; flex-direction: column; }
.hm-today__h { font-size: 13px; font-weight: 600; color: #B9B2DD; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.hm-today__row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 13px 0;
  border-top: 1px solid rgba(255, 255, 255, .09); }
.hm-today__h + .hm-today__row { border-top: 0; }
.hm-today__row b { display: block; font-weight: 500; font-size: 15px; color: #E4E0F7; }
.hm-today__row small { display: block; font-size: 12.5px; color: #9C95C4; margin-top: 2px; }
.hm-today__row:hover b { color: #FFFFFF; text-decoration: underline; text-underline-offset: 3px; }
.hm-today__v { font-family: 'Unbounded', 'Golos Text', sans-serif; font-weight: 700; font-size: 24px; letter-spacing: -.03em; white-space: nowrap; }

/* ── Калькуляторы: пример с ответом ─────────────────────── */
.hm-calcs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hm-calc { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 22px;
  display: grid; grid-template-rows: subgrid; grid-row: span 5; row-gap: 6px; transition: box-shadow .2s, transform .2s; }
.hm-calc:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.hm-calc__k { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.hm-calc__q { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.hm-calc__v { font-family: 'Unbounded', 'Golos Text', sans-serif; font-weight: 700; font-size: clamp(22px, 2.3vw, 28px);
  letter-spacing: -.03em; line-height: 1.1; margin-top: 10px; white-space: nowrap; }
.hm-calc__s { font-size: 13px; color: var(--ink-3); }
.hm-calc__go { font-size: 14px; font-weight: 600; color: var(--accent); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.hm-note { font-size: 13px; color: var(--ink-3); margin-top: -8px; }

/* ── Витрина ───────────────────────────────────────────── */
.hm-show { background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.hm-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.hm-tab { font: inherit; font-size: 14.5px; padding: 8px 15px; border-radius: 99px; border: 0; cursor: pointer; background: var(--tint); color: var(--ink-2); transition: background .2s, color .2s; }
.hm-tab:hover { color: var(--ink); }
.hm-tab.is-on { background: var(--ink); color: #FFFFFF; }
.hm-panel[hidden] { display: none; }
/* Баннеры одной высоты во всех вкладках: её задаёт ряд из четырёх 240×400 (ширина = 0,6 высоты,
   три промежутка по 22 px), не больше 400 px. Нестандартный баннер (у вкладов Озона 385×490)
   той же высоты выходит шире — ширина берётся из пропорций картинки. */
.hm-panel { container-type: inline-size; }
.hm-bnrs { display: flex; gap: 22px; }
.hm-bnr { margin: 0; display: flex; flex-direction: column; gap: 8px; flex: none; width: min-content; }
.hm-bnr img { display: block; height: min(400px, calc((100cqw - 66px) / 2.4)); width: auto; border-radius: 12px; box-shadow: var(--shadow-sm); background: var(--tint); }
.hm-bnr a:hover img { box-shadow: var(--shadow-md); }
.hm-bnr figcaption { font-size: 11px; color: var(--ink-4); line-height: 1.35; }
.hm-risk { display: flex; gap: 10px; align-items: center; margin-top: 18px; font-weight: 600; font-size: 15px; color: var(--ink);
  background: var(--amber-tint); border-radius: var(--r-md); padding: 12px 16px; }
.hm-risk svg { width: 20px; height: 20px; flex: none; color: var(--amber); }
.hm-adnote { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ── Справочники ───────────────────────────────────────── */
.hm-refs { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 14px; }
.hm-ref { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; transition: box-shadow .2s; }
.hm-ref:hover { box-shadow: var(--shadow-md); }
.hm-ref:hover h3 { color: var(--accent); }
.hm-ref h3 { font-size: 17px; font-weight: 700; line-height: 1.3; transition: color .2s; }
.hm-ref p { font-size: 14px; color: var(--ink-3); }
.hm-ref--cal { grid-row: span 2; }
.hm-ref__m { font-size: 14px; font-weight: 600; margin-top: 8px; }
.hm-ref__v { font-family: 'Unbounded', 'Golos Text', sans-serif; font-weight: 700; font-size: 28px; letter-spacing: -.03em; line-height: 1.1; margin-top: 4px; }
.hm-ref__s { font-size: 13px; color: var(--ink-3); }
.hm-ref__l { display: flex; flex-direction: column; gap: 5px; margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; }
.hm-ref__l div { display: flex; justify-content: space-between; gap: 10px; }
.hm-ref__l dt { color: var(--ink-3); }
.hm-ref__l dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; }
.hm-ref__pair { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin: 6px 0 4px; }
.hm-ref__pair b { display: block; font-family: 'Unbounded', 'Golos Text', sans-serif; font-size: 18px; color: var(--ink); }
.hm-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: 12.5px; text-align: center; margin-top: 4px; }
.hm-cal b { font-weight: 500; color: var(--ink-4); font-size: 11px; }
.hm-cal span { padding: 6px 0; border-radius: 7px; background: var(--ground); font-variant-numeric: tabular-nums; }
.hm-cal span.off { background: var(--coral-tint); color: var(--coral); font-weight: 600; }
.hm-cal span.we { color: var(--coral); }
.hm-cal span.e { background: transparent; }
.hm-kbars { display: flex; gap: 6px; align-items: flex-end; height: 76px; margin-top: auto; padding-top: 10px; }
.hm-kb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.hm-kb i { display: block; width: 100%; background: var(--tint-2); border-radius: 5px 5px 2px 2px; }
.hm-kb:last-child i { background: var(--accent); }
.hm-kb span { font-size: 11px; color: var(--ink-4); }

/* ── Приложение ────────────────────────────────────────── */
.hm-app { background: var(--night); color: #FFFFFF; border-radius: var(--r-xl); padding: 36px; display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; overflow: hidden; }
.hm-app h2 { font-family: 'Unbounded', 'Golos Text', sans-serif; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-size: clamp(22px, 2.8vw, 30px); text-wrap: balance; }
.hm-app__txt > p { color: #C8C2E6; margin-top: 12px; font-size: 16px; }
.hm-app__feat { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-top: 20px; font-size: 15px; color: #E4E0F7; }
.hm-app__feat li { display: flex; gap: 9px; align-items: flex-start; }
.hm-app__feat li::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent-2); margin-top: 9px; flex: none; }
.hm-app__row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hm-btn--line { background: transparent; color: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.hm-btn--line:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55); }
.hm-app__price { font-size: 13.5px; color: #9C95C4; margin-top: 14px; }
.hm-app__shots { display: flex; gap: 16px; justify-content: center; align-items: center; }
.hm-app__shots img { width: 46%; max-width: 200px; height: auto; border-radius: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }

/* ── Сообщества ────────────────────────────────────────── */
.hm-subs { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--tint); border-radius: var(--r-lg); padding: 20px 24px; }
.hm-subs p { color: var(--ink-2); font-size: 15px; }
.hm-subs b { display: block; color: var(--ink); font-size: 17px; }
.hm-subs__l { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Адаптив ───────────────────────────────────────────── */
@media (max-width: 980px) {
  .hm-hero { grid-template-columns: minmax(0, 1fr); }
  .hm-calcs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-refs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-ref--cal { grid-column: 1 / -1; grid-row: auto; }
  .hm-app { grid-template-columns: minmax(0, 1fr); padding: 28px 24px; }
  .hm-app__shots { max-width: 440px; margin: 0 auto; }
}
@media (max-width: 640px) {
  .hm { padding-top: 28px; gap: 56px; }
  .hm-lead { font-size: 16.5px; }
  .hm-search .btn { display: none; }
  .hm-calcs, .hm-refs { grid-template-columns: minmax(0, 1fr); }
  .hm-calc { grid-row: auto; grid-template-rows: none; }
  .hm-show { padding: 18px 14px; }
  .hm-bnrs { flex-wrap: wrap; gap: 14px; }
  .hm-bnr { width: calc(50% - 7px); }
  .hm-bnr img { width: 100%; height: auto; }
  .hm-app__feat { grid-template-columns: minmax(0, 1fr); }
}
