/* ==========================================================================
   News archive — block (Query Loop) implementation of the "News.dc.html"
   design (Claude Design project 66a781bc). Covers /news/ (blog home),
   category archives and search results, which share one synced pattern.

   Values come from the South Lytchett Manor design-system tokens:
   gold #BA9804 / #9A7D03 · forest green #537253 · wash #F1F4ED ·
   ink #1c1b1f · muted #5E636B · hairlines #ECECED / #D6D6D7 ·
   radii 12 / 16 / pill · container 1280 with 56px gutters.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600&family=Lato:wght@400;600;700&display=swap');

.slm-news-intro,
.slm-news-toolbar-wrap,
.slm-news-query {
  --slm-gold: #BA9804;
  --slm-gold-dark: #9A7D03;
  --slm-gold-wash: #FAF3DA;
  --slm-green: #537253;
  --slm-wash: #F1F4ED;
  --slm-ink: #1c1b1f;
  --slm-body: #3D434D;
  --slm-muted: #5E636B;
  --slm-light: #8E9298;
  --slm-line: #D6D6D7;
  --slm-line-soft: #ECECED;
  --slm-container: 1280px;
  --slm-gutter: 56px;

  font-family: 'Lato', sans-serif;
  color: var(--slm-body);
}

/* Shared width wrapper */
.slm-news-wrap {
  max-width: var(--slm-container);
  margin: 0 auto;
  padding-left: var(--slm-gutter);
  padding-right: var(--slm-gutter);
}

/* ---- Intro band ---------------------------------------------------------- */
.slm-news-intro {
  background: var(--slm-wash);
}
/* Top-level blocks pick up WordPress's global block gap; the band sits flush. */
.wp-site-blocks > .slm-news-intro {
  margin-top: 0;
}
.slm-news-intro .slm-news-wrap {
  padding-top: 52px;
  padding-bottom: 52px;
}
.slm-eyebrow {
  margin: 0;
  font: 700 14px/1.2 'Lato', sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--slm-gold-dark);
}
.slm-news-h1 {
  margin: 12px 0 0;
  font-family: 'Open Sans', sans-serif;
  font-weight: 500;
  font-size: 40px;
  line-height: 1.2;
  color: var(--slm-ink);
  padding: 0;
  max-width: none;
}
.slm-news-lede {
  margin: 14px 0 0;
  max-width: 620px;
  font-size: 18px;
  line-height: 1.4;
  color: var(--slm-muted);
}
/* Archive/search titles reuse the h1 treatment */
.slm-news-intro .wp-block-query-title {
  margin: 12px 0 0;
  font-family: 'Open Sans', sans-serif;
  font-weight: 500;
  font-size: 40px;
  line-height: 1.2;
  color: var(--slm-ink);
}
.slm-news-intro .wp-block-term-description {
  margin: 14px 0 0;
  max-width: 620px;
  font-size: 18px;
  line-height: 1.4;
  color: var(--slm-muted);
}
.slm-news-intro .wp-block-term-description p { margin: 0; }

/* ---- Toolbar: category chips + search ------------------------------------ */
.slm-news-toolbar-wrap .slm-news-wrap {
  padding-top: 28px;
}
.slm-news-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
/* Flow layout puts margin-block-start on the second child; on a centred flex
   row that margin is part of the box, so the search field sat below centre. */
.slm-news-toolbar > * {
  margin-top: 0;
  margin-bottom: 0;
}

.slm-filters {
  /* basis, not auto: the chip row's content is wider than the container, and
     flex-basis:auto would size it to content and wrap the search field below */
  flex: 1 1 320px;
  min-width: 0;
  max-width: 100%;
}
.slm-filter-select { display: none; }

.slm-chips {
  display: flex;
  max-width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 6px;
  background: var(--slm-wash);
  border-radius: 100px;
  scrollbar-width: none;
}
.slm-chips::-webkit-scrollbar { height: 0; }

.slm-chips .slm-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 18px;
  border-radius: 100px;
  font: 600 16px/1 'Lato', sans-serif;
  color: var(--slm-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
/* style.css has `.wp-block-group p a { text-decoration: underline }` (0,2,2)
   and loads after this file, so the chips need a heavier selector. */
.slm-news-toolbar-wrap .slm-news-toolbar .slm-chips a {
  text-decoration: none;
}
.slm-chips .slm-chip:hover { color: var(--slm-ink); }
/* Active chip is resolved server-side by the News Filters block */
.slm-chips .slm-chip.is-active {
  background: #fff;
  color: #25292F;
  box-shadow: 0 1px 3px 0 rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.06);
}

/* Search field — core Search block, no button */
.slm-search {
  flex: 0 0 auto;
}
.slm-search .wp-block-search__inside-wrapper { border: 0; padding: 0; }
.slm-search .wp-block-search__input {
  height: 46px;
  width: 250px;
  max-width: 100%;
  padding: 0 18px 0 44px;
  border-radius: 100px;
  border: 1.5px solid var(--slm-line);
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: 16px center;
  background-size: 18px 18px;
  /* magnifier, --neutral-light */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E9298' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  font: 400 16px/1 'Lato', sans-serif;
  color: var(--slm-body);
}
.slm-search .wp-block-search__input:focus {
  outline: none;
  border-color: var(--slm-gold);
  box-shadow: 0 0 0 3px var(--slm-gold-wash);
}

/* Category dropdown (narrow screens) */
.slm-filter-select select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 46px;
  padding: 0 44px 0 18px;
  border-radius: 100px;
  border: 1.5px solid var(--slm-line);
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px 16px;
  /* chevron, --neutral-light */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E9298' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  font: 600 16px/1 'Lato', sans-serif;
  color: var(--slm-body);
}
.slm-filter-select select:focus {
  outline: none;
  border-color: var(--slm-gold);
  box-shadow: 0 0 0 3px var(--slm-gold-wash);
}

/* ---- Result count -------------------------------------------------------- */
.slm-result-label {
  margin: 20px 0 0;
  font-size: 14px;
  color: var(--slm-muted);
}
/* core/query-total already renders "Displaying 1 – 10 of 79" */
.slm-result-label::after { content: ' articles'; }

/* ---- Card grid ----------------------------------------------------------- */
.slm-news-query .slm-news-wrap { padding-top: 0; }

.slm-cards.wp-block-post-template {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  gap: 30px;
}
.slm-cards > li { display: flex; margin: 0; }

.slm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #fff;
  border: 1px solid var(--slm-line-soft);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.slm-card:hover {
  border-color: var(--slm-line);
  box-shadow: 0 6px 16px -4px rgba(0,0,0,.10), 0 2px 6px -2px rgba(0,0,0,.06);
}

/* The card and its body are core groups with flow layout, so WordPress adds
   `margin-block-start` to every child after the first. Spacing here comes from
   flex gap and explicit padding, so zero those out. */
.slm-card > *,
.slm-card-body > * {
  margin-top: 0;
  margin-bottom: 0;
}

.slm-card-media {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--slm-line-soft);
}
.slm-card-media .wp-block-post-featured-image {
  margin: 0;
  position: absolute;
  inset: 0;
}
.slm-card-media .wp-block-post-featured-image a { display: block; height: 100%; }
.slm-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.slm-card:hover .slm-card-media img { transform: scale(1.05); }

/* Category pill. Posts sit in several categories — show the first only. */
.slm-card-cat {
  position: absolute;
  left: 12px;
  top: 12px;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  border-radius: 100px;
  background: var(--slm-gold);
  color: #333;
  font: 600 12px/1 'Lato', sans-serif;
  letter-spacing: .02em;
}
.slm-card-cat a { color: inherit; text-decoration: none; }
.slm-card-cat a:not(:first-of-type),
.slm-card-cat .wp-block-post-terms__separator { display: none; }

.slm-card-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 20px 22px 24px;
  flex: 1;
}
.slm-card-date {
  margin: 0;
  font: 700 12px/1.2 'Lato', sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--slm-light);
}
.slm-card-title {
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  color: var(--slm-ink);
  max-height: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color .15s ease;
}
.slm-card-title a { color: inherit; text-decoration: none; }
/* Stretched link — the whole card is clickable, keyboard focus stays on the title */
.slm-card-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}
.slm-card:hover .slm-card-title { color: var(--slm-gold-dark); }

.slm-card-excerpt { margin: 0; }
.slm-card-excerpt .wp-block-post-excerpt__excerpt {
  margin: 0;
  padding: 0;
  font: 400 16px/1.4 'Lato', sans-serif;
  color: var(--slm-muted);
  text-align: left;
  max-height: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.slm-readmore {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  font: 600 16px/1 'Lato', sans-serif;
  color: var(--slm-gold-dark);
  text-decoration: none;
  transition: gap .15s ease;
}
.slm-readmore::after { content: '\2192'; font-size: 15px; }
.slm-card:hover .slm-readmore { gap: 10px; }

/* ---- Featured story: newest post, unfiltered first page only ------------- */
@media (min-width: 900px) {
  body.blog:not(.paged) .slm-cards > li:first-child { grid-column: 1 / -1; }

  body.blog:not(.paged) .slm-cards > li:first-child .slm-card {
    flex-direction: row;
    flex-wrap: wrap;
    border-radius: 16px;
    box-shadow: 0 6px 16px -4px rgba(0,0,0,.10), 0 2px 6px -2px rgba(0,0,0,.06);
  }
  body.blog:not(.paged) .slm-cards > li:first-child .slm-card-media {
    flex: 1 1 420px;
    aspect-ratio: auto;
    min-height: 340px;
  }
  body.blog:not(.paged) .slm-cards > li:first-child .slm-card-body {
    flex: 1 1 380px;
    justify-content: center;
    gap: 14px;
    padding: 44px 48px;
  }
  /* "Featured story" eyebrow, as in the design */
  body.blog:not(.paged) .slm-cards > li:first-child .slm-card-body::before {
    content: 'Featured story';
    font: 700 14px/1.2 'Lato', sans-serif;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--slm-gold-dark);
  }
  body.blog:not(.paged) .slm-cards > li:first-child .slm-card-title {
    font-size: 32px;
    -webkit-line-clamp: 3;
  }
  body.blog:not(.paged) .slm-cards > li:first-child .slm-card-excerpt .wp-block-post-excerpt__excerpt {
    font-size: 18px;
    max-width: 460px;
    -webkit-line-clamp: 3;
  }
  /* The read-more becomes the gold CTA button. The label is swapped in CSS
     because every card in a Query Loop shares one block definition. */
  body.blog:not(.paged) .slm-cards > li:first-child .slm-readmore {
    align-self: flex-start;
    margin-top: 6px;
    height: 52px;
    padding: 0 28px;
    border-radius: 100px;
    background: var(--slm-gold);
    color: #333;
    font-size: 0;
    gap: 0;
  }
  body.blog:not(.paged) .slm-cards > li:first-child .slm-readmore::before {
    content: 'Read this post';
    font-size: 16px;
    font-weight: 600;
  }
  body.blog:not(.paged) .slm-cards > li:first-child .slm-readmore::after { content: ''; }
  body.blog:not(.paged) .slm-cards > li:first-child:hover .slm-readmore { background: var(--slm-gold-dark); color: #fff; }
}

/* ---- No results ---------------------------------------------------------- */
.slm-no-results {
  text-align: center;
  padding: 64px 0;
  color: var(--slm-muted);
}
.slm-no-results-title {
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  font-weight: 500;
  font-size: 20px;
  color: var(--slm-ink);
}
.slm-no-results p:last-child { margin: 8px 0 0; font-size: 16px; }

/* ---- Pagination ---------------------------------------------------------- */
.slm-pagination {
  gap: 8px;
  padding: 36px 0 8px;
  font-family: 'Lato', sans-serif;
}
.slm-pagination .page-numbers,
.slm-pagination .wp-block-query-pagination-previous,
.slm-pagination .wp-block-query-pagination-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  border-radius: 100px;
  font: 600 16px/1 'Lato', sans-serif;
  color: var(--slm-body);
  text-decoration: none;
  box-shadow: inset 0 0 0 1.5px var(--slm-line);
  transition: background-color .15s ease, color .15s ease;
}
.slm-pagination .page-numbers.current {
  background: var(--slm-green);
  color: #fff;
  box-shadow: none;
}
.slm-pagination .page-numbers.dots { box-shadow: none; }
.slm-pagination .wp-block-query-pagination-previous,
.slm-pagination .wp-block-query-pagination-next {
  gap: 6px;
  padding: 0 18px;
  color: var(--slm-green);
  box-shadow: inset 0 0 0 2px var(--slm-green);
}
.slm-pagination a:hover { background: var(--slm-wash); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .slm-cards.wp-block-post-template { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .slm-news-intro .slm-news-wrap { padding-top: 40px; padding-bottom: 40px; }
  .slm-news-h1,
  .slm-news-intro .wp-block-query-title { font-size: 32px; }
}
@media (max-width: 680px) {
  .slm-news-wrap { --slm-gutter: 24px; }
  .slm-cards.wp-block-post-template { grid-template-columns: 1fr; }
  .slm-news-toolbar { flex-direction: column; align-items: stretch; }
  /* Stacked, the children must be held to the container: the chip row's
     max-content width would otherwise size them and scroll the page. */
  .slm-news-toolbar > * { width: 100%; max-width: 100%; min-width: 0; }
  /* Stacked, the container's main axis is vertical — the 320px basis would
     become the filter row's HEIGHT. */
  .slm-filters { flex: 0 0 auto; }
  /* Sideways scrolling is awkward on a phone: swap the chips for a dropdown,
     and put it under the search field. */
  .slm-chips { display: none; }
  .slm-filter-select { display: block; }
  .slm-search { order: 1; }
  .slm-filters { order: 2; }
  .slm-search .wp-block-search__input { width: 100%; }
  .slm-news-h1,
  .slm-news-intro .wp-block-query-title { font-size: 28px; }
  .slm-news-lede { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .slm-card,
  .slm-card-media img,
  .slm-readmore,
  .slm-pagination a { transition: none; }
  .slm-card:hover .slm-card-media img { transform: none; }
}
