/* The other tourist guides of the same region and theme on the guide page
   (rendered by App_Code/GuideRelated.cs). Same look as the nearby points of
   the POI 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 .guide-related-section {
    margin-top: 0;
    margin-bottom: 40px;
    min-width: 0;
}

/* The portal script whole-words.js keeps hyphenated compounds on one line
   ("Lessinia-Baldo"). Inside the tiles they may wrap, so a long one can never
   push a tile wider than its column. */
#page .guide-related-grid .portal-whole-word,
#page .guide-related-actions .portal-whole-word {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

#page .guide-related-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#page .guide-related-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 (the height comes from the padding): 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. Same choice as the POI tiles. */
    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 .guide-related-name {
    grid-column: 1;
    min-width: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

#page .guide-related-link::after {
    content: "";
    grid-column: 2;
    width: 7px;
    height: 7px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
}

#page .guide-related-link:hover {
    border-color: #92b0c4;
    background: #fff;
    color: #003c70;
    text-decoration: none;
}

#page .guide-related-link:focus-visible,
#page .guide-related-all:focus-visible {
    outline: 3px solid #1479b8;
    outline-offset: 3px;
}

#page .guide-related-actions {
    margin-top: 16px;
    min-width: 0;
}

#page .guide-related-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 .guide-related-all:hover {
    border-color: #92b0c4;
    background: #f3f8fb;
    color: #003c70;
    text-decoration: none;
}

@media (min-width: 768px) {
    #page .guide-related-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    /* A single guide fills its row. */
    #page .guide-related-grid[data-count="1"] {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 992px) {
    #page .guide-related-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    #page .guide-related-grid[data-count="2"],
    #page .guide-related-grid[data-count="4"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    #page .guide-related-grid,
    #page .guide-related-grid[data-count="4"] {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    /* Keep the rows even: 3 -> 3, 5 -> 3+2, 6 -> 3+3, 9 -> 3+3+3. */
    #page .guide-related-grid[data-count="3"],
    #page .guide-related-grid[data-count="5"],
    #page .guide-related-grid[data-count="6"],
    #page .guide-related-grid[data-count="9"] {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
