/* ============================================
   PHOTO TILE (Views/Shared/Components/_PhotoTile, model StaysPhotoCard)
   A /stays area's photo with its name and stay count: the home page's "Explore by area" island,
   laid out in the bento grid (.bl-bento, at the end). Loaded by
   _Layout on every page; its own blocks (stays-photo-card*, bl-bento), so it is safe anywhere.
   ============================================ */

.stays-photo-card {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius-lg);
}

.stays-photo-card:hover,
.stays-photo-card:focus-visible {
    color: inherit;
    text-decoration: none;
}

.stays-photo-card:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.stays-photo-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background-color: var(--color-surface-muted);
}

.stays-photo-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* No photo yet: a brand-green wash so the tile still reads as a place, not a broken image. */
.stays-photo-card__media--empty {
    background: linear-gradient(150deg, var(--green-50) 0%, var(--green-300) 70%, var(--green-500) 140%);
}

/* --- Text over the photo: a shade keeps white text readable on any image --- */
.stays-photo-card--area {
    position: relative;
}

.stays-photo-card--area .stays-photo-card__media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.15) 45%, rgba(0, 0, 0, 0) 70%);
}

.stays-photo-card--area .stays-photo-card__text {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    padding: var(--space-4) var(--space-5);
    color: var(--color-surface);
}

.stays-photo-card--area .stays-photo-card__media {
    aspect-ratio: 16 / 10;
}

.stays-photo-card--area .stays-photo-card__name {
    display: block;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.stays-photo-card--area .stays-photo-card__count {
    display: block;
    font-size: 0.875rem;
    opacity: 0.92;
}

/* --- Bento grid of area tiles: ul.bl-bento.bl-bento--n{count} > li > the tile (StaysPhotoCard.ForBento).
   The home page's "Explore by area"; 1 to 5 tiles.
   Phones: two columns of --bento-row rows (a page may set it); the first tile spans both columns
   and two rows, the rest are squares, and an odd one out at the end spans the row. From 768px:
   four columns, the first tile 2 x 2 and the others filling the two rows beside it (n1: one
   banner; n2: two big; n3: two wide beside the big one; n4: two squares and a wide one; n5: four
   squares). Each tile fills its cell, its name over the photo. After the tile rules above, which
   it overrides at the same specificity (the 16:10 area photo becomes the cell's height). --- */
.bl-bento {
    --bento-row: 150px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: var(--bento-row);
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.bl-bento > li {
    min-width: 0;
}

.bl-bento > li:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.bl-bento--n2 > li:last-child,
.bl-bento--n4 > li:last-child {
    grid-column: span 2;
}

.bl-bento .stays-photo-card,
.bl-bento .stays-photo-card__media {
    height: 100%;
}

.bl-bento .stays-photo-card__media {
    aspect-ratio: auto;
}

.bl-bento > li:not(:first-child) .stays-photo-card__text {
    padding: var(--space-3) var(--space-4);
}

.bl-bento > li:not(:first-child) .stays-photo-card__name {
    font-size: 1.125rem;
}

.bl-bento > li:first-child .stays-photo-card__text {
    padding: var(--space-5);
}

.bl-bento > li:first-child .stays-photo-card__name {
    font-size: 1.75rem;
}

@media (min-width: 768px) {
    .bl-bento {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-auto-rows: clamp(150px, 15vw, 260px);
        gap: var(--space-4);
    }

    .bl-bento--n1 > li:first-child {
        grid-column: span 4;
    }

    .bl-bento--n2 > li:last-child {
        grid-row: span 2;
    }

    .bl-bento--n3 > li:not(:first-child) {
        grid-column: span 2;
    }

    .bl-bento > li:first-child .stays-photo-card__text {
        padding: var(--space-6) var(--space-8);
    }

    .bl-bento > li:first-child .stays-photo-card__name {
        font-size: 2.25rem;
    }

    .bl-bento > li:not(:first-child) .stays-photo-card__name {
        font-size: 1.375rem;
    }
}

/* Hover: the photo eases in a little (pointer devices only; :hover sticks after a tap). */
@media (hover: hover) and (pointer: fine) {
    .stays-photo-card__media img {
        transition: transform var(--duration-base) var(--ease-out);
    }

    .stays-photo-card:hover .stays-photo-card__media img {
        transform: scale(1.04);
    }
}

@media (prefers-reduced-motion: reduce) {
    .stays-photo-card__media img {
        transition: none;
    }

    .stays-photo-card:hover .stays-photo-card__media img {
        transform: none;
    }
}
