/* Blog: post pages, /perspectives/ and the category and tag lists.
   Mobile first; the 1200px rules reproduce the measured desktop values (reference/DESIGN.md section 11). */

/* ---------- Shared bits ---------- */
.avatar {
  position: relative;
  flex: none;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 50%;
  background: #b5b5b5;
}
.avatar::before,
.avatar::after {
  position: absolute;
  left: 50%;
  background: #e9e9e9;
  content: "";
  transform: translateX(-50%);
}
.avatar::before { top: 7px; width: 12px; height: 12px; border-radius: 50%; }
.avatar::after { top: 20px; width: 22px; height: 20px; border-radius: 11px 11px 0 0; }

/* ---------- Post page ---------- */
.post-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 0 20px;
}
.post {
  padding: 0 20px;
  font-family: var(--font-avenir-light);
  font-weight: 300;
}
.post__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 21px;
  color: var(--teal);
}
.post__meta .avatar { margin-right: 12px; }
.post__date::before,
.post__read-time::before,
.blog-card__when span::before,
.recent-card__meta span::before {
  display: inline-block;
  width: 2px;
  height: 2px;
  margin: 0 7px 2px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  content: "";
}
.post__date::before, .post__read-time::before { margin: 0 7px 2px 9px; }
.post__title {
  margin: 18px 0 34px;
  font-family: var(--font-poppins);
  font-weight: 600;
  font-size: 30px;
  line-height: 40px;
  color: var(--teal);
  overflow-wrap: break-word;
}
.post__updated {
  margin: -16px 0 34px;
  font-size: 14px;
  line-height: 21px;
  color: var(--teal);
}

.post__body {
  --line: 27px;                      /* one empty line of the original text */
  font-size: 18px;
  line-height: var(--line);
  letter-spacing: 0.1px;             /* Nunito Sans runs narrower than the original Avenir Light */
  overflow-wrap: break-word;
}
.post__body > p:first-child { margin-top: -12px; }   /* a text start sits 12px closer to the title than a picture */
.post__body p { margin: 0 0 var(--line); }
.post__body p.tight { margin-bottom: 0; }
.post__body p.gap-2 { margin-bottom: calc(var(--line) * 2); }
.post__body p.gap-3 { margin-bottom: calc(var(--line) * 3); }
.post__body p.gap-4 { margin-bottom: calc(var(--line) * 4); }
.post__body p.gap-5 { margin-bottom: calc(var(--line) * 5); }
.post__body p.center { text-align: center; }
.post__body .muted { color: #717171; }
.post__body a { text-decoration: underline; }
.post__body strong { font-weight: 700; }
.post__body a:hover { color: var(--brown); }
.post__body ul { margin: 0 0 var(--line); padding-left: 1.5em; list-style: disc; }
.post__body li { margin: 0; }
.post-figure { margin: 0; }
.post-figure--gap { margin-bottom: var(--line); }
.post-figure--lead { margin-top: 47px; }
.post-figure--caption { margin-bottom: 13px; }
.post-figure--gap-2 { margin-bottom: calc(var(--line) * 2); }
.post-figure img { width: 100%; height: auto; object-fit: cover; }

.post__body > :last-child:not([class*="gap-"]) { margin-bottom: 0; }
.post__footer { margin-top: 40px; }
.post__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 23px;
}
.tag {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(72, 141, 149, 0.2);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 19.6px;
  color: var(--teal);
}
.tag:hover { color: var(--brown); }
.post__categories {
  margin: 0 0 24px 4px;
  font-size: 14px;
  line-height: 21px;
  color: var(--teal);
}
.post__categories a { text-decoration: underline; }
.post__categories a:hover { color: var(--brown); }
.post__share {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 66px;
  border-top: 1px solid rgba(72, 141, 149, 0.2);
}
.share-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--teal);
}
.share-btn:first-child { margin-left: -9px; }
.share-btn svg { width: 18px; height: 18px; fill: currentColor; }
.share-btn:hover { color: var(--brown); }

/* ---------- Recent posts ---------- */
.recent { padding: 36px 20px 0; }
.recent__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  font-family: var(--font-avenir-light);
  font-weight: 300;
  color: var(--teal);
}
.recent__title { font-size: 18px; font-weight: 300; line-height: 27px; }
.recent__all { font-size: 14px; line-height: 21px; }
.recent__all:hover { color: var(--brown); }
.recent__grid { display: grid; grid-template-columns: minmax(0, 291px); gap: 24px; }
.recent-card {
  height: 314px;
  border: 1px solid var(--card-border);
  background: var(--white);
}
.recent-card__link { display: flex; flex-direction: column; height: 100%; padding-bottom: 24px; }
.recent-card__image { width: 100%; height: 162px; object-fit: cover; }
.recent-card__title {
  margin: 24px 25px 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-family: var(--font-poppins);
  font-weight: 600;
  font-size: 18px;
  line-height: 27px;
  color: var(--teal);
}
.recent-card__link:hover .recent-card__title { color: var(--brown); }
.recent-card__meta {
  display: flex;
  align-items: center;
  height: 34px;
  margin: auto 25px 0;
  border-top: 1px solid rgba(72, 141, 149, 0.2);
  font-family: var(--font-avenir-light);
  font-weight: 300;
  font-size: 12px;
  color: var(--teal);
}
.recent-card__meta span:first-of-type::before { margin-left: 7px; }
.recent-card__meta span::before { margin: 0 7px 2px; }
.recent-card__meta time + span::before { margin: 0 7px 2px; }

@media (min-width: 760px) {
  .recent__grid { grid-template-columns: repeat(2, 291px); gap: 34px; }
}

@media (min-width: 1200px) {
  .post-page { padding: 100px 20px 20px; }
  .post {
    padding: 60px 99px 100px;
    border: 1px solid var(--card-border);
  }
  .post__title { font-size: 40px; line-height: 50px; }
  .post__footer { margin-top: 49px; }
  .post__tags { margin-bottom: 23px; }
  .recent { padding: 30px 0 0; }
  .recent__grid { grid-template-columns: repeat(3, minmax(0, 291px)); justify-content: space-between; gap: 0; }
}

/* ---------- Blog lists: shared ---------- */
.blog-list { padding: 0 0 40px; }
.blog-list__title {
  margin: 28px 0 20px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 27px;
  line-height: 37.8px;
  letter-spacing: 2.7px;
  text-align: center;
  color: var(--teal);
}

/* Category selector: an orange bar on small screens only, as the original shows it */
.blog-cats { position: relative; margin-bottom: 0; }
.blog-cats__summary {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 18px;
  background: #F1562A;
  font-size: 14px;
  color: var(--white);
  cursor: pointer;
  list-style: none;
}
.blog-cats__summary::-webkit-details-marker { display: none; }
.blog-cats__summary::after {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  content: "";
  transform: translateY(-2px) rotate(45deg);
}
.blog-cats__menu[open] .blog-cats__summary::after { transform: translateY(2px) rotate(-135deg); }
.blog-cats__list {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  padding: 8px 0;
  background: var(--white);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}
.blog-cats__list a { display: block; padding: 10px 18px; font-size: 15px; color: var(--teal); }
.blog-cats__list a:hover,
.blog-cats__list a[aria-current] { color: var(--brown); }

/* Card, small screens: image on top, details below (both list layouts) */
.blog-card { border-bottom: 0; background: var(--white); }
.blog-card__link { display: block; }
.blog-card__image { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.blog-card__body {
  display: flex;
  flex-direction: column;
  padding: 32px 18px 0;
  color: var(--teal);
}
.blog-card__body::after {
  height: 0;
  margin-top: 54px;
  border-top: 1px solid rgba(72, 141, 149, 0.25);
  content: "";
}
.blog-card__meta {
  display: grid;
  grid-template-columns: 32px auto;
  column-gap: 10px;
  align-items: center;
  font-size: 12px;
  line-height: 16px;
}
.blog-card__meta .avatar { grid-row: 1 / 3; }
.blog-card__when span::before { margin: 0 8px 2px; }
.blog-card__when time + span::before { margin: 0 8px 2px; }
.blog-card__title {
  margin-top: 20px;
  font-size: 22px;
  font-weight: 700;
  line-height: 30.8px;
}
.blog-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  margin-top: 11px;
  overflow: hidden;
  font-size: 14px;
  line-height: 21px;
}
.blog-card__link:hover .blog-card__title { color: var(--brown); }
.blog-list__grid > .blog-card + .blog-card { margin-top: 0; }

/* ---------- /perspectives/: overlay cards from 640px ---------- */
@media (min-width: 640px) {
  .blog-cats { display: none; }
  .blog-list__title { margin-top: 36px; font-size: 40px; line-height: 56px; letter-spacing: 4px; }
  .blog-list--overlay .blog-list__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 20px;
  }
  .blog-list--overlay .blog-card {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #222;
  }
  .blog-list--overlay .blog-card__link,
  .blog-list--overlay .blog-card__image { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
  .blog-list--overlay .blog-card__link::after {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    content: "";
  }
  .blog-list--overlay .blog-card__body {
    position: absolute;
    inset: 0;
    z-index: 1;
    padding: 29px 30px 60px;
    color: var(--white);
  }
  .blog-list--overlay .blog-card__body::after { display: none; }
  .blog-list--overlay .blog-card__meta { display: block; }
  .blog-list--overlay .blog-card__meta .avatar { display: none; }
  .blog-list--overlay .blog-card__author,
  .blog-list--overlay .blog-card__when { display: block; line-height: 17px; }
  .blog-list--overlay .blog-card__title {
    margin-top: auto;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.9);
    font-family: var(--font-poppins);
    font-weight: 600;
    font-size: 26px;
    line-height: 39px;
    color: var(--white);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.25);
  }
  .blog-list--overlay .blog-card__excerpt { display: none; }
  .blog-list--overlay .blog-card__link:hover .blog-card__title { color: var(--white); }
}
@media (min-width: 960px) {
  .blog-list--overlay .blog-list__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .blog-list { padding-bottom: 40px; }
  .blog-list__title { margin: 28px 0 5px; font-size: 55px; line-height: 77px; letter-spacing: 5.5px; }
  /* The original shows two rows of cards: six posts here, so the seventh (the oldest) is not listed. */
  .blog-list--overlay { min-height: 1521px; }
  .blog-list--overlay .blog-card:nth-child(n + 7) { display: none; }
}
@media (min-width: 1600px) {
  .blog-list--overlay { min-height: 0; padding-bottom: 41px; }
  .blog-list--overlay .blog-list__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .blog-list--overlay .blog-card:nth-child(n + 7) { display: block; }
}

/* ---------- Category and tag pages: wide cards with excerpts ---------- */
@media (min-width: 800px) {
  .blog-list--wide .blog-list__grid { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
  .blog-list--wide .blog-card {
    margin-bottom: 32px;
    border: 1px solid var(--card-border);
  }
  .blog-list--wide .blog-card__link {
    display: grid;
    grid-template-columns: 48.5% 1fr;
    height: 386px;
  }
  .blog-list--wide .blog-card__image { width: 100%; height: 100%; aspect-ratio: auto; }
  .blog-list--wide .blog-card__body { padding: 26px 36px 58px; }
  .blog-list--wide .blog-card__body::after { margin-top: auto; }
  .blog-list--wide .blog-card__title { margin-top: 14px; font-size: 28px; line-height: 36px; }
  .blog-list--wide .blog-card__excerpt { margin-top: 12px; font-size: 16px; line-height: 24px; }
}
@media (min-width: 1200px) {
  .blog-list--wide { min-height: 726px; }
  .blog-list--wide .blog-list__grid { padding: 0; }
}

/* Small screens: the overlay list and the wide list use the same stacked cards. */
@media (max-width: 639px) {
  .blog-card__meta { font-size: 13px; line-height: 18px; }
  .blog-card__title { font-size: 26px; line-height: 36px; }
  .blog-card__excerpt { font-size: 16px; line-height: 24px; }
  .blog-cats__summary { font-size: 16px; }
  .blog-list--overlay .blog-card__title { font-family: var(--font-poppins); font-weight: 600; font-size: 26px; line-height: 38px; }
  .blog-list--overlay .blog-card__excerpt { font-size: 16px; line-height: 24px; }
}
