/* Blog: the index cards and the post page. Loaded after hm.css. Pages are built by tools/build_blog.py.

   The owner's brief for this layout: fixed sizes, centred and boxed, easy to read, short paragraphs, graphics.
   So sizes here are set outright instead of following the theme's sliding scale. There are three steps:
   desktop (default), tablet (991px and under) and phone (575px and under). The card grid also drops from
   three columns to two at 1199px.
   Colours, fonts and the 15px corner radius are the theme's. The logo blue is var(--theme). The light grey
   #F1F1F1 is the theme's own chip colour (.blog-details-info .meta). */

/* =====================================================================
   Cards: /web-design-blog/ and "More from the blog" under a post
   ===================================================================== */

/* Three columns, and every row the height of the tallest one, so all cards are the same size whatever the
   length of the title and excerpt and whether or not there is a picture. */
.blog-area .hm-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 24px;
}
.blog-area .hm-card-col {
  display: flex;
  min-width: 0;
}
/* A single card left over on the last row sits in the middle column. */
.blog-area .hm-card-col:last-child:nth-child(3n + 1) {
  grid-column: 2;
}
.blog-area .blog__item.hm-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background-color: var(--white);
  transition: border-color 0.3s;
}
.blog-area .blog__item.hm-card:hover {
  border-color: rgba(17, 17, 17, 0.35);
}

/* Picture: always a 16:9 box, whatever shape the file is. A card without a picture has no box at all. */
.blog-area .hm-card .thumb {
  aspect-ratio: 16 / 9;
  border-radius: 0;
  background-color: #F1F1F1;
}
.blog-area .hm-card .thumb a {
  display: block;
  height: 100%;
}
.blog-area .hm-card .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-area .hm-card .content-wrapper {
  display: flex;
  flex: 1;
}
.blog-area .hm-card .content {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 0;
  padding: 26px 26px 24px;
}
/* Category chip: the theme's meta chip from the post page. */
.blog-area .hm-card .hm-card__cat {
  align-self: flex-start;
  margin-bottom: 18px;
  padding: 10.5px 13px;
  border-radius: 500px;
  font-size: 14px;
  font-weight: 500;
  line-height: 14px;
  color: var(--primary);
  background-color: #F1F1F1;
}
.blog-area .hm-card .title {
  max-width: none;
  font-size: 24px;
  font-weight: 500;
  line-height: 30px;
  letter-spacing: -0.5px;
}
.blog-area .hm-card .excerpt {
  margin-top: 12px;
  font-size: 16px;
  line-height: 25px;
  color: var(--secondary);
}
/* The date sits on the bottom edge of every card, however long the title and excerpt are. */
.blog-area .hm-card .meta {
  margin-top: auto;
  padding-top: 20px;
}
.blog-area .hm-card .meta li {
  font-size: 14px;
  line-height: 20px;
  color: var(--secondary);
}
/* Text-only card (no picture yet): a blue rule on top, so the row of boxes still reads as finished. */
.blog-area .blog__item.hm-card--text,
.blog-area .blog__item.hm-card--text:hover {
  border-top: 4px solid var(--theme);
}

.blog-area .hm-blog-empty {
  font-size: 19px;
  line-height: 32px;
}

/* "More from the blog" under a post */
.blog-area.hm-more {
  padding: 80px 0 76px;
  border-top: 1px solid var(--border);
}
.blog-area.hm-more .section-title-wrapper {
  margin-bottom: 40px;
  text-align: center;
}
.blog-area.hm-more .section-title-wrapper .title-wrapper {
  margin-top: 0;
}
.blog-area.hm-more .section-title-wrapper .title-wrapper .section-title {
  font-size: 40px;
  font-weight: 400;
  line-height: 48px;
  letter-spacing: -1px;
}

/* =====================================================================
   Post page: one centred column
   ===================================================================== */

.blog-details.hm-post {
  padding-bottom: 90px;
}

/* ---- Category, date and title, centred above the column ---- */
.blog-details.hm-post .hm-post__head {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.blog-details.hm-post .blog-details-info .meta {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 26px;
}
.blog-details.hm-post .section-title-wrapper .section-title {
  display: block;
  font-size: 54px;
  font-weight: 400;
  line-height: 62px;
  letter-spacing: -1.5px;
}

/* ---- Featured image: a fixed 16:9 box, a little wider than the text ---- */
.blog-details.hm-post .hm-post__featured {
  max-width: 1100px;
  margin: 48px auto 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 15px;
  background-color: #F1F1F1;
}
.blog-details.hm-post .hm-post__featured img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- The reading column: 760px at most, on every screen ---- */
.blog-details__content.hm-post__body {
  max-width: 760px;
  margin: 52px auto 0;
  font-size: 19px;
  line-height: 32px;
  color: var(--secondary);
}
.blog-details__content.hm-post__body p {
  margin-bottom: 24px;
  font-size: 19px;
  line-height: 32px;
  color: var(--secondary);
}
.blog-details__content.hm-post__body strong {
  font-weight: 600;
  color: var(--primary);
}
.blog-details__content.hm-post__body a {
  color: var(--theme);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.blog-details__content.hm-post__body a:hover {
  color: var(--primary);
}

/* Headings sized for reading, well under the 54px page title. */
.blog-details__content.hm-post__body h2 {
  margin: 52px 0 16px;
  font-size: 30px;
  font-weight: 500;
  line-height: 38px;
  letter-spacing: -0.5px;
}
.blog-details__content.hm-post__body h3 {
  margin: 36px 0 12px;
  font-size: 23px;
  font-weight: 500;
  line-height: 31px;
}
/* A sub-heading straight under a section heading sits close to it. */
.blog-details__content.hm-post__body h2 + h3 {
  margin-top: 0;
}
.blog-details__content.hm-post__body > :first-child {
  margin-top: 0;
}
.blog-details__content.hm-post__body > :last-child {
  margin-bottom: 0;
}

/* Lists: the theme's .list, at the column's text size, with room for the markers. */
.blog-details .hm-post__body .list {
  margin: 0 0 24px;
  padding-left: 26px;
}
.blog-details .hm-post__body .list li {
  margin-bottom: 10px;
  padding-left: 4px;
  font-size: 19px;
  line-height: 32px;
  list-style: disc;
}
.blog-details .hm-post__body ol.list li {
  list-style: decimal;
}
.blog-details .hm-post__body .list li::marker {
  color: var(--theme);
  font-weight: 600;
}
.blog-details .hm-post__body .list li p {
  margin-bottom: 10px;
}
.blog-details .hm-post__body .list .list {
  margin: 10px 0 0;
}

/* Key point: a boxed quote. Grey panel, blue bar. */
.blog-details__content.hm-post__body blockquote {
  margin: 36px 0;
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--theme);
  border-radius: 15px;
  background-color: #F1F1F1;
  font-size: 21px;
  font-weight: 500;
  line-height: 32px;
  color: var(--primary);
}
.blog-details__content.hm-post__body blockquote p {
  margin-bottom: 12px;
  font-size: 21px;
  font-weight: 500;
  line-height: 32px;
  color: var(--primary);
}
.blog-details__content.hm-post__body blockquote > :last-child {
  margin-bottom: 0;
}

/* "What to do this week": the heading and its steps in one outlined box, each step with a numbered blue disc. */
.blog-details__content.hm-post__body .hm-post__todo {
  margin: 52px 0 36px;
  padding: 30px 32px 12px;
  border: 2px solid var(--primary);
  border-radius: 15px;
}
.blog-details__content.hm-post__body .hm-post__todo h2 {
  margin: 0 0 18px;
}
.blog-details .hm-post__body .hm-post__todo > ol.list {
  margin: 0;
  padding-left: 0;
  counter-reset: hm-step;
}
.blog-details .hm-post__body .hm-post__todo > ol.list > li {
  position: relative;
  margin: 0;
  padding: 16px 0 16px 54px;
  border-top: 1px solid var(--border);
  list-style: none;
  counter-increment: hm-step;
}
.blog-details .hm-post__body .hm-post__todo > ol.list > li::before {
  content: counter(hm-step);
  position: absolute;
  top: 15px;
  left: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 600;
  line-height: 36px;
  text-align: center;
  color: var(--white);
  background-color: var(--theme);
}

/* In-body graphics: a fixed 16:9 picture the width of the column, with an optional caption. */
.blog-details__content.hm-post__body .hm-figure {
  margin: 36px 0;
}
.blog-details__content.hm-post__body .hm-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 15px;
  background-color: #F1F1F1;
}
.blog-details__content.hm-post__body .hm-figure figcaption {
  margin-top: 12px;
  font-size: 15px;
  line-height: 22px;
  text-align: center;
  color: var(--secondary);
}

/* Tables: Bootstrap's .table in a rounded box. On a narrow screen the table keeps its width and scrolls sideways
   inside the box, so columns never squash into unreadable slivers. */
.blog-details__content.hm-post__body .table-responsive {
  margin: 32px 0;
  border: 1px solid var(--border);
  border-radius: 15px;
}
.blog-details__content.hm-post__body .table {
  min-width: 560px;
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  color: var(--secondary);
}
.blog-details__content.hm-post__body .table th,
.blog-details__content.hm-post__body .table td {
  padding: 13px 16px;
  vertical-align: top;
  border-color: var(--border);
  color: var(--secondary);
}
.blog-details__content.hm-post__body .table th {
  font-weight: 600;
  color: var(--primary);
}
.blog-details__content.hm-post__body .table thead th {
  background-color: #F1F1F1;
}
.blog-details__content.hm-post__body .table tbody tr:last-child > * {
  border-bottom: 0;
}

/* ---- Way back to the index, centred under the column ---- */
.blog-details.hm-post .hm-post__foot {
  max-width: 760px;
  margin: 48px auto 0;
  padding-top: 30px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* =====================================================================
   Tablet: 991px and under
   ===================================================================== */
/* Cards go to two columns under 1200px, where three would squeeze the titles. */
@media (max-width: 1199px) {
  .blog-area .hm-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-area .hm-card-col:last-child:nth-child(3n + 1) { grid-column: auto; }
}

@media (max-width: 991px) {
  .blog-details.hm-post .section-title-wrapper .section-title {
    font-size: 42px;
    line-height: 50px;
    letter-spacing: -1px;
  }
  .blog-details.hm-post .hm-post__featured { margin-top: 40px; }
  .blog-details__content.hm-post__body { margin-top: 44px; }
  .blog-area.hm-more { padding: 64px 0 60px; }
  .blog-area.hm-more .section-title-wrapper .title-wrapper .section-title {
    font-size: 34px;
    line-height: 42px;
  }
}

/* =====================================================================
   Phone: 575px and under
   ===================================================================== */
@media (max-width: 575px) {
  /* One card per row. Each is as tall as its own text; equal heights only matter side by side. */
  .blog-area .hm-card-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    gap: 16px;
  }
  .blog-area .hm-card .content { padding: 22px 20px 20px; }
  .blog-area .hm-card .title {
    font-size: 22px;
    line-height: 28px;
  }

  .blog-details.hm-post { padding-bottom: 64px; }
  .blog-details.hm-post .section-title-wrapper .section-title {
    font-size: 32px;
    line-height: 40px;
    letter-spacing: -0.5px;
  }
  .blog-details.hm-post .hm-post__featured { margin-top: 30px; }
  .blog-details__content.hm-post__body {
    margin-top: 34px;
    font-size: 18px;
    line-height: 30px;
  }
  .blog-details__content.hm-post__body p,
  .blog-details .hm-post__body .list li {
    font-size: 18px;
    line-height: 30px;
  }
  .blog-details__content.hm-post__body h2 {
    margin-top: 42px;
    font-size: 26px;
    line-height: 34px;
  }
  .blog-details__content.hm-post__body h3 {
    margin-top: 30px;
    font-size: 21px;
    line-height: 29px;
  }
  .blog-details__content.hm-post__body blockquote {
    padding: 20px 20px;
    font-size: 19px;
    line-height: 30px;
  }
  .blog-details__content.hm-post__body blockquote p {
    font-size: 19px;
    line-height: 30px;
  }
  .blog-details__content.hm-post__body .hm-post__todo {
    margin-top: 42px;
    padding: 24px 20px 8px;
  }
  .blog-details .hm-post__body .hm-post__todo > ol.list > li { padding-left: 48px; }
  .blog-details__content.hm-post__body .table { font-size: 15px; }
}
