body {
    background: #fff;
}

.blog-article {
    /* Светлая типографика — по практике контентных сайтов: боди-текст
       ~10:1 (Tailwind slate-700, у Medium/GitHub ещё темнее), вторичный
       текст ≥4.5:1 (WCAG AA; Tailwind slate-500 — 4.8, GitHub muted — 5.3) */
    --blog-blue: #045cf1;
    --blog-blue-strong: #0450d2;
    --blog-ink: #0b1b3b;
    --blog-text: #36415a;
    --blog-muted: #62718c;
    --blog-line: #e7edf7;
    --blog-soft: #f5f8fc;
    --blog-bg: #fff;
    --blog-card: #fff;
    --blog-card-border: #dce4ef;
    --blog-chip: #edf3ff;
    --blog-dim: #5c6b85;
    --blog-dot: #9aa9be;
    --blog-bullet: #c4cfdf;
    --blog-shadow: rgba(17, 37, 72, 0.14);
    width: 88%;
    max-width: 1280px;
    margin: 0 auto;
    color: var(--blog-text);
    box-sizing: border-box;
}

.blog-article *,
.blog-article *::before,
.blog-article *::after {
    box-sizing: border-box;
}

.blog-hero {
    padding: 64px 0 48px;
}

.blog-back {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--blog-blue);
    font: 600 14px/20px "Inter", sans-serif;
    text-decoration: none;
}

.blog-hero h1 {
    margin: 0;
    color: var(--blog-ink);
    font: 700 46px/56px "Onest", "Inter", sans-serif;
    letter-spacing: -0.6px;
}

.blog-description {
    margin: 16px 0 0;
    font: 400 18px/30px "Inter", sans-serif;
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 24px;
    color: var(--blog-muted);
    font: 400 14px/20px "Inter", sans-serif;
}

.blog-meta > span + span::before {
    display: inline-block;
    margin-right: 18px;
    color: var(--blog-bullet);
    content: "•";
}

/* Author in the meta line: the name links to the profile page; hovering
   (or focusing) it reveals a Linear-style hover card with the photo, role,
   and social icons */
.blog-author {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.blog-author__trigger {
    border-bottom: 1px dotted var(--blog-dot);
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

.blog-author__trigger:hover {
    color: var(--blog-blue);
}

.blog-author__trigger:focus-visible {
    border-radius: 3px;
    outline: 2px solid rgba(26, 99, 230, 0.28);
    outline-offset: 3px;
}

/* Невидимый «мостик» между именем и карточкой: без него hover теряется,
   пока курсор пересекает зазор, и карточка исчезает */
.blog-author::after {
    position: absolute;
    top: 100%;
    left: 50%;
    display: none;
    width: calc(100% + 40px);
    height: 16px;
    content: "";
    transform: translateX(-50%);
}

.blog-author:hover::after,
.blog-author:focus-within::after {
    display: block;
}

.blog-author__card {
    position: absolute;
    z-index: 20;
    top: calc(100% + 12px);
    left: 50%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 2px 13px;
    width: max-content;
    max-width: min(380px, calc(100vw - 40px));
    padding: 13px 15px;
    border: 1px solid var(--blog-card-border);
    border-radius: 12px;
    background: var(--blog-card);
    box-shadow: 0 14px 35px var(--blog-shadow);
    color: var(--blog-text);
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translate(-50%, -4px);
    transition: opacity 0.16s ease 0.15s, transform 0.16s ease 0.15s, visibility 0.16s 0.15s;
    visibility: hidden;
}

.blog-author__card::before,
.blog-author__card::after {
    position: absolute;
    bottom: 100%;
    left: 50%;
    border: 7px solid transparent;
    content: "";
    transform: translateX(-50%);
}

.blog-author__card::before {
    border-bottom-color: var(--blog-card-border);
}

.blog-author__card::after {
    margin-bottom: -1px;
    border-bottom-color: var(--blog-card);
}

.blog-author:hover .blog-author__card,
.blog-author:focus-within .blog-author__card {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
    transition-delay: 0s;
    visibility: visible;
}

.blog-author__avatar {
    display: grid;
    grid-row: 1 / span 2;
    width: 44px;
    height: 44px;
    overflow: hidden;
    place-items: center;
    align-self: center;
    border-radius: 50%;
    background: var(--blog-chip);
    color: var(--blog-blue);
}

.blog-author__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-author__avatar .logo2-mark {
    width: 24px;
    height: 24px;
}

.blog-author__name {
    align-self: end;
    color: var(--blog-ink);
    font: 650 14px/19px "Onest", "Inter", sans-serif;
    text-decoration: none;
    white-space: nowrap;
}

a.blog-author__name:hover {
    color: var(--blog-blue);
}

.blog-author__role {
    align-self: start;
    color: var(--blog-muted);
    font: 400 12px/17px "Inter", sans-serif;
    white-space: nowrap;
}

/* Соцсети справа от имени и роли, за вертикальным разделителем (как у Linear) */
.blog-author__links {
    display: flex;
    grid-row: 1 / span 2;
    grid-column: 3;
    align-items: center;
    align-self: center;
    gap: 6px;
    padding-left: 13px;
    border-left: 1px solid var(--blog-line);
}

.blog-author__links a {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    background: var(--blog-soft);
    color: var(--blog-dim);
    font: 500 12px/18px "Inter", sans-serif;
    text-decoration: none;
    transition: color 0.16s ease, background 0.16s ease;
}

.blog-author__links a:hover {
    background: var(--blog-chip);
    color: var(--blog-blue);
}

.blog-author__links svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.blog-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 64px;
    align-items: start;
    padding: 46px 0 96px;
    border-top: 1px solid var(--blog-line);
}

.blog-aside {
    position: sticky;
    top: calc(var(--hd2-h, 70px) + 24px);
}

.blog-aside__title {
    margin: 0 0 12px;
    color: var(--blog-ink);
    font: 600 14px/20px "Inter", sans-serif;
}

.blog-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-toc li + li {
    margin-top: 10px;
}

.blog-toc a {
    color: var(--blog-dim);
    font: 400 14px/21px "Inter", sans-serif;
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-toc a:hover {
    color: var(--blog-blue);
}

/* Активный раздел подсвечивается скролл-спаем из js/blog/article.js */
.blog-toc a.is-active {
    color: var(--blog-blue);
    font-weight: 600;
}

/* «Статья для ИИ» под оглавлением: разделитель + кнопки экспорта в Markdown */
.blog-ai {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--blog-line);
}

.blog-ai__text {
    margin: 0 0 14px;
    color: var(--blog-muted);
    font: 400 12.5px/19px "Inter", sans-serif;
}

.blog-ai__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.blog-ai__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 8px 13px;
    border: 1px solid var(--blog-line);
    border-radius: 8px;
    appearance: none;
    background: var(--blog-card);
    color: var(--blog-ink);
    font: 600 12.5px/18px "Inter", sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.blog-ai__btn:hover {
    border-color: var(--blog-blue);
    color: var(--blog-blue);
}

.blog-ai__btn--primary {
    grid-column: 1 / -1;
    border-color: var(--blog-blue);
    background: var(--blog-blue);
    color: #fff;
}

.blog-ai__btn--primary:hover {
    border-color: var(--blog-blue-strong);
    background: var(--blog-blue-strong);
    color: #fff;
}

.blog-ai__note {
    margin: 12px 0 0;
    color: var(--blog-muted);
    font: 400 11.5px/17px "Inter", sans-serif;
}

.blog-toast {
    /* Тост живёт вне main.blog-article, поэтому цвета заданы литералами:
       CSS-переменные блога (--blog-ink и др.) здесь недоступны */
    position: fixed;
    z-index: 90;
    bottom: 28px;
    left: 50%;
    max-width: min(480px, calc(100vw - 40px));
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: #0b1b3b;
    box-shadow: 0 12px 30px rgba(11, 27, 59, 0.25);
    color: #fff;
    font: 500 13.5px/20px "Inter", sans-serif;
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.blog-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.blog-content {
    min-width: 0;
    max-width: 900px;
    font: 400 16.5px/29px "Inter", sans-serif;
}

.blog-content > :first-child {
    margin-top: 0;
}

.blog-content h2 {
    margin: 60px 0 16px;
    color: var(--blog-ink);
    font: 700 29px/38px "Onest", "Inter", sans-serif;
    scroll-margin-top: calc(var(--hd2-h, 70px) + 24px);
}

.blog-content h3 {
    margin: 36px 0 12px;
    color: var(--blog-ink);
    font: 700 21px/29px "Onest", "Inter", sans-serif;
}

.blog-content p {
    margin: 0 0 20px;
}

.blog-content ul,
.blog-content ol {
    margin: 0 0 24px;
    padding-left: 24px;
}

.blog-content li + li {
    margin-top: 7px;
}

.blog-content a {
    color: var(--blog-blue);
}

.blog-content code {
    border-radius: 4px;
    background: var(--blog-soft);
    color: var(--blog-ink);
    font: 500 0.9em/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.blog-content :not(pre) > code {
    padding: 2px 6px;
}

.blog-content pre {
    max-width: 100%;
    margin: 24px 0 30px;
    padding: 22px 24px;
    overflow-x: auto;
    border: 1px solid var(--blog-line);
    border-radius: 12px;
    background: #0b1b3b;
}

.blog-content pre code {
    padding: 0;
    background: transparent;
    color: #f4f7fc;
    font-size: 13.5px;
    line-height: 22px;
}

.blog-code {
    margin: 24px 0 30px;
    overflow: hidden;
    border: 1px solid #343b49;
    border-radius: 12px;
    background: #282c34;
}

.blog-code__header {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 8px 16px;
    border-bottom: 1px solid #343b49;
    background: #21252d;
}

.blog-code__language {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #aeb8ca;
    font: 600 12.5px/18px "Inter", sans-serif;
    letter-spacing: 0.2px;
}

.blog-code__language svg,
.blog-code__copy svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.blog-code__language svg {
    color: #768297;
    stroke-width: 1.5;
}

.blog-code__copy {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    padding: 5px 10px;
    border: 1px solid #465064;
    border-radius: 7px;
    background: transparent;
    color: #b7c1d2;
    cursor: pointer;
    font: 600 12px/18px "Inter", sans-serif;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.blog-code__copy svg {
    stroke-width: 1.4;
}

.blog-code__copy:hover,
.blog-code__copy:focus-visible {
    border-color: #77839a;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
}

.blog-code__copy.is-copied {
    border-color: #3e6b52;
    color: #67d391;
}

.blog-content .blog-code pre {
    margin: 0;
    padding: 22px 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.blog-content .blog-code pre code,
.blog-content .blog-code pre code.hljs {
    display: block;
    padding: 0;
    overflow-x: visible;
    background: transparent;
    color: #f4f7fc;
}

.blog-content table {
    display: table;
    width: 100%;
    margin: 28px 0 34px;
    border: 1px solid var(--blog-line);
    border-spacing: 0;
    border-collapse: separate;
    border-radius: 10px;
    font-size: 14px;
    line-height: 22px;
}

.blog-content thead th:first-child {
    border-top-left-radius: 9px;
}

.blog-content thead th:last-child {
    border-top-right-radius: 9px;
}

@media (max-width: 760px) {
    .blog-content table {
        display: block;
        overflow-x: auto;
    }
}

.blog-content th,
.blog-content td {
    min-width: 120px;
    padding: 12px 14px;
    border-right: 1px solid var(--blog-line);
    border-bottom: 1px solid var(--blog-line);
    text-align: left;
    vertical-align: top;
}

.blog-content th {
    background: var(--blog-soft);
    color: var(--blog-ink);
    font-weight: 650;
}

.blog-content tr:last-child td {
    border-bottom: 0;
}

.blog-content th:last-child,
.blog-content td:last-child {
    border-right: 0;
}

.blog-callout {
    margin: 30px 0;
    padding: 22px 24px;
    border-left: 4px solid var(--blog-blue);
    border-radius: 0 10px 10px 0;
    background: var(--blog-soft);
}

.blog-callout__title {
    margin: 0 0 6px !important;
    color: var(--blog-ink);
    font: 700 16px/23px "Inter", sans-serif !important;
}

.blog-callout__body p:last-child {
    margin-bottom: 0;
}

.blog-takeaways {
    /* frame in the brand palette; the heading sits on the border line
       (fieldset-legend style), the chevron is anchored to the frame so it
       doesn't move between the collapsed and expanded states */
    position: relative;
    margin: 44px 0 38px;
    border: 2px solid var(--blog-blue);
    border-radius: 14px;
    background: var(--blog-bg);
}

.blog-takeaways__summary {
    display: block;
    min-height: 50px;
    box-sizing: border-box;
    padding: 25px 64px 22px 26px;
    cursor: pointer;
    list-style: none;
}

.blog-takeaways__summary::-webkit-details-marker {
    display: none;
}

.blog-takeaways__heading {
    position: absolute;
    top: -14px;
    left: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: var(--blog-bg);
    color: var(--blog-ink);
    font: 700 16px/26px "Onest", "Inter", sans-serif;
}

.blog-takeaways__mark {
    color: var(--blog-blue);
    font-size: 22px;
    line-height: 1;
}

.blog-takeaways__preview {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 8px;
    color: var(--blog-text);
    font: 400 16px/27px "Inter", sans-serif;
}

.blog-takeaways__chevron {
    position: absolute;
    z-index: 1;
    top: 24px;
    right: 24px;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.blog-takeaways__chevron::before {
    position: absolute;
    top: 1px;
    left: 3px;
    width: 10px;
    height: 10px;
    border-right: 2.5px solid var(--blog-blue);
    border-bottom: 2.5px solid var(--blog-blue);
    content: "";
    transform: rotate(45deg);
}

.blog-takeaways[open] .blog-takeaways__summary {
    padding-bottom: 0;
}

.blog-takeaways[open] .blog-takeaways__preview {
    display: none;
}

.blog-takeaways[open] .blog-takeaways__chevron {
    transform: rotate(180deg);
}

.blog-takeaways__body {
    /* нижний отступ 22px — как padding-bottom summary в свёрнутом виде */
    padding: 0 26px 22px;
    /* тот же размер, что и в свёрнутом превью, — текст не «подрастает» */
    font: 400 16px/27px "Inter", sans-serif;
}

/* Keep each item as one inline formatting context. A grid here would turn
   text nodes and inline <code> elements into separate grid items. */
.blog-takeaways__body ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.blog-takeaways__body li {
    position: relative;
    display: block;
    padding-left: 22px;
}

.blog-takeaways__body li::before {
    position: absolute;
    top: 0;
    left: 0;
    content: "•";
}

.blog-takeaways__body li + li {
    margin-top: 13px;
}

.blog-takeaways code {
    white-space: normal;
    overflow-wrap: anywhere;
}

.blog-takeaways__note {
    margin: 24px 0 0 !important;
    padding-top: 18px;
    border-top: 1px solid var(--blog-line);
    color: var(--blog-muted);
    font-size: 13px;
    line-height: 21px;
}

@media (max-width: 900px) {
    .blog-hero {
        padding-top: 44px;
    }

    .blog-hero h1 {
        font-size: 37px;
        line-height: 46px;
    }

    .blog-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .blog-aside {
        position: static;
        padding: 20px;
        border-radius: 10px;
        background: var(--blog-soft);
    }
}

@media (max-width: 560px) {
    .blog-article {
        width: calc(100% - 32px);
    }

    .blog-hero {
        padding: 36px 0 32px;
    }

    .blog-hero h1 {
        font-size: 31px;
        line-height: 39px;
    }

    .blog-description {
        font-size: 16px;
        line-height: 26px;
    }

    .blog-meta {
        display: grid;
        gap: 5px;
    }

    .blog-meta > span + span::before {
        display: none;
    }

    .blog-author__card {
        left: 0;
        width: min(286px, calc(100vw - 40px));
        transform: translateY(-4px);
    }

    .blog-author__card::before,
    .blog-author__card::after {
        left: 28px;
    }

    .blog-author:hover .blog-author__card,
    .blog-author:focus-within .blog-author__card {
        transform: translateY(0);
    }

    .blog-layout {
        padding: 30px 0 72px;
    }

    .blog-content {
        font-size: 16px;
        line-height: 28px;
    }

    .blog-content h2 {
        margin-top: 46px;
        font-size: 25px;
        line-height: 33px;
    }

    .blog-takeaways__summary {
        padding: 20px 52px 18px 20px;
    }

    .blog-takeaways__chevron {
        top: 20px;
        right: 18px;
    }

    .blog-takeaways__body {
        padding: 0 20px 20px;
    }
}

/* ---------- Тёмная тема (пилот): включается data-theme="dark" на <html>,
   см. css/blog/dark.css (фон страницы, шапка, кнопка-переключатель) ---------- */

[data-theme="dark"] .blog-article {
    /* База — графит футера v2 (#10151f), без синевы.
       Типографика — по практике тёмных тем (Material, GitHub, Tailwind):
       заголовки ≈ белый на 87% (чистый #fff «вибрирует» на тёмном),
       боди-текст ~70% (между Tailwind slate-400 и GitHub fg-muted),
       акцент осветлён И обесцвечен — насыщенный бренд-синий на тёмном
       фоне визуально «звенит» */
    --blog-blue: #7fa8f0;
    --blog-blue-strong: #9dbdf6;
    --blog-ink: #dde3ec;
    --blog-text: #a5b0c2;
    --blog-muted: #7d8ba0;
    --blog-line: #232b3a;
    --blog-soft: #171d29;
    --blog-bg: #10151f;
    --blog-card: #171d29;
    --blog-card-border: #2b3445;
    --blog-chip: #1f2735;
    --blog-dim: #8b98ad;
    --blog-dot: #556074;
    --blog-bullet: #3a4457;
    --blog-shadow: rgba(0, 0, 0, 0.5);
}

/* Заливка primary-кнопки: осветлённый акцент не держит белый текст,
   поэтому у кнопки свой насыщенный синий */
[data-theme="dark"] .blog-ai__btn--primary {
    border-color: #2563eb;
    background: #2563eb;
}

[data-theme="dark"] .blog-ai__btn--primary:hover {
    border-color: #3b74f1;
    background: #3b74f1;
}

/* Инлайновые pre без обёртки .blog-code: на тёмном фоне тон #0b1b3b
   сливается со страницей — приподнимаем поверхность */
[data-theme="dark"] .blog-content pre {
    background: #161c28;
}
