/*==========================================================
    Blog pages — All Blogs (design B: featured + grid) and the article page (design A: polished centred)
    Views/Home/AllBlogs.cshtml, Views/Shared/_BlogArticle.cshtml, Views/Shared/_BlogCard.cshtml
    bx- = list + shared card bits, ba- = article. Colours come from tokens.css (accents follow --brand).
==========================================================*/

/* ---------- shared ---------- */
.bx-page, .ba-page { font-family: var(--font-sans); color: var(--color-text); }
.bx-wrap { max-width: 1330px; margin: 0 auto; }
.bx-page a, .ba-page a { text-decoration: none; }
.bx-page ul, .ba-page ul.bx-grid { list-style: none; margin: 0; padding: 0; }
.bx-page a:focus-visible, .ba-page a:focus-visible, .bx-page button:focus-visible, .ba-page button:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: 3px;
}

.bx-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--color-primary-soft);
    border: 1px solid var(--color-primary-soft-border);
    color: var(--color-primary-hover);
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.bx-eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary-bright); }
.bx-h1 {
    margin: 16px 0 0;
    font-size: clamp(2rem, 3vw + .6rem, 3.2rem);
    line-height: var(--lh-tight);
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--color-text);
}
.bx-h2 { margin: 0; font-size: 1.6rem; font-weight: 800; line-height: var(--lh-tight); color: var(--color-text); }
/* span gradient: components.css (shared heading-highlight rule) */
.bx-lead { margin: 14px 0 0; max-width: 640px; font-size: 1.05rem; line-height: 1.75; color: var(--color-text-muted); }

.bx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 22px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--color-border);
    background: #fff;
    color: var(--color-text);
    font-size: 15px;
    font-weight: var(--fw-semibold);
    white-space: nowrap;
    transition: border-color var(--duration-base), color var(--duration-base);
}
.bx-btn:hover, .bx-btn:focus-visible { border-color: var(--color-primary); color: var(--color-primary-hover); }
.bx-btn--primary { border: 0; background: var(--gradient-primary); color: #fff; box-shadow: var(--shadow-primary); }
.bx-btn--primary:hover, .bx-btn--primary:focus-visible { color: #fff; background: var(--gradient-primary-hover); }

.bx-cat {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    font-size: 11.5px;
    font-weight: var(--fw-bold);
    letter-spacing: .6px;
    text-transform: uppercase;
}
.bx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; font-weight: var(--fw-medium); color: var(--color-text-subtle); }
.bx-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.bx-meta i { color: var(--color-primary); font-size: 12px; }
.bx-more { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--color-primary-hover); }
.bx-more i { transition: transform var(--duration-base); }

.bx-thumb {
    position: relative;
    display: block;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary-soft), color-mix(in srgb, var(--brand) 22%, #fff));
}
.bx-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-standard); }
/* Default cover: a picture that is missing or fails to load (is-missing, set by the view or its script)
   gets the same branded cover on cards, the featured post and the article, so the layout stays aligned. */
.bx-thumb.is-missing, .ba-cover.is-missing {
    container-type: inline-size;
    background:
        radial-gradient(circle at 18% 22%, rgba(255, 255, 255, .28) 0 14%, transparent 15%),
        radial-gradient(circle at 88% 85%, rgba(255, 255, 255, .16) 0 22%, transparent 23%),
        radial-gradient(rgba(255, 255, 255, .22) 1.2px, transparent 1.6px) 0 0 / 18px 18px,
        linear-gradient(135deg, var(--brand-mid), var(--brand) 55%, var(--brand-dark));
}
.bx-thumb.is-missing img, .ba-cover.is-missing img { visibility: hidden; }
.bx-thumb.is-missing::after, .ba-cover.is-missing::after {
    content: "\f1ea";
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(48px, 18cqw, 120px);
    aspect-ratio: 1;
    transform: translate(-50%, -58%);
    display: grid;
    place-items: center;
    border-radius: 28%;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .18);
    font: 900 clamp(20px, 7.5cqw, 50px)/1 "Font Awesome 6 Free";
    color: var(--brand);
}
.bx-thumb.is-missing::before, .ba-cover.is-missing::before {
    content: "SACHIN. T  ·  BLOG";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 9%;
    text-align: center;
    white-space: pre;
    font: 700 clamp(9px, 2.6cqw, 16px)/1 var(--font-sans);
    letter-spacing: .2em;
    color: rgba(255, 255, 255, .92);
}
.ba-cover { position: relative; }
.bx-thumb .bx-cat { position: absolute; left: 14px; top: 14px; z-index: 1; background: rgba(255, 255, 255, .95); box-shadow: var(--shadow-sm); }

/* card */
.bx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.bx-page .bx-grid, .ba-page .bx-grid { margin-top: 28px; }
.bx-grid > li[hidden] { display: none; }
.bx-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    overflow: hidden;
    color: var(--color-text);
    transition: border-color var(--duration-base), box-shadow var(--duration-base), transform var(--duration-base);
}
.bx-card:hover, .bx-card:focus-visible { border-color: var(--color-primary-soft-border); box-shadow: var(--shadow-md); transform: translateY(-4px); color: var(--color-text); }
.bx-card:hover .bx-thumb img { transform: scale(1.05); }
.bx-card:hover .bx-more i { transform: translateX(4px); }
.bx-card .bx-thumb { aspect-ratio: 16 / 9; }
.bx-card__body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.bx-card__title { display: block; margin-top: 10px; font-size: 1.12rem; font-weight: var(--fw-bold); line-height: 1.35; }
.bx-card__desc {
    display: -webkit-box;
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.65;
    color: var(--color-text-muted);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bx-card .bx-more { margin-top: auto; padding-top: 16px; }

/* ---------- ALL BLOGS ---------- */
.bx-page { padding: 120px clamp(18px, 5.5vw, 80px) 80px; background: var(--color-surface-muted); }
.bx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

.bx-feat {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    margin-top: 32px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 28px;
    overflow: hidden;
    color: var(--color-text);
    transition: border-color var(--duration-base), box-shadow var(--duration-base);
}
.bx-feat:hover, .bx-feat:focus-visible { border-color: var(--color-primary-soft-border); box-shadow: var(--shadow-md); color: var(--color-text); }
.bx-feat:hover .bx-thumb img { transform: scale(1.04); }
.bx-feat:hover .bx-more i { transform: translateX(4px); }
.bx-feat .bx-thumb { min-height: 340px; }
.bx-badge {
    position: absolute; left: 16px; top: 16px; z-index: 1;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--gradient-primary);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: var(--fw-bold);
}
.bx-feat__body { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: 40px; }
.bx-feat__title { display: block; margin-top: 14px; font-size: 2rem; font-weight: 800; line-height: 1.2; }
.bx-feat__desc { display: block; margin-top: 12px; line-height: 1.75; color: var(--color-text-muted); }
.bx-feat .bx-meta { margin-top: 16px; }
.bx-feat .bx-more { margin-top: 22px; }

.bx-more-sec { margin-top: 48px; }
.bx-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.bx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bx-chips button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background: #fff;
    font: inherit;
    font-size: 13.5px;
    font-weight: var(--fw-semibold);
    color: var(--color-neutral-700);
    cursor: pointer;
    transition: border-color var(--duration-fast), background var(--duration-fast), color var(--duration-fast);
}
.bx-chips button:hover { border-color: var(--color-primary); }
.bx-chips button small { font-size: 11.5px; color: var(--color-text-subtle); background: var(--color-neutral-100); padding: 1px 7px; border-radius: var(--radius-pill); }
.bx-chips button[aria-pressed="true"] { background: var(--color-neutral-900); border-color: var(--color-neutral-900); color: #fff; }
.bx-chips button[aria-pressed="true"] small { background: rgba(255, 255, 255, .18); color: #fff; }
.bx-search { position: relative; width: 280px; max-width: 100%; margin: 0; }
.bx-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-neutral-400); pointer-events: none; }
.bx-search input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: var(--color-text);
}
.bx-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.bx-none { margin: 32px 0 0; padding: 32px; text-align: center; color: var(--color-text-muted); background: #fff; border: 1px dashed var(--color-border); border-radius: var(--radius-lg); }

.bx-pager { display: flex; justify-content: center; gap: 8px; margin-top: 36px; }
.bx-pager[hidden] { display: none; }
.bx-pager button {
    min-width: 42px; height: 42px; padding: 0 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background: #fff;
    font: inherit; font-size: 14px; font-weight: var(--fw-semibold);
    color: var(--color-neutral-700);
    cursor: pointer;
}
.bx-pager button[aria-current="page"] { background: var(--gradient-primary); border-color: transparent; color: #fff; }
.bx-pager button:disabled { opacity: .4; cursor: default; }

.bx-empty { margin-top: 32px; padding: 64px 20px; text-align: center; background: #fff; border: 1px solid var(--color-border); border-radius: 24px; color: var(--color-text-muted); }
.bx-empty__icon { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; margin-bottom: 18px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 26px; }
.bx-empty h2 { margin: 0 0 8px; font-size: 1.5rem; color: var(--color-text); }
.bx-empty p { max-width: 460px; margin: 0 auto 24px; line-height: 1.6; }

/* ---------- ARTICLE ---------- */
.ba-article { padding: 120px clamp(18px, 5.5vw, 80px) 64px; background: #fff; }
.ba-top { max-width: 820px; margin: 0 auto; text-align: center; }
.ba-crumb { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 13.5px; color: var(--color-text-subtle); }
.ba-crumb a { color: var(--color-text-subtle); }
.ba-crumb a:hover, .ba-crumb a:focus-visible { color: var(--color-primary-hover); }
.ba-crumb [aria-current] { color: var(--color-neutral-700); font-weight: var(--fw-medium); }
.ba-cat { margin-top: 22px; }
.ba-title {
    margin: 14px 0 0;
    font-size: clamp(2rem, 3.2vw + .5rem, 3.3rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.5px;
    color: var(--color-text);
    text-wrap: balance;
    overflow-wrap: anywhere;
}
.ba-byline { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 18px; margin-top: 20px; font-size: 14px; color: var(--color-text-muted); }
.ba-byline > span { display: inline-flex; align-items: center; gap: 7px; }
.ba-byline i { color: var(--color-primary); }
.ba-who { font-weight: var(--fw-semibold); color: var(--color-text); }
.ba-who img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

.ba-cover { max-width: 1040px; margin: 36px auto 0; border-radius: 24px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--color-surface-muted); }
.ba-cover[hidden] { display: none; }
.ba-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }

.ba-body { max-width: 720px; margin: 40px auto 0; }
.ba-prose { font-size: 18px; line-height: 1.8; color: var(--color-neutral-700); overflow-wrap: break-word; }
.ba-prose > * + * { margin-top: 1.1em; }
.ba-prose p { margin-bottom: 0; }
.ba-prose > :first-child { margin-top: 0; }
.ba-prose h2 { font-size: 28px; line-height: 1.3; color: var(--color-text); margin: 1.8em 0 .5em; font-weight: var(--fw-bold); }
.ba-prose h3 { font-size: 22px; line-height: 1.35; color: var(--color-text); margin: 1.6em 0 .4em; font-weight: var(--fw-semibold); }
.ba-prose h4 { font-size: 19px; color: var(--color-text); margin: 1.4em 0 .4em; font-weight: var(--fw-semibold); }
.ba-prose a { color: var(--color-primary-hover); text-decoration: underline; text-underline-offset: 3px; }
.ba-prose ul, .ba-prose ol { padding-left: 1.4em; }
.ba-prose li + li { margin-top: .4em; }
.ba-prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--color-primary); color: var(--color-text-muted); font-style: italic; }
.ba-prose img { max-width: 100%; height: auto; border-radius: 12px; }
.ba-prose code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .88em; background: var(--color-surface-muted); border: 1px solid var(--color-border); border-radius: 6px; padding: .1em .4em; }
.ba-prose pre { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 18px 20px; overflow-x: auto; font-size: 15px; line-height: 1.6; }
.ba-prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.ba-prose table { width: 100%; border-collapse: collapse; font-size: 16px; display: block; overflow-x: auto; }
.ba-prose th, .ba-prose td { border: 1px solid var(--color-border); padding: 8px 12px; text-align: left; }

/* table of contents (articles with 3+ h2 headings) */
.ba-toc { margin: 0 0 32px; padding: 20px 24px; border-radius: 16px; background: var(--color-surface-muted); border: 1px solid var(--color-border); }
.ba-toc strong { display: block; margin-bottom: 8px; color: var(--color-text); }
.ba-toc ul { margin: 0; padding-left: 1.3em; columns: 2; column-gap: 32px; font-size: 15px; line-height: 1.6; }
.ba-toc li { break-inside: avoid; margin-bottom: 4px; }
.ba-toc a { color: var(--color-text-muted); text-decoration: none; }
.ba-toc a:hover, .ba-toc a:focus-visible { color: var(--color-primary-hover); text-decoration: underline; }
.ba-prose h2[id] { scroll-margin-top: 96px; }

/* call to action after the article body */
.ba-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-top: 40px; padding: 24px 28px; border-radius: 20px; background: #0f172a; color: #e2e8f0; }
.ba-cta strong { display: block; font-size: 19px; color: #fff; }
.ba-cta p { margin: 6px 0 0; font-size: 15px; line-height: 1.6; color: #cbd5e1; max-width: 520px; }
.ba-cta__btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; background: var(--color-primary-strong); color: #fff; font-weight: var(--fw-semibold); text-decoration: none; white-space: nowrap; }
.ba-cta__btn:hover, .ba-cta__btn:focus-visible { background: var(--color-primary-hover); color: #fff; }
.ba-who a { color: inherit; text-decoration: none; }
@media (max-width: 767px) { .ba-toc ul { columns: 1; } }

.ba-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 36px; padding: 20px 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.ba-share__label { margin-right: 4px; font-size: 14px; font-weight: var(--fw-bold); color: var(--color-text); }
.ba-share a, .ba-share button {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: #fff;
    display: grid; place-items: center;
    color: var(--color-neutral-700);
    font-size: 15px;
    cursor: pointer;
    transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}
.ba-share svg { display: block; }
.ba-share a:hover, .ba-share button:hover, .ba-share a:focus-visible, .ba-share button:focus-visible { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.ba-share__status { font-size: 13px; color: var(--color-success-text); }

.ba-author { display: flex; gap: 18px; align-items: center; margin-top: 28px; padding: 24px; border-radius: 24px; background: var(--color-primary-soft); border: 1px solid var(--color-primary-soft-border); }
.ba-author img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; }
.ba-author strong { display: block; font-size: 17px; color: var(--color-text); }
.ba-author p { margin: 4px 0 8px; font-size: 14.5px; color: var(--color-text-muted); }
.ba-author .bx-more:hover i { transform: translateX(4px); }

.ba-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.ba-pn a { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: #fff; color: var(--color-text); transition: border-color var(--duration-fast); }
.ba-pn a:hover, .ba-pn a:focus-visible { border-color: var(--color-primary); color: var(--color-text); }
.ba-pn small { font-size: 12px; font-weight: var(--fw-semibold); letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-subtle); }
.ba-pn b { font-size: 15.5px; }
.ba-pn__older { grid-column: 2; text-align: right; }

.ba-related { padding: 64px clamp(18px, 5.5vw, 80px) 72px; background: var(--color-surface-muted); }
.ba-related__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ba-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
    .bx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .bx-feat { grid-template-columns: 1fr; }
    .bx-feat .bx-thumb { min-height: 0; aspect-ratio: 16 / 9; }
}
@media (max-width: 767px) {
    .bx-page { padding: 100px 16px 56px; }
    .bx-head .bx-btn { width: 100%; }
    .bx-feat__body { padding: 22px; }
    .bx-feat__title { font-size: 1.45rem; }
    .bx-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
    .bx-chips::-webkit-scrollbar { display: none; }
    .bx-chips button { flex: none; }
    .bx-search { width: 100%; }
    .bx-grid { grid-template-columns: 1fr; gap: 16px; }

    .ba-article { padding: 100px 16px 48px; }
    .ba-top { text-align: left; }
    .ba-crumb, .ba-byline { justify-content: flex-start; }
    .ba-cover { margin-top: 28px; border-radius: 16px; }
    .ba-body { margin-top: 28px; }
    .ba-prose { font-size: 17px; }
    .ba-prose h2 { font-size: 24px; }
    .ba-author { flex-direction: column; align-items: flex-start; }
    .ba-pn { grid-template-columns: 1fr; }
    .ba-pn__older { grid-column: auto; }
    .ba-related { padding: 48px 16px 56px; }
    .ba-actions, .ba-actions .bx-btn { width: 100%; }
    .ba-actions .bx-btn { flex: 1; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .bx-card, .bx-feat, .bx-thumb img, .bx-more i, .bx-btn, .ba-share a, .ba-share button { transition: none; }
    .bx-card:hover { transform: none; }
}
