/*
 * Blog styles — listing, category archives, single posts.
 * Auto-enqueued by infinity_scripts() (any .css in /deft is picked up).
 */

/* ---------------------------------------------------------------------------
 * Banner alignment fix.
 *
 * main.css full-bleeds .big-title with `margin: 0 -100%` above 75rem, which
 * relies on the inner .container being the same width as .site-content
 * (73.125rem). deft_styles.css widens every .container to 83.125rem, so inside
 * the bleed the container no longer centres on the content column and the
 * heading is clipped off the left edge of the viewport.
 *
 * Restore the original width for this one context only. Below 75rem the bleed
 * rule doesn't apply and alignment is already correct, so the fix is scoped to
 * that breakpoint. Also repairs /contact-us/ and /fullerprojects/, which hit
 * the same bug.
 * ------------------------------------------------------------------------ */
@media only screen and (min-width: 75rem) {
   .big-title > .container,
   .big-title--single > .container {
      max-width: 73.125rem;
   }
}

/* --- Blog banner ---------------------------------------------------------- */
.deft-blog-banner {
   background-size: cover;
   background-position: center;
   background-repeat: no-repeat;
   position: relative;
   display: flex;
   align-items: center;
   min-height: 260px;
   padding: 50px 0;
   @media only screen and (max-width: 1024px) {
      min-height: 210px;
      padding: 40px 0;
   }
   @media only screen and (max-width: 767px) {
      min-height: 160px;
      padding: 32px 0;
   }
   &:before {
      content: "";
      position: absolute;
      inset: 0;
      background-color: rgba(0, 0, 0, 0.65);
   }
   .container {
      position: relative;
      z-index: 1;
      /* As a flex item this would otherwise shrink to its content width and
         stop lining up with the post list below. */
      width: 100%;
   }
   .entry-title {
      color: white;
      margin: 0;
      padding: 0;
   }
   .deft-blog-banner__intro {
      color: white;
      max-width: 650px;
      margin: 12px 0 0;
      font-size: 18px;
      @media only screen and (max-width: 1024px) {
         font-size: 16.2px; /* 90% of 18px */
      }
      @media only screen and (max-width: 767px) {
         font-size: 14.4px; /* 80% of 18px */
      }
      p {
         margin: 0;
      }
   }
}

/*
 * Kirki prints `.big-title .entry-title { font-size: 25px }` in an inline
 * <style> block in wp_head — after this file — so an equal-specificity rule
 * loses on source order. The leading `body` outweighs it.
 */
body .deft-blog-banner .entry-title {
   font-size: 40px;
   line-height: 1.15;
   @media only screen and (max-width: 1024px) {
      font-size: 36px; /* 90% of 40px */
   }
   @media only screen and (max-width: 767px) {
      font-size: 32px; /* 80% of 40px */
   }
}

/* Single posts use the flat dark banner rather than an image. */
.single-post .big-title--single {
   min-height: 0;
   padding: 30px 0;
   .entry-title {
      /* main.css hangs 80px of padding off .entry-title for the tall image
         banners; this one is a slim bar, so drop it. */
      display: block;
      padding: 0;
      margin: 0;
      font-size: 22px;
      line-height: 1.2;
      font-weight: 700;
      @media only screen and (max-width: 767px) {
         font-size: 18px;
      }
   }
}

/* --- Shared meta line ----------------------------------------------------- */
.deft-meta {
   display: flex;
   flex-wrap: wrap;
   align-items: center;
   gap: 8px 18px;
   font-size: 14px;
   color: #6b6b6b;
   margin: 0 0 10px;
   a {
      color: #6b6b6b;
      text-decoration: none;
      &:hover {
         color: #111111;
         text-decoration: underline;
      }
   }
   .deft-meta__cat a {
      color: #111111;
      font-weight: 700;
   }
   i {
      margin-right: 6px;
   }
}

/* --- Listing (blog + category archives) ----------------------------------- */
.deft-blog-list {
   display: flex;
   flex-direction: column;
   gap: 40px;
   margin: 0 0 50px;
   @media only screen and (max-width: 767px) {
      gap: 30px;
   }
}

.deft-post-card {
   display: grid;
   grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
   gap: 30px;
   align-items: center;
   padding-bottom: 40px;
   border-bottom: 1px solid #e4e4e4;
   @media only screen and (max-width: 767px) {
      grid-template-columns: minmax(0, 1fr);
      gap: 16px;
      padding-bottom: 30px;
   }
   &:last-child {
      border-bottom: 0;
      padding-bottom: 0;
   }
   /* No featured image — let the text use the full width. */
   &.deft-post-card--no-media {
      grid-template-columns: minmax(0, 1fr);
   }
}

.deft-post-card__media {
   display: block;
   overflow: hidden;
   border-radius: 4px;
   img {
      display: block;
      width: 100%;
      height: 100%;
      aspect-ratio: 3 / 2;
      object-fit: cover;
      transition: transform 0.4s ease;
   }
   &:hover img {
      transform: scale(1.04);
   }
}

.deft-post-card__body {
   display: flex;
   flex-direction: column;
   align-items: start;
   gap: 10px;
}

.deft-post-card__title {
   margin: 0;
   font-size: 26px;
   line-height: 1.3;
   text-wrap-style: pretty;
   @media only screen and (max-width: 1024px) {
      font-size: 23.4px; /* 90% of 26px */
   }
   @media only screen and (max-width: 767px) {
      font-size: 20.8px; /* 80% of 26px */
   }
   a {
      color: #111111;
      text-decoration: none;
      &:hover {
         color: #b9970a;
      }
   }
}

.deft-post-card__excerpt {
   margin: 0;
   color: #4a4a4a;
   font-size: 17px;
   line-height: 1.6;
   @media only screen and (max-width: 1024px) {
      font-size: 16.2px; /* 90% of 18px */
   }
   @media only screen and (max-width: 767px) {
      font-size: 14.4px; /* 80% of 18px */
   }
}

/* --- Single post ---------------------------------------------------------- */
.single-post .content > article {
   max-width: 820px;
   margin: 0 auto;
}

.deft-single__title {
   margin: 0 0 14px;
   font-size: 43px;
   line-height: 1.2;
   color: #111111;
   text-wrap-style: pretty;
   @media only screen and (max-width: 1024px) {
      font-size: 38.7px; /* 90% of 43px */
   }
   @media only screen and (max-width: 767px) {
      font-size: 33.6px; /* 80% of 43px */
   }
}

.deft-single__media {
   margin: 0 0 30px;
   img {
      display: block;
      width: 100%;
      height: auto;
      border-radius: 4px;
   }
}

.single-post .entry-content {
   font-size: 18px;
   line-height: 1.7;
   color: #333333;
   @media only screen and (max-width: 1024px) {
      font-size: 16.2px; /* 90% of 18px */
   }
   @media only screen and (max-width: 767px) {
      /* Deliberately not the house 80% step (14.4px). This is long-form article
         body copy, and 16px is the practical floor for comfortable reading on a
         phone. Change to 14.4px if strict convention is preferred. */
      font-size: 16px;
   }
   p,
   ul,
   ol {
      margin: 0 0 22px;
   }
   h2 {
      margin: 40px 0 14px;
      font-size: 30px;
      line-height: 1.3;
      color: #111111;
      text-wrap-style: pretty;
      @media only screen and (max-width: 767px) {
         font-size: 24px;
      }
   }
   h3 {
      margin: 30px 0 12px;
      font-size: 22px;
      color: #111111;
   }
   ul,
   ol {
      padding-left: 22px;
   }
   li {
      margin-bottom: 8px;
   }
   a {
      color: #b9970a;
      text-decoration: underline;
      &:hover {
         color: #111111;
      }
   }
   strong {
      color: #111111;
   }
   blockquote {
      margin: 30px 0;
      padding: 4px 0 4px 22px;
      border-left: 4px solid #fbd232;
      font-style: italic;
      color: #444444;
   }
   img {
      max-width: 100%;
      height: auto;
   }
}

/* --- Share buttons -------------------------------------------------------- */
.post-share-buttons {
   display: flex;
   align-items: center;
   gap: 10px;
   a {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background-color: #f0f0f0;
      color: #111111;
      text-decoration: none;
      transition: background-color 0.2s ease, color 0.2s ease;
      &:hover {
         background-color: #fbd232;
         color: #111111;
      }
   }
   svg {
      width: 16px;
      height: 16px;
      fill: currentColor;
   }
}

.single-post .entry-footer {
   max-width: 820px;
   margin: 0 auto;
   padding: 24px 0 10px;
   border-top: 1px solid #e4e4e4;
}

/* --- Pagination ----------------------------------------------------------- */
.paging-navigation {
   margin: 10px 0 60px;
   .page-numbers {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 40px;
      height: 40px;
      padding: 0 12px;
      margin-right: 6px;
      border-radius: 3px;
      background-color: #f0f0f0;
      color: #111111;
      text-decoration: none;
      font-weight: 700;
      &:hover {
         background-color: #fbd232;
      }
      &.current {
         background-color: #111111;
         color: white;
      }
   }
}

/* --- Empty state ---------------------------------------------------------- */
.deft-no-posts {
   padding: 40px 0 70px;
   max-width: 650px;
   h2 {
      margin: 0 0 10px;
      color: #111111;
   }
   p {
      color: #4a4a4a;
   }
}
