/* ============================================================
   AD HOLIC — the blog (/blog and its posts)
   Long-form reading on the dark ground, on the same lines as
   legal.css: a comfortable measure, headings that break the page
   into answers, links that look like links. Logical properties
   throughout so Arabic mirrors without overrides.
   ============================================================ */

/* ---------- The list ---------- */
.blog-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: var(--s-5);
  margin-top: var(--s-8);
}
.blog-more .blog-cards { margin-top: var(--s-6); }
.blog-empty { margin-top: var(--s-7); }

.blog-card__a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--plum);
  border: 1px solid var(--plum-high);
  border-radius: var(--r-3);
  overflow: hidden;
  transition: border-color var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.blog-card__a:hover { border-color: var(--magenta); transform: translateY(-3px); }
.blog-card__a:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; }

/* With no cover image the card carries the service name on the ribbon,
   so a post never shows an empty grey box while it waits for artwork. */
.blog-card__art {
  position: relative;
  display: grid;
  place-items: end start;
  aspect-ratio: 16 / 9;
  padding: var(--s-5);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(46, 127, 232, .35), transparent 60%),
    radial-gradient(80% 110% at 0% 100%, rgba(233, 29, 127, .45), transparent 62%),
    var(--indigo);
}
.blog-card__art.has-img { padding: 0; background: var(--plum-high); }
.blog-card__art img { width: 100%; height: 100%; object-fit: cover; }
.blog-card__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  color: var(--ice);
}

.blog-card__body {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-5) var(--s-5) var(--s-6);
}
.blog-card__meta { font-size: var(--fs-xs); color: var(--lilac-dim); }
.blog-card__t {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  color: var(--ice);
}
.blog-card__d { font-size: var(--fs-sm); color: var(--lilac); line-height: 1.6; }

/* ---------- A post ---------- */
.post__preview {
  position: sticky;
  top: var(--header-h);
  z-index: 5;
  margin: 0;
  padding: 10px var(--gutter);
  background: var(--magenta);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: center;
}

.post__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
  font-size: var(--fs-sm);
  color: var(--lilac-dim);
}
.post__crumbs a { color: var(--lilac); }
.post__crumbs a:hover { color: var(--ice); }

.post__head { max-width: 860px; }
.post__title { font-size: calc(clamp(2rem, 1.3rem + 2.6vw, 3.4rem) * var(--ar-type)); }
.post__lede { margin-top: var(--s-5); }

.post__by {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--plum-high);
}
.post__by p { display: grid; gap: 2px; font-size: var(--fs-sm); }
.post__avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ribbon-120);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-lg);
}
.post__avatar--lg { width: 64px; height: 64px; font-size: var(--fs-xl); }
.post__author { color: var(--ice); font-weight: 700; }
.post__author:hover { color: var(--magenta-soft); }
.post__role { color: var(--lilac); }
.post__meta { color: var(--lilac-dim); }

.post__cover { margin-top: var(--s-7); }
.post__cover img {
  width: 100%;
  height: auto;
  border-radius: var(--r-3);
  border: 1px solid var(--plum-high);
}

/* Contents beside the text on a wide screen, above it on a narrow one. */
.post__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-6);
  margin-top: var(--s-7);
}
@media (min-width: 1040px) {
  .post__grid { grid-template-columns: 250px minmax(0, 760px); gap: var(--s-8); }
  .post__toc { position: sticky; top: calc(var(--header-h) + var(--s-5)); align-self: start; }
}

.post__toc {
  background: var(--plum);
  border: 1px solid var(--plum-high);
  border-radius: var(--r-2);
  padding: var(--s-5);
  font-size: var(--fs-sm);
}
.post__toc-h {
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: var(--tr-eyebrow);
  text-transform: uppercase;
  color: var(--magenta-soft);
  margin-bottom: var(--s-3);
}
:root[data-lang="ar"] .post__toc-h { letter-spacing: 0; }
.post__toc ol { display: grid; gap: var(--s-2); counter-reset: toc; }
.post__toc li { counter-increment: toc; display: flex; gap: var(--s-2); line-height: 1.45; }
.post__toc li::before { content: counter(toc) "."; color: var(--lilac-dim); flex: none; }
:root[data-lang="ar"] .post__toc li::before { content: counter(toc, arabic-indic) "."; }
.post__toc a { color: var(--lilac); }
.post__toc a:hover { color: var(--ice); }

/* The text itself. */
.post__body {
  color: var(--lilac);
  font-size: calc(1.0625rem * var(--ar-type));
  line-height: 1.75;
  min-width: 0;
}
.post__body > * + * { margin-top: var(--s-4); }
.post__body h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  color: var(--ice);
  margin-top: var(--s-8);
  scroll-margin-top: calc(var(--header-h) + var(--s-5));
}
.post__body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  color: var(--ice);
  margin-top: var(--s-6);
  scroll-margin-top: calc(var(--header-h) + var(--s-5));
}
.post__body h2 + *, .post__body h3 + * { margin-top: var(--s-3); }
.post__body strong { color: var(--ice); font-weight: 600; }

.post__body ul, .post__body ol {
  padding-inline-start: 1.3em;
  display: grid;
  gap: var(--s-2);
}
.post__body ul { list-style: disc; }
.post__body ol { list-style: decimal; }
[dir="rtl"] .post__body ol { list-style: arabic-indic; }
.post__body li { padding-inline-start: .2em; }
.post__body li::marker { color: var(--magenta); font-weight: 600; }

.post__body a {
  color: var(--ice);
  text-decoration: underline;
  text-decoration-color: var(--magenta);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.post__body a:hover { color: var(--magenta-soft); }

/* The short answer, and any other boxed note. */
.post__note {
  background: var(--plum);
  border: 1px solid var(--plum-high);
  border-inline-start: 3px solid var(--magenta);
  border-radius: var(--r-2);
  padding: var(--s-5);
  color: var(--ice);
}

.post__table {
  overflow-x: auto;
  border: 1px solid var(--plum-high);
  border-radius: var(--r-2);
}
.post__table:focus-visible { outline: 2px solid var(--magenta); outline-offset: 2px; }
.post__table table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.55; }
.post__table th, .post__table td {
  padding: 12px 16px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--plum-high);
}
.post__table thead th { background: var(--plum); color: var(--ice); font-weight: 700; }
.post__table tbody th { color: var(--ice); font-weight: 600; }
.post__table tr:last-child th, .post__table tr:last-child td { border-bottom: 0; }

.post__fig img { width: 100%; height: auto; border-radius: var(--r-2); border: 1px solid var(--plum-high); }
.post__fig figcaption { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--lilac-dim); }

/* The close: what to do next, then who wrote it. */
.post__cta {
  margin-top: var(--s-8) !important;
  padding: var(--s-6);
  border-radius: var(--r-3);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--plum), var(--plum)) padding-box,
    var(--ribbon-120) border-box;
}
.post__cta-h { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-xl); color: var(--ice); }
.post__cta p + p { margin-top: var(--s-2); }
.post__cta-act { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-5); }

.post__bio {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  margin-top: var(--s-6) !important;
  padding: var(--s-5);
  border: 1px solid var(--plum-high);
  border-radius: var(--r-3);
  font-size: var(--fs-sm);
}
.post__bio div { display: grid; gap: var(--s-1); }
.post__bio-n { color: var(--ice); font-weight: 700; font-size: var(--fs-base); }
.post__bio .post__role { margin-bottom: var(--s-2); }
.post__li { justify-self: start; margin-top: var(--s-2); color: var(--ice) !important; }

@media (max-width: 640px) {
  .post__cta { padding: var(--s-5); }
  .post__cta-act .btn { width: 100%; }
  .post__bio { flex-direction: column; }
}
