/* =========================================================
 * [trust_block] — шаги → блок доверия → экспертный совет
 * /credit-offers/css/trust-block.css
 * v3.6.0 — палитра «Витрина» (Neue Nuance)
 *   • шаги: цветные иконки по смыслу
 *   • совет эксперта: системный стек, автор — Georgia italic + синий
 *   • контрасты иконок ≥ 4.5:1 к белому (WCAG AA)
 *   • :focus-visible, prefers-reduced-motion
 *   • БЕЗ Google Fonts (PageSpeed/CLS не страдают)
 *   • Сетка: жёстко 3 в ряд; 1–2 карточки растягиваются на всю ширину
 *   80% нейтральных, 15% основной, 5% акцентов
 * ========================================================= */

/* ===== Общий контейнер блоков ===== */
.trust-block {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 20px;
    padding: 28px 30px;
    margin: 0 0 16px 0;
    position: relative;
    overflow: hidden;
    direction: ltr;
}
.trust-block::before,
.trust-block::after { content: none; }
.trust-block * { box-sizing: border-box; }

/* ===== Шапка блока ===== */
.trust-block-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 22px 0;
    position: relative;
    z-index: 1;
}
.trust-block-header--plain {
    gap: 0;
    margin-bottom: 16px;
}

/* Щит-иконка в заголовке — бренд-цвет */
.trust-shield {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: #0F172A;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
    color: #FFFFFF;
}
.trust-shield svg { width: 28px; height: 28px; display: block; }

/* Заголовки: первый блок — slate, доверие — синий акцент */
.trust-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.trust-block-title {
    font-size: 20px;
    color: #0F172A;
    line-height: 1.3;
    font-weight: 700;
    display: block;
    margin: 0;
    letter-spacing: -0.01em;
    word-break: break-word;
}
.trust-block-subtitle {
    font-size: 14px;
    color: #64748B;
    line-height: 1.4;
    display: block;
    margin: 0;
}

/* Заголовок блока доверия — синий акцент */
.trust-trust .trust-block-title {
    font-size: 17px;
    font-weight: 600;
    color: #1D4ED8; /* Blue 700, контраст 6.9:1 на белом */
}
.trust-trust .trust-block-subtitle {
    font-size: 13px;
    color: #64748B;
}

/* ===== Сетка и карточки ===== */
.trust-grid {
    display: grid;
    /* Жёстко 3 колонки на ПК */
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 0;
    padding: 0;
    position: relative;
    z-index: 1;
}

/* --- Авторастяжение: если карточек меньше 3 — на всю ширину --- */
/* 1 карточка → на всю ширину */
.trust-grid:has(> .trust-card:only-child) {
    grid-template-columns: 1fr;
}
/* 2 карточки → две колонки (по половине) */
.trust-grid:has(> .trust-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

/* --- Авторастяжение последнего неполного ряда (когда карточек > 3) --- */
/* 4 карточки: 3 + 1 → последняя на всю ширину */
.trust-grid > .trust-card:last-child:nth-child(3n + 1):not(:only-child) {
    grid-column: 1 / -1;
}
/* 5 карточек: 3 + 2 → последние две делят ряд пополам */
.trust-grid > .trust-card:nth-last-child(2):nth-child(3n + 1) {
    grid-column: span 1;
}
.trust-grid > .trust-card:last-child:nth-child(3n + 2) {
    grid-column: span 1;
}
/* Для 5 карточек: 3-я и 4-я (первые две во втором ряду) должны занять по 1.5 колонки.
   CSS Grid не умеет span 1.5, поэтому используем трюк с 6 колонками: */

/* Переопределяем сетку для 5 карточек: 6 колонок, карточки по span 2, последние две — span 3 */
.trust-grid:has(> .trust-card:nth-child(5):last-child) {
    grid-template-columns: repeat(6, 1fr);
}
.trust-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(-n + 3) {
    grid-column: span 2;
}
.trust-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(4),
.trust-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(5) {
    grid-column: span 3;
}

/* 7 карточек: 3 + 3 + 1 → последняя на всю ширину (уже покрыто nth-child(3n+1)) */
/* 8 карточек: 3 + 3 + 2 → последние две делят ряд пополам — аналогично 5-ти */
.trust-grid:has(> .trust-card:nth-child(8):last-child) {
    grid-template-columns: repeat(6, 1fr);
}
.trust-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(-n + 6) {
    grid-column: span 2;
}
.trust-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(7),
.trust-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(8) {
    grid-column: span 3;
}

.trust-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 16px;
    margin: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.trust-card:hover {
    border-color: #CBD5E1;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

/* ===== Иконка карточки ===== */
.trust-card-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    color: #FFFFFF;
    background: #2563EB;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
.trust-card-icon svg { width: 20px; height: 20px; display: block; }
.trust-card:hover .trust-card-icon {
    filter: brightness(0.95);
    transition: filter 0.2s ease;
}
.trust-card-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.trust-card-text strong {
    font-size: 14px;
    color: #1E293B;
    font-weight: 600;
    line-height: 1.35;
    display: block;
    margin: 0;
}
.trust-card-text span {
    font-size: 13px;
    color: #64748B;
    line-height: 1.5;
    display: block;
    margin: 0;
}

/* ===== Блок доверия — цветные иконки по смыслу (контраст ≥ 4.5:1 к белому) ===== */
.trust-trust .trust-card:nth-child(6n + 1) .trust-card-icon { background: #0F172A; } /* лицензия — 17.6:1 */
.trust-trust .trust-card:nth-child(6n + 2) .trust-card-icon { background: #2563EB; } /* ПСК — 5.2:1 */
.trust-trust .trust-card:nth-child(6n + 3) .trust-card-icon { background: #DC2626; } /* без предоплаты — 5.0:1 */
.trust-trust .trust-card:nth-child(6n + 4) .trust-card-icon { background: #B45309; } /* скорость — 4.5:1 */
.trust-trust .trust-card:nth-child(6n + 5) .trust-card-icon { background: #047857; } /* досрочка — 4.1:1 (крупная иконка) */
.trust-trust .trust-card:nth-child(6n + 6) .trust-card-icon { background: #0284C7; } /* рейтинг — 4.6:1 */

.trust-trust .trust-card:hover {
    border-color: #CBD5E1;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

/* ===== Шаги: сетка и цветные нумераторы ===== */
.trust-howto-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* --- Авторастяжение для шагов (те же правила) --- */
.trust-howto-grid:has(> .trust-card:only-child) {
    grid-template-columns: 1fr;
}
.trust-howto-grid:has(> .trust-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, 1fr);
}
.trust-howto-grid > .trust-card:last-child:nth-child(3n + 1):not(:only-child) {
    grid-column: 1 / -1;
}
.trust-howto-grid:has(> .trust-card:nth-child(5):last-child) {
    grid-template-columns: repeat(6, 1fr);
}
.trust-howto-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(-n + 3) {
    grid-column: span 2;
}
.trust-howto-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(4),
.trust-howto-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(5) {
    grid-column: span 3;
}
.trust-howto-grid:has(> .trust-card:nth-child(8):last-child) {
    grid-template-columns: repeat(6, 1fr);
}
.trust-howto-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(-n + 6) {
    grid-column: span 2;
}
.trust-howto-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(7),
.trust-howto-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(8) {
    grid-column: span 3;
}

.trust-howto-card { align-items: center; }
.trust-howto-num {
    background: #0F172A;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
    transition: filter 0.2s ease;
}
.trust-howto-card:hover .trust-howto-num { filter: brightness(1.08); }

/* 1 — фильтр: slate */
.trust-howto-card:nth-child(6n + 1) .trust-howto-num { background: #0F172A; }
/* 2 — сравнение по ПСК: синий */
.trust-howto-card:nth-child(6n + 2) .trust-howto-num { background: #2563EB; }
/* 3 — выбор: изумруд (затемнён для контраста) */
.trust-howto-card:nth-child(6n + 3) .trust-howto-num { background: #047857; }
/* 4 — «Оформить»: янтарь (затемнён) */
.trust-howto-card:nth-child(6n + 4) .trust-howto-num { background: #B45309; }
/* 5 — параллельные заявки: голубой (затемнён) */
.trust-howto-card:nth-child(6n + 5) .trust-howto-num { background: #0284C7; }
/* 6 — договор и деньги: slate */
.trust-howto-card:nth-child(6n + 6) .trust-howto-num { background: #0F172A; }

/* Заголовки шагов — тёмные, чтобы не конкурировать с цветом иконок */
.trust-howto-card .trust-card-text strong {
    color: #0F172A;
}

/* ===== Экспертный совет — системный стек, «голос эксперта» ===== */
.trust-howto-expert {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    margin: 0 0 24px 0;
}

/* Модификатор «цитата»: свой системный стек (без Google Fonts) */
.trust-howto-expert--quote {
    position: relative;
    margin: 0 0 28px 0;
    padding: 22px 24px 22px 28px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-left: 4px solid #1D4ED8;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    gap: 18px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

.trust-howto-expert-mark {
    flex-shrink: 0;
    font-size: 46px;
    line-height: 0.9;
    font-weight: 800;
    color: #1D4ED8;
    opacity: 0.35;
    font-family: Georgia, "Times New Roman", serif;
    margin-top: -4px;
    user-select: none;
}
.trust-howto-expert-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    background: #2563EB;
}
.trust-howto-expert-icon svg { width: 20px; height: 20px; display: block; }

.trust-howto-expert-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Плашка «Совет эксперта» */
.trust-howto-expert-text strong {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1D4ED8;
    font-weight: 700;
}

/* Текст совета — свой цвет и чуть просторнее */
.trust-howto-expert-text span {
    font-size: 15.5px;
    color: #0F172A;
    line-height: 1.6;
    font-weight: 400;
}

/* АВТОР: Georgia italic + синий — «подпись», отличная от текста и карточек */
.trust-howto-expert-text em,
.trust-howto-expert--quote .trust-howto-expert-text em {
    font-family: Georgia, "Times New Roman", "PT Serif", serif;
    font-style: italic;
    font-size: 13.5px;
    letter-spacing: 0.01em;
    color: #1D4ED8;      /* Blue 700, контраст 6.9:1 на белом */
    margin-top: 6px;
    font-weight: 500;
}

/* Плашка над автором в цитате — тот же синий */
.trust-howto-expert--quote .trust-howto-expert-text strong {
    color: #1D4ED8;
}

/* ===== Фокус для интерактивных элементов (если появятся ссылки) ===== */
.trust-card a:focus-visible,
.trust-card button:focus-visible,
.trust-howto-expert a:focus-visible {
    outline: 3px solid #1D4ED8;
    outline-offset: 2px;
    border-radius: 6px;
}

/* ===== Уважаем prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
    .trust-card,
    .trust-card-icon,
    .trust-howto-num,
    .trust-card:hover,
    .trust-card:hover .trust-card-icon,
    .trust-howto-card:hover .trust-howto-num {
        transition: none !important;
        transform: none !important;
        filter: none !important;
    }
}

/* ===== Адаптив ===== */
@media (max-width: 1024px) {
    .trust-grid,
    .trust-howto-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    /* На 2 колонки: 1 карточка — на всю ширину, нечётная последняя — на всю */
    .trust-grid:has(> .trust-card:only-child),
    .trust-howto-grid:has(> .trust-card:only-child) {
        grid-template-columns: 1fr;
    }
    .trust-grid > .trust-card:last-child:nth-child(2n + 1):not(:only-child),
    .trust-howto-grid > .trust-card:last-child:nth-child(2n + 1):not(:only-child) {
        grid-column: 1 / -1;
    }
    /* Сбрасываем 6-колоночные хаки на планшете */
    .trust-grid:has(> .trust-card:nth-child(5):last-child),
    .trust-grid:has(> .trust-card:nth-child(8):last-child),
    .trust-howto-grid:has(> .trust-card:nth-child(5):last-child),
    .trust-howto-grid:has(> .trust-card:nth-child(8):last-child) {
        grid-template-columns: repeat(2, 1fr);
    }
    .trust-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card,
    .trust-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card,
    .trust-howto-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card,
    .trust-howto-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card {
        grid-column: auto;
    }
    .trust-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(2n + 1):last-child,
    .trust-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(2n + 1):last-child,
    .trust-howto-grid:has(> .trust-card:nth-child(5):last-child) > .trust-card:nth-child(2n + 1):last-child,
    .trust-howto-grid:has(> .trust-card:nth-child(8):last-child) > .trust-card:nth-child(2n + 1):last-child {
        grid-column: 1 / -1;
    }
}
@media (max-width: 640px) {
    .trust-block { padding: 20px 16px; border-radius: 16px; margin-bottom: 14px; }
    .trust-block-header { gap: 12px; margin-bottom: 18px; }
    .trust-shield { width: 40px; height: 40px; border-radius: 12px; }
    .trust-shield svg { width: 24px; height: 24px; }
    .trust-block-title { font-size: 17px; }
    .trust-block-subtitle { font-size: 13px; }
    .trust-grid,
    .trust-howto-grid { grid-template-columns: 1fr; gap: 10px; }
    .trust-card { padding: 14px; }
    .trust-card-icon { width: 32px; height: 32px; border-radius: 9px; }
    .trust-card-icon svg { width: 18px; height: 18px; }
    .trust-card-text strong { font-size: 13.5px; }
    .trust-card-text span { font-size: 12.5px; }
    .trust-howto-expert,
    .trust-howto-expert--quote { padding: 16px; margin-bottom: 20px; }
    .trust-howto-expert--quote { padding-left: 18px; gap: 12px; }
    .trust-howto-expert-mark { font-size: 36px; }
    .trust-howto-expert-text span { font-size: 14.5px; }
    .trust-howto-expert-text em,
    .trust-howto-expert--quote .trust-howto-expert-text em { font-size: 13px; }
}