/* ==========================================================================
   Blog: overview (home.php) + category archives (category.php)
   Loaded only on is_home() / is_category() – see inc/blog.php
   ========================================================================== */

/* Header intro
   ========================================================================== */

.blog-header__intro {
  max-width: 56rem;
  margin-top: 1rem;
  font-size: 1.125rem;
  opacity: 0.85;
}

.blog-header__intro p:last-child {
  margin-bottom: 0;
}

/* Category chips
   ========================================================================== */

.blog-cats {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

.blog-cats__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.blog-cats__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.125rem;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 999px;
  color: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.blog-cats__link:hover {
  border-color: var(--wp--preset--color--link-hover, currentColor);
}

.blog-cats__link.is-active {
  border-color: var(--wp--preset--color--link);
  background-color: var(--wp--preset--color--link);
  color: #121421;
  font-weight: 700;
}

/* Sections
   ========================================================================== */

.blog-section {
  margin-bottom: 4rem;
}

.blog-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-bottom: 1.5rem;
}

.blog-section__title {
  margin: 0;
}

.blog-section__more {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* Featured post: wide format like the article header images (1440 x 680) */
.blog-section--featured .post[data-style="card-background"] {
  aspect-ratio: 1440 / 680;
  min-height: 0;
  box-sizing: border-box;
}

/* Small screens: the 1440/680 ratio is too low for title + excerpt */
@media (max-width: 767px) {
  .blog-section--featured .post[data-style="card-background"] {
    aspect-ratio: auto;
    min-height: 26rem;
  }
}

/* Featured image in colour (parent renders card-background images in grayscale) */
.blog-section--featured .post[data-style="card-background"] .card-box__image {
  filter: none !important;
}

.blog-section--featured .post__title {
  font-size: clamp(1.75rem, 1.2rem + 1.5vw, 2.25rem);
}

/* Card: title is the link, whole card clickable (link_type "title")
   ========================================================================== */

.post[data-link="title"] {
  position: relative;
}

.post[data-link="title"] .post__link {
  color: inherit;
  text-decoration: none;
}

.post[data-link="title"] .post__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}

.post[data-link="title"]:hover .post__link {
  color: var(--wp--preset--color--link-hover, inherit);
}

.post[data-link="title"] .post__link:focus,
.post[data-link="title"] .post__link:focus-visible {
  outline: none;
}

/* Focus ring only for keyboard users (no ring after a mouse click) */
.post[data-link="title"]:has(.post__link:focus-visible) {
  outline: 2px solid var(--wp--preset--color--link-hover, currentColor);
  outline-offset: 3px;
}

.post__more {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--wp--preset--color--link-hover, inherit);
}

/* Compact list ("Aus dem Unternehmen")
   ========================================================================== */

.posts--compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}

.posts--compact .post {
  display: flex;
  align-items: center;
  gap: 1.125rem;
  padding: 0.875rem;
}

.posts--compact .post__image {
  flex: 0 0 7rem;
  width: 7rem;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0.375rem;
}

.posts--compact .post__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.posts--compact .post__content {
  padding: 0;
}

.posts--compact .post__title {
  margin: 0.25rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.35;
}

/* CTA band
   ========================================================================== */

.blog-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 4rem;
  padding: 2.5rem;
  border-radius: 0.5rem;
  background-color: var(--wp--preset--color--link);
  color: #121421;
}

.blog-cta__text {
  flex: 1 1 32rem;
  min-width: 0;
}

.blog-cta__title {
  margin: 0 0 0.5rem;
  color: inherit;
}

.blog-cta__text p {
  margin: 0;
}

/* Empty category
   ========================================================================== */

.blog-empty {
  margin: 2.5rem 0 4rem;
  padding: 3rem 1.5rem;
  border: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 0.5rem;
  text-align: center;
}

.blog-empty__title {
  margin-top: 0;
}

/* Contrast fixes on dark image cards and the light CTA band */
.post[data-style="card-background"] .post__more,
.post[data-style="card-background"]:hover .post__link {
  color: #bee1f4;
}

.blog-cta .blog-cta__btn {
  border-color: #121421;
  background-color: #121421;
  color: #fff;
}

/* ==========================================================================
   Fixes after live check (expleto.de/blog/)
   ========================================================================== */

/* Header: less empty space between H1 and chips */
.page-header.blog-header {
  margin-bottom: 0;
  padding-bottom: 1.5rem;
}

.blog-header__trail a {
  color: inherit;
  text-decoration: none;
}

.blog-header__trail span {
  margin: 0 0.375rem;
  opacity: 0.6;
}

/* Chips: one scrollable row on small screens instead of 3 wrapped rows */
@media (max-width: 767px) {
  .blog-cats__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-right: calc(var(--container-padding, 1.5rem) * -1);
    padding-right: var(--container-padding, 1.5rem);
    scrollbar-width: none;
  }

  .blog-cats__list::-webkit-scrollbar {
    display: none;
  }

  .blog-cats__link {
    white-space: nowrap;
  }
}

/* Image cards (featured + success stories): gradient instead of a 90 % flat overlay,
   so the photo stays visible and the text stays readable */
.blog-hub .post[data-style="card-background"] .card-box__color {
  opacity: 1 !important;
  background: linear-gradient(to top, rgba(18, 20, 33, 0.96) 0%, rgba(18, 20, 33, 0.7) 40%, rgba(18, 20, 33, 0.1) 75%) !important;
}

/* Success stories: same height as the article cards */
.blog-section--projects .post[data-style="card-background"] {
  min-height: 22rem;
}

/* Excerpts: max. 3 lines, so cards in a row stay even */
.blog-hub .post[data-style="card-image"] .post__content__excerpt,
.blog-archive .post[data-style="card-image"] .post__content__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-section--featured .post__content__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 46rem;
}

/* Compact list: image left, text right (parent sets column + min-height via data-size) */
.blog-hub .posts--compact .post[data-style] {
  flex-direction: row;
  align-items: center;
  min-height: 0;
  height: auto;
}

.blog-hub .posts--compact .post[data-style] .post__image {
  position: relative;
  inset: auto;
  flex: 0 0 7rem;
  width: 7rem;
  height: auto;
}

.blog-hub .posts--compact .post[data-style] .post__content {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
  padding: 0;
}

.blog-hub .posts--compact .post__meta {
  margin: 0;
}

/* Parent sets a large top margin on .page-content */
.page-content.blog-hub,
.page-content.blog-archive {
  margin-top: 0;
  padding-top: 0;
}

/* Featured: text sits left, so darken from the left and keep the right side of the photo visible */
.blog-hub .blog-section--featured .post[data-style="card-background"] .card-box__color {
  background: linear-gradient(90deg, rgba(18, 20, 33, 0.96) 0%, rgba(18, 20, 33, 0.85) 35%, rgba(18, 20, 33, 0.2) 70%, rgba(18, 20, 33, 0.05) 100%) !important;
}

@media (max-width: 767px) {
  .blog-hub .blog-section--featured .post[data-style="card-background"] .card-box__color {
    background: linear-gradient(to top, rgba(18, 20, 33, 0.96) 0%, rgba(18, 20, 33, 0.8) 55%, rgba(18, 20, 33, 0.2) 100%) !important;
  }
}

/* More space between sections */
.blog-hub .blog-section,
.blog-hub .blog-cta {
  margin-bottom: 6rem;
}

.blog-hub .blog-section--featured {
  margin-bottom: 5rem;
}

@media (max-width: 767px) {
  .blog-hub .blog-section,
  .blog-hub .blog-cta,
  .blog-hub .blog-section--featured {
    margin-bottom: 4rem;
  }

  .blog-cta {
    padding: 2rem 1.5rem;
  }

  /* "Alle Fachartikel →" / "Alle Neuigkeiten →" / "Alle Referenzen →" below the posts */
  .blog-section {
    display: flex;
    flex-direction: column;
  }

  .blog-section__head {
    display: contents;
  }

  .blog-section__head > :not(.blog-section__more) {
    order: 0;
    margin-bottom: 1.5rem;
  }

  .blog-section > .posts {
    order: 1;
  }

  .blog-section__more {
    order: 2;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 1rem;
  }
}

/* Header: same width as the content, text left + search right (blog overview) */
.blog-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem 2.5rem;
}

.blog-header__text {
  flex: 1 1 36rem;
  min-width: 0;
}

.blog-header__text .page-header__title {
  max-width: 64rem;
}

.blog-search {
  display: flex;
  flex: 0 1 22rem;
  gap: 0.5rem;
}

.blog-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 0.875rem;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.9375rem;
}

.blog-search__input::placeholder {
  color: inherit;
  opacity: 0.6;
}

.blog-search__input:focus {
  border-color: var(--wp--preset--color--link);
  outline: none;
}

.blog-search__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--wp--preset--color--link);
  cursor: pointer;
}

.blog-search__btn:hover,
.blog-search__btn:focus-visible {
  border-color: var(--wp--preset--color--link);
}

@media (max-width: 767px) {
  .blog-search {
    flex-basis: 100%;
  }
}

/* Theme sets svg { fill: currentColor; stroke: none } – the search icon is a stroke icon */
.blog-search__btn svg {
  width: 18px;
  height: 18px;
}

.blog-search__btn svg,
.blog-search__btn svg * {
  fill: none !important;
  stroke: currentColor !important;
}

/* Grid gap: max. 24px (parent uses ~40px) */
.blog-hub .posts--grid,
.blog-archive .posts--grid {
  gap: 24px;
}

/* Rank Math breadcrumbs (blog, archives, singles) – see expleto_blog_breadcrumbs() */
.blog-breadcrumbs {
  margin-bottom: 1rem;
}

.blog-breadcrumbs .rank-math-breadcrumb p {
  margin: 0;
}

.blog-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.blog-breadcrumbs a:hover {
  color: var(--wp--preset--color--link);
}

.blog-breadcrumbs .separator {
  margin: 0 0.375rem;
  opacity: 0.6;
}
