/*!
 * CryptoDigest — карточка врезки инструмента ([cd_tool]).
 * Использует токены темы: --sf --tx --mu --ln --ac --up --dn --bd
 */

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

.cd-embed {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;

    margin: 1.5rem 0;
    padding: 0.875rem 1rem;

    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.35;

    color: var(--tx, #14161a);
    background: var(--sf, #f6f7f9);
    border: 1px solid var(--ln, var(--bd, rgba(0, 0, 0, 0.12)));
    border-radius: 0.75rem;
}

/* Внутри текста статьи (.cd-prose) карточка не наследует стили абзацев */
.cd-prose .cd-embed,
.cd-prose .cd-embed * {
    text-indent: 0;
    letter-spacing: normal;
    text-transform: none;
    font-style: normal;
}

.cd-prose .cd-embed p,
.cd-prose .cd-embed ul,
.cd-prose .cd-embed ol,
.cd-prose .cd-embed figure,
.cd-prose .cd-embed blockquote {
    margin: 0;
    padding: 0;
}

.cd-prose .cd-embed {
    font-size: 0.9375rem;
}

/* Иконка */

.cd-embed__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 2.25rem;
    height: 2.25rem;

    font-size: 1.25rem;
    line-height: 1;

    border-radius: 0.5rem;
    background: var(--sf, rgba(0, 0, 0, 0.04));
    border: 1px solid var(--ln, var(--bd, rgba(0, 0, 0, 0.08)));
}

/* Текстовый блок */

.cd-embed__body {
    flex: 1 1 10rem;
    min-width: 0;

    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.cd-embed__title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mu, #6b7280);
}

.cd-embed__value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--tx, #14161a);
    font-variant-numeric: tabular-nums;
}

.cd-embed__sub {
    font-size: 0.8125rem;
    line-height: 1.3;
    color: var(--mu, #6b7280);
    font-variant-numeric: tabular-nums;
}

.cd-embed__sub.is-up {
    color: var(--up, #16a34a);
}

.cd-embed__sub.is-down {
    color: var(--dn, #dc2626);
}

/* Ссылка */

.cd-embed__link {
    flex: 0 0 auto;
    margin-left: auto;
    align-self: center;

    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;

    color: var(--ac, #2563eb);
    text-decoration: none;
}

.cd-embed__link:hover,
.cd-embed__link:focus {
    text-decoration: underline;
}

.cd-embed__link:focus-visible {
    outline: 2px solid var(--ac, #2563eb);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* Мобильные — в столбик */

@media (max-width: 520px) {
    .cd-embed {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .cd-embed__link {
        margin-left: 0;
        align-self: flex-start;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .cd-embed__sub {
        transition: color 0.15s ease;
    }
}
