/*=============================================
=            Blog Page Styles               =
=============================================*/

:root {
  --bg-debug: hsla(76, 100%, 47%, 0.1);
  --color-action: hsl(223, 100%, 40%);
  --color-action-hover: hsl(223, 100%, 28%);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/*----------  Outlined Buttons  ----------*/

.pill-outline {
  background: white;
  border-radius: 999px;
  border: 1px solid var(--color-action);
  color: var(--color-action);
  flex: 0 0 auto;
  font-size: 0.875rem;
  font-weight: 600;
  /* line-height: calc(1 / 14 * 16); */
  line-height: 1.1428571429;
  /* The Elza font in use has a base line-height issue */
  padding: 8px 16px 4px;
  /* Bottom padding reduced to match Elza */
  text-transform: capitalize;
  white-space: nowrap;

  scroll-snap-align: center;
  scroll-margin-left: 1.5rem;

  &:first-child {
    margin-left: 16px;
  }
  &:last-child {
    margin-right: 16px;
  }

  &.is-active,
  &.is-active:hover {
    background: var(--color-action);
    color: white;
    cursor: default;
  }
}

.regular-view .pill-outline:hover {
  background: var(--color-action-hover);
  color: white;
}
/*----------  BLOG  ----------*/

.blog {
  overflow-x: hidden;
  .content-body & {
    padding-top: 4.5rem;
  }
  h1 {
    font-size: 1.5rem;
    @media (min-width: 1024px) {
      font-size: 3rem;
    }
  }
  > div {
    p {
      @media (min-width: 1024px) {
        width: 70%;
      }
    }
  }
}

.blog-utilities {
  display: flex;
  flex-direction: column;
  margin-top: 72px;
  gap: 16px;
  @media (min-width: 1024px) {
    align-items: center;
    flex-direction: row;
  }
}
.blog-search {
  position: relative;
  width: 100%;

  @media (min-width: 1024px) {
    max-width: 492px;
  }

  input {
    @media (min-width: 1024px) {
      max-width: 492px;
    }
  }
  a {
    align-items: center;
    display: flex;
    height: 99%;
    justify-content: center;
    position: absolute;
    right: 0;
    text-transform: capitalize;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
  }
}

.blog-categories {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  overflow-x: auto;
  padding-block: 16px;

  scroll-snap-type: x mandatory;
  scroll-padding-left: 1.5rem;
  -webkit-overflow-scrolling: touch;
  gap: 16px;
  &::-webkit-scrollbar {
    display: none;
  }

  @media (min-width: 768px) {
    margin-left: auto;
    width: auto;
    padding: 0;
  }

  .pill-outline {
    &:last-child {
      margin-right: 16px;
    }
  }
}

.blog-posts {
  display: grid;
  grid-gap: 32px;
  margin-top: 48px;

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

  @media (min-width: 1024px) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .content-body &:not(footer) {
    padding-block: 2.5rem;
  }
  div:has(> &) {
    @media (min-width: 768px) {
      margin-block-start: 48px; 
    }
  }
}

.blog-post {
  color: black;
  display: flex;
  flex-direction: column;
  img {
    background-color: white;
    border-radius: 16px;
    aspect-ratio: 4/3;
    object-fit: cover;
    width: 100%;
  }
  div {
    align-items: center;
    background: white;
    border-radius: 16px;
    display: flex;
    margin-top: -32px;
    margin-inline: auto;
    position: relative;
    text-align: center;
    width: calc(100% - 69px);
  }
  h3 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0;
    width: 100%;
  }
  .excerpt {
    font-size: 1rem; 
    line-height: 1.5; 
    color: #666; 
    margin: 0; 
    text-align: center; 
    display: -webkit-box;             
    -webkit-box-orient: vertical;     
    overflow: hidden;                 
    text-overflow: ellipsis;          
    -webkit-line-clamp: 6;            
    line-clamp: 6;                   
    max-height: calc(1.5em * 6);      
  }

  /*----------  First Post  ----------*/

  @media (min-width: 768px) {
    &:first-child.hero-post {
      grid-column: 1/3;
      h3 {
        font-size: 1.5rem;
      }
    }
  }
  @media (min-width: 1024px) {
    &:first-child.hero-post {
      display: grid;
      grid-column: 1/4;
      grid-template-columns: repeat(5, minmax(0, 1fr));

      img,
      div {
        grid-row: 1/2;
      }

      img {
        grid-column: 1/4;
      }
      div {
        align-self: center;
        grid-column: 3/-1;
        height: auto;
        margin: 0;
        min-height: 50%;
        padding: 40px;
        width: auto;
        text-align: left;
      }
      h3 {
        font-size: 2rem;
      }
      h4 {
        font-size: 2rem;
      }
    }
  }
}

.blog-post-no-hero {
  color: black;
  display: flex;
  flex-direction: column;
  img {
    background-color: white;
    border-radius: 16px;
    aspect-ratio: 4/3;
    object-fit: cover;
    width: 100%;
  }
  div {
    align-items: center;
    background: white;
    border-radius: 16px;
    display: flex;
    margin-top: -32px;
    margin-inline: auto;
    padding: 24px;
    position: relative;
    text-align: center;
    width: calc(100% - 48px);

  }
  h3 {
    font-size: 1.25rem;
    line-height: 1.2;
    margin: 0;
    width: 100%;
  }
}

.blog-post.hero-post {
  width: 100%;
  margin: 0 auto
}

.embla__buttons .btn__prev.blog-mobile.disabled, .embla__buttons .btn__next.blog-mobile.disabled {
  border-color:grey;
  color:grey;
  background-color: white !important
}

.embla__buttons .btn__prev.blog-mobile{ 
  left: 0 !important
}

.embla__buttons .btn__next.blog-mobile{ 
  right: 0 !important
}

@media (max-width: 1023px) {
  .embla__buttons .btn__prev.blog-mobile, .embla__buttons .btn__next.blog-mobile{
    display: none;
  }
}

/*----------  Single Blog Post  ----------*/

.blog-article {
  .content-body & {
    padding-top: 1rem;
  }
  h1 {
    font-size: 1.5rem;
    @media (min-width: 1024px) {
      font-size: 3rem;
    }
  }
  .article-category {
    opacity: 0.7;
  }
  .prose {
    padding-top: 1.5rem;
    word-wrap: break-word;

    img {
      margin-inline: auto;
    }
  }

  footer {
    /* margin-block-end: 3em; */
    div {
      flex-direction: column;
      /* align-items: flex-start; */
    }
  }
}

.blog-article-tags {
  gap: 0.5em;
  align-items: center;
  margin-block: 3em;
  h6 {
    margin: 0 1em 0 0;
  }
}

.article-date {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-block: 3em;
  h6 {
    margin: 0 1em 0 0;
  }
}

.article-header-image img {
  width: 100%; /* Makes the image responsive */
  height: auto; /* Maintains the aspect ratio */
  display: block; /* Removes the bottom margin space */
  margin-bottom: 20px; /* Adds some space below the image */
}

@media (min-width: 768px) {
  .article-meta {
    display: flex;
    align-items: center;
  }
}

.blog-share {
  display: flex;
  gap: 4px;
  margin-block-start: 4px;

  @media (min-width: 768px) {
    margin-left: auto;
  }
  a {
    background: white;
    color: var(--color-action);
    border: 1px solid var(--color-action);
    border-radius: 4px;
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    &:hover {
      color: var(--color-action-hover);
    }
  }
}

.blog-posts .blog-post:not(:first-child) > div > h3 {
 padding: 8px;
}

.blog-posts .blog-post:not(:first-child) > .row > .excerpt {
  letter-spacing: 0.042px;
  width: 100%;
  padding: 4px 8px;
}

.blog-posts .blog-post:first-child > .row > .excerpt {
  width: 100%;
}

/*=====  End of Blog Page Styles     ======*/


.blog-utilities {
  display: flex;
  flex-wrap: wrap;
  overflow-wrap: break-word; 

}

.blog-search {
  flex: 1 1 100%;
}

.blog-categories {
  display: flex;
  flex-wrap: wrap;
}


.pill-outline:first-child {
  margin-left: 0; 
}

@media (max-width: 767px) {
  .blog-article article {
    text-align: center;
  }
  .blog-article ol,
  .blog-article ul {
    text-align: left; 
  }
}

@media (min-width: 768px) {
  .blog-share {
    justify-content: flex-end !important;
  }
}
