/* Blog: article list (/blog), categories and articles. Direction A: immersive dark 3D. Script: assets/blog.js
   Loaded after works.css (base, header, footer) and about.css (eyebrow, CTA band). Themable colors follow the
   var(--L-name, <dark value>) pattern; light tokens live in theme.css. */

.bl { --card: rgb(var(--L-raised-rgb, 24 34 54) / .7); --card2: rgb(var(--L-surface-rgb, 13 18 30) / .96); --soft: var(--L-soft, #c9d0e6); }
.bl-wrap { max-width: 80rem; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 40rem) { .bl-wrap { padding-inline: 1.5rem; } }
@media (min-width: 64rem) { .bl-wrap { padding-inline: 2rem; } }

/* ---------- Hero (list and category) ---------- */
.bl-hero {
  position: relative; isolation: isolate; overflow: hidden; overflow: clip; border-bottom: 1px solid var(--line);
  background: radial-gradient(44rem 26rem at 80% 10%, rgb(59 77 255 / .2), transparent 70%), radial-gradient(28rem 20rem at 8% 100%, rgb(255 190 11 / .06), transparent 70%), var(--bg);
}
html[dir="rtl"] .bl-hero { background: radial-gradient(44rem 26rem at 20% 10%, rgb(59 77 255 / .2), transparent 70%), radial-gradient(28rem 20rem at 92% 100%, rgb(255 190 11 / .06), transparent 70%), var(--bg); }
.bl-hero-in { position: relative; padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2.25rem, 5vw, 3.25rem); }
.bl-hero h1 { margin-top: 1rem; max-width: 52rem; color: var(--ink); font-weight: 900; font-size: clamp(2.1rem, 5.4vw, 4rem); line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
html[dir="ltr"] .bl-hero h1 { line-height: 1.05; letter-spacing: -.035em; }
.bl-hero h1 em, .bl-post-head h1 em { font-style: normal; color: transparent; background: linear-gradient(100deg, var(--L-indigo, #8e9bff), var(--L-ink, #f4f6ff) 55%, #ffbe0b); -webkit-background-clip: text; background-clip: text; }
.bl-lede { margin-top: 1.1rem; max-width: 40rem; color: var(--soft); font-size: clamp(1rem, 1.35vw, 1.12rem); line-height: 1.95; }
.bl-hero-in > *, .bl-post-head-in > * { opacity: 0; animation: ab-rise .8s var(--ease) forwards; }
.bl-hero-in > :nth-child(2), .bl-post-head-in > :nth-child(2) { animation-delay: .06s; }
.bl-hero-in > :nth-child(3), .bl-post-head-in > :nth-child(3) { animation-delay: .12s; }
.bl-hero-in > :nth-child(4), .bl-post-head-in > :nth-child(4) { animation-delay: .18s; }

/* Two tilted orbit rings behind the title, echoing the home hero */
.bl-hero-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; perspective: 900px; }
.bl-ring {
  position: absolute; top: 50%; inset-inline-end: -8rem; width: 34rem; height: 34rem; margin-top: -17rem; border-radius: 50%;
  border: 1px solid rgb(142 155 255 / .22); transform: rotateX(68deg) rotateZ(-18deg);
  box-shadow: 0 0 60px rgb(59 77 255 / .18), inset 0 0 40px rgb(59 77 255 / .12);
  animation: bl-spin 40s linear infinite;
}
.bl-ring::after { content: ""; position: absolute; top: 50%; left: -5px; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #ffbe0b; box-shadow: 0 0 18px 4px rgb(255 190 11 / .6); }
.bl-ring--2 { width: 22rem; height: 22rem; margin-top: -11rem; inset-inline-end: -2rem; border-color: rgb(255 190 11 / .2); animation-duration: 28s; animation-direction: reverse; }
.bl-ring--2::after { background: #8e9bff; box-shadow: 0 0 18px 4px rgb(59 77 255 / .7); }
@keyframes bl-spin { to { transform: rotateX(68deg) rotateZ(342deg); } }
@media (max-width: 47.999rem) { .bl-ring { opacity: .55; inset-inline-end: -18rem; } .bl-ring--2 { inset-inline-end: -10rem; } }

/* Category links */
.bl-cats { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; max-width: 100%; width: max-content; margin-top: 2rem; padding: .3rem; border-radius: 99px; background: rgb(var(--L-surface-rgb, 17 24 39) / .85); border: 1px solid var(--line); }
.bl-cats::-webkit-scrollbar { display: none; }
.bl-cats a { flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 2.5rem; padding: 0 1.1rem; border-radius: 99px; color: var(--mist); font-size: .88rem; font-weight: 700; white-space: nowrap; transition: color .2s, background .2s; }
.bl-cats a:hover { color: var(--ink); }
.bl-cats a[aria-current="page"] { background: var(--ink); color: var(--L-on-ink, #0b0f1a); }
.bl-cats sup { top: 0; font: 700 .7rem/1 'Plus Jakarta Sans', 'Dana Pro', sans-serif; opacity: .7; }
html[dir="rtl"] .bl-cats sup { font-family: 'Dana Pro', sans-serif; }

/* ---------- Cards ---------- */
.bl-list { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3.5rem, 8vw, 6rem); }
.bl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
@media (max-width: 63.999rem) { .bl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; } }
@media (max-width: 39.999rem) { .bl-grid { grid-template-columns: minmax(0, 1fr); } }

.bl-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: 1.6rem;
  border: 1px solid var(--line); background: linear-gradient(165deg, var(--card), var(--card2));
  transition: transform .5s var(--ease), border-color .4s, box-shadow .4s;
}
.bl-card:hover { transform: translateY(-4px); border-color: rgb(142 155 255 / .4); box-shadow: 0 40px 80px -44px #3b4dff; }
.bl-card:focus-within { border-color: rgb(255 190 11 / .55); }
.js .bl-card { opacity: 0; translate: 0 26px; transition: opacity .7s var(--ease) var(--d, 0s), translate .7s var(--ease) var(--d, 0s), transform .5s var(--ease), border-color .4s, box-shadow .4s; }
.js .bl-card.is-in { opacity: 1; translate: none; }
.bl-card-media { position: relative; aspect-ratio: 16 / 9.5; overflow: hidden; background: var(--L-surface, #0b0f19); }
.bl-card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.2s var(--ease); }
.bl-card:hover .bl-card-media img { transform: scale(1.04); }
.bl-card-media::after { content: ""; position: absolute; inset: auto 0 0; height: 45%; background: linear-gradient(to top, rgb(var(--L-bg-rgb, 9 13 22) / .7), transparent); pointer-events: none; }
.bl-card-media > .bl-chip { position: absolute; z-index: 1; top: .9rem; inset-inline-start: .9rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); background: rgb(var(--L-bg-rgb, 9 13 22) / .6); }
.bl-chip { display: inline-flex; align-items: center; min-height: 1.75rem; padding: .2rem .75rem; border-radius: 99px; font-size: .75rem; font-weight: 700; color: var(--L-gold-ink, #ffbe0b); background: rgb(255 190 11 / .1); border: 1px solid rgb(255 190 11 / .25); }
a.bl-chip:hover { background: rgb(255 190 11 / .18); }

.bl-card-body { display: flex; flex: 1; flex-direction: column; gap: .7rem; padding: 1.25rem 1.35rem 1.4rem; }
.bl-card h3 { color: var(--ink); font-size: 1.15rem; font-weight: 800; line-height: 1.6; text-wrap: pretty; }
html[dir="ltr"] .bl-card h3 { line-height: 1.35; }
.bl-card-link::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; }
.bl-card-link:focus-visible { outline: none; }
.bl-card-link:focus-visible::after { outline: 2px solid #ffbe0b; outline-offset: -3px; }
.bl-excerpt { color: var(--mist); font-size: .9rem; line-height: 1.85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; color: var(--dim); font-size: .8rem; font-weight: 600; }
.bl-meta i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .6; }
.bl-read { display: inline-flex; align-items: center; gap: .45rem; margin-top: auto; padding-top: .35rem; color: var(--ink); font-size: .88rem; font-weight: 800; }
.bl-arrow { width: 1.1rem; height: 1.1rem; flex: none; transition: transform .3s var(--ease); }
html[dir="rtl"] .bl-arrow { transform: scaleX(-1); }
.bl-card:hover .bl-read .bl-arrow { transform: translateX(4px); color: #ffbe0b; }
html[dir="rtl"] .bl-card:hover .bl-read .bl-arrow { transform: scaleX(-1) translateX(4px); }

/* Featured: the newest article, wide */
.bl-card.is-featured { margin-bottom: 1.5rem; }
@media (min-width: 56rem) {
  .bl-card.is-featured { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  .bl-card.is-featured .bl-card-media { aspect-ratio: auto; min-height: 22rem; }
  .bl-card.is-featured .bl-card-body { justify-content: center; gap: 1rem; padding: clamp(1.75rem, 3vw, 2.75rem); }
  .bl-card.is-featured h3 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); font-weight: 900; line-height: 1.45; }
  html[dir="ltr"] .bl-card.is-featured h3 { line-height: 1.15; letter-spacing: -.02em; }
  .bl-card.is-featured .bl-excerpt { -webkit-line-clamp: 3; font-size: 1rem; }
  .bl-card.is-featured .bl-read { margin-top: .5rem; }
}
.bl-card.is-featured { background: radial-gradient(30rem 18rem at 100% 100%, rgb(59 77 255 / .18), transparent 70%), linear-gradient(165deg, var(--card), var(--card2)); }

/* No cover: a branded panel */
.bl-cover-none {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(22rem 14rem at 30% 20%, rgb(59 77 255 / .45), transparent 70%), radial-gradient(18rem 12rem at 85% 90%, rgb(255 190 11 / .18), transparent 70%), linear-gradient(160deg, var(--L-raised, #131c33), var(--L-surface, #0a0e18));
}
.bl-cover-mark { width: 3.5rem; opacity: .95; filter: drop-shadow(0 10px 30px rgb(59 77 255 / .6)); transition: transform .8s var(--ease); }
.bl-card:hover .bl-cover-mark { transform: rotate(-8deg) scale(1.06); }
.bl-cover-word { position: absolute; inset-inline-start: 1rem; bottom: .6rem; color: rgb(var(--L-ink-rgb, 255 255 255) / .07); font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 900; line-height: 1; white-space: nowrap; }

/* Pagination */
.bl-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin-top: 2.5rem; }
.bl-pager-now { color: var(--dim); font-size: .9rem; font-weight: 700; }
.bl-pager-btn { display: inline-flex; align-items: center; gap: .5rem; justify-self: start; min-height: 2.9rem; padding: 0 1.3rem; border-radius: 99px; border: 1px solid var(--line); background: var(--L-surface, #111827); color: var(--ink); font-weight: 800; font-size: .9rem; transition: background .2s, border-color .2s; }
.bl-pager-btn.is-next { justify-self: end; }
.bl-pager-btn:hover { border-color: rgb(255 190 11 / .5); }
.bl-pager-btn.is-prev .bl-arrow { transform: scaleX(-1); }
html[dir="rtl"] .bl-pager-btn.is-prev .bl-arrow { transform: none; }

/* Empty */
.bl-empty { display: grid; justify-items: center; gap: .8rem; max-width: 34rem; margin-inline: auto; padding: clamp(2.5rem, 6vw, 4rem) 1.5rem; border-radius: 2rem; border: 1px dashed rgb(var(--L-ink-rgb, 255 255 255) / .14); text-align: center; }
.bl-empty-mark { width: 3rem; margin-bottom: .5rem; animation: bl-float 5s ease-in-out infinite; }
@keyframes bl-float { 50% { transform: translateY(-6px) rotate(-6deg); } }
.bl-empty h2 { margin: 0; color: var(--ink); font-size: 1.35rem; font-weight: 900; }
.bl-empty p { color: var(--mist); line-height: 1.9; }

/* ---------- Article ---------- */
.bl-progress { position: fixed; inset-inline: 0; top: 0; z-index: 60; height: 3px; pointer-events: none; }
.bl-progress i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, #3b4dff, #8e9bff 50%, #ffbe0b); }
html[dir="rtl"] .bl-progress i { transform-origin: right; }

.bl-post-head { position: relative; isolation: isolate; overflow: hidden; overflow: clip; background: radial-gradient(40rem 24rem at 85% 0%, rgb(59 77 255 / .18), transparent 70%), var(--bg); }
html[dir="rtl"] .bl-post-head { background: radial-gradient(40rem 24rem at 15% 0%, rgb(59 77 255 / .18), transparent 70%), var(--bg); }
.bl-post-head-in { position: relative; padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 2.5rem); }
.bl-post-head-in > :is(h1, .bl-lede) { max-width: 54rem; }
.bl-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.bl-back { display: inline-flex; align-items: center; gap: .4rem; min-height: 2rem; margin-inline-end: .35rem; color: var(--mist); font-size: .88rem; font-weight: 700; transition: color .2s; }
.bl-back:hover { color: var(--ink); }
.bl-back .bl-arrow { transform: scaleX(-1); }
html[dir="rtl"] .bl-back .bl-arrow { transform: none; }
.bl-post-head h1 { margin-top: 1.1rem; color: var(--ink); font-weight: 900; font-size: clamp(1.85rem, 4.4vw, 3.2rem); line-height: 1.4; letter-spacing: -.015em; text-wrap: balance; }
html[dir="ltr"] .bl-post-head h1 { line-height: 1.12; letter-spacing: -.03em; }
.bl-byline { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.5rem; color: var(--dim); font-size: .85rem; }
.bl-authors { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font-weight: 700; }
.bl-avatars { display: inline-flex; }
.bl-avatars .bl-avatar + .bl-avatar { margin-inline-start: -.6rem; }
.bl-avatar { width: 2.25rem; height: 2.25rem; font-size: .8rem; overflow: hidden; }
.bl-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bl-updated { font-weight: 600; }
.bl-post-head .bl-ring { inset-inline-end: -12rem; opacity: .6; }

.bl-post-cover { margin: 0; overflow: hidden; border-radius: 1.75rem; border: 1px solid var(--line); aspect-ratio: 1200 / 630; background: var(--L-surface, #0b0f19); box-shadow: 0 50px 100px -50px rgb(var(--L-shade-rgb, 0 0 0) / calc(.9 * var(--L-shade-k, 1))), 0 0 90px -40px #3b4dff; }
.bl-post-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }

.bl-post-body { display: grid; gap: 2rem; padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem); }
.bl-post-main { min-width: 0; max-width: 46rem; }
@media (min-width: 64rem) {
  .bl-post-body.has-toc { grid-template-columns: 15rem minmax(0, 46rem); justify-content: center; gap: 4rem; }
  .bl-post-body:not(.has-toc) .bl-post-main { margin-inline: auto; }
  .bl-toc { position: sticky; top: 6.5rem; align-self: start; }
}
@media (max-width: 63.999rem) { .bl-post-main { margin-inline: auto; width: 100%; } .bl-toc { max-width: 46rem; margin-inline: auto; width: 100%; } }

.bl-toc details { border-radius: 1.25rem; border: 1px solid var(--line); background: rgb(var(--L-ink-rgb, 255 255 255) / .025); }
.bl-toc summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 3rem; padding: 0 1.1rem; color: var(--ink); font-weight: 800; font-size: .9rem; cursor: pointer; list-style: none; }
.bl-toc summary::-webkit-details-marker { display: none; }
.bl-toc summary::after { content: ""; width: .5rem; height: .5rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform .25s; opacity: .6; }
.bl-toc details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.bl-toc ol { display: grid; gap: .1rem; padding: 0 .6rem .8rem; }
.bl-toc li.is-sub { padding-inline-start: .9rem; }
.bl-toc a { position: relative; display: block; padding: .45rem .6rem; border-radius: .7rem; color: var(--mist); font-size: .85rem; line-height: 1.6; transition: color .2s, background .2s; }
.bl-toc a:hover { color: var(--ink); background: rgb(var(--L-ink-rgb, 255 255 255) / .04); }
.bl-toc a.is-active { color: var(--ink); background: rgb(59 77 255 / .14); }
.bl-toc a.is-active::before { content: ""; position: absolute; inset-inline-start: 0; top: .5rem; bottom: .5rem; width: 2px; border-radius: 2px; background: #ffbe0b; }

/* Article text */
.bl-prose { color: var(--soft); font-size: 1.05rem; line-height: 2.05; overflow-wrap: break-word; }
html[dir="ltr"] .bl-prose { line-height: 1.8; font-size: 1.06rem; }
.bl-prose > * + * { margin-top: 1.15em; }
.bl-prose h2, .bl-prose h3, .bl-prose h4 { color: var(--ink); font-weight: 900; line-height: 1.5; scroll-margin-top: 6.5rem; text-wrap: balance; }
html[dir="ltr"] .bl-prose :is(h2, h3, h4) { line-height: 1.25; letter-spacing: -.015em; }
.bl-prose h2 { margin-top: 2em; font-size: clamp(1.4rem, 2.4vw, 1.75rem); }
.bl-prose h3 { margin-top: 1.7em; font-size: 1.25rem; }
.bl-prose h4 { margin-top: 1.5em; font-size: 1.08rem; }
.bl-prose h2::before { content: ""; display: block; width: 2.2rem; height: 3px; margin-bottom: .7rem; border-radius: 3px; background: linear-gradient(90deg, #3b4dff, #ffbe0b); }
html[dir="rtl"] .bl-prose h2::before { background: linear-gradient(-90deg, #3b4dff, #ffbe0b); }
.bl-prose strong { color: var(--ink); font-weight: 800; }
.bl-prose a { color: var(--L-indigo, #a5b0ff); text-decoration: underline; text-decoration-color: rgb(142 155 255 / .45); text-underline-offset: .25em; transition: text-decoration-color .2s, color .2s; }
.bl-prose a:hover { color: var(--ink); text-decoration-color: #ffbe0b; }
.bl-prose :is(ul, ol) { padding-inline-start: 1.4em; }
.bl-prose ul { list-style: none; }
.bl-prose ul > li { position: relative; }
.bl-prose ul > li::before { content: ""; position: absolute; inset-inline-start: -1.05em; top: .9em; width: .42em; height: .42em; border-radius: 50%; background: #ffbe0b; box-shadow: 0 0 10px rgb(255 190 11 / .5); }
html[dir="ltr"] .bl-prose ul > li::before { top: .7em; }
.bl-prose ol { list-style: decimal; }
html[dir="rtl"] .bl-prose ol { list-style: persian; }
.bl-prose ol > li::marker { color: var(--L-gold-ink, #ffbe0b); font-weight: 800; }
.bl-prose li + li { margin-top: .4em; }
.bl-prose blockquote {
  position: relative; margin-inline: 0; padding: 1.1em 1.4em; border-radius: 1.2rem; border-inline-start: 3px solid #ffbe0b;
  background: linear-gradient(90deg, rgb(255 190 11 / .08), transparent 80%); color: var(--ink); font-size: 1.1em; font-weight: 700;
}
html[dir="rtl"] .bl-prose blockquote { background: linear-gradient(-90deg, rgb(255 190 11 / .08), transparent 80%); }
.bl-prose code { padding: .12em .4em; border-radius: .4em; background: rgb(var(--L-ink-rgb, 255 255 255) / .07); color: var(--ink); font-size: .88em; }
.bl-prose pre { overflow-x: auto; padding: 1em 1.2em; border-radius: 1rem; background: var(--L-surface, #0b0f19); border: 1px solid var(--line); direction: ltr; text-align: left; }
.bl-prose hr { border: 0; height: 1px; margin-block: 2.2em; background: linear-gradient(90deg, transparent, rgb(var(--L-ink-rgb, 255 255 255) / .18), transparent); }
.bl-prose table { width: 100%; border-collapse: collapse; font-size: .92em; display: block; overflow-x: auto; }
.bl-prose :is(th, td) { padding: .6em .8em; border: 1px solid var(--line); text-align: start; }
.bl-prose th { color: var(--ink); background: rgb(var(--L-ink-rgb, 255 255 255) / .04); }
.bl-figure { margin-block: 2em; }
.bl-figure img { width: 100%; height: auto; border-radius: 1.2rem; border: 1px solid var(--line); }
.bl-figure figcaption { margin-top: .6rem; color: var(--dim); font-size: .85rem; text-align: center; }
.bl-text { padding-block: 3rem; }
.bl-text .bl-prose { max-width: 46rem; margin-inline: auto; }

/* Author box */
.bl-author-box { display: grid; gap: .9rem; margin-top: 3rem; padding: 1.3rem 1.4rem; border-radius: 1.4rem; border: 1px solid var(--line); background: radial-gradient(20rem 10rem at 100% 0%, rgb(59 77 255 / .12), transparent 70%), rgb(var(--L-ink-rgb, 255 255 255) / .02); }
.bl-author-label { color: var(--dim); font-size: .8rem; font-weight: 700; }
.bl-author { display: flex; align-items: center; gap: .9rem; }
.bl-author .bl-avatar { width: 3rem; height: 3rem; font-size: 1rem; }
.bl-author-name { color: var(--ink); font-weight: 800; }
.bl-author-role { color: var(--mist); font-size: .85rem; }

/* Related */
.bl-related { padding-block: 0 clamp(3.5rem, 8vw, 5.5rem); }
.bl-related h2 { margin: 0 0 1.5rem; max-width: none; font-size: clamp(1.5rem, 2.6vw, 2rem); }

@media (prefers-reduced-motion: reduce) {
  .bl-ring, .bl-empty-mark { animation: none; }
  .bl-hero-in > *, .bl-post-head-in > * { animation: none; opacity: 1; }
  .js .bl-card { opacity: 1; translate: none; transition: none; }
  .bl-card, .bl-card-media img { transition: none; }
}
