/* Only the dropdown mechanics live here; type and button styling come from the theme. */

.c-country {
    position: relative;
    display: inline-block;
    margin-left: 1.2rem;
}

/* Deliberately not a .c-btn--link: the theme fills that with a gold wash on hover, which
   reads as a block of colour around a flag rather than as a link. */
.c-country__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
}

.c-country__toggle:hover .c-country__flag,
.c-country__toggle:focus-visible .c-country__flag {
    border-color: var(--color-secondary, #c79455);
}

.c-country__toggle:focus-visible {
    outline: 2px solid var(--color-secondary, #c79455);
    outline-offset: 2px;
}

.c-country__flag {
    display: block;
    width: 20px;
    height: 15px;
    border: 1px solid rgba(61, 62, 73, 0.15);
    border-radius: 1px;
}

.c-country__chevron {
    width: 10px;
    height: 6px;
    transition: transform 0.15s ease;
    opacity: 0.6;
}

.c-country__toggle:hover .c-country__chevron {
    opacity: 1;
}

.c-country[data-open] .c-country__chevron {
    transform: rotate(180deg);
}

.c-country__list {
    position: absolute;
    /* The theme's own scale: a header dropdown sits with the menus, not above modals. */
    z-index: var(--z-menu, 2000);
    top: 100%;
    right: 0;
    min-width: 19rem;
    margin: 0;
    padding: 0.4rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(61, 62, 73, 0.12);
    box-shadow: 0 2px 12px rgba(61, 62, 73, 0.18);
}

/* The panel overlays the page, so it must never be left visible but empty if a stylesheet
   or an image fails to load. */
.c-country__list[hidden] {
    display: none;
}

.c-country__item {
    margin: 0;
    line-height: 1.3;
}

/* The theme decorates every list item with a bullet, which has no place in a menu. */
.c-country__item::before {
    content: none;
}

.c-country__link {
    /* The topbar decorates every link with an absolutely positioned ::before highlight.
       Without a positioning context of its own, that highlight resolves against the panel and
       covers it whole, and the last row's one ends up on top of all the others. */
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.2rem;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

/* The highlight is positioned, so it paints above the row's own inline content. Lifting the
   flag and the label keeps them readable while hovered. */
.c-country__link > * {
    position: relative;
}

/* The hover background is the theme's own highlight, now that it stays inside the row. */
.c-country__link:focus-visible {
    outline: 2px solid var(--color-secondary, #c79455);
    outline-offset: -2px;
}
