/* Homepage featured + recent items (.home-item from theme items/single.php) */


/* --- Mobile: full-width image; featured has title + description below image; hide layout toggle --- */
@media screen and (max-width: 767px) {
  .home-recent-view-toggle {
    display: none;
  }

  #home #featured-item .item.record.home-item,
  #home #recent-items .item.record.home-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  #home #featured-item .home-item-media,
  #home #recent-items .home-item-media {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  #home #featured-item .home-item-media a.image,
  #home #recent-items .home-item-media a.image {
    display: block;
    line-height: 0;
  }

  #home #featured-item .item.record.home-item img,
  #home #recent-items .item.record.home-item img {
    float: none;
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
    box-sizing: border-box;
  }

  #home #recent-items .home-recent-items-results {
    column-count: 1 !important;
  }

  #home #featured-item .home-item-body,
  #home #recent-items .home-item-body {
    width: 100%;
  }

  #home #featured-item .home-item-body h3,
  #home #recent-items .home-item-body h3 {
    margin-top: 12px;
  }
}

/* --- Recent heading row + icon toggle (desktop) --- */
.home-recent-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 12px;
}

.home-recent-heading-row h2 {
  margin: 0;
}

.home-recent-view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  /* border: 1px solid #dfe2e2; */
  border-radius: 2px;
  overflow: hidden;
}

.home-recent-view-btn {
  margin: 0;
  padding: 0.45em 0.65em;
  font: inherit;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: #f5f5f5;
  color: #333;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.home-recent-view-btn + .home-recent-view-btn {
  /* border-left: 1px solid #dfe2e2; */
}

.home-recent-view-btn:hover,
.home-recent-view-btn:focus {
  background: #eaeaea;
  outline: none;
}

.home-recent-view-btn:focus-visible {
  outline: 2px solid #2183b8;
  outline-offset: 2px;
}

.home-recent-view-btn[aria-pressed="true"] {
  background: #2183b8;
  color: #fff;
}

.home-recent-view-btn[aria-pressed="true"]:hover,
.home-recent-view-btn[aria-pressed="true"]:focus {
  background: #1072a7;
}

.home-recent-view-icon svg {
  display: block;
}

/* --- Desktop: recent items list vs masonry --- */
@media screen and (min-width: 768px) {
  #home #recent-items .home-recent-items-results--masonry {
    column-count: 2;
    column-gap: 1.25rem;
  }

  #home #recent-items .home-recent-items-results--masonry .item.record.home-item {
    break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin-bottom: 1.25rem;
    vertical-align: top;
    box-sizing: border-box;
    /* border: 1px solid #dfe2e2; */
    padding: 0.75rem;
    background: #fff;
  }

  #home #recent-items .home-recent-items-results--masonry .home-item-media a.image {
    display: block;
    line-height: 0;
  }

  #home #recent-items .home-recent-items-results--masonry .item.record.home-item img {
    float: none;
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
  }

  #home #recent-items .home-recent-items-results--masonry .home-item-body h3 {
    margin-top: 0.65rem;
    margin-bottom: 0;
    font-size: 1rem;
    line-height: 1.3;
  }

  #home #recent-items .home-recent-items-results--list .item.record.home-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    clear: both;
    text-align: left;
  }

  #home #recent-items .home-recent-items-results--list .home-item-media {
    flex: 0 0 auto;
    max-width: 240px;
  }

  #home #recent-items .home-recent-items-results--list .home-item-media a.image {
    display: block;
    line-height: 0;
  }

  #home #recent-items .home-recent-items-results--list .item.record.home-item img {
    float: none;
    width: auto;
    max-width: 240px;
    height: auto;
    max-height: none;
    display: block;
    margin: 0;
  }

  #home #recent-items .home-recent-items-results--list .home-item-body {
    flex: 1;
    min-width: 0;
  }

  #home #recent-items .home-recent-items-results--list .home-item-body h3 {
    margin-top: 0;
  }
}

@media screen and (min-width: 1100px) {
  #home #recent-items .home-recent-items-results--masonry {
    column-count: 3;
  }
}

/* Night: masonry cards match dark panels */
.night #home #recent-items .home-recent-items-results--masonry .item.record.home-item {
  background-color: #252525;
  border-color: #313131;
}
