/********************* Stores directory *********************/

/* The /retailers/ page. The find box, its no-match line and the breadcrumb come
   from directory.css and global.css; this file is the page frame, the tools panel
   with the country chips, and the country sections. */

#retailers {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 18px 20px 72px;
    box-sizing: content-box;
}

#retailersIntro {
    max-width: 720px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.55;
}


/********************* Tools *********************/

/* the find box over the country chips, on the faint surface panel */
#retailersTools {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    background-color: var(--surface);
}

#retailersTools #directoryFind {
    max-width: 440px;
    margin-top: 0;
}

#retailersToolsChips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* each country chip's store count, quieter than the name (inherits white when pressed) */
.retailersToolsChipsCount {
    font-weight: 400;
}


/********************* Sections *********************/

.retailersGroupsSection {
    margin-top: 40px;
}

.retailersGroupsSection.filteredOut,
.retailersGroupsSection.countryOut {
    display: none;
}

.retailersGroupsSectionHeader {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
}

/* "These stores may not ship to Italy": only once the visitor's country is known */
.retailersGroupsSectionShips {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 14px;
}

.retailersGroupsSectionShips.active {
    display: flex;
}

.retailersGroupsSectionShipsIcon {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
}

/* the biggest country's A to Z jump row */
.retailersGroupsSectionJump {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 14px;
}

.retailersGroupsSectionJumpItem {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--control-height);
    height: var(--control-height);
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    color: var(--black);
    font-size: 14px;
    font-weight: 700;
    transition: border-color var(--transition), color var(--transition);
}

.retailersGroupsSectionJumpItem:hover {
    border-color: var(--primary);
    color: var(--primary);
}

#retailersGroups.filtering .retailersGroupsSectionJump {
    display: none;
}

/* a letter block; a jump lands below the 68px sticky header */
.retailersGroupsSectionLetter {
    scroll-margin-top: 88px;
}

.retailersGroupsSectionLetter.folded,
.retailersGroupsSectionLetter.filteredOut {
    display: none;
}

.retailersGroupsSection.active .retailersGroupsSectionLetter.folded,
#retailersGroups.filtering .retailersGroupsSectionLetter.folded {
    display: block;
}

.retailersGroupsSection.active .retailersGroupsSectionLetter.folded.filteredOut,
#retailersGroups.filtering .retailersGroupsSectionLetter.folded.filteredOut {
    display: none;
}

.retailersGroupsSectionLetterTitle {
    margin: 22px 0 10px;
    color: var(--muted);
}

/* the store cards, four across */
.retailersGroupsSectionList {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.retailersGroupsSectionLetter .retailersGroupsSectionList {
    margin-top: 0;
}

.retailersGroupsSectionListItem.filteredOut {
    display: none;
}

/* TODO (API): the board shows "N wines tracked" under each name; retailers.json
   carries no wine count yet, so a card is the name alone */
.retailersGroupsSectionListItemLink {
    display: flex;
    align-items: center;
    min-height: 52px;
    height: 100%;
    padding: 10px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    color: var(--black);
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
    transition: border-color var(--transition), color var(--transition);
}

.retailersGroupsSectionListItemLink:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.retailersGroupsSectionMore {
    margin-top: 14px;
}

.retailersGroupsSectionMore.used,
#retailersGroups.filtering .retailersGroupsSectionMore {
    display: none;
}


/********************* More countries *********************/

/* a row per small country: name and count, then its stores inline */
#retailersGroupsMoreTable {
    margin: 14px 0 0;
    padding: 0;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-card);
    list-style: none;
    overflow: hidden;
}

.retailersGroupsMoreTableRow {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    min-height: 48px;
    padding: 4px 18px;
    border-top: 1px solid var(--hairline);
}

.retailersGroupsMoreTableRow:first-child {
    border-top: none;
}

.retailersGroupsMoreTableRow.filteredOut,
.retailersGroupsMoreTableRow.countryOut {
    display: none;
}

.retailersGroupsMoreTableRowCountry {
    font-size: 15px;
    font-weight: 700;
}

.retailersGroupsMoreTableRowCountryCount {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.retailersGroupsMoreTableRowStores {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.retailersGroupsMoreTableRowStoresItem.filteredOut {
    display: none;
}

.retailersGroupsMoreTableRowStoresItemLink {
    display: inline-flex;
    align-items: center;
    min-height: var(--control-height);
    color: var(--primary);
    font-size: 15px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.retailersGroupsMoreTableRowStoresItemLink:hover {
    color: var(--primary-hover);
}

#retailersDisclaimer {
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid var(--hairline);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}


/********************* Responsive *********************/

@media (max-width: 1000px) {
    .retailersGroupsSectionList {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    #retailers {
        padding: 16px 16px 56px;
    }

    #retailersTools {
        padding: 16px;
    }

    #retailersTools #directoryFind {
        max-width: none;
    }

    .retailersGroupsSectionList {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .retailersGroupsMoreTableRow {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 10px 16px;
    }
}
