/* Blog hub (phase 5): topic rail, cards, shelves, stories, topic tiles, post extras.
   Every category sets its own colour through --a; the tints are derived from it. */

.bh-hero, .bh-rail, .bh-main, .bh-after, .bh-post, .bh-home-topics {
  --bh-ink: var(--brand-ink, #17302b);
  --bh-soft: var(--ink-soft, #55655f);
  --bh-line: var(--line, #dfe5e2);
  --bh-surface: #fff;
  --bh-paper: #fffdf7;
}
.bh-hero, .bh-rail, .bh-main, .bh-after, .bh-post, .bh-home-topics, .bc, .bh-tile, .bh-feature, .bh-stories, .bh-shelf, .bh-pill {
  --a: #0f766e;
}
.bc, .bh-tile, .bh-feature, .bh-stories, .bh-shelf, .bh-pill, .bh-hero-cat, .bh-post {
  --ad: color-mix(in srgb, var(--a) 78%, #000);
  --at: color-mix(in srgb, var(--a) 10%, #fff);
}
@supports not (color: color-mix(in srgb, red, blue)) {
  .bc, .bh-tile, .bh-feature, .bh-stories, .bh-shelf, .bh-pill, .bh-hero-cat, .bh-post { --ad: var(--a); --at: #f0f4f2; }
}
html[data-theme="dark"] .bh-hero, html[data-theme="dark"] .bh-rail, html[data-theme="dark"] .bh-main,
html[data-theme="dark"] .bh-after, html[data-theme="dark"] .bh-post, html[data-theme="dark"] .bh-home-topics {
  --bh-ink: #e4eeeb; --bh-soft: #9db0aa; --bh-line: #27353a; --bh-surface: #161f22; --bh-paper: #1b2427;
}
html[data-theme="dark"] .bc, html[data-theme="dark"] .bh-tile, html[data-theme="dark"] .bh-feature,
html[data-theme="dark"] .bh-stories, html[data-theme="dark"] .bh-shelf, html[data-theme="dark"] .bh-pill, html[data-theme="dark"] .bh-hero-cat, html[data-theme="dark"] .bh-post {
  --ad: color-mix(in srgb, var(--a) 55%, #fff);
  --at: color-mix(in srgb, var(--a) 20%, #161f22);
}

.bh-i, .bh-pill-i, .bc-cat-i, .bc-meta-i, .bc-fallback-i, .bh-empty-i { width: 1.1em; height: 1.1em; flex: none; }

/* one-time entrance */
@keyframes bh-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes bh-pop { from { opacity: 0; transform: translateY(8px) scale(.94); } }

/* ------------------------------------------------------------------ hero */
.bh-hero { padding: 2.4rem 0 1.4rem; }
.bh-hero-in { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.bh-hero-text { max-width: 44rem; }
.bh-h1 { margin: 0 0 .6rem; font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.1; animation: bh-rise .7s cubic-bezier(.2,.7,.2,1) backwards; }
.bh-lead { margin: 0; font-size: 1.1rem; line-height: 1.6; color: var(--bh-soft); max-width: 40rem; animation: bh-rise .7s .1s cubic-bezier(.2,.7,.2,1) backwards; }
.bh-count { margin: .9rem 0 0; font-weight: 600; color: var(--ad, var(--bh-ink)); animation: bh-rise .7s .18s cubic-bezier(.2,.7,.2,1) backwards; }
.bh-crumb { margin: 0 0 .7rem; font-size: .9rem; color: var(--bh-soft); }
.bh-crumb a { color: inherit; }
.bh-hero-cat { background: var(--at); border-bottom: 1px solid color-mix(in srgb, var(--a) 25%, transparent); padding-bottom: 2rem; }
.bh-hero-ico { flex: none; display: grid; place-items: center; width: clamp(72px, 14vw, 120px); aspect-ratio: 1; border-radius: 30%; background: var(--a); color: #fff; animation: bh-pop .8s .15s cubic-bezier(.2,.8,.2,1.2) backwards; }
.bh-hero-ico svg { width: 52%; height: 52%; }

/* ------------------------------------------------------------------ topic rail */
.bh-rail { padding: .9rem 0; border-bottom: 1px solid var(--bh-line); }
.bh-rail-list { list-style: none; margin: 0; padding: 2px; display: flex; gap: .55rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%); }
.bh-rail-list::-webkit-scrollbar { display: none; }
.bh-rail-list li { flex: none; animation: bh-pop .5s cubic-bezier(.2,.7,.2,1) backwards; }
.bh-rail-list li:nth-child(1) { animation-delay: .15s; } .bh-rail-list li:nth-child(2) { animation-delay: .2s; }
.bh-rail-list li:nth-child(3) { animation-delay: .25s; } .bh-rail-list li:nth-child(4) { animation-delay: .3s; }
.bh-rail-list li:nth-child(5) { animation-delay: .35s; } .bh-rail-list li:nth-child(6) { animation-delay: .4s; }
.bh-rail-list li:nth-child(n+7) { animation-delay: .45s; }
.bh-pill { display: inline-flex; align-items: center; gap: .45rem; min-height: 42px; padding: .3rem .75rem .3rem .65rem; border: 1px solid var(--bh-line); border-radius: 999px;
  background: var(--bh-surface); color: var(--bh-ink); font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s; }
.bh-pill-i { color: var(--a); transition: color .2s, transform .3s; }
.bh-pill b { font-size: .75rem; font-weight: 700; min-width: 1.5em; padding: .08rem .4rem; border-radius: 999px; background: var(--at, #eef3f1); color: var(--ad, var(--bh-ink)); text-align: center; }
.bh-pill:hover { border-color: var(--a); transform: translateY(-1px); }
.bh-pill:hover .bh-pill-i { transform: rotate(-8deg) scale(1.12); }
.bh-pill:not([style]) { --a: var(--bh-ink); }
.bh-pill.is-on { background: var(--a); border-color: var(--a); color: #fff; }
.bh-pill.is-on .bh-pill-i { color: #fff; }
.bh-pill.is-on b { background: rgba(255,255,255,.22); color: #fff; }
.bh-pill:focus-visible, .bc a:focus-visible, .bh-tile:focus-visible, .bh-more:focus-visible, .bh-cta:focus-visible, .bh-share a:focus-visible, .bh-share button:focus-visible { outline: 3px solid var(--a, #0f766e); outline-offset: 3px; }
@media (min-width: 900px) {
  .bh-rail-list { flex-wrap: wrap; overflow: visible; mask-image: none; }
}

/* ------------------------------------------------------------------ cards */
.bh-main { padding-top: 2rem; }
.bh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }
.bh-grid-stories { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.bc.blog-card { position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--bh-line); border-radius: 16px; background: var(--bh-surface); box-shadow: none; color: var(--bh-ink);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.bc.blog-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--a) 55%, var(--bh-line)); box-shadow: 0 18px 28px -20px color-mix(in srgb, var(--a) 80%, transparent); }
.bc-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--at); }
.bc-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.bc:hover .bc-media img, .bh-feature:hover .bh-feature-media img { transform: scale(1.05); }
.bc-fallback { display: grid; place-items: center; width: 100%; height: 100%; color: var(--a); }
.bc-fallback-i { width: 3.4rem; height: 3.4rem; opacity: .85; transition: transform .5s cubic-bezier(.2,.8,.2,1.2); }
.bc:hover .bc-fallback-i, .bh-feature:hover .bc-fallback-i { transform: rotate(-6deg) scale(1.1); }
.bc-body { display: flex; flex: 1; flex-direction: column; gap: .55rem; padding: 1rem 1.1rem 1.15rem; }
.bc-cat { position: relative; z-index: 2; align-self: flex-start; display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem .2rem .5rem;
  border-radius: 999px; background: var(--at); color: var(--ad); font-size: .8rem; font-weight: 600; text-decoration: none; transition: background-color .2s; }
.bc-cat:hover { background: color-mix(in srgb, var(--a) 20%, var(--bh-surface)); }
.bc-cat-i { width: 14px; height: 14px; }
.bc-title { margin: 0; font-size: 1.12rem; line-height: 1.32; }
.bc-title a { color: var(--bh-ink); text-decoration: none; }
.bc-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }   /* whole card is one tap target */
.bc-excerpt { margin: 0; font-size: .93rem; line-height: 1.55; color: var(--bh-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; margin: auto 0 0; padding-top: .35rem; font-size: .8rem; color: var(--bh-soft); }
.bc-read { display: inline-flex; align-items: center; gap: .3rem; }
.bc-meta-i { width: 14px; height: 14px; }

/* story cards */
.bc-story.blog-card { background: var(--bh-paper); border-left: 4px solid var(--a); }
.bc-story .bc-title { font-family: 'Lora', Georgia, 'Noto Serif Bengali', serif; font-size: 1.28rem; font-weight: 600; line-height: 1.3; }
.bc-story .bc-excerpt { font-family: 'Lora', Georgia, 'Noto Serif Bengali', serif; font-style: italic; font-size: 1rem; line-height: 1.65; -webkit-line-clamp: 4; }
.bc-story .bc-media { aspect-ratio: 3 / 2; }

/* ------------------------------------------------------------------ featured */
.bh-feature { position: relative; display: grid; margin-bottom: 2.5rem; overflow: hidden; border: 1px solid var(--bh-line); border-radius: 22px; background: var(--bh-surface); transition: border-color .25s, box-shadow .25s; }
.bh-feature:hover { border-color: color-mix(in srgb, var(--a) 55%, var(--bh-line)); box-shadow: 0 22px 36px -26px color-mix(in srgb, var(--a) 85%, transparent); }
.bh-feature-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--at); }
.bh-feature-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.bh-feature-media .bc-fallback-i { width: 5rem; height: 5rem; }
.bh-feature-body { display: flex; flex-direction: column; gap: .8rem; padding: 1.4rem 1.4rem 1.6rem; }
.bh-feature-title { margin: 0; font-size: clamp(1.45rem, 3vw, 2.1rem); line-height: 1.2; }
.bh-feature-title a { color: var(--bh-ink); text-decoration: none; }
.bh-feature-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.bh-feature-excerpt { margin: 0; color: var(--bh-soft); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bh-feature .bc-meta { margin-top: 0; padding-top: 0; }
.bh-cta { align-self: flex-start; font-weight: 700; color: var(--ad); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; padding-bottom: 3px; transition: background-size .3s ease; }
.bh-feature:hover .bh-cta, .bh-cta:focus-visible { background-size: 100% 2px; }
@media (min-width: 820px) {
  .bh-feature { grid-template-columns: 1.15fr 1fr; }
  .bh-feature-media { aspect-ratio: auto; min-height: 340px; }
  .bh-feature-body { justify-content: center; padding: 2.2rem; }
}

/* ------------------------------------------------------------------ shelves & stories */
.bh-shelf, .bh-foryou, .bh-latest-head { margin-top: 3rem; }
.bh-latest-head { margin-top: 0; }
.bh-shelf-head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.1rem; }
.bh-shelf-head h2 { margin: 0; font-size: 1.4rem; line-height: 1.2; }
.bh-shelf-head p { margin: .15rem 0 0; font-size: .9rem; color: var(--bh-soft); }
.bh-shelf-ico { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--at); color: var(--ad); }
.bh-shelf-ico svg { width: 24px; height: 24px; }
.bh-more { margin-left: auto; flex: none; padding: .4rem .95rem; border: 1px solid color-mix(in srgb, var(--a) 40%, var(--bh-line)); border-radius: 999px; color: var(--ad); font-weight: 600; font-size: .9rem; text-decoration: none; transition: background-color .2s; }
.bh-more:hover { background: var(--at); }

.bh-stories { margin-top: 3.5rem; padding: 1.6rem; border-radius: 26px; background: var(--at); }
.bh-stories-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.bh-stories-head > div { flex: 1 1 260px; }
.bh-stories-head h2 { margin: 0; font-family: 'Lora', Georgia, 'Noto Serif Bengali', serif; font-size: 1.6rem; }
.bh-stories-head p { margin: .2rem 0 0; font-family: 'Lora', Georgia, 'Noto Serif Bengali', serif; font-style: italic; color: var(--bh-soft); max-width: 38rem; }
.bh-stories .bh-shelf-ico { background: var(--a); color: #fff; }

@media (max-width: 719px) {
  .bh-snap { display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -1rem; padding: 0 1rem .8rem; scrollbar-width: none; }
  .bh-snap::-webkit-scrollbar { display: none; }
  .bh-snap > .bc { flex: 0 0 78%; scroll-snap-align: start; }
  .bh-more { padding: .35rem .8rem; }
  .bh-stories { padding: 1.1rem; border-radius: 20px; }
}

/* ------------------------------------------------------------------ topic tiles */
.bh-tiles { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.bh-tile { display: grid; gap: .25rem; align-content: start; height: 100%; padding: 1.1rem; border: 1px solid color-mix(in srgb, var(--a) 22%, transparent); border-radius: 18px;
  background: var(--at); color: var(--bh-ink); text-decoration: none; transition: transform .25s ease, box-shadow .25s ease; }
.bh-tile:hover { transform: translateY(-3px); box-shadow: 0 16px 26px -20px color-mix(in srgb, var(--a) 90%, transparent); }
.bh-tile-ico { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: .55rem; border-radius: 13px; background: var(--a); color: #fff; transition: transform .35s cubic-bezier(.2,.8,.2,1.3); }
.bh-tile-ico svg { width: 24px; height: 24px; }
.bh-tile:hover .bh-tile-ico { transform: rotate(-8deg) scale(1.1); }
.bh-tile-name { font-family: var(--font-heading, inherit); font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.bh-tile-sub { font-size: .84rem; color: var(--bh-soft); line-height: 1.4; }
.bh-tile-n { margin-top: .4rem; font-size: .8rem; font-weight: 700; color: var(--ad); }
.bh-more-topics { margin-top: 3.5rem; }
.bh-more-topics h2 { margin: 0; font-size: 1.4rem; }
.bh-home-topics .bh-tiles { margin-top: 1.1rem; }

.bh-empty { max-width: 40rem; margin: 1rem auto 2rem; text-align: center; }
.bh-empty-i { width: 3rem; height: 3rem; color: var(--a); }
.bh-empty .bh-tiles { text-align: left; }
.bh-pager { display: flex; align-items: center; justify-content: space-between; margin-top: 2.5rem; }

/* ------------------------------------------------------------------ reveal on scroll */
.bh-js .bh-reveal:not(.in) { opacity: 0; }
.bh-reveal.in { animation: bh-rise .6s cubic-bezier(.2,.7,.2,1) backwards; animation-delay: calc(var(--d, 0) * 70ms); }

/* ------------------------------------------------------------------ post page extras */
.bh-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; background: var(--a, #0f766e); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
.bh-post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: .3rem 0 1rem; font-size: .9rem; color: var(--bh-soft, #55655f); }
.bh-share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 1.5rem 0; padding: .9rem 0; border-block: 1px solid var(--bh-line, #dfe5e2); }
.bh-share-label { font-weight: 600; margin-right: .3rem; }
.bh-share a, .bh-share button { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: .3rem .95rem; border: 1px solid var(--bh-line, #dfe5e2); border-radius: 999px; background: var(--bh-surface, #fff);
  color: inherit; font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: border-color .2s, background-color .2s, transform .2s; }
.bh-share a:hover, .bh-share button:hover { border-color: var(--a, #0f766e); background: var(--at, #f0f4f2); transform: translateY(-1px); }
.bh-share svg { width: 16px; height: 16px; }
.bh-share [data-native-share][hidden] { display: none; }
.bh-share-msg { font-size: .85rem; color: var(--bh-soft, #55655f); }
.post-story { font-family: 'Lora', Georgia, 'Noto Serif Bengali', serif; font-size: 1.15rem; line-height: 1.95; max-width: 42rem; }
.post-story p { margin: 0 0 1.4em; }
.bh-after { margin-top: 3rem; border-top: 1px solid var(--bh-line); padding-top: 1.75rem; }
.bh-after h2 { margin: 0 0 1.1rem; font-size: 1.35rem; }
.bh-after section + section { margin-top: 2.5rem; }
.bh-after .bh-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.bh-after .bh-tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.bh-after .bh-tile-sub { display: none; }

/* ------------------------------------------------------------------ accessibility */
@media (prefers-reduced-motion: reduce) {
  .bh-h1, .bh-lead, .bh-count, .bh-hero-ico, .bh-rail-list li, .bh-reveal.in { animation: none !important; }
  .bh-js .bh-reveal:not(.in) { opacity: 1; }
  .bc.blog-card, .bc-media img, .bh-feature-media img, .bh-tile, .bh-tile-ico, .bh-pill, .bh-pill-i, .bc-fallback-i, .bh-cta, .bh-share a, .bh-share button { transition: none; }
  .bc.blog-card:hover, .bh-tile:hover, .bh-pill:hover, .bh-share a:hover, .bh-share button:hover { transform: none; }
  .bc:hover .bc-media img, .bh-feature:hover .bh-feature-media img { transform: none; }
}

/* post body text (moved out of inline style so the story reading mode can override it) */
.bh-post .post-content { font-size: 1.1rem; line-height: 1.8; }
.bh-post .post-story { font-size: 1.15rem; line-height: 1.95; }
.bh-post .bh-post-meta .bc-cat { margin-right: .2rem; }

/* topic shelves show exactly three cards per row on desktop so the row looks complete */
@media (min-width: 900px) { .bh-shelf .bh-grid { grid-template-columns: repeat(3, 1fr); } }

/* Citations in blog posts: ‘(Author, year)’ links to the References list at the end */
.post-content a.cite { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; white-space: nowrap; font-size: .93em; }
.post-content a.cite:hover, .post-content a.cite:focus-visible { color: var(--brand-primary-dark, #00b892); border-bottom-style: solid; }
.post-content ol.refs { padding-left: 1.5rem; font-size: .95em; }
.post-content ol.refs li { margin: .5rem 0; padding: .2rem .45rem; border-radius: 8px; overflow-wrap: anywhere; scroll-margin-top: 6rem; }
.post-content ol.refs li:target { background: rgba(0, 184, 146, .14); outline: 2px solid var(--brand-primary-dark, #00b892); }

/* Tables pasted from Word / Docs (sanitizer keeps only table/tr/th/td, no inline styles) */
.post-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 1.2rem 0; font-size: .97em; line-height: 1.5; }
.post-content th, .post-content td { border: 1px solid rgba(128, 128, 128, .35); padding: .5rem .7rem; text-align: left; vertical-align: top; min-width: 5rem; }
.post-content th { background: rgba(128, 128, 128, .12); font-weight: 700; }
