/* ==========================================================================
   YooAI - Blog — витрина. Изоляция в .yooai-blog, CSS-переменные, без сторонних библиотек.
   ========================================================================== */

.yooai-blog {
    --yoo-blog-accent: #2563eb;
    --yoo-blog-radius: 16px;
    --yoo-blog-gap: 20px;
    --yoo-blog-text: #0f172a;
    --yoo-blog-muted: #64748b;
    --yoo-blog-border: #e2e8f0;
    --yoo-blog-bg: #ffffff;
    --yoo-blog-soft: #f8fafc;
    --yoo-thumb-inset: 0px;
    --yoo-thumb-compact-inset: 0px;
    --yoo-thumb-radius: 0px;
    font-family: inherit;
    color: var(--yoo-blog-text);
}

/* Статья: цвет и шрифт текста с шаблона, не с карточек блога. */
.yooai-post {
    color: inherit;
    font-family: inherit;
}

.yooai-blog--inset {
    --yoo-thumb-inset: 12px;
    --yoo-thumb-compact-inset: 8px;
    --yoo-thumb-radius: 10px;
}

.yooai-blog:not(.yooai-blog--inset) .yooai-card__media,
.yooai-blog--flush .yooai-card__media,
.yooai-blog:not(.yooai-blog--inset) .yooai-card--compact .yooai-card__media,
.yooai-blog--flush .yooai-card--compact .yooai-card__media {
    margin: 0 !important;
    border-radius: 0 !important;
}

.yooai-blog *,
.yooai-blog *::before,
.yooai-blog *::after {
    box-sizing: border-box;
}

.yooai-blog--theme-dark {
    --yoo-blog-text: #f8fafc;
    --yoo-blog-muted: #cbd5e1;
    --yoo-blog-border: #334155;
    --yoo-blog-bg: #0f172a;
    --yoo-blog-soft: #1e293b;
    color: #f8fafc;
}

.yooai-blog--theme-dark a.yooai-card,
.yooai-blog--theme-dark .yooai-card,
.yooai-blog--theme-dark .yooai-card *,
.yooai-blog--theme-dark .yooai-card__body,
.yooai-blog--theme-dark .yooai-card__name,
.yooai-blog--theme-dark .yooai-card__date,
.yooai-blog--theme-dark .yooai-blog__title {
    color: #f8fafc !important;
}

.yooai-blog--theme-dark .yooai-blog__more {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc !important;
}

.yooai-blog--theme-dark .yooai-blog__more:hover,
.yooai-blog--theme-dark .yooai-blog__more:focus {
    border-color: #93c5fd;
    color: #93c5fd !important;
}

.yooai-blog--theme-dark .yooai-card__excerpt,
.yooai-blog--theme-dark .yooai-card__stats,
.yooai-blog--theme-dark .yooai-card__views,
.yooai-blog--theme-dark .yooai-card__meta,
.yooai-blog--theme-dark .yooai-blog__subtitle {
    color: #cbd5e1 !important;
}

.yooai-blog--theme-dark .yooai-card {
    background: #0f172a;
    border-color: #334155;
}

.yooai-blog--theme-dark .yooai-card__badge {
    background: rgba(255, 255, 255, 0.16);
    color: #e2e8f0 !important;
}

.yooai-blog--theme-soft {
    --yoo-blog-bg: #f8fafc;
    --yoo-blog-soft: #ffffff;
}

.yooai-blog__head {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    text-align: left;
}

.yooai-blog__head > div {
    width: 100%;
    text-align: left;
}

.yooai-blog__title {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    text-align: left !important;
}

.yooai-blog__subtitle {
    margin: 8px 0 0;
    color: var(--yoo-blog-muted);
    font-size: 15px;
    text-align: left !important;
}

.yooai-blog__foot {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.yooai-blog__more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 26px;
    border-radius: 999px;
    border: 1px solid var(--yoo-blog-border);
    background: var(--yoo-blog-soft);
    color: var(--yoo-blog-text);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.yooai-blog__more:hover,
.yooai-blog__more:focus {
    border-color: var(--yoo-blog-accent);
    color: var(--yoo-blog-accent);
    background: #fff;
    text-decoration: none;
}

.yooai-blog__cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.yooai-blog__cat,
.yooai-blog__cat:hover,
.yooai-blog__cat:focus,
.yooai-blog__cat:active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--yoo-blog-soft);
    border: 1px solid var(--yoo-blog-border);
    color: inherit;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
}

.yooai-blog__cat.is-active {
    background: var(--yoo-blog-accent);
    border-color: var(--yoo-blog-accent);
    color: #fff;
}

.yooai-blog--boxed {
    max-width: var(--yoo-blog-max, none);
    margin-left: auto;
    margin-right: auto;
}

.yooai-blog--full {
    width: 100%;
    max-width: none;
}

/* Оболочка: отступы блока. Ширина — класс Bootstrap «container» + yooai-cw-* */
.yooai-blog-shell {
    width: 100%;
    position: relative;
}

.yooai-blog-shell .yooai-blog,
.yooai-blog[style*="--yoo-blog-mt"] {
    padding-top: var(--yoo-blog-mt-m, 0px);
    padding-bottom: var(--yoo-blog-mb-m, 0px);
    padding-left: var(--yoo-blog-ml-m, 0px);
    padding-right: var(--yoo-blog-mr-m, 0px);
    --yoo-blog-gap: var(--yoo-blog-gap-m, 16px);
}

/* Страницы блога: зазор под меню и над подвалом. Боковые поля контейнера не трогаем. */
.yooai-blog-page {
    padding-top: var(--yoo-blog-mt-m, 16px) !important;
    padding-bottom: var(--yoo-blog-mb-m, 40px) !important;
}

.yooai-cw-m-full {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

/* iOS Safari: 100vw шире visual viewport → body{overflow-x:hidden} клипает правый край текста */
@supports (width: 100dvw) {
    .yooai-cw-m-full {
        width: 100dvw !important;
        max-width: 100dvw !important;
        margin-left: calc(50% - 50dvw) !important;
        margin-right: calc(50% - 50dvw) !important;
    }
}

.yooai-cw-m-full .yooai-card--hero {
    border-radius: 0;
}

.yooai-cw-m-boxed {
    width: 100%;
    max-width: var(--yoo-cw-max-m, none);
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .yooai-blog-shell .yooai-blog,
    .yooai-blog[style*="--yoo-blog-mt"] {
        padding-top: var(--yoo-blog-mt-d, 0px);
        padding-bottom: var(--yoo-blog-mb-d, 0px);
        padding-left: var(--yoo-blog-ml-d, 0px);
        padding-right: var(--yoo-blog-mr-d, 0px);
        --yoo-blog-gap: var(--yoo-blog-gap-d, 20px);
    }

    .yooai-blog-page {
        padding-top: var(--yoo-blog-mt-d, 24px) !important;
        padding-bottom: var(--yoo-blog-mb-d, 56px) !important;
    }

    .yooai-cw-m-full,
    .yooai-cw-m-boxed {
        width: auto;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .yooai-cw-m-full .yooai-card--hero {
        border-radius: var(--yoo-blog-radius);
    }

    .container.yooai-cw-m-container:not(.yooai-cw-d-container) {
        width: auto;
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    .yooai-cw-d-full {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: calc(50% - 50vw) !important;
        margin-right: calc(50% - 50vw) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }

    @supports (width: 100dvw) {
        .yooai-cw-d-full {
            width: 100dvw !important;
            max-width: 100dvw !important;
            margin-left: calc(50% - 50dvw) !important;
            margin-right: calc(50% - 50dvw) !important;
        }
    }

    .yooai-cw-d-boxed,
    .container.yooai-cw-d-boxed {
        width: 100%;
        max-width: var(--yoo-cw-max-d, none) !important;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 767px) {
    /* Сетка bento на мобиле не должна быть container — иначе большая карточка не выйдет на всю ширину */
    .yooai-blog__bento.container:not(.yooai-cw-m-container) {
        width: auto !important;
        max-width: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .container.yooai-cw-m-full {
        width: 100vw !important;
        max-width: 100vw !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: calc(50% - 50vw) !important;
        margin-right: calc(50% - 50vw) !important;
        box-sizing: border-box !important;
    }

    @supports (width: 100dvw) {
        .container.yooai-cw-m-full {
            width: 100dvw !important;
            max-width: 100dvw !important;
            margin-left: calc(50% - 50dvw) !important;
            margin-right: calc(50% - 50dvw) !important;
        }
    }

    .container.yooai-cw-m-boxed {
        width: 100%;
        max-width: var(--yoo-cw-max-m, none);
    }
}

.yooai-blog__empty {
    padding: 48px 16px;
    text-align: center;
    color: var(--yoo-blog-muted);
}

/* Карточка статьи */
.yooai-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--yoo-blog-bg);
    /*border: 1px solid var(--yoo-blog-border);*/
    border-radius: var(--yoo-blog-radius);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.yooai-card__hit {
    position: absolute;
    inset: 0;
    z-index: 1;
    text-decoration: none;
    color: inherit;
}

a.yooai-card:hover,
.yooai-card:hover {
    color: inherit;
    text-decoration: none;
}

.yooai-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--yoo-blog-soft);
    overflow: hidden;
    margin: var(--yoo-thumb-inset) var(--yoo-thumb-inset) 0;
    border-radius: var(--yoo-thumb-radius);
}

.yooai-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Вуаль эффекта живёт внутри фото и не двигает саму картинку */
.yooai-card__media::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
}

.yooai-card__body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
    flex: 1;
    pointer-events: none;
}

.yooai-card__badge,
a.yooai-card__badge:hover,
a.yooai-card__badge:focus,
a.yooai-card__badge:active {
    display: inline-flex;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #eff6ff;
    color: var(--yoo-blog-accent);
    text-decoration: none !important;
    pointer-events: auto;
    position: relative;
    z-index: 2;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.yooai-card__badge:hover,
a.yooai-card__badge:hover {
    background: #c7d2fe;
    color: #1e3a8a;
    filter: brightness(0.96);
    text-decoration: none !important;
}

.yooai-card__name {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.yooai-card__excerpt {
    margin: 0;
    font-size: 15px;
    color: var(--yoo-blog-muted);
    line-height: 1.45;
}

.yooai-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    margin-top: auto;
    font-size: 12px;
    color: var(--yoo-blog-muted);
}

.yooai-card__date {
    font-weight: 600;
    color: var(--yoo-blog-text);
    white-space: nowrap;
}

.yooai-card__stats {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    color: var(--yoo-blog-muted);
}

.yooai-card__views {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.yooai-card__views svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.yooai-card--hero .yooai-card__media {
    margin: 0;
    border-radius: 0;
    aspect-ratio: auto;
    height: 100%;
    min-height: 360px;
}

.yooai-card--hero .yooai-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yooai-card--hero .yooai-card__overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    box-sizing: border-box;
    /* width:auto + left/right — Safari не раздувает absolute-блок как max-content */
    width: auto;
    max-width: none;
    padding: 28px 22px 20px;
    /* block вместо flex: WebKit иначе даёт детям intrinsic-ширину и клипает overflow */
    display: block;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0) 0%, rgba(15, 23, 42, 0.55) 42%, rgba(15, 23, 42, 0.88) 100%);
    color: #fff;
}

.yooai-card--hero .yooai-card__name {
    display: block;
    width: auto;
    max-width: 100%;
    margin: 0 0 8px;
    font-size: 32px;
    letter-spacing: 0; /* отрицательный letter-spacing в Safari клипает последнюю букву при overflow:hidden */
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
}

.yooai-card--hero .yooai-card__excerpt {
    display: block;
    width: auto;
    max-width: 100%;
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.88);
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
    -webkit-line-clamp: unset;
}

.yooai-card--hero .yooai-card__badge {
    display: inline-flex;
    margin: 0 0 8px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    transition: background 0.2s ease;
}

.yooai-card--hero .yooai-card__badge:hover {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
    filter: none;
}

.yooai-card--hero .yooai-card__meta {
    display: flex;
    width: auto;
    max-width: 100%;
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
}

.yooai-card--hero .yooai-card__date {
    color: #fff;
}

.yooai-card--hero .yooai-card__stats,
.yooai-card--hero .yooai-card__views {
    color: rgba(255, 255, 255, 0.92);
}

.yooai-card--compact {
    flex-direction: row;
    align-items: stretch;
    min-height: 118px;
    height: auto;
    overflow: hidden;
}

.yooai-card--compact .yooai-card__media {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    aspect-ratio: auto;
    height: auto;
    align-self: stretch;
    margin: var(--yoo-thumb-compact-inset) 0 var(--yoo-thumb-compact-inset) var(--yoo-thumb-compact-inset);
    border-radius: var(--yoo-thumb-radius);
}

.yooai-card--compact .yooai-card__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.yooai-card--compact .yooai-card__body {
    flex: 1 1 0%; /* Safari: иначе текст в ряду вылезает и клипается overflow карточки */
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding: 12px 14px;
    justify-content: center;
    overflow: hidden;
}

.yooai-card--compact .yooai-card__name {
    font-size: 17px;
    line-height: 1.4;
    letter-spacing: 0;
    display: block;
    max-width: 100%;
    max-height: none;
    overflow: visible;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-line-clamp: unset;
}

.yooai-card--compact .yooai-card__excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.4;
    max-height: 2.8em;
    margin: 0;
}

/* Эффекты наведения: без scale, картинка не мылится. На тач-экранах не включаются. */
@media (hover: hover) {
    .yooai-blog--hover-dim .yooai-card__media::after,
    .yooai-blog--hover-shine .yooai-card__media::after,
    .yooai-blog--hover-soft .yooai-card__media::after,
    .yooai-blog--hover-veil .yooai-card__media::after {
        transition: opacity 0.4s cubic-bezier(0.33, 1, 0.68, 1), transform 0.7s cubic-bezier(0.33, 1, 0.68, 1);
    }

    .yooai-blog--hover-dim .yooai-card__name,
    .yooai-blog--hover-shine .yooai-card__name,
    .yooai-blog--hover-soft .yooai-card__name,
    .yooai-blog--hover-veil .yooai-card__name,
    .yooai-blog--hover-ink .yooai-card__name,
    .yooai-blog--hover-frame .yooai-card__name {
        transition: color 0.35s cubic-bezier(0.33, 1, 0.68, 1), background-size 0.4s cubic-bezier(0.33, 1, 0.68, 1);
    }

    .yooai-blog--hover-dim .yooai-card:hover .yooai-card__name,
    .yooai-blog--hover-shine .yooai-card:hover .yooai-card__name,
    .yooai-blog--hover-soft .yooai-card:hover .yooai-card__name,
    .yooai-blog--hover-veil .yooai-card:hover .yooai-card__name,
    .yooai-blog--hover-ink .yooai-card:hover .yooai-card__name,
    .yooai-blog--hover-frame .yooai-card:hover .yooai-card__name {
        color: var(--yoo-blog-accent);
    }

    .yooai-blog--hover-dim .yooai-card--hero:hover .yooai-card__name,
    .yooai-blog--hover-shine .yooai-card--hero:hover .yooai-card__name,
    .yooai-blog--hover-soft .yooai-card--hero:hover .yooai-card__name,
    .yooai-blog--hover-veil .yooai-card--hero:hover .yooai-card__name,
    .yooai-blog--hover-ink .yooai-card--hero:hover .yooai-card__name,
    .yooai-blog--hover-frame .yooai-card--hero:hover .yooai-card__name {
        color: #fff;
    }

    /* Затемнение фото */
    .yooai-blog--hover-dim .yooai-card__media::after {
        background: rgba(15, 23, 42, 0.34);
    }

    .yooai-blog--hover-dim .yooai-card:hover .yooai-card__media::after {
        opacity: 1;
    }

    /* Блик по фото */
    .yooai-blog--hover-shine .yooai-card__media::after {
        opacity: 1;
        background: linear-gradient(
            115deg,
            transparent 34%,
            rgba(255, 255, 255, 0.42) 50%,
            transparent 66%
        );
        transform: translateX(-130%);
    }

    .yooai-blog--hover-shine .yooai-card:hover .yooai-card__media::after {
        transform: translateX(130%);
    }

    /* Мягкий градиент снизу */
    .yooai-blog--hover-soft .yooai-card__media::after {
        background: linear-gradient(to top, rgba(15, 23, 42, 0.55) 0%, rgba(15, 23, 42, 0.16) 46%, transparent 72%);
    }

    .yooai-blog--hover-soft .yooai-card:hover .yooai-card__media::after {
        opacity: 1;
    }

    /* Цветная вуаль в акценте темы */
    .yooai-blog--hover-veil .yooai-card__media::after {
        background: var(--yoo-blog-accent);
    }

    .yooai-blog--hover-veil .yooai-card:hover .yooai-card__media::after {
        opacity: 0.32;
    }

    /* Подчёркивание заголовка */
    .yooai-blog--hover-ink .yooai-card__name {
        background-image: linear-gradient(currentColor, currentColor);
        background-position: 0 100%;
        background-repeat: no-repeat;
        background-size: 0% 1.5px;
        padding-bottom: 1px;
    }

    .yooai-blog--hover-ink .yooai-card:hover .yooai-card__name {
        background-size: 100% 1.5px;
    }

    /* Акцентная рамка без сдвига вёрстки */
    .yooai-blog--hover-frame .yooai-card {
        transition: border-color 0.35s cubic-bezier(0.33, 1, 0.68, 1), box-shadow 0.35s cubic-bezier(0.33, 1, 0.68, 1);
    }

    .yooai-blog--hover-frame .yooai-card:hover {
        border-color: var(--yoo-blog-accent);
        box-shadow: 0 0 0 1px var(--yoo-blog-accent);
    }

    /* Тень карточки, фото остаётся на месте */
    .yooai-blog--hover-shadow .yooai-card {
        transition: box-shadow 0.35s cubic-bezier(0.33, 1, 0.68, 1);
    }

    .yooai-blog--hover-shadow .yooai-card:hover {
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
    }

    .yooai-blog--theme-dark.yooai-blog--hover-shadow .yooai-card:hover {
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.45);
    }
}

@media (prefers-reduced-motion: reduce) {
    .yooai-card__media::after,
    .yooai-card__name,
    .yooai-card,
    .yooai-product {
        transition: none;
        transform: none;
    }
}

/* Сетки виджетов */
.yooai-blog__grid {
    display: grid;
    grid-template-columns: repeat(var(--yoo-blog-cols, 3), minmax(0, 1fr));
    gap: var(--yoo-blog-gap);
    align-items: stretch;
}

.yooai-blog__grid .yooai-card__media {
    aspect-ratio: var(--yoo-blog-ratio, 16 / 9);
}

.yooai-blog__bento {
    display: grid;
    grid-template-columns: minmax(0, var(--yoo-bento-hero, 1.85fr)) minmax(220px, 1fr);
    gap: var(--yoo-blog-gap);
    align-items: stretch;
}

.yooai-blog__hero-slot {
    min-width: 0;
}

.yooai-blog__bento-side {
    display: flex;
    flex-direction: column;
    gap: var(--yoo-blog-gap);
    min-width: 0;
}

/* Bootstrap .container::before/::after (clearfix) становятся flex-элементами:
   gap рисует «дыры» над первой и под последней карточкой. Класс container оставляем. */
.yooai-blog__bento-side::before,
.yooai-blog__bento-side::after,
.yooai-blog__head.container::before,
.yooai-blog__head.container::after,
.yooai-blog__bento.container::before,
.yooai-blog__bento.container::after {
    content: none !important;
    display: none !important;
}

.yooai-blog__bento-side .yooai-card--compact {
    flex: 0 0 auto;
}

@media (min-width: 992px) {
    /*
     * Причина «дыры» под заголовком: тема часто даёт .container { padding-top/... }.
     * Класс container оставляем (max-width и боковые паддинги темы),
     * вертикаль у сетки глушим — иначе между subtitle и карточками пустота.
     */
    .yooai-blog__bento.container,
    .yooai-blog__bento.yooai-cw-d-container,
    .yooai-blog__bento.yooai-cw-d-boxed {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Ячейки в ряду: ширину даёт grid — container/boxed/full не должны задавать box */
    .yooai-blog__bento .yooai-blog__hero-slot.container,
    .yooai-blog__bento .yooai-blog__bento-side.container,
    .yooai-blog__bento .yooai-blog__hero-slot.yooai-cw-d-boxed,
    .yooai-blog__bento .yooai-blog__bento-side.yooai-cw-d-boxed,
    .yooai-blog__bento .yooai-blog__hero-slot.yooai-cw-d-full,
    .yooai-blog__bento .yooai-blog__bento-side.yooai-cw-d-full,
    .yooai-blog__bento .yooai-blog__hero-slot.yooai-cw-d-container,
    .yooai-blog__bento .yooai-blog__bento-side.yooai-cw-d-container {
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /*
     * На средних десктопах (~992–1200) aspect-ratio фото делает hero «блином»,
     * а правая колонка выше — низ не совпадает. Высоту ряда задаёт side,
     * большая карточка растягивается на весь ряд (cover), как на широком десктопе.
     */
    .yooai-blog__hero-slot {
        display: flex;
        flex-direction: column;
        align-self: stretch;
        min-height: 0;
    }

    .yooai-blog__bento .yooai-card--hero {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        width: 100%;
        height: 100%;
        min-height: 360px;
    }

    .yooai-blog__bento .yooai-card--hero .yooai-card__media {
        flex: 1 1 auto;
        width: 100%;
        height: auto;
        min-height: 100%;
        aspect-ratio: auto !important; /* снять inline ratio из twig */
    }

    .yooai-blog__bento-side {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-self: stretch;
        height: auto;
        min-height: 0;
        overflow: hidden;
        gap: var(--yoo-blog-gap);
    }

    .yooai-blog__bento-side .yooai-card--compact {
        flex: 1 1 0%;
        min-height: 118px;
        height: auto;
    }

    .yooai-blog__bento-side .yooai-card--compact .yooai-card__media {
        align-self: stretch;
        min-height: 0;
    }
}

.yooai-blog__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.yooai-blog--list-plain .yooai-blog__list .yooai-card__media {
    display: none;
}

.yooai-blog--list-divided .yooai-blog__list {
    gap: 0;
}

.yooai-blog--list-divided .yooai-blog__list .yooai-card--compact {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.yooai-blog--list-divided .yooai-blog__list .yooai-card--compact + .yooai-card--compact {
    border-top: 1px solid var(--yoo-blog-border);
}

.yooai-blog__carousel {
    display: flex;
    align-items: stretch;
    gap: var(--yoo-blog-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.yooai-blog__carousel::-webkit-scrollbar {
    display: none;
}

.yooai-blog__carousel .yooai-card {
    flex: 0 0 calc((100% - (var(--yoo-carousel-d, 3) - 1) * var(--yoo-blog-gap, 20px)) / var(--yoo-carousel-d, 3));
    width: auto;
    min-width: 0;
    scroll-snap-align: start;
    align-self: stretch;
    min-height: 100%;
}

.yooai-blog--arrows-hidden .yooai-blog__nav {
    display: none;
}

.yooai-blog__nav {
    display: flex;
    gap: 8px;
}

.yooai-blog__nav button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--yoo-blog-border);
    background: var(--yoo-blog-bg);
    cursor: pointer;
    font-size: 16px;
}

@media (max-width: 991px) {
    .yooai-blog__grid {
        grid-template-columns: repeat(var(--yoo-blog-cols-t, 2), minmax(0, 1fr));
    }

    .yooai-blog__bento {
        grid-template-columns: 1fr;
    }

    .yooai-blog--arrows-desktop .yooai-blog__nav {
        display: none;
    }

    .yooai-card--hero .yooai-card__overlay {
        padding: 22px 16px 16px;
    }

    .yooai-card--hero .yooai-card__name {
        font-size: 24px;
        line-height: 1.25;
    }

    .yooai-card--hero .yooai-card__excerpt {
        font-size: 14px;
    }

    .yooai-card--hero .yooai-card__media {
        min-height: 300px;
    }
}

@media (max-width: 767px) {
    .yooai-blog__grid {
        grid-template-columns: repeat(var(--yoo-blog-cols-m, 1), minmax(0, 1fr));
    }

    .yooai-blog__carousel .yooai-card {
        flex-basis: calc((100% - (var(--yoo-carousel-m, 1.15) - 1) * var(--yoo-blog-gap, 20px)) / var(--yoo-carousel-m, 1.15));
    }
}

@media (max-width: 479px) {
    .yooai-card--hero .yooai-card__name {
        font-size: 22px;
    }
}

/* Статья */
.yooai-post__hero {
    margin: 0 0 22px;
    border-radius: var(--yoo-blog-radius);
    overflow: hidden;
    background: var(--yoo-blog-soft);
    aspect-ratio: 1200 / 630;
}

.yooai-post__hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.yooai-blog--flush .yooai-post__hero,
.yooai-blog:not(.yooai-blog--inset) .yooai-post__hero {
    width: 100%;
    max-width: none;
    margin: 0 0 28px;
}

.yooai-post__hero--content {
    width: 100%;
    margin: 0 0 22px;
    border-radius: var(--yoo-blog-radius);
}

.yooai-post__lead {
    float: left;
    width: min(280px, 42%);
    margin: 6px 22px 14px 0;
    border-radius: var(--yoo-blog-radius);
    overflow: hidden;
    background: var(--yoo-blog-soft);
    aspect-ratio: 3 / 2;
}

.yooai-post__lead img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.yooai-post__content::after {
    content: "";
    display: table;
    clear: both;
}

.yooai-post__h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.yooai-post__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 22px;
    color: var(--yoo-blog-muted);
    font-size: 13.5px;
}

.yooai-post__meta .yooai-card__date {
    font-size: 13.5px;
}

.yooai-post__meta .yooai-card__stats {
    font-size: 13px;
}

/* overflow:hidden у .row/#content темы ломает sticky — держим видимость на своей оболочке */
.yooai-post,
.yooai-post__layout,
.yooai-post__main {
    overflow: visible;
}

.yooai-post__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    grid-template-areas: "main toc";
    gap: 32px;
    align-items: start;
}

.yooai-post__main {
    grid-area: main;
    min-width: 0;
}

.yooai-post__layout.is-solo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
}

.yooai-post__toc {
    grid-area: toc;
    align-self: start;
    position: -webkit-sticky;
    position: sticky;
    top: 24px;
    z-index: 5;
    max-height: calc(100vh - 48px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--yoo-blog-border);
    border-radius: 12px;
    background: var(--yoo-blog-soft);
    -webkit-overflow-scrolling: touch;
}

.yooai-post__toc.is-pinned {
    position: fixed;
    margin: 0;
    box-sizing: border-box;
}

.yooai-post__toc-ph {
    grid-area: toc;
    align-self: start;
    width: 240px;
    max-width: 100%;
    pointer-events: none;
}

.yooai-post__toc h2 {
    margin: 0 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.yooai-post__toc a {
    display: block;
    padding: 6px 8px;
    margin: 0 -8px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.35;
    transition: background 0.2s ease;
}

.yooai-post__toc a:hover {
    background: #e2e8f0;
}

.yooai-post__toc a.is-h3 {
    padding-left: 12px;
    color: var(--yoo-blog-muted);
}

/* Текст статьи (h1–h6, p, ссылки) не красим: шрифт и цвет берёт шаблон.
   Списки и таблицы — всегда модуль. Тема часто обнуляет ul/ol/table. */
#content .yooai-post__content ul,
#content .yooai-post__content ol {
    margin: 1em 0 1.75em !important;
    padding: 0 !important;
    list-style: none !important;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

#content .yooai-post__content ol {
    counter-reset: yoo-ol;
}

#content .yooai-post__content li {
    position: relative;
    margin: 0 0 10px !important;
    padding-left: 28px;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

#content .yooai-post__content li:last-child {
    margin-bottom: 0 !important;
}

#content .yooai-post__content ul > li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 14px;
    height: 2px;
    background: var(--yoo-blog-accent);
    transform: translateY(-50%);
}

#content .yooai-post__content ol > li {
    counter-increment: yoo-ol;
    padding-left: 34px;
}

#content .yooai-post__content ol > li::before {
    content: counter(yoo-ol);
    position: absolute;
    left: 0;
    top: 0.05em;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--yoo-blog-accent) 14%, #fff);
    color: var(--yoo-blog-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8em;
    line-height: 1;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--yoo-blog-accent) 10%, transparent);
}

#content .yooai-post__content li > ul,
#content .yooai-post__content li > ol {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
}

#content .yooai-post__content table {
    width: 100%;
    max-width: 100%;
    margin: 1.35em 0 1.75em;
    border: 1px solid #e5eaf0;
    border-radius: 14px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background: #fff;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

#content .yooai-post__content th,
#content .yooai-post__content td {
    padding: 14px 18px !important;
    vertical-align: top;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    border: 0 !important;
    border-bottom: 1px solid #eef1f5 !important;
    color: inherit;
    background: #fff;
}

#content .yooai-post__content thead th,
#content .yooai-post__content thead td,
#content .yooai-post__content tbody > tr:first-child:not(:has(td)) > th {
    background: #f1f5f9;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    border-bottom-color: #e5eaf0 !important;
}

#content .yooai-post__content tbody > tr:has(td) > th {
    font-weight: 600;
    color: inherit;
    background: #fff;
}

#content .yooai-post__content tr:last-child > th,
#content .yooai-post__content tr:last-child > td {
    border-bottom: 0 !important;
}

#content .yooai-post__content thead tr:first-child > th:first-child,
#content .yooai-post__content thead tr:first-child > td:first-child,
#content .yooai-post__content tbody > tr:first-child:not(:has(td)) > th:first-child {
    border-top-left-radius: 13px;
}

#content .yooai-post__content thead tr:first-child > th:last-child,
#content .yooai-post__content thead tr:first-child > td:last-child,
#content .yooai-post__content tbody > tr:first-child:not(:has(td)) > th:last-child {
    border-top-right-radius: 13px;
}

#content .yooai-post__content tbody tr:last-child > th:first-child,
#content .yooai-post__content tbody tr:last-child > td:first-child {
    border-bottom-left-radius: 13px;
}

#content .yooai-post__content tbody tr:last-child > th:last-child,
#content .yooai-post__content tbody tr:last-child > td:last-child {
    border-bottom-right-radius: 13px;
}

@media (max-width: 767px) {
    #content .yooai-post__content th,
    #content .yooai-post__content td {
        padding: 12px 14px !important;
    }
}

.yooai-post__content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.yooai-blog-callout {
    padding: 14px 16px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    margin: 18px 0;
}

.yooai-blog-quote {
    margin: 18px 0;
    padding: 8px 0 8px 16px;
    border-left: 3px solid var(--yoo-blog-accent);
    color: var(--yoo-blog-muted);
    font-style: italic;
}

.yooai-blog-pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 18px 0;
}

.yooai-blog-pros,
.yooai-blog-cons {
    padding: 14px;
    border-radius: 12px;
    background: var(--yoo-blog-soft);
}

.yooai-post__products,
.yooai-post__related,
.yooai-post__author,
.yooai-post__engage {
    margin-top: 36px;
}

/* Бутик-полка: компактные карточки, чтобы похожие товары не раздували статью и не слипались */
.yooai-post__products {
    padding: 18px 18px 16px;
    border: 1px solid var(--yoo-blog-border);
    border-radius: var(--yoo-blog-radius);
    background: var(--yoo-blog-soft);
}

.yooai-post__products-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.2;
    color: var(--yoo-blog-text);
}

.yooai-post__products-ico {
    width: 1.15em;
    height: 1.15em;
    flex: 0 0 auto;
    stroke: var(--yoo-blog-accent);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yooai-post__related {
    margin-bottom: 36px;
}

.yooai-post__related-title {
    margin: 0 0 18px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--yoo-blog-text);
}

.yooai-post__products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 168px));
    justify-content: start;
    gap: 12px;
    align-items: stretch;
}

.yooai-product {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--yoo-blog-border);
    border-radius: 12px;
    padding: 10px;
    color: inherit;
    background: var(--yoo-blog-bg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.yooai-product:hover {
    border-color: var(--yoo-blog-accent);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

.yooai-product__link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    text-decoration: none;
    color: inherit;
}

.yooai-product__media {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    padding: 10px;
    border-radius: 10px;
    background: #eef2f7;
    overflow: hidden;
}

.yooai-blog--theme-dark .yooai-product__media {
    background: #1e293b;
}

.yooai-product__media img {
    width: 100%;
    height: 100%;
    max-width: 140px;
    max-height: 140px;
    object-fit: contain;
}

.yooai-product__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 8px 0 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
}

.yooai-product__price {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 6px;
    margin-top: 8px;
}

.yooai-product__now {
    font-weight: 800;
    font-size: 13.5px;
    color: var(--yoo-blog-accent);
}

.yooai-product__old {
    text-decoration: line-through;
    color: var(--yoo-blog-muted);
    font-weight: 500;
    font-size: 11.5px;
}

.yooai-product__cart {
    margin-top: 10px;
    border: 0;
    border-radius: 9px;
    background-color: var(--yoo-blog-accent);
    background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 10px;
    cursor: pointer;
    transition: background-image 0.2s ease;
}

.yooai-product__cart:hover {
    background-image: linear-gradient(rgba(0, 0, 0, 0.14), rgba(0, 0, 0, 0.14));
}

@media (max-width: 575px) {
    .yooai-post__products {
        padding: 14px;
    }

    .yooai-post__products-grid {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
        margin: 0 -2px;
        padding-left: 2px;
        padding-right: 2px;
    }

    .yooai-post__products-grid::-webkit-scrollbar {
        display: none;
    }

    .yooai-product {
        flex: 0 0 148px;
        scroll-snap-align: start;
    }
}

.yooai-post__author {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--yoo-blog-border);
    border-radius: 14px;
    background: var(--yoo-blog-soft);
}

.yooai-post__avatar {
    width: 72px;
    height: 72px;
    min-width: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: #e2e8f0;
    flex-shrink: 0;
}

.yooai-post__avatar img,
.yooai-post__author img {
    width: 72px !important;
    height: 72px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block;
}

.yooai-post__author p {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--yoo-blog-muted);
}

.yooai-post__tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
}

.yooai-post__tags-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--yoo-blog-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}

.yooai-post__tag {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--yoo-blog-soft);
    border: 1px solid var(--yoo-blog-border);
    font-size: 12.5px;
    font-weight: 600;
}

.yooai-post__engage {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.yooai-vote,
.yooai-share {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.yooai-vote button,
.yooai-share a,
.yooai-share button {
    border: 1px solid var(--yoo-blog-border);
    background: var(--yoo-blog-bg);
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.yooai-share__copy {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.yooai-share__copy svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yooai-share__copy.is-copied {
    border-color: var(--yoo-blog-accent);
    color: var(--yoo-blog-accent);
}

.yooai-vote button.is-on {
    border-color: var(--yoo-blog-accent);
    color: var(--yoo-blog-accent);
}

.yooai-related-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--yoo-blog-gap);
    align-items: stretch;
}

@media (max-width: 991px) {
    .yooai-post__layout,
    .yooai-blog-pros-cons,
    .yooai-related-grid {
        grid-template-columns: 1fr;
    }
    .yooai-post__layout {
        grid-template-areas: "toc" "main";
    }
    .yooai-post__toc {
        position: static;
        margin-bottom: 4px;
    }
}
