/* ==========================================================================
   /insights — the health blog

   A TOPIC-LED MAGAZINE, and a deliberately different design from the newsroom
   (news.css): a tinted hero with a photo collage, a sticky topic rail, an
   asymmetric editor's-picks block and a soft, image-led card grid. The two
   pages share only feed.css's pager.

   Everything scoped under `.blg`. Logical properties throughout.
   ========================================================================== */

.blg {
  /* Green-biased, where the newsroom is blue-biased: the blog is health
     content, not corporate announcements. Both come from the brand tokens —
     nothing here invents a colour. */
  --blg-tint: #f2f8f4;
  --blg-accent: var(--c-green);
  --blg-accent-deep: #1f6b30;
  /* «All topics» uses navy. Every category chip overrides this with the
     colour of its own editorial cover template in templates/insights.php. */
  --blg-topic-color: #123a70;
  --blg-topic-color-deep: color-mix(in srgb, var(--blg-topic-color) 82%, #071a36);
  --blg-radius: 18px;
}

/* =================================================================== hero */

.blg-hero {
  position: relative;
  background:
    radial-gradient(ellipse 38% 72% at 31% 52%, rgba(213, 237, 223, 0.72) 0%, rgba(239, 248, 243, 0.48) 58%, transparent 59%),
    linear-gradient(90deg, #f6faf8 0%, #fff 48%, #fbfcfc 100%);
  border-block-end: 1px solid var(--c-line);
  padding-block: var(--s-10) var(--s-12);
  overflow: hidden;
}

.blg-hero::before {
  content: "";
  position: absolute;
  left: 5.5%;
  right: auto;
  inset-block-end: 20%;
  inline-size: 130px;
  block-size: 160px;
  background:
    radial-gradient(ellipse at 50% 100%, transparent 47%, #9fcfb0 48% 53%, transparent 54%) 22px 0 / 54px 88px no-repeat,
    radial-gradient(ellipse at 50% 100%, transparent 47%, #78bd91 48% 53%, transparent 54%) 58px 35px / 58px 94px no-repeat;
  opacity: .55;
  transform: rotate(-18deg);
  pointer-events: none;
}

/* CSS-drawn dot field — no image request, and it cannot 404. */
.blg-hero__dots {
  position: absolute;
  inset-block-start: 40px;
  left: 8.5%;
  right: auto;
  inline-size: 180px;
  block-size: 180px;
  background-image: radial-gradient(#9dbdad 1.25px, transparent 1.25px);
  background-size: 13px 13px;
  opacity: 0.58;
  pointer-events: none;
}

.blg-hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .86fr) minmax(420px, 1.14fr);
  gap: clamp(32px, 6vw, 92px);
  align-items: center;
}

.blg-hero__crumb {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  font-size: var(--t-sm);
  color: var(--c-muted);
  margin-block-end: var(--s-5);
  opacity: .78;
}
.blg-hero__crumb a {
  color: var(--c-muted);
}
.blg-hero__crumb a:hover {
  color: var(--blg-accent-deep);
}

.blg-hero__eyebrow {
  display: inline-block;
  font-size: var(--t-sm);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--blg-accent-deep);
  background: #edf7f0;
  border: 1px solid #cfe8d7;
  padding: 5px var(--s-4);
  border-radius: 20px;
  margin: 0 0 var(--s-4);
}

.blg-hero__title {
  font-size: clamp(2rem, 3.2vw, 3.15rem);
  line-height: var(--lh-tight);
  color: var(--c-ink);
  margin: 0;
}

.blg-hero__lede {
  max-inline-size: 54ch;
  margin-block: var(--s-5) 0;
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: var(--lh-snug);
  color: var(--c-body);
}

.blg-hero__count {
  margin-block-start: var(--s-6);
  font-size: var(--t-sm);
  color: var(--c-muted);
}
.blg-hero__count b {
  color: var(--blg-accent-deep);
  font-size: var(--t-lg);
  font-weight: 700;
}

/* Collage — three real article photographs, fanned. Purely decorative
   (aria-hidden in the template): every one of them is reachable below. */
.blg-hero__collage {
  position: relative;
  block-size: 360px;
  direction: ltr;
}
.blg-hero__shot {
  position: absolute;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(22, 58, 43, 0.12);
  background: var(--c-wash);
}
.blg-hero__shot img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
}
.blg-hero__shot--1 {
  inline-size: 55%;
  block-size: 80%;
  inset-block-start: 3%;
  inset-inline-start: 10%;
  z-index: 3;
}
.blg-hero__shot--2 {
  inline-size: 43%;
  block-size: 59%;
  inset-block-end: 3%;
  inset-inline-end: 3%;
  z-index: 2;
}
.blg-hero__shot--3 {
  inline-size: 38%;
  block-size: 48%;
  inset-block-start: 21%;
  inset-inline-end: 17%;
  z-index: 4;
  opacity: 1;
}
.blg-hero__shot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 30, 25, .48), transparent 45%);
  pointer-events: none;
}
.blg-hero__shot-label {
  position: absolute;
  z-index: 2;
  inset-inline-start: 14px;
  inset-block-end: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: var(--c-ink);
  font-size: 12px;
  font-weight: 700;
  direction: rtl;
}

/* ============================================================= topic rail */

.blg-topics {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--c-line);
}

.blg-topics__inner {
  display: flex;
  gap: var(--s-2);
  align-items: center;
  overflow-x: auto;
  padding-block: var(--s-4);

  /* The rail must scroll inside itself, never widen the page. */
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.blg-topics__inner::-webkit-scrollbar {
  block-size: 4px;
}
.blg-topics__inner::-webkit-scrollbar-thumb {
  background: var(--c-line-strong);
  border-radius: 4px;
}

.blg-topics__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  flex: none;
  padding: 8px var(--s-4);
  border: 1px solid var(--c-line);
  border-radius: 22px;
  background: var(--c-surface);
  color: var(--c-body);
  font-size: var(--t-sm);
  white-space: nowrap;
  transition: border-color var(--dur-1, 0.15s), background-color var(--dur-1, 0.15s),
              color var(--dur-1, 0.15s);
}
.blg-topics__chip:hover {
  border-color: var(--blg-topic-color);
  color: var(--blg-topic-color-deep);
  text-decoration: none;
}
.blg-topics__chip.is-active {
  background: var(--blg-topic-color);
  border-color: var(--blg-topic-color);
  color: #fff;
}

/* One glyph per topic, mapped by slug in templates/insights.php. It carries the
   accent while the chip is quiet and goes white with the label once the chip is
   filled, so the pair always reads as one object. */
.blg-topics__icon {
  inline-size: 16px;
  block-size: 16px;
  flex: none;
  color: var(--blg-topic-color);
}
.blg-topics__chip.is-active .blg-topics__icon {
  color: inherit;
}

/* ========================================================= editor's picks */

/* The block sits on its own pale panel, as in the reference — it is the one
   editorial selection on a page that is otherwise a machine-ordered feed, and
   the panel is what says so without a second heading style. */
.blg-pick {
  padding-block: var(--sec-y) 0;
}
/* ⚠️ Only the BLOCK padding is set here. `.container` already carries
   `padding-inline: 24px`, which becomes the panel's own inset — override it and
   this section's content stops lining up with every other section on the page. */
.blg-pick > .container {
  padding-block: clamp(28px, 3.5vw, 48px);
  border-radius: 24px;
  background: linear-gradient(145deg, #f7fbf8 0%, #f4f8fb 100%);
  border: 1px solid color-mix(in srgb, var(--blg-accent) 10%, var(--c-line));
}

.blg-pick__title {
  font-size: var(--t-xl);
  color: var(--c-ink);
  margin: 0;
  text-align: center;
}
.blg-pick__rule {
  display: block;
  inline-size: 56px;
  block-size: 3px;
  border-radius: 2px;
  background: var(--blg-accent);
  margin: var(--s-4) auto var(--s-10);
}

/* Asymmetric on purpose — one hero card beside two stacked. The newsroom's
   most-read strip is three equal cards; these two pages must not converge.
   ⚠️ The hero sits at the INLINE-END (the left in fa), which is where the
   reference puts it, and it is placed by `grid-column` rather than by moving it
   in the markup — it is the first highlight and must stay first in the DOM. */
.blg-pick__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: none;
  gap: clamp(16px, 2vw, 24px);
  align-items: stretch;
}
.blg-pick__card--hero {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.blg-pick__card {
  position: relative;   /* the containing block for .blg-tag--onmedia */
  display: flex;
  flex-direction: column;
  /* Tinted from the post's own topic — set inline by the template, because the
     category slugs are Persian and would make for unreadable class names. */
  background: var(--c-surface);
  border: 1px solid color-mix(in srgb, var(--blg-accent) 14%, var(--c-line));
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(19, 58, 47, .055);
  transition: border-color var(--dur-1, 0.15s), box-shadow var(--dur-1, 0.15s),
              transform var(--dur-1, 0.15s);
}

/* The two small cards run HORIZONTAL — picture at the inline-start, text beside
   it — which is what lets them stack to the hero's height without their images
   growing to fill it. The hero stays vertical. */
.blg-pick__card:not(.blg-pick__card--hero) {
  flex-direction: column;
  align-items: stretch;
}
.blg-pick__card:not(.blg-pick__card--hero) .blg-pick__media {
  flex: none;
  inline-size: 100%;
  max-inline-size: none;
  aspect-ratio: 14 / 9;
}
.blg-pick__card:hover {
  border-color: var(--c-line-strong);
  box-shadow: var(--shadow-1);
  transform: translateY(-2px);
}

.blg-pick__media {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--c-wash);
  overflow: hidden;
  flex: none;
}
.blg-pick__card--hero .blg-pick__media {
  aspect-ratio: 16 / 9;
  flex: none;
  min-block-size: 0;
}
.blg-pick__media img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-3, .45s) var(--ease);
}
.blg-pick__card:hover .blg-pick__media img {
  transform: scale(1.025);
}
.blg-pick__media.is-empty {
  background: var(--blg-tint);
}

.blg-pick__body {
  padding: clamp(18px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.blg-pick__card--hero .blg-pick__body {
  flex: 1;
  padding: clamp(18px, 2vw, 24px);
}

.blg-pick__name {
  font-size: var(--t-md);
  font-weight: 700;
  line-height: var(--lh-snug);
  margin: 0;
}
.blg-pick__card--hero .blg-pick__name {
  font-size: var(--t-md);
}
.blg-pick__name a {
  color: var(--c-ink);
}
.blg-pick__name a:hover {
  color: var(--blg-accent-deep);
  text-decoration: none;
}

.blg-pick__sum {
  margin: 0;
  color: var(--c-muted);
  line-height: var(--lh-body);
  font-size: var(--t-sm);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.blg-pick__meta {
  margin: auto 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  font-size: var(--t-xs);
  color: var(--c-muted);
  padding-block-start: var(--s-3);
  border-block-start: 1px solid color-mix(in srgb, var(--blg-accent) 12%, var(--c-line));
}
.blg-pick__metaitem {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  white-space: nowrap;
}
.blg-pick__metaicon {
  inline-size: 14px;
  block-size: 14px;
  flex: none;
  color: var(--blg-accent);
  opacity: 0.75;
}

/* ================================================================== tag */

.blg-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--blg-accent-deep);
  background: var(--c-green-soft);
  padding: 3px var(--s-3);
  border-radius: 20px;
  white-space: nowrap;
}

/* On the card image, where it needs its own opaque ground to stay legible over
   an arbitrary photograph. */
.blg-tag--float {
  position: absolute;
  inset-block-end: var(--s-3);
  inset-inline-start: var(--s-3);
  background: rgba(255, 255, 255, 0.94);
  color: var(--blg-accent-deep);
  box-shadow: 0 2px 8px rgba(14, 31, 39, 0.16);
}

/* Same idea on the editor's picks, but anchored to the CARD rather than to the
   media — see the note in the template: the media anchor is aria-hidden, so
   nothing that carries meaning may live inside it. The media is the card's
   first child, so the card's top corner is the image's top corner. */
.blg-tag--onmedia {
  position: absolute;
  inset-block-start: var(--s-4);
  inset-inline-start: var(--s-4);
  z-index: 1;
  background: rgba(255, 255, 255, 0.94);
  color: var(--blg-accent-deep);
  box-shadow: 0 2px 8px rgba(14, 31, 39, 0.16);
}

/* ============================================================== toolbar */

.blg-feed {
  padding-block: var(--sec-y);
}

.blg-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--s-5);
  flex-wrap: wrap;
  margin-block-end: var(--s-2);
}

/* Heading over its own short rule, matching the picks block above it. The rule
   is a sibling rather than a ::after so it keeps the heading's own width out of
   it — a long "نتیجه جست‌وجو" must not stretch the rule with it. */
.blg-bar__head {
  margin-inline-end: auto;
}
.blg-bar__title {
  font-size: var(--t-xl);
  color: var(--c-ink);
  margin: 0;
}
.blg-bar__rule {
  display: block;
  inline-size: 56px;
  block-size: 3px;
  border-radius: 2px;
  background: var(--blg-accent);
  margin-block-start: var(--s-3);
}

.blg-bar__form {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.blg-search {
  position: relative;
  display: flex;
  align-items: center;
  min-inline-size: 280px;
}
.blg-search__icon {
  position: absolute;
  inset-inline-start: var(--s-4);
  inline-size: 18px;
  block-size: 18px;
  color: var(--c-muted);
  pointer-events: none;
}
.blg-search__input {
  inline-size: 100%;
  block-size: 44px;
  padding-inline: calc(var(--s-4) * 2 + 18px) calc(var(--s-4) * 2 + 18px);
  border: 1px solid var(--c-line);
  border-radius: var(--blg-radius);
  background: var(--c-surface);
  color: var(--c-ink);
  font: inherit;
  font-size: var(--t-sm);
}
.blg-search__input:focus-visible {
  outline: 2px solid var(--blg-accent);
  outline-offset: 1px;
  border-color: var(--blg-accent);
}
.blg-search__input::-webkit-search-cancel-button {
  display: none;
}

.blg-search__clear {
  position: absolute;
  inset-inline-end: var(--s-3);
  inline-size: 26px;
  block-size: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--c-wash);
  color: var(--c-body);
  cursor: pointer;
}
.blg-search__clear[hidden] {
  display: none;
}
.blg-search__clear svg {
  inline-size: 14px;
  block-size: 14px;
}

.blg-sort {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.blg-sort__select {
  appearance: none;
  block-size: 44px;
  padding-inline: var(--s-4) calc(var(--s-4) + 18px);
  border: 1px solid var(--c-line);
  border-radius: var(--blg-radius);
  background: var(--c-surface);
  color: var(--c-ink);
  font: inherit;
  font-size: var(--t-sm);
  cursor: pointer;
}
.blg-sort__chev {
  position: absolute;
  inset-inline-end: var(--s-3);
  inline-size: 16px;
  block-size: 16px;
  color: var(--c-muted);
  pointer-events: none;
}

.blg--js .blg-bar__go {
  display: none;
}

.blg-count {
  margin-block: 0 var(--s-6);
  font-size: var(--t-sm);
  color: var(--c-muted);
}
.blg-count b {
  color: var(--c-ink);
  font-weight: 700;
}

/* ================================================================== grid */

.blg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-6);
}

.blg-card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--blg-radius);
  overflow: hidden;
  transition: border-color var(--dur-1, 0.15s), box-shadow var(--dur-1, 0.15s),
              transform var(--dur-1, 0.15s);
}
.blg-card:hover {
  border-color: var(--c-line-strong);
  box-shadow: var(--shadow-1);
  transform: translateY(-2px);
}

.blg-card__media {
  position: relative;
  display: block;
  aspect-ratio: 14 / 10;
  background: var(--c-wash);
  overflow: hidden;
  flex: none;
}
.blg-card__media img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-2, 0.3s) ease;
}
.blg-card:hover .blg-card__media img {
  transform: scale(1.04);
}
.blg-card__media.is-empty {
  display: grid;
  place-items: center;
  background: var(--blg-tint);
}
.blg-card__glyph {
  inline-size: 40px;
  block-size: 40px;
  color: var(--blg-accent);
  opacity: 0.4;
}

.blg-card__body {
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1;
}

.blg-card__name {
  font-size: var(--t-md);
  font-weight: 500;
  line-height: var(--lh-snug);
  margin: 0;

  /* Migrated titles run past 100 characters. Clamping is what keeps a row of
     three cards from being set by its longest headline. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blg-card__name a {
  color: var(--c-ink);
}
.blg-card__name a:hover {
  color: var(--blg-accent-deep);
  text-decoration: none;
}

.blg-card__sum {
  margin: 0;
  font-size: var(--t-sm);
  line-height: var(--lh-body);
  color: var(--c-muted);

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blg-card__meta {
  margin: auto 0 0;
  padding-block-start: var(--s-3);
  border-block-start: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--t-xs);
  color: var(--c-muted);
}

/* Views and date share the inline-start half; the read link holds the other.
   They wrap as a unit, so the link never ends up alone on a line above them. */
.blg-card__facts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  min-inline-size: 0;
}
.blg-card__metaitem {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  white-space: nowrap;
}
.blg-card__metaicon {
  inline-size: 13px;
  block-size: 13px;
  flex: none;
  color: var(--blg-accent);
  opacity: 0.75;
}

.blg-card__go {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--blg-accent-deep);
  font-weight: 500;
  white-space: nowrap;
}
.blg-card__go .arw {
  inline-size: 15px;
  block-size: 15px;
}

/* =========================================================== empty state */

.blg-empty {
  text-align: center;
  padding-block: var(--s-16);
}
.blg-empty[hidden] {
  display: none;
}
.blg-empty__glyph {
  inline-size: 40px;
  block-size: 40px;
  color: var(--c-line-strong);
}
.blg-empty__title {
  margin-block: var(--s-4) var(--s-2);
  font-size: var(--t-lg);
  color: var(--c-ink);
}
.blg-empty__text {
  margin: 0 0 var(--s-6);
  color: var(--c-muted);
}

/* ============================================================ responsive */

@media (max-width: 1040px) {
  .blg-hero__inner {
    grid-template-columns: 1fr;
    gap: var(--s-8);
  }
  /* The fanned collage needs width to read as a fan; stacked under the text it
     is just three overlapping rectangles. */
  .blg-hero__collage {
    display: none;
  }
  .blg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .blg-pick__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: none;
  }
  .blg-pick__card--hero {
    grid-column: auto;
    grid-row: auto;
  }
  .blg-pick__card--hero .blg-pick__media {
    aspect-ratio: 16 / 9;
    flex: none;
    min-block-size: 0;
  }
  .blg-pick__card--hero .blg-pick__body {
    flex: 1;
  }
  .blg-pick__card:not(.blg-pick__card--hero) .blg-pick__media {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 620px) {
  /* A 38% picture beside text is a stamp at this width — the small cards go
     vertical too, which makes all three picks the same shape. */
  .blg-pick__card:not(.blg-pick__card--hero) {
    flex-direction: column;
  }
  .blg-pick__card:not(.blg-pick__card--hero) .blg-pick__media {
    inline-size: 100%;
    max-inline-size: none;
    aspect-ratio: 14 / 9;
  }
}

@media (max-width: 820px) {
  .blg-pick__grid {
    grid-template-columns: 1fr;
  }
  .blg-hero__title {
    font-size: var(--t-xl);
  }
  .blg-hero__lede {
    font-size: var(--t-md);
  }
  .blg-bar {
    align-items: stretch;
  }
  .blg-bar__form {
    inline-size: 100%;
  }
  .blg-search {
    flex: 1 1 220px;
    min-inline-size: 0;
  }
}

@media (max-width: 560px) {
  .blg-grid {
    grid-template-columns: 1fr;
  }
  .blg-topics {
    /* Sticky under a sticky header stacks two bars on a short screen and the
       grid loses most of the viewport. */
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blg-card,
  .blg-pick__card,
  .blg-card__media img {
    transition: none;
  }
  .blg-card:hover,
  .blg-pick__card:hover {
    transform: none;
  }
  .blg-card:hover .blg-card__media img {
    transform: none;
  }
}

/* ---- justified body copy · centred blocks keep their centring ------------
   The `:where(p, blockquote, dd)` rule in hitco.css declares alignment ON the
   paragraph, and a direct declaration outranks the `text-align: center` these
   containers pass DOWN to it by inheritance. Re-inheriting restores them.
   Add a centred container that holds a paragraph and it belongs in this list. */
.blg-empty :where(p, blockquote, dd) {
  text-align: inherit;
}
