/*
  Farm locations grid — a 3-column mosaic where the first tile spans two
  columns (large featured), the rest are equal cells. Width is set by the
  page-builder row. Tiles are static cards (no single view to link to); the
  only interactive part is the "Lees meer" disclosure on each card.
*/

.locations-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;          /* tiles in a row match each other's height. The
                                    "Lees meer" toggle is NOT bottom-pinned, so it
                                    stays with its text and cream fills the space
                                    below it. */
  gap: var(--space-m);
}

.locations-grid__item {
  display: flex;
  flex-direction: column;
  overflow: clip;
  background-color: var(--color-cream);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.locations-grid__item--featured {
  grid-column: span 2;
}

/* ---- Media ---- */
.locations-grid__media {
  display: block;
  aspect-ratio: 384 / 203;
  overflow: clip;
}

.locations-grid__item--featured .locations-grid__media {
  aspect-ratio: 792 / 289;
}

.locations-grid__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.locations-grid__media--placeholder {
  background-color: var(--color-green-muted);
}

/* ---- Body ---- */
.locations-grid__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-m) var(--space-s);
}

.locations-grid__title {
  margin: 0;
}

.locations-grid__excerpt,
.locations-grid__excerpt-rest {
  margin: 0;
  font-size: var(--text-small);
}

/* The excerpt is WYSIWYG HTML (paragraphs). Drop the outer block margins so it
   sits flush in the tile's flex column (which spaces children via its gap);
   inner paragraphs keep their spacing from one another. */
.locations-grid__excerpt > :first-child,
.locations-grid__excerpt-rest > :first-child {
  margin-block-start: 0;
}

.locations-grid__excerpt > :last-child,
.locations-grid__excerpt-rest > :last-child {
  margin-block-end: 0;
}

/* "Lees meer" — a text-link button (not a pill); chevron rotates when open. */
/* Label swaps "Lees meer" → "Lees minder" purely off aria-expanded (mirrors the
   tile toggle, tile.css), so the JS only has to flip the attribute. */
.locations-grid__more-label-less {
  display: none;
}

.locations-grid__more[aria-expanded="true"] .locations-grid__more-label-more {
  display: none;
}

.locations-grid__more[aria-expanded="true"] .locations-grid__more-label-less {
  display: inline;
}

.locations-grid__more::after {
  content: "";
  width: 1.25em;
  height: 1.25em;
  background-color: currentColor;
  -webkit-mask: url("../../svg/chevron-down.svg") no-repeat center / contain;
  mask: url("../../svg/chevron-down.svg") no-repeat center / contain;
  transition: transform 0.15s ease;
}

.locations-grid__more[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .locations-grid__more::after {
    transition: none;
  }
}

/* ---- Responsive ---- */
@media (max-width: 60rem) {
  .locations-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .locations-grid__item--featured {
    grid-column: span 2;
  }
}

@media (max-width: 40rem) {
  .locations-grid {
    grid-template-columns: 1fr;
  }

  .locations-grid__item--featured {
    grid-column: auto;
  }

  .locations-grid__item--featured .locations-grid__media {
    aspect-ratio: 384 / 203;
  }
}
