/* VVE Finder block */

.block-vve-finder {
    --vve-gap: 20px;
}

.block-vve-finder__inner {
    display: flex;
    flex-direction: column;
    gap: var(--vve-gap);
}

.block-vve-finder__title {
    width: 100%;
    margin: 0;
    text-align: left;
}

/* Live search — layout only, the cards carry their own look */

.live-search {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.live-search__search {
    display: flex;
    justify-content: center;
    width: 100%;
}

.live-search__search-field {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 56px;
    border: var(--border-01) solid;
    border-top: 0;
    border-left: 0;
    border-radius: 0;
}

.live-search__search-icon {
    position: absolute;
    right: 16px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 18px;
    height: 18px;
    pointer-events: none;
    user-select: none;
}

.live-search__search-input {
    appearance: none;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0 48px 0 0;
    border: 0;
    outline: 0;
    background-color: transparent;
    color: inherit;
    font: inherit;
}

.live-search__search-field:has(input:focus) {
    border-color: var(--wp--preset--color--energiek-blauw);
}

.live-search__search-icon {
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.live-search__search-field:has(input:focus) .live-search__search-icon {
    color: var(--wp--preset--color--energiek-blauw);
}

.live-search__search-field input::placeholder {
    color: var(--wp--preset--color--warm-grijs-03);
    opacity: 1;
}

.live-search__list {
    display: grid;
    grid-template-columns: 1fr;
    /* Held at 20px, where --vve-gap opens up to 30px on desktop */
    gap: 20px;
    width: 100%;
}

.live-search__not-found-p {
    margin: 0;
    text-align: center;
    color: var(--wp--preset--color--warm-grijs-04);
}

/* Search index, never shown */
.live-search__data,
.live-search__not-found {
    display: none;
}

/* Card — same shape as the post cards */

.block-vve-finder__card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--wp--preset--color--white);
    border-radius: var(--radius-06);
    overflow: hidden;
}

.block-vve-finder__card-image {
    position: relative;
    /* Flex items default to min-height:auto, and the image's intrinsic height
       becomes that minimum — which overrides the aspect ratio below. */
    min-height: 0;
    overflow: hidden;
    aspect-ratio: 399 / 223;
    flex-shrink: 0;
    background-color: var(--wp--preset--color--helder-blauw-licht);
}

/* Only where there is a photo — the placeholder colour needs no scrim */
.block-vve-finder__card-image:has(img)::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 50%, rgba(0, 0, 0, 0.48) 100%);
    pointer-events: none;
}

.block-vve-finder__card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.block-vve-finder__card-badge {
    position: absolute;
    bottom: 11px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    color: var(--wp--preset--color--helder-blauw-licht);
}

/* No image: the badge sits on the placeholder colour instead of a photo */
.block-vve-finder__card-image:not(:has(img)) .block-vve-finder__card-badge {
    color: var(--wp--preset--color--helder-blauw-text);
}

.block-vve-finder__card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    padding: 1rem;
    text-align: left;
}

.block-vve-finder__card-title {
    margin: 0;
}

/* Phone on the left, the link icon lined up with it on the right */
.block-vve-finder__card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.block-vve-finder__card-phone {
    /* Above the cover link, so calling still works */
    position: relative;
    z-index: 2;
    color: var(--wp--preset--color--warm-grijs-03);
    text-decoration: none;
}

.block-vve-finder__card-icon {
    display: flex;
    flex-shrink: 0;
}

.block-vve-finder__card-icon svg {
    display: block;
}

/* Makes the whole card the link, without nesting anchors */
.block-vve-finder__card-cover {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* Desktop */

@media (min-width: 600px) {
    .live-search__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 782px) {
    .block-vve-finder {
        --vve-gap: 30px;
    }

    .live-search__list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Four up once there is room for it — the same edge the menu uses to switch to
   its desktop layout. */
@media (min-width: 1180px) {
    .live-search__list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
