/* ============================================================
   blog.css — globall.dev blog index + article pages
   Layered on top of styles.css (assumes its :root tokens and
   reusable classes: .card .btn .btn--primary .page--bots etc.)
   LIGHT system: white bg, Telegram-blue accent, Inter, RU-first.
   Load AFTER styles.css
   ============================================================ */

/* ============================================================
   WIDE-CANVAS LAYOUT (consistent with styles.css v9.0 .section)
   .page--bots is now full-width (padding:0); these blog blocks
   own their own centering + capping via the padding-inline trick,
   matching the home/bots full-bleed rhythm. NO inner wrapper div.
   ------------------------------------------------------------
   Centered, capped content blocks (page width ~1240px).
   --cap / --gutter / --section-pad-y come from styles.css :root.
   ------------------------------------------------------------ */
.breadcrumbs,
.blog-grid {
    width: 100%;
    padding-inline: max(var(--gutter, 20px), calc(50% - var(--cap, 620px)));
}

/* Vertical rhythm between the page blocks, matching marketing pages */
.page--bots > .blog-grid {
    margin-block: 0;
    padding-block: clamp(40px, 5vw, 72px);
}
/* Article reading column: readable width, centered, comfortable gutters.
   Keeps body text narrow (does NOT use the wide ~1240px cap). */
.page--bots > .article {
    padding-block: clamp(40px, 5vw, 72px);
    padding-inline: var(--gutter, 20px);
}

/* ------------------------------------------------------------
   Breadcrumbs — Главная › Блог › <article>
   ------------------------------------------------------------ */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    padding-top: 22px;
    font-size: .82rem;
    line-height: 1.5;
    color: var(--text-sec);
}
.breadcrumbs a {
    color: var(--text-sec);
    border-bottom: 1px solid transparent;
    transition: color .25s var(--ease), border-color .25s var(--ease);
}
.breadcrumbs a:hover {
    color: var(--blue);
    border-bottom-color: rgba(0, 152, 234, 0.4);
}
.breadcrumbs__sep {
    color: var(--text-dim);
    font-size: .78rem;
    user-select: none;
    margin: 0 1px;
}
.breadcrumbs [aria-current="page"],
.breadcrumbs span:last-child:not(.breadcrumbs__sep) {
    color: var(--text);
    font-weight: 600;
}

/* ============================================================
   BLOG INDEX
   ============================================================ */

/* ---------- Index hero — full-bleed soft band ---------- */
.blog-hero {
    width: 100%;
    text-align: center;
    /* full-bleed band: soft gradient edge-to-edge, content capped + centered */
    padding-block: clamp(48px, 6vw, 84px);
    padding-inline: max(var(--gutter, 20px), calc(50% - var(--cap, 620px)));
    margin-bottom: 0;
    background: linear-gradient(180deg, var(--bg-soft) 0%, #ffffff 80%);
    position: relative;
    overflow: hidden;
}
.blog-hero::before {
    content: '';
    position: absolute;
    top: -140px; left: 50%;
    transform: translateX(-50%);
    width: 560px; height: 360px;
    background: radial-gradient(ellipse, rgba(0, 152, 234, 0.08), transparent 65%);
    pointer-events: none;
    z-index: 0;
}
.blog-hero > * { position: relative; z-index: 1; }
.blog-hero__kicker {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    background: var(--blue-soft);
    border: none;
    color: var(--blue);
    margin-bottom: 20px;
}
.blog-hero__title {
    font-family: var(--font);
    font-size: 3.4rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.035em;
    margin-bottom: 18px;
    color: var(--text);
}
.blog-hero__title .grad {
    background: linear-gradient(90deg, var(--blue), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.blog-hero__sub {
    color: var(--text-sec);
    font-size: 1.12rem;
    line-height: 1.6;
    max-width: 620px;
    margin: 0 auto;
}

/* ---------- Card grid — wide canvas, auto-fit 3-col, capped ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 26px;
    align-items: stretch;
}

/* ---------- Blog card (reuses .card aesthetic) ---------- */
.blog-card {
    display: flex;
    flex-direction: column;
    padding: 30px 28px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: border-color .35s var(--ease), transform .35s var(--ease),
                box-shadow .35s var(--ease);
    position: relative;
    overflow: hidden;
}
/* Top accent line on hover (matches .proj) */
.blog-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blue), transparent);
    border-radius: var(--radius) var(--radius) 0 0;
    opacity: 0;
    transition: opacity .4s var(--ease);
}
.blog-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 1px 2px rgba(13, 18, 30, 0.05), 0 16px 40px rgba(13, 18, 30, 0.10);
}
.blog-card:hover::after { opacity: 1; }

.blog-card__kicker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.blog-card__cat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    border-radius: var(--radius-xs);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--blue-soft);
    border: none;
    color: var(--blue);
    white-space: nowrap;
}
.blog-card__meta {
    font-size: .74rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: .02em;
}
.blog-card__title {
    font-family: var(--font);
    font-size: 1.32rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
    margin-bottom: 12px;
    color: var(--text);
    transition: color .25s var(--ease);
}
.blog-card:hover .blog-card__title { color: var(--blue); }
.blog-card__excerpt {
    font-size: .92rem;
    color: var(--text-sec);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 20px;
}
.blog-card__more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .86rem;
    font-weight: 700;
    color: var(--blue);
    margin-top: auto;
    transition: gap .25s var(--ease), color .25s var(--ease);
}
.blog-card:hover .blog-card__more {
    gap: 11px;
    color: var(--blue-dark);
}
/* Make the whole card clickable when wrapped in an <a class="blog-card"> */
a.blog-card { color: inherit; }

/* ============================================================
   ARTICLE PAGE
   ============================================================ */

/* ---------- Reading column wrapper ----------
   Stays a comfortable reading measure (~800px) centered on the wide
   canvas. Body text intentionally NOT widened to full page width. */
.article {
    max-width: 800px;
    margin: 0 auto;
}

/* ---------- Article hero ---------- */
.article__hero {
    margin-bottom: 40px;
}
.article__hero h1 {
    font-family: var(--font);
    font-size: 2.9rem;
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 22px;
    color: var(--text);
}
.article__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    font-size: .86rem;
    color: var(--text-sec);
}
.article__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.article__meta-item i {
    font-size: .82rem;
    color: var(--blue);
}
.article__meta-cat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    border-radius: var(--radius-xs);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    background: var(--blue-soft);
    border: none;
    color: var(--blue);
}
.article__meta-sep {
    color: var(--text-dim);
    user-select: none;
}

/* ---------- Table of contents (optional, sticky-ish) ---------- */
.article__toc {
    padding: 24px 26px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    margin-bottom: 40px;
}
.article__toc-title {
    font-family: var(--font);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 14px;
}
.article__toc ol,
.article__toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    counter-reset: toc;
}
.article__toc li { counter-increment: toc; }
.article__toc a {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    font-size: .94rem;
    line-height: 1.45;
    color: var(--text-sec);
    transition: color .25s var(--ease);
}
.article__toc a::before {
    content: counter(toc, decimal-leading-zero);
    font-family: var(--font);
    font-size: .76rem;
    font-weight: 800;
    color: var(--blue);
    opacity: .7;
    flex-shrink: 0;
}
.article__toc a:hover {
    color: var(--blue);
}
.article__toc a:hover::before { opacity: 1; }

/* ============================================================
   PROSE — .article__body
   Generous vertical rhythm, comfortable reading line-height.
   ============================================================ */
.article__body {
    font-size: 1.06rem;
    line-height: 1.8;
    color: var(--text-sec); /* softened dark for long reading on white */
}

/* Paragraphs */
.article__body p {
    margin: 0 0 1.4em;
}
.article__body > p:first-child {
    font-size: 1.16rem;
    line-height: 1.7;
    color: var(--text);
}

/* Headings */
.article__body h2 {
    font-family: var(--font);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--text);
    margin: 2.4em 0 .7em;
    padding-top: 1.5em;
    border-top: 1px solid var(--border);
    scroll-margin-top: 28px;
}
.article__body h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}
.article__body h3 {
    font-family: var(--font);
    font-size: 1.36rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
    color: var(--text);
    margin: 1.9em 0 .55em;
    scroll-margin-top: 28px;
}
.article__body h4 {
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.6em 0 .5em;
}

/* Inline emphasis */
.article__body strong {
    color: var(--text);
    font-weight: 700;
}
.article__body em { font-style: italic; }

/* Links — underline appears on hover, --blue */
.article__body a {
    color: var(--blue);
    border-bottom: 1px solid rgba(0, 152, 234, 0.28);
    transition: color .25s var(--ease), border-color .25s var(--ease);
    word-break: break-word;
}
.article__body a:hover {
    color: var(--blue-dark);
    border-bottom-color: var(--blue-dark);
}

/* Lists */
.article__body ul,
.article__body ol {
    margin: 0 0 1.4em;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .55em;
}
.article__body li {
    position: relative;
    padding-left: 1.7em;
    line-height: 1.7;
}
.article__body ul > li::before {
    content: '';
    position: absolute;
    left: .35em;
    top: .72em;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--blue);
}
.article__body ol {
    counter-reset: ol-list;
}
.article__body ol > li {
    counter-increment: ol-list;
}
.article__body ol > li::before {
    content: counter(ol-list) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--font);
    font-weight: 800;
    font-size: .95em;
    color: var(--blue);
}
/* Nested lists */
.article__body li > ul,
.article__body li > ol {
    margin: .55em 0 0;
}

/* Blockquote — blue left border on soft panel */
.article__body blockquote {
    margin: 1.8em 0;
    padding: 16px 24px;
    border-left: 3px solid var(--blue);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--bg-soft);
    color: var(--text);
    font-size: 1.14rem;
    line-height: 1.65;
    font-style: italic;
}
.article__body blockquote p:last-child { margin-bottom: 0; }
.article__body blockquote cite {
    display: block;
    margin-top: .7em;
    font-size: .88rem;
    font-style: normal;
    font-weight: 600;
    color: var(--text-sec);
}
.article__body blockquote cite::before { content: '— '; }

/* Inline code + code blocks */
.article__body code {
    font-family: 'SFMono-Regular', 'JetBrains Mono', Consolas, 'Liberation Mono', monospace;
    font-size: .88em;
    padding: .12em .42em;
    border-radius: 6px;
    background: var(--blue-soft);
    border: 1px solid var(--border);
    color: var(--blue-dark);
    word-break: break-word;
}
.article__body pre {
    margin: 1.6em 0;
    padding: 20px 22px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    overflow-x: auto;
    font-size: .92rem;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
}
.article__body pre code {
    padding: 0;
    background: none;
    border: none;
    color: var(--text);
    font-size: .9rem;
}

/* Horizontal rule */
.article__body hr {
    border: none;
    height: 1px;
    margin: 2.6em 0;
    background: var(--border);
}

/* Images — rounded with subtle frame */
.article__body img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin: 1.8em 0;
    box-shadow: var(--shadow-card);
}
.article__body figure {
    margin: 1.8em 0;
}
.article__body figure img { margin: 0; }
.article__body figcaption {
    margin-top: .8em;
    text-align: center;
    font-size: .85rem;
    color: var(--text-sec);
    line-height: 1.5;
}

/* Responsive table — light striped */
.article__table-wrap {
    margin: 1.8em 0;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}
.article__body table,
.article__table {
    width: 100%;
    border-collapse: collapse;
    font-size: .94rem;
    background: var(--bg-card);
}
.article__body table thead th,
.article__table thead th {
    text-align: left;
    font-family: var(--font);
    font-weight: 700;
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text);
    padding: 14px 18px;
    background: var(--blue-soft);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.article__body table td,
.article__table td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-sec);
    line-height: 1.55;
    vertical-align: top;
}
.article__body table tbody tr:nth-child(even) td,
.article__table tbody tr:nth-child(even) td {
    background: var(--bg-soft);
}
.article__body table tbody tr:last-child td,
.article__table tbody tr:last-child td { border-bottom: none; }
.article__body table tbody tr:hover td,
.article__table tbody tr:hover td {
    background: var(--blue-soft);
    color: var(--text);
}
.article__body table strong,
.article__table strong { color: var(--text); }

/* When a table is placed directly in prose, allow horizontal scroll */
.article__body table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   ARTICLE CTA — blue-tinted panel reusing .btn
   ============================================================ */
.article__cta {
    position: relative;
    margin: 48px 0 8px;
    padding: 36px 38px;
    border-radius: var(--radius);
    background: var(--blue-soft);
    border: 1px solid var(--border);
    overflow: hidden;
}
/* On the blog INDEX the CTA is a top-level block on the wide canvas:
   center it and cap to the readable column so the form stays usable. */
.page--bots > .article__cta {
    max-width: 820px;
    margin-inline: auto;
    margin-block: clamp(40px, 5vw, 64px) clamp(48px, 6vw, 80px);
    width: calc(100% - 2 * var(--gutter, 20px));
}
.article__cta::before {
    content: '';
    position: absolute;
    top: -80px; right: -60px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(0, 152, 234, 0.10), transparent 65%);
    pointer-events: none;
}
.article__cta > * { position: relative; z-index: 1; }
.article__cta-kicker {
    display: inline-block;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: 12px;
}
.article__cta-title {
    font-family: var(--font);
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 12px;
    color: var(--text);
}
.article__cta-text {
    font-size: 1rem;
    color: var(--text-sec);
    line-height: 1.6;
    max-width: 540px;
    margin-bottom: 24px;
}
.article__cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}
.article__cta-note {
    margin-top: 14px;
    font-size: .84rem;
    color: var(--text-dim);
    line-height: 1.5;
}

/* ============================================================
   RELATED — articles / cases links grid
   ============================================================ */
.related {
    max-width: 800px;
    margin: 56px auto 0;
    padding-top: 44px;
    border-top: 1px solid var(--border);
}
.related__title {
    font-family: var(--font);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    color: var(--text);
}
.related__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.related__card {
    display: flex;
    flex-direction: column;
    padding: 24px 26px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    color: inherit;
    transition: border-color .3s var(--ease), transform .3s var(--ease),
                box-shadow .3s var(--ease);
}
.related__card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 1px 2px rgba(13, 18, 30, 0.05), 0 14px 36px rgba(13, 18, 30, 0.10);
}
.related__cat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    font-size: .66rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: var(--blue-soft);
    border: none;
    color: var(--blue);
    margin-bottom: 12px;
}
.related__card-title {
    font-family: var(--font);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-bottom: 6px;
    transition: color .25s var(--ease);
}
.related__card:hover .related__card-title { color: var(--blue); }
.related__card-sub {
    font-size: .86rem;
    color: var(--text-sec);
    line-height: 1.55;
    margin-bottom: 14px;
    flex: 1;
}
.related__card-more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--blue);
    margin-top: auto;
    transition: gap .25s var(--ease);
}
.related__card:hover .related__card-more { gap: 11px; }

/* ============================================================
   A11Y — focus-visible (consistent with site, scoped to blog)
   ============================================================ */
.breadcrumbs a:focus-visible,
.blog-card:focus-visible,
.article__body a:focus-visible,
.article__toc a:focus-visible,
.related__card:focus-visible,
.article__cta a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* .blog-grid uses auto-fit minmax(300px) — it reflows on its own;
   no rigid column overrides needed. */

@media (max-width: 820px) {
    .blog-hero { padding-block: 48px 44px; }
    .blog-hero__title { font-size: 2.6rem; }
}

@media (max-width: 680px) {
    .blog-hero { padding-block: 40px 36px; }
    .blog-hero__title { font-size: 2.1rem; }
    .blog-hero__sub { font-size: 1rem; }

    .article__hero h1 { font-size: 2.05rem; }
    .article__body { font-size: 1.02rem; }
    .article__body > p:first-child { font-size: 1.08rem; }
    .article__body h2 { font-size: 1.55rem; margin-top: 2em; padding-top: 1.2em; }
    .article__body h3 { font-size: 1.22rem; }

    .article__cta { padding: 28px 24px; }
    .article__cta-title { font-size: 1.42rem; }
    .article__cta-actions { flex-direction: column; align-items: stretch; }
    .article__cta-actions .btn { width: 100%; }

    .related__grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
    .blog-hero__title { font-size: 1.8rem; }
    .article__hero h1 { font-size: 1.72rem; }
    .blog-card { padding: 24px 22px; }
}

/* Reduced motion (global rule in styles.css trims durations) */
@media (prefers-reduced-motion: reduce) {
    .blog-card, .related__card { transition: none; }
}
