/* Nearest points of interest of the same category on the POI page
   (rendered by App_Code/PoiNearby.cs). Same look as the nearby towns of the
   town pages. This file is linked before the portal bundles, so every rule
   is scoped under #page. Only min-width queries: no gap at fractional widths. */
#page .poi-nearby-section {
    margin-top: 0;
    margin-bottom: 40px;
    min-width: 0;
}

/* The heading keeps the page's own section-title style; only the space
   before the description line is reduced. */
#page .poi-nearby-section > .section-title {
    margin-bottom: 10px !important;
}

/* The portal script whole-words.js keeps hyphenated compounds on one line
   ("Adriatica-Nereto-Controguerra"). Inside this section they may wrap, so a
   long one can never push a tile or the description wider than its column. */
#page .poi-nearby-section .portal-whole-word {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

#page .poi-nearby-description {
    margin: 0 0 20px;
    color: #526b7d;
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
    overflow-wrap: anywhere;
}

#page .poi-nearby-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#page .poi-nearby-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: center;
    align-items: center;
    gap: 6px 14px;
    min-width: 0;
    /* No min-height here: with one, Safari keeps the tile at its old height when
       the page gets narrower after loading (a phone turned upright) and a name
       that now needs more lines spills out of the tile. */
    padding: 15px;
    border: 1px solid #dce6ed;
    border-radius: 11px;
    background: #f3f8fb;
    color: #003c70;
    font-size: 15px;
    line-height: 1.5;
    text-align: start;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

#page .poi-nearby-name {
    grid-column: 1;
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

#page .poi-nearby-meta {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 14px;
    min-width: 0;
    color: #526b7d;
    font-size: 13px;
    line-height: 1.5;
}

#page .poi-nearby-place {
    min-width: 0;
    overflow-wrap: anywhere;
}

#page .poi-nearby-distance {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
}

#page .poi-nearby-distance > .fa {
    flex: 0 0 auto;
    margin: 0;
}

#page .poi-nearby-link::after {
    content: "";
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 7px;
    height: 7px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
}

#page .poi-nearby-link:hover {
    border-color: #92b0c4;
    background: #fff;
    color: #003c70;
    text-decoration: none;
}

#page .poi-nearby-link:focus-visible,
#page .poi-nearby-all:focus-visible {
    outline: 3px solid #1479b8;
    outline-offset: 3px;
}

#page .poi-nearby-actions {
    margin-top: 16px;
    min-width: 0;
}

#page .poi-nearby-all {
    display: block;
    min-width: 0;
    min-height: 48px;
    padding: 12px 16px;
    border: 1px solid #dce6ed;
    border-radius: 11px;
    background: #fff;
    color: #003c70;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

#page .poi-nearby-all:hover {
    border-color: #92b0c4;
    background: #f3f8fb;
    color: #003c70;
    text-decoration: none;
}

@media (min-width: 768px) {
    #page .poi-nearby-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    #page .poi-nearby-link {
        padding: 16px;
    }

    /* A single neighbour fills its row. */
    #page .poi-nearby-grid[data-count="1"] {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 1200px) {
    #page .poi-nearby-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Keep the rows even: 2 -> 2, 3 -> 3, 5 -> 3+2, 6 -> 3+3. */
    #page .poi-nearby-grid[data-count="2"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #page .poi-nearby-grid[data-count="3"],
    #page .poi-nearby-grid[data-count="5"],
    #page .poi-nearby-grid[data-count="6"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
