/*
 * News Reports and Press Releases listings (template-parts/listing-page.php) — search form, results toolbar,
 * Load More and pager. Loads after dist/news-report.css and dist/search-sidebar.css.
 */

.listing-page {
  --nr-navy: #003062;
  --nr-orange: #f36f21;
  --nr-border: #ccc;
  --nr-muted: #5f6368;
  --nr-panel: #f3f4f6;
}

/* Search form */

.news-report-filters label {
  display: block;
}

.news-report-filters__search-box {
  position: relative;
}

.news-report-filters__search-box svg {
  position: absolute;
  top: 50%;
  left: 0.7rem;
  transform: translateY(-50%);
  color: var(--nr-navy);
  pointer-events: none;
}

.search-sidebar .news-report-filters__search-box input[type="search"] {
  min-height: 2.75rem;
  padding: 0.55rem 0.65rem 0.55rem 2.2rem;
}

.news-report-filters__hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--nr-muted);
}

.news-report-filters__field {
  margin: 1.5rem 0 0;
}

.news-report-filters__field select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 2.85rem 0.55rem 0.65rem;
  border: 1px solid var(--nr-border);
  font-size: 1rem;
  line-height: 1.35;
  box-sizing: border-box;
  color: inherit;
  cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23003062' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 0.7rem center / 1.25rem;
  appearance: none;
}

.news-report-filters__range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.news-report-filters__range[hidden] {
  display: none;
}

.news-report-filters__range input {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--nr-border);
  box-sizing: border-box;
  font-size: 0.9rem;
  background: #fff;
}

.news-report-filters__reset,
.news-report__link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--nr-navy);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.news-report-filters__reset {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

/* Without JS the form submits normally (GET) */
.news-report-filters__submit {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.5rem;
  border: none;
  background-color: var(--nr-navy);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.news-report-filters__reset:hover,
.news-report__link-button:hover {
  color: var(--nr-orange);
}

/* Mobile-only "Filters" toggle */
.news-report-filters__toggle {
  display: none;
}

.news-report-filters__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.4rem;
  border-radius: 999px;
  background: var(--nr-orange);
  color: #fff;
  font-size: 0.75rem;
}

.news-report-filters__count[hidden] {
  display: none;
}

/* Results toolbar: count + active filter chips */

.news-report__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.news-report__status {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--nr-navy);
}

.news-report__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.news-report__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--nr-navy);
  border-radius: 999px;
  background: #fff;
  color: var(--nr-navy);
  font: inherit;
  cursor: pointer;
}

.news-report__chip span {
  font-size: 1rem;
  line-height: 1;
}

.news-report__chip:hover {
  background: var(--nr-navy);
  color: #fff;
}

/* Results list */

.news-report__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-report__list .news-report__item {
  border-bottom: 1px solid #e5e7eb;
}

.news-report__item-title {
  margin: 0.25rem 0 0;
  font-size: inherit;
  line-height: 1.35;
}

.news-report__item-meta {
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.news-report__item-also {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--nr-muted);
}

.news-report__item-also a {
  color: var(--nr-orange);
}

.news-report__item-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.news-report__item-categories a {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: #fdeee5;
  color: #b4490f;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.news-report__item-categories a:hover {
  background: var(--nr-orange);
  color: #fff;
}

.news-report__list mark {
  padding: 0 0.1em;
  background: #fde3d3;
  color: inherit;
}

/* Loading placeholders */

.news-report__skeleton {
  display: grid;
  gap: 0.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.news-report__skeleton span {
  height: 0.8rem;
  border-radius: 4px;
  background: linear-gradient(90deg, #eceef1 25%, #f6f7f9 50%, #eceef1 75%) 0 0 / 200% 100%;
  animation: news-report-shimmer 1.2s linear infinite;
}

.news-report__skeleton span:nth-child(1) { width: 30%; }
.news-report__skeleton span:nth-child(2) { width: 85%; height: 1.1rem; }
.news-report__skeleton span:nth-child(3) { width: 55%; }

@keyframes news-report-shimmer {
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .news-report__skeleton span {
    animation: none;
  }
}

/* Load more */

.news-report__more {
  margin-top: 2rem;
  text-align: center;
}

.listing-page #load-more-button {
  margin-top: 0;
}

.listing-page #load-more-button[hidden],
.listing-page:not(.has-js) #load-more-button {
  display: none;
}

.listing-page #load-more-button:disabled {
  background-color: #5a6f8c;
  cursor: progress;
}

.news-report__more-count {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--nr-muted);
}

.news-report__more-error {
  margin: 0 0 0.75rem;
  color: #b91c1c;
}

/* Newer / older pages (/news-reports/page/N/) — for crawlers and no-JS; Load More replaces "Older" with JS */

.news-report__pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.news-report__pager[hidden] {
  display: none;
}

.news-report__pager a {
  color: var(--nr-navy);
  font-weight: 600;
  text-decoration: none;
}

.news-report__pager a:hover {
  color: var(--nr-orange);
}

.news-report__pager-older {
  margin-left: auto;
}

.news-report__pager-label {
  color: var(--nr-muted);
}

.listing-page.has-js .news-report__pager-older,
.listing-page.has-js .news-report__pager-label {
  display: none;
}

/* Media contacts: compact rows (photo + name + role), so filters and contacts fit the sticky sidebar together */

.media-contacts {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
}

.media-contacts__title {
  margin: 0 0 0.6rem;
  color: var(--nr-navy);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3; /* the theme's h2 line-height is 42px */
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Tighter than search-sidebar.css (2rem) so filters + contacts fit a 768px-tall screen while sticky */
.listing-page .search-sidebar {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.media-contacts__list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Head of Corporate Communications, then Media Contacts, split by a divider */
.media-contacts__group + .media-contacts__group {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #e5e7eb;
}

.media-contacts__person {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.media-contacts__photo {
  flex: none;
  box-sizing: border-box; /* border inside the 48px, so the layout doesn't shift */
  width: 48px;
  height: 48px;
  border: 1px solid rgba(0, 48, 98, 0.12); /* faint navy ring: white-background photos keep their edge */
  border-radius: 50%;
  object-fit: cover;
  object-position: center 30%; /* favour faces if a photo isn't square */
  background: var(--nr-panel);
}

.media-contacts__name {
  color: var(--nr-navy);
  font-weight: 600;
  line-height: 1.3;
}

.media-contacts__email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  color: var(--nr-orange);
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.media-contacts__email:hover {
  text-decoration: underline;
}

/* Focus */

.listing-page :is(a, button, input, select):focus-visible {
  outline: 2px solid var(--nr-orange);
  outline-offset: 2px;
}

/* Mobile: search first, filters collapsed, results next, media contacts last */

@media (max-width: 767.98px) {
  .listing-page .news-report__layout-aside,
  .listing-page .news-report__sticky {
    display: contents;
  }

  .listing-page .news-report-filters { order: 1; }
  .listing-page .news-report__layout-main { order: 2; }
  .listing-page .media-contacts { order: 3; }

  .listing-page .search-sidebar {
    padding: 1rem;
  }

  .news-report-filters__toggle {
    display: inline-flex;
    align-items: center;
    margin-top: 0.75rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--nr-navy);
    background: #fff;
    color: var(--nr-navy);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
  }

  .news-report-filters:not(.is-open) .news-report-filters__panel {
    display: none;
  }

  .news-report__layout-main .title {
    margin-top: 0.5rem;
  }
}
