/* Scoped to the Grid instance authored with ID = "country-selector" (matches me.ford.com country/language selector layout). */
#country-selector {
    --country-selector-content-width: 51.25rem;
    --country-selector-english-gap: 3rem;
    --country-selector-arabic-gap: 4rem;
    --country-selector-divider-color: var(--subtleBorderColor, #d8d8d8);
}

#country-selector .cmp-grid__heading {
    text-align: center;
    font-weight: 300;
    font-size: 2.5rem;
    line-height: 1.3;
    color: var(--subtleFontColor, #6e6e6e);
}

#country-selector .cmp-grid__items-section {
    max-width: var(--country-selector-content-width);
    margin: 0 auto;
    padding-inline: 0;
}

#country-selector .cmp-grid__items-section > div {
    justify-content: center;
    column-gap: 0;
}

#country-selector .cmp-text:is(.cmp-container > div:first-child, .cmp-container > div:first-child *) {
    padding-inline-end: var(--country-selector-english-gap);
}

/* This page's own locale isn't Arabic, so force the Arabic Ford webfont and RTL direction only for the second (last) column, which always holds the Arabic content (matches me.ford.com's ar_* locale pages). Targeted by position, not a lang attribute, since lang="ar" isn't reliably authorable via the Text component dialog. */
#country-selector .cmp-text:is(.cmp-container > div:last-child, .cmp-container > div:last-child *) {
    padding-inline-end: var(--country-selector-arabic-gap);
    border-inline-end: 1px solid var(--country-selector-divider-color);
    --FordFont: 'FordFontArabic', 'FordFont', Arial, sans-serif;
    font-family: var(--FordFont);
    direction: rtl;
    text-align: start;
}

#country-selector .cmp-text h2 {
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.4;
    color: var(--primaryFontColor, #000);
    margin-bottom: 18px;
}

#country-selector .cmp-text ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#country-selector .cmp-text li {
    margin-bottom: 16px;
    font-size: 0.8125rem;
}

#country-selector .cmp-text a {
    color: var(--activeFontColor, #0562d2);
    font-size: 0.8125rem;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

#country-selector .cmp-text a:hover {
    text-decoration-thickness: 2px;
}

#country-selector .cmp-text a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Mobile breakpoint matches the site's $screen-sm-max (767px) convention, see ui.frontend/src/main/webpack/ford/site/_customvars.scss. */
@media (max-width: 767px) {
    /* Row-divider list look: every row gets a line above and below it (top line shared with the previous row's bottom line). */
    #country-selector .cmp-grid__items-section {
        border-top: 1px solid var(--country-selector-divider-color);
    }

    #country-selector .cmp-text:is(.cmp-container > div:first-child, .cmp-container > div:first-child *) {
        padding-inline-end: 0;
        border-bottom: 1px solid var(--country-selector-divider-color);
    }

    #country-selector .cmp-text:is(.cmp-container > div:last-child, .cmp-container > div:last-child *) {
        border-inline-end: none;
        padding-inline-end: 0;
        padding-top: 0;
        margin-top: 0;
        border-bottom: 1px solid var(--country-selector-divider-color);
    }

    /* Collapsed-by-default accordion; country-selector.js toggles the "is-expanded" class on click/keypress. */
    #country-selector .cmp-text h2 {
        text-align: center;
        padding: 18px 22px;
        margin-bottom: 0;
        color: var(--activeFontColor, #0562d2);
        font-size: 1rem;
    }

    #country-selector .cmp-text.is-accordion h2 {
        padding: 0;
    }

    #country-selector .country-selector__toggle {
        position: relative;
        display: block;
        box-sizing: border-box;
        width: 100%;
        border: 0;
        border-radius: 0;
        padding: 18px 22px;
        background: transparent;
        color: inherit;
        font: inherit;
        text-align: center;
        cursor: pointer;
    }

    #country-selector .country-selector__toggle:focus-visible {
        outline: 2px solid currentColor;
        outline-offset: -2px;
    }

    #country-selector .country-selector__toggle::after {
        content: '';
        position: absolute;
        right: 2px;
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.2s ease;
    }

    #country-selector .cmp-text.is-expanded .country-selector__toggle::after {
        transform: rotate(-135deg);
    }

    #country-selector .cmp-text ul {
        margin-top: 0;
        padding-bottom: 18px;
    }

    #country-selector .cmp-text.is-accordion ul {
        display: none;
    }

    #country-selector .cmp-text.is-expanded ul {
        display: block;
    }
}
