/*
 * Sitemap: pages/sitemap. The bar of sections is the shared .section-nav (sections.css);
 * long lists fold with the shared Read more button (site.js).
 */

.sitemap {
    padding-block: var(--space-6) var(--space-8);
}

/* The sticky bar of sections sits under the header, so a group stops below both. */
.sitemap-group {
    scroll-margin-top: calc(var(--header-height) + var(--space-8));
}

.sitemap-group + .sitemap-group {
    margin-top: var(--space-8);
}

.sitemap-group__title {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.sitemap-group__intro {
    margin-top: calc(var(--space-2) * -1);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.sitemap-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    align-items: start;
    gap: var(--space-5);
}

.sitemap-card {
    padding: var(--space-5);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}

.sitemap-card__title {
    margin-bottom: var(--space-3);
    font-size: var(--text-lg);
}

/* One link a row, each row the same height, so a folded list can stop at a whole row. */
.sitemap-links {
    --row: 2rem;
    --fold-rows: 10;

    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sitemap-links li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 var(--space-2);
    min-height: var(--row);
    padding-block: 0.25rem;
    line-height: 1.5;
}

.sitemap-links a {
    color: var(--color-text);
    text-decoration: none;
}

.sitemap-links a:hover {
    color: var(--color-accent-text);
    text-decoration: underline;
}

.sitemap-links__note {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Dealers and towns: across the page, in as many columns as fit. */
.sitemap-links--wide {
    --fold-rows: 8;

    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    column-gap: var(--space-5);
}

.sitemap-links--towns {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
}

/* A long town name wraps on its own, with Used kept at the end of its first line. */
.sitemap-links--towns li {
    flex-wrap: nowrap;
}

.sitemap-links--towns li > a:first-child {
    min-width: 0;
}

.sitemap-links__used {
    flex: none;
    margin-inline-start: auto;
    font-size: var(--text-sm);
}

.sitemap-links a.sitemap-links__used {
    color: var(--color-accent-text);
}

/* Folded: the shared .is-clamped is for text, so a list gets whole rows and a fade instead. */
.sitemap-links.is-clamped {
    display: grid;
    max-height: calc(var(--fold-rows) * var(--row));
    overflow: hidden;
    -webkit-line-clamp: none;
    mask-image: linear-gradient(#000 calc(100% - var(--row) * 1.5), transparent);
}

.sitemap-more {
    min-height: 44px;
    margin-top: var(--space-2);
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-accent-text);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}
