/* =============================================================================
 * Homepage component: News list grid (.kunst-news-list-container, .kunst-list-*, .kunst-sub-title)
 * Split from homepage.css (Issue #5). Homepage-only; enqueued after km-global.
 * ========================================================================== */

/* -----------------------------------------
   8. News list grid (kunst-news-list-container)
   ----------------------------------------- */
.kunst-news-list-container {
  --kunst-accent: #9a1815;
  --kunst-lines: #e0e0e0;
  padding-top: 30px;
  margin-bottom: 40px;
  clear: both;
  width: 100%;
}
/* Hide duplicate widget title */
.kunst-news-list-container .mh-widget-title {
  display: none;
}
.kunst-list-wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.kunst-list-item {
  background: transparent;
  border: none;
  position: relative;
  margin-bottom: 30px;
  padding-top: 5px;
  padding-left: 25px;
  padding-right: 25px;
  min-height: 120px;
  box-sizing: border-box;
  min-width: 0; /* grid item must be allowed to shrink, else long titles overflow the divider */
  overflow-wrap: break-word;
}
/* Edge alignment */
.kunst-list-item:nth-child(3n+1) {
  padding-left: 0;
  padding-right: 25px;
}
.kunst-list-item:nth-child(3n) {
  padding-left: 25px;
  padding-right: 0;
}
/* Horizontal divider (first row) */
.kunst-list-item:nth-child(-n+3) {
  border-bottom: 1px solid var(--kunst-lines);
  padding-bottom: 25px;
  margin-bottom: 25px;
}
/* Vertical dividers */
.kunst-list-item:not(:nth-child(3n))::after {
  content: "";
  position: absolute;
  right: 0;
  width: 1px;
  background-color: var(--kunst-lines);
}
/* Top row: line from top to near horizontal divider */
.kunst-list-item:nth-child(-n+3):not(:nth-child(3n))::after {
  top: 0;
  bottom: 12px;
}
/* Bottom row: line starts after horizontal divider */
.kunst-list-item:nth-child(n+4):not(:nth-child(3n))::after {
  top: -13px;
  bottom: 0;
}
a.kunst-list-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  overflow-wrap: break-word;
}
.kunst-sub-title {
  display: block;
  min-height: 18px;
  height: 18px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--kunst-accent);
  line-height: 18px;
  visibility: visible;
}
.kunst-sub-title:empty {
  visibility: hidden;
}
.kunst-list-title {
  font-size: 17px;
  line-height: 1.4;
  font-weight: 700;
  margin: 0;
  color: #000;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kunst-list-title:hover {
  color: var(--kunst-accent);
}


/* Tablet (incl. iPad, 601–1024px): 2 columns — the 3-column divider grid is too
   cramped here. The 3-column nth-child(3n)/(-n+3) edge + divider rules are
   neutralised; rows are separated by a bottom border, no vertical grid lines.
   Phones (<=600px) drop to a single column below. */
@media screen and (min-width: 601px) and (max-width: 1024px) {
  .kunst-list-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }
  .kunst-list-item,
  .kunst-list-item:nth-child(3n+1),
  .kunst-list-item:nth-child(3n) {
    padding: 0 25px 20px 25px;
    margin-bottom: 20px;
    min-height: auto;
    border-bottom: 1px solid var(--kunst-lines);
  }
  .kunst-list-item:nth-child(-n+3) {
    padding-bottom: 20px;
    margin-bottom: 20px;
  }
  .kunst-list-item:nth-child(odd) {
    padding-left: 0;
  }
  .kunst-list-item:nth-child(even) {
    padding-right: 0;
  }
  .kunst-list-item::after {
    display: none;
  }
}

@media screen and (max-width: 600px) {
  .kunst-list-wrapper {
    grid-template-columns: 1fr;
  }
  .kunst-news-list-container {
    padding-top: 20px;
  }
  .kunst-list-item,
  .kunst-list-item:nth-child(3n+1),
  .kunst-list-item:nth-child(3n) {
    border-bottom: 1px solid var(--kunst-lines);
    margin-bottom: 20px;
    padding-bottom: 20px;
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    min-height: auto;
  }
  .kunst-list-item:last-child {
    border-bottom: none;
  }
  .kunst-list-item::after {
    display: none;
  }
  .kunst-sub-title {
    min-height: auto;
    height: auto;
  }
}
