/* BHM 2.4.21 — discovery pages.
   Keep the existing queries, artwork, advert slots and slider behaviour.
   Features has its own reviewed layout; reader and book views are separate. */

@media screen {
  /* The legacy search input uses content-box. A descendant universal selector
     cannot override that more-specific rule, so size the actual controls. */
  .bhm-event-finder-form input[type="search"],
  .bhm-event-finder-form select,
  .bhm-event-finder-form .bhm-event-finder-submit,
  .page-wrap .bhm-search-form input[type="search"],
  .page-wrap .bhm-search-form button {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
  }

  .bhm-event-finder-form .bhm-event-finder-field {
    display: grid;
    grid-template-rows: auto 48px;
    align-content: end;
    min-width: 0;
    max-width: 100%;
  }

  .bhm-event-finder-form input[type="search"],
  .bhm-event-finder-form select {
    min-width: 0;
    min-height: 48px;
    max-height: 48px;
  }

  .bhm-event-finder-form .bhm-event-finder-submit {
    min-height: 48px;
    align-self: end;
  }

  .page-wrap .bhm-search-form input[type="search"] {
    min-height: 48px;
    font-size: 16px;
  }

  /* Home section links retain a complete, comfortable target when a heading
     wraps. No rule in this file touches the photographic slider. */
  .bhm-home .bhm-section-heading > div,
  .bhm-home .bhm-card-copy,
  .bhm-home .bhm-latest li a > span {
    min-width: 0;
  }

  .bhm-home .bhm-section-heading > .bhm-text-link {
    flex-shrink: 0;
    min-height: 44px;
    white-space: nowrap;
  }

  .bhm-home .bhm-card-copy h3,
  .bhm-home .bhm-section-heading h2 {
    text-wrap: pretty;
  }

  .bhm-home .bhm-region-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Archive and search headlines now share the homepage display face.
     Media archives keep their dark design and profile templates are excluded. */
  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .content-header .section-title {
    padding-top: 22px;
    font-family: var(--bhm-display, "Libre Caslon Display", Georgia, serif);
    font-size: clamp(36px, 4.5vw, 56px);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -.025em;
    text-wrap: balance;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list {
    container-name: bhm-discovery-feed;
    container-type: inline-size;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row {
    align-items: stretch;
    row-gap: 36px;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row > .post-list-item {
    align-self: stretch;
    padding-bottom: 24px;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row > .post-list-item .post-list-item--article {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    font-size: 16px;
    line-height: 1.65;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row > .post-list-item .post-list-title {
    margin-bottom: 12px;
    font-family: var(--bhm-display, "Libre Caslon Display", Georgia, serif);
    font-size: clamp(28px, 2.6vw, 34px);
    font-weight: 400;
    line-height: 1.14;
    letter-spacing: -.015em;
    text-wrap: pretty;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row > .post-list-item .post-link-comments {
    width: 100%;
    margin-top: auto;
    padding-top: 6px;
  }

  body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row > .post-list-item .post-link-comments a.article-links {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 7px 0;
    font: 650 14px/1.5 var(--bhm-font, "DM Sans", sans-serif);
    white-space: nowrap;
    text-transform: none;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
  }

  /* This sidebar's event read link is separate from the ordinary article link. */
  body.bhm-editorial .bhm-highlights-archive .bhm-highlights-read-more {
    min-height: 44px;
    white-space: nowrap;
  }

  /* Feed width, including any real sidebar/ad rail, determines how many cards
     fit. Narrow columns should not inherit the viewport's two-column grid. */
  @container bhm-discovery-feed (max-width: 589px) {
    body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @container bhm-discovery-feed (max-width: 439px) {
    body.bhm-editorial.search .page-wrap:not(.bhm-listings-archive) #main-content > .row > .post-list > .post-list-row > .post-list-item {
      grid-template-columns: minmax(0, 1fr);
      gap: 18px;
    }
  }

  /* Event cards remain compact, with landscape thumbnail windows and room for
     the full title. Individual event image frames are intentionally untouched. */
  .bhm-listings-archive #main-content > .row > .listings-list {
    container-name: bhm-listings-feed;
    container-type: inline-size;
  }

  .bhm-listings-archive .listings-header .listings-header--title {
    max-width: 28ch;
    font-family: var(--bhm-display, "Libre Caslon Display", Georgia, serif);
    font-size: clamp(38px, 4.5vw, 56px);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -.025em;
    text-wrap: balance;
  }

  .bhm-listings-archive .listings-header--intro {
    max-width: 68ch;
  }

  body.bhm-editorial .bhm-listings-archive #main-content > .row > .listings-list > .post-list-row .post-list-item .post-list-item--fig,
  body.bhm-editorial .bhm-listings-archive #main-content > .row > .listings-list > .post-list-row .post-list-item .post-list-item--fig img {
    aspect-ratio: 4 / 3;
  }

  body.bhm-editorial .bhm-listings-archive #main-content > .row > .listings-list > .post-list-row .post-list-item .post-listings-list-title {
    overflow-wrap: break-word;
    text-wrap: pretty;
  }

  body.bhm-editorial .bhm-listings-archive #main-content > .row > .listings-list > .post-list-row > .post-list-item:focus-within {
    border-color: var(--bhm-dark-red, #951b24);
  }

  @container bhm-listings-feed (max-width: 759px) {
    body.bhm-editorial .bhm-listings-archive #main-content > .row > .listings-list > .post-list-row {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /* Even card baselines make the subject collection easier to scan without
     hiding excerpts or imposing fixed text heights. */
  .bhm-subjects .bhm-subject-grid {
    align-items: stretch;
  }

  .bhm-subjects .bhm-subject-card {
    align-self: stretch;
  }

  .bhm-subjects .bhm-subject-card-copy {
    flex: 1;
  }

  .bhm-subjects .bhm-subject-card-copy .bhm-subject-date {
    margin-top: auto;
  }

  .bhm-subjects :is(.bhm-subject-feature-copy h2, .bhm-subject-card-copy h3) {
    text-wrap: pretty;
  }

  @media (max-width: 599px) {
    body.bhm-editorial:is(.archive, .search, .blog):not(.post-type-archive-post_profile, .tax-profile_category, .post-type-archive-post_video, .post-type-archive-post_gallery) .page-wrap:not(.bhm-features-archive, .bhm-listings-archive) #main-content > .row > .post-list > .post-list-row {
      row-gap: 28px;
    }

    .bhm-listings-archive .bhm-listings-result-range {
      display: block;
      margin-left: 0;
    }

    .page-wrap .bhm-search-form {
      flex-wrap: wrap;
    }

    .page-wrap .bhm-search-form input[type="search"] {
      flex-basis: 190px;
    }

    .page-wrap .bhm-search-form button {
      min-height: 48px;
    }
  }

}
