/*
 * A department's news list (templates/pages/departments/page-dept-news.php):
 * search, year and «Додати новину» in one row, then the news as rows — the
 * cover on the left, date, title and a few lines.
 * A list of rows rather than a grid of cards: a department's news is read
 * by date, and many items have no photo.
 */

.dept-news {
  --dn-field-h: 44px;
  /* The year's arrow is an image, which cannot follow a colour token: one per theme. */
  --dn-select-arrow: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23475569%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E');
}

html[data-theme="dark"] .dept-news {
  --dn-select-arrow: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23aaaaaa%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C%2Fpolyline%3E%3C%2Fsvg%3E');
}

.dept-news__header {
  margin-bottom: 24px;
}

/* ------------------------------------------------------------ controls */

.dept-news__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.dept-news__search {
  display: flex;
  flex: 1 1 360px;
  min-width: 0;
}

.dept-news__search input,
.dept-news__year select {
  height: var(--dn-field-h);
  box-sizing: border-box;
  border: 1px solid var(--color-border-strong);
  border-radius: 0;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  font: inherit;
  font-size: 16px;
}

.dept-news__search input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0 14px;
  border-right: 0;
  line-height: normal;
  appearance: none;
}

/* search.css gives every field on a desktop a bottom padding with !important,
   which put the text above the middle of this one. */
.dept-news__search input[type="search"] {
  padding: 0 14px !important;
}

.dept-news__search input::placeholder {
  color: var(--color-text-muted);
}

.dept-news__search-btn,
.dept-news__add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--dn-field-h);
  padding: 0 20px;
  box-sizing: border-box;
  border: 1px solid var(--color-blue-200);
  border-radius: 0;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.dept-news__search-btn {
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  background: var(--color-blue-200);
  color: var(--color-white);
}

.dept-news__search-btn:hover {
  background: var(--color-blue-100);
}

.dept-news__year select {
  min-width: 140px;
  padding: 0 36px 0 14px;
  appearance: none;
  background-image: var(--dn-select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

.dept-news__add {
  margin-left: auto;
  background: transparent;
  color: var(--color-link);
  border-color: var(--color-link);
}

.dept-news__add:hover {
  background: var(--color-link);
  color: var(--color-white);
}

/* ------------------------------------------------------------- results */

.dept-news__results {
  transition: opacity 0.2s ease;
}

.dept-news__results.is-loading {
  opacity: 0.45;
}

.dept-news__summary {
  margin: 0 0 4px;
  min-height: 1.4em;
  color: var(--color-text-muted);
  font-size: 15px;
}

.dept-news__summary a {
  margin-left: 8px;
  color: var(--color-link);
}

.dept-news__empty {
  padding: 40px 0;
  color: var(--color-text-secondary);
  font-size: 17px;
}

.dept-news__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-border);
}

.dept-news-item {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
}

.dept-news-item--text {
  grid-template-columns: minmax(0, 1fr);
}

.dept-news-item__media {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--color-bg-secondary);
}

.dept-news-item__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dept-news-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0 0 8px;
  color: var(--color-text-muted);
  font-size: 15px;
}

.dept-news-item__title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.3;
}

.dept-news-item__title a {
  color: var(--color-text-heading);
  text-decoration: none;
}

.dept-news-item__title a:hover {
  color: var(--color-link);
}

.dept-news-item__excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--color-text-secondary);
  font-size: 16px;
  line-height: 1.55;
}

/* --------------------------------------------------------------- phone */

@media (max-width: 900px) {
  .dept-news-item {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 20px;
  }

  .dept-news-item__title {
    font-size: 19px;
  }
}

@media (max-width: 600px) {
  .dept-news__controls {
    gap: 8px;
  }

  .dept-news__search {
    flex-basis: 100%;
  }

  .dept-news__search-btn,
  .dept-news__add {
    padding: 0 16px;
  }

  .dept-news__year {
    flex: 1 1 auto;
  }

  .dept-news__year select {
    width: 100%;
  }

  .dept-news-item {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 14px;
    padding: 16px 0;
  }

  .dept-news-item--text {
    grid-template-columns: minmax(0, 1fr);
  }

  .dept-news-item__media {
    aspect-ratio: 1;
  }

  .dept-news-item__meta {
    gap: 2px 10px;
    margin-bottom: 4px;
    font-size: 13px;
  }

  .dept-news-item__title {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
  }

  .dept-news-item__excerpt {
    display: none;
  }

  .dept-news-item--text .dept-news-item__excerpt {
    display: -webkit-box;
    margin-top: 6px;
    font-size: 15px;
    -webkit-line-clamp: 2;
  }
}
