/* ============================================================
   Rammed Earth Projects Grid — front-end styles
   Self-contained: no CSS variables, no theme dependencies.

   PALETTE (find & replace to re-skin)
     paper       #F7F4ED   sand        #E3D5BE
     paper-alt   #EFEADD   clay        #C67A45
     clay-deep   #A85D34   clay-light  #E3A97B
     forest      #1F5137   forest-dark #1F3D2B
     ink         #2A2621   muted       #6E6559
     slot-mid    #DBCFB8   slot-light  #E8DCC7

   LAYOUTS
     .re-projects__grid            equal-height CSS grid (default)
     .re-projects__grid--masonry   multi-column masonry, natural image heights
   ============================================================ */

.re-projects {
  position: relative;
  scroll-margin-top: 90px;
  font-size: 17px;
  line-height: 1.65;
  color: #2A2621;
}
.re-projects *,
.re-projects *::before,
.re-projects *::after { box-sizing: border-box; }


/* --- Filter bar --------------------------------------------- */
.re-projects__filter {
  background: #F7F4ED;
  border-top: 1px solid #E3D5BE;
  border-bottom: 1px solid #E3D5BE;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 2rem;
  z-index: 40;
}
/* `top` is written inline by the shortcode from the header_offset attribute. */
.re-projects--sticky .re-projects__filter { position: sticky; }

.re-projects__filter-inner {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.re-projects .re-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.re-projects .re-chips li { margin: 0; padding: 0; list-style: none; }

@media (min-width: 900px) {
  .re-projects .re-chips { flex-wrap: wrap; }
}

.re-projects .re-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  white-space: nowrap;
  text-decoration: none;
  padding: 0.5em 1em;
  border: 1px solid #E3D5BE;
  border-radius: 999px;
  background: #F7F4ED;
  color: #2A2621;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.re-projects .re-chip:hover,
.re-projects .re-chip:focus {
  border-color: #C67A45;
  color: #A85D34;
  text-decoration: none;
}
.re-projects .re-chip.is-active,
.re-projects .re-chip[aria-current="true"] {
  background: #1F5137;
  border-color: #1F5137;
  color: #F7F4ED;
}
.re-projects .re-chip__count {
  font-size: 0.72em;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}
.re-projects .re-chip:focus-visible {
  outline: 3px solid #A85D34;
  outline-offset: 3px;
}


/* --- Results ------------------------------------------------ */
.re-projects__results { position: relative; min-height: 12rem; }
.re-projects__results:focus { outline: none; }

.re-projects__count {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: #6E6559;
}


/* --- Grid ---------------------------------------------------- */
.re-projects__grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .re-projects__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .re-projects__grid--2 { grid-template-columns: repeat(2, 1fr); }
  .re-projects__grid--3 { grid-template-columns: repeat(3, 1fr); }
  .re-projects__grid--4 { grid-template-columns: repeat(4, 1fr); }
}



/* --- Card ---------------------------------------------------- */
.re-projects .re-card {
  display: flex;
  flex-direction: column;
  background: #F7F4ED;
  border: 1px solid #E3D5BE;
  border-radius: 3px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.re-projects .re-card:hover { border-color: #C67A45; }

.re-projects .re-card__media-link { display: block; text-decoration: none; }

.re-projects .re-card__media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #EFEADD;
}
.re-projects .re-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.re-projects .re-card:hover .re-card__media img { transform: scale(1.03); }

.re-projects .re-card__body {
  padding: 1.15rem 1.25rem 1.35rem;
  display: grid;
  gap: 0.5rem;
}
.re-projects .re-card__tag {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: #A85D34;
}
.re-projects .re-card__title {
  margin: 0;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.15;
  color: #1F3D2B;
}
.re-projects .re-card__title a { color: #1F3D2B; text-decoration: none; }
.re-projects .re-card__title a:hover { color: #A85D34; }
.re-projects .re-card__meta {
  margin: 0;
  font-size: 0.85rem;
  color: #6E6559;
}
.re-projects .re-card__text {
  margin: 0;
  font-size: 0.93rem;
  color: #6E6559;
}


/* --- Photo placeholder (no featured image) ------------------- */
.re-projects .re-photo-slot {
  height: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  background: repeating-linear-gradient(
    180deg,
    #E3D5BE 0 3px,
    #DBCFB8 3px 6px,
    #E8DCC7 6px 9px
  );
  color: #6E6559;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.re-projects .re-photo-slot span {
  background: rgba(247, 244, 237, 0.88);
  padding: 0.5rem 0.75rem;
  border-radius: 2px;
  max-width: 90%;
}


/* --- Loading state ------------------------------------------- */
.re-projects__results[aria-busy="true"] .re-projects__grid,
.re-projects__results[aria-busy="true"] .re-projects__count,
.re-projects__results[aria-busy="true"] .re-pagination {
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.re-projects__results[aria-busy="true"]::after {
  content: "";
  position: absolute;
  top: 4rem;
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border: 3px solid #E3D5BE;
  border-top-color: #A85D34;
  border-radius: 50%;
  animation: re-projects-spin 0.7s linear infinite;
}
@keyframes re-projects-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .re-projects__results[aria-busy="true"]::after { animation-duration: 2s; }
  .re-projects .re-card,
  .re-projects .re-card__media img,
  .re-projects .re-chip { transition: none; }
}


/* --- Empty state --------------------------------------------- */
.re-projects__empty {
  padding: 3rem 0;
  text-align: center;
  color: #6E6559;
}
.re-projects__empty p { margin: 0 auto 1.25rem; max-width: 40ch; }

.re-projects .re-strata {
  height: 4px;
  width: 56px;
  border: 0;
  margin: 0 auto 1.25rem;
  background: repeating-linear-gradient(
    180deg,
    #C67A45 0 1px,
    #E3A97B 1px 2px,
    #A85D34 2px 3px,
    #E3A97B 3px 4px
  );
}


/* --- Pagination ----------------------------------------------- */
.re-pagination { margin-top: 2.5rem; }
.re-pagination__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.re-pagination__list li { margin: 0; padding: 0; list-style: none; }

.re-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.55em 0.85em;
  border: 1px solid #E3D5BE;
  border-radius: 3px;
  background: #F7F4ED;
  color: #2A2621;
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.re-pagination a.page-numbers:hover {
  border-color: #C67A45;
  color: #A85D34;
}
.re-pagination .page-numbers.current {
  background: #1F5137;
  border-color: #1F5137;
  color: #F7F4ED;
  font-weight: 600;
}
.re-pagination .page-numbers.dots {
  min-width: 1.5rem;
  border-color: transparent;
  background: transparent;
  color: #6E6559;
}
.re-pagination .prev,
.re-pagination .next { font-weight: 600; color: #1F5137; }
.re-pagination a.page-numbers:focus-visible {
  outline: 3px solid #A85D34;
  outline-offset: 3px;
}


/* --- Screen-reader-only status line ---------------------------- */
.re-projects .re-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* --- Masonry layout (layout="masonry") -----------------------
   CSS multi-column: no library, no JS, no reflow jump. Cards keep
   their natural image height and flow down each column in turn.
   ------------------------------------------------------------- */
.re-projects__grid--masonry {
  display: block;
  column-count: 1;
  column-gap: 1.5rem;
}
@media (min-width: 640px) {
  .re-projects__grid--masonry.re-projects__grid--2,
  .re-projects__grid--masonry.re-projects__grid--3,
  .re-projects__grid--masonry.re-projects__grid--4 { column-count: 2; }
}
@media (min-width: 900px) {
  .re-projects__grid--masonry.re-projects__grid--2 { column-count: 2; }
  .re-projects__grid--masonry.re-projects__grid--3 { column-count: 3; }
  .re-projects__grid--masonry.re-projects__grid--4 { column-count: 4; }
}

.re-projects .re-projects__grid--masonry .re-card {
  display: block;              /* flex children fragment badly across columns in Safari */
  width: 100%;
  margin: 0 0 1.5rem;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}
/* Natural image proportions are the whole point of masonry. */
.re-projects .re-projects__grid--masonry .re-card__media { aspect-ratio: auto; }
.re-projects .re-projects__grid--masonry .re-card__media img { height: auto; }
.re-projects .re-projects__grid--masonry .re-photo-slot {
  aspect-ratio: 4 / 3;
  height: auto;
  min-height: 0;
}
