/* UK blog, research, foundation and safeguarding pages, from includes/blog-uk.inc.
   Builds on css/subjects.css (the .sj tokens, hero, sections and closing panel).
   The old css/blog.css still loads but only styles its own class names. */

/* Post cards */
.bl-grid
{
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

/* Posts after the first few wait for "Show more". Only while scripts run, so
   without scripts every post shows. */
@media (scripting: enabled)
{
  .bl-card.is-later
  {
    display: none;
  }
}

.bl-card
{
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sj-line);
  border-radius: 18px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

.bl-card:hover
{
  border-color: #b9c9e2;
  box-shadow: var(--sj-shadow);
}

.bl-card__photo
{
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--sj-tint);
}

.bl-card__photo img
{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bl-card__body
{
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 18px 20px 20px;
}

.bl-tag
{
  color: var(--sj-blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.sj .bl-card h3
{
  margin-top: 6px;
  font-size: 19px;
  line-height: 1.3;
}

.sj .bl-card h3 a
{
  color: var(--sj-navy);
}

/* The whole card opens the post. */
.bl-card h3 a:after
{
  content: "";
  position: absolute;
  inset: 0;
}

.sj .bl-card:hover h3 a
{
  color: var(--sj-blue);
}

.bl-card__text
{
  margin-top: 8px;
  color: var(--sj-ink);
  font-size: 15px;
  line-height: 1.55;
}

.bl-meta
{
  display: flex;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 14px;
  color: var(--sj-slate);
  font-size: 14px;
}

.bl-meta > * + *:before
{
  content: "\00b7";
  margin: 0 8px;
  color: #9aa8bb;
}

.bl-morewrap
{
  margin-top: 28px;
  text-align: center;
}

.sj .bl-more
{
  display: inline-block;
  height: auto;
  margin: 0;
  padding: 13px 32px;
  border: 1px solid var(--sj-navy);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  color: var(--sj-navy);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  text-transform: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}

.sj .bl-more:hover, .sj .bl-more:focus
{
  border-color: var(--sj-blue);
  background: var(--sj-blue);
  color: #fff;
}

.sj .bl-more:focus-visible
{
  outline: 3px solid var(--sj-blue);
  outline-offset: 2px;
}

/* Month archive */
.bl-archive
{
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.bl-year
{
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.sj .bl-year h3
{
  flex: none;
  width: 48px;
  font-size: 17px;
}

.bl-year ul
{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sj .bl-year a
{
  display: inline-block;
  min-width: 50px;
  padding: 5px 11px;
  border: 1px solid var(--sj-line);
  border-radius: 999px;
  background: #fff;
  color: var(--sj-navy);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.sj .bl-year a:hover, .sj .bl-year a:focus
{
  border-color: var(--sj-blue);
  color: var(--sj-blue);
}

.sj .bl-year a[aria-current]
{
  border-color: var(--sj-blue);
  background: var(--sj-blue);
  color: #fff;
}

/* A post */
.bl-post__head
{
  padding: 26px 0 64px;
  background: var(--sj-tint);
}

.bl-post__intro
{
  max-width: 760px;
  margin: 0 auto;
}

.sj .bl-post h1
{
  margin-top: 8px;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.12;
  text-wrap: balance;
}

.bl-post__head .bl-meta
{
  margin-top: 16px;
  padding-top: 0;
  font-size: 15px;
}

.bl-post__photo
{
  max-width: 920px;
  margin: -40px auto 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: #dfe7f3;
  box-shadow: var(--sj-shadow);
}

/* The foundation photos are small originals (one is 400px wide), so their 1200px
   copies are enlarged: show them smaller to keep them sharp. */
.bl-post__photo--small
{
  max-width: 600px;
}

.bl-post__photo img
{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The post's own HTML, written over the years: paragraphs, h2/h3, lists, a few
   tables and floated images with inline sizes. */
.bl-body
{
  max-width: 720px;
  margin: 32px auto 0;
  padding-bottom: 48px;
  color: #263548;
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.bl-body:after
{
  content: "";
  display: block;
  clear: both;
}

.bl-body p
{
  margin: 0 0 1.15em;
}

.sj .bl-body h2
{
  margin: 1.6em 0 .55em;
  font-size: clamp(22px, 2vw, 27px);
  line-height: 1.25;
}

.sj .bl-body h3
{
  margin: 1.4em 0 .5em;
  font-size: 20px;
  line-height: 1.3;
}

.bl-body ul, .bl-body ol
{
  margin: 0 0 1.15em;
  padding-left: 1.4em;
}

.bl-body ul li
{
  list-style: disc;
}

.bl-body ol li
{
  list-style: decimal;
}

.bl-body li
{
  margin: 0 0 .4em;
  padding-left: .2em;
}

.sj .bl-body a
{
  color: var(--sj-blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.bl-body strong, .bl-body b
{
  color: var(--sj-navy);
  font-weight: 700;
}

.bl-body em, .bl-body i
{
  font-style: italic;
}

/* Inline sizes in the stored posts must not push past the column. */
.bl-body img
{
  max-width: 100% !important;
  height: auto !important;
  border-radius: 12px;
}

.bl-body table
{
  display: block;
  max-width: 100%;
  margin: 0 0 1.4em;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 16px;
}

.bl-body th, .bl-body td
{
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--sj-line);
  text-align: left;
  vertical-align: top;
}

.bl-body th
{
  color: var(--sj-navy);
  font-weight: 700;
}

.bl-body blockquote
{
  margin: 1.4em 0;
  padding: 2px 0 2px 20px;
  border-left: 4px solid var(--sj-lime);
  color: var(--sj-navy);
}

@media (max-width: 767px)
{
  .bl-body img
  {
    display: block;
    float: none !important;
    margin: 8px 0 20px !important;
  }
}

@media (min-width: 600px)
{
  .bl-grid
  {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bl-card--lead
  {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px)
{
  .bl-post__head
  {
    padding: 34px 0 104px;
  }

  .bl-post__photo
  {
    margin-top: -72px;
    border-radius: 20px;
  }

  .bl-body
  {
    margin-top: 44px;
    font-size: 18px;
  }

  .bl-body img[style*="float: right"], .bl-body img[style*="float:right"]
  {
    max-width: 46% !important;
    margin: 6px 0 18px 28px;
  }

  .bl-body img[style*="float: left"], .bl-body img[style*="float:left"]
  {
    max-width: 46% !important;
    margin: 6px 28px 18px 0;
  }

  .bl-archive
  {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 48px;
  }
}

@media (min-width: 992px)
{
  .bl-grid
  {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }

  .bl-card--lead
  {
    flex-direction: row;
  }

  .bl-card--lead .bl-card__photo
  {
    flex: 0 0 58%;
    min-height: 340px;
    aspect-ratio: auto;
  }

  .bl-card--lead .bl-card__body
  {
    justify-content: center;
    padding: 36px 40px;
  }

  .sj .bl-card--lead h3
  {
    font-size: 30px;
    line-height: 1.2;
  }

  .bl-card--lead .bl-card__text
  {
    margin-top: 12px;
    font-size: 17px;
  }

  .bl-card--lead .bl-meta
  {
    margin-top: 18px;
    padding-top: 0;
  }
}

/* Photos fade in once loaded, as on the subject pages (keyframes in subjects.css). */
@media (scripting: enabled)
{
  .bl-card__photo img, .bl-post__photo img
  {
    opacity: 0;
  }

  .bl-card__photo.is-in img, .bl-post__photo.is-in img
  {
    animation: sj-fade .7s ease-out both;
  }
}

@media (prefers-reduced-motion: no-preference)
{
  .bl-card:hover
  {
    transform: translateY(-2px);
  }

  .bl-card__photo img
  {
    transition: transform .6s cubic-bezier(.2, .7, .2, 1);
  }

  .bl-card:hover .bl-card__photo img
  {
    transform: scale(1.04);
  }
}

@media print
{
  .bl-post__photo, .bl-morewrap
  {
    display: none;
  }
}
