/* Language switcher and the language suggestion banner (FR-10).
   Loaded on every page by parts/head.ejs. */

.fp-lang-switcher {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin: 0 8px 0 0;
    font-size: 14px;
    line-height: 1;
}
.fp-lang-switcher > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
}
.fp-lang-switcher > summary::-webkit-details-marker {
    display: none;
}
.fp-lang-switcher > summary:hover,
.fp-lang-switcher[open] > summary {
    color: #f91942;
}
.fp-lang-switcher > summary .sl {
    font-size: 17px;
}
.fp-lang-switcher-code {
    font-weight: 600;
    letter-spacing: .5px;
}
.fp-lang-switcher > ul {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1100;
    min-width: 150px;
    margin: 6px 0 0;
    padding: 6px 0;
    list-style: none;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
}
.fp-lang-switcher > ul li {
    margin: 0;
    padding: 0;
}
.fp-lang-switcher > ul a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 9px 18px;
    color: #333;
    font-size: 14px;
    line-height: 1.2;
    white-space: nowrap;
}
.fp-lang-switcher > ul a:hover {
    background: #f6f6f6;
    color: #f91942;
}
/* round flag of the language (resources/locales/languages.js: flag) */
.fp-lang-flag {
    flex: none;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    border-radius: 50%;
}
.mm-menu .header-lang a .fp-lang-flag {
    margin: -2px 10px 0 0;
}
.fp-lang-switcher > ul a.current {
    font-weight: 600;
    color: #f91942;
}

/* In the header row: aligned to the top like the sign-in link
   (.header-widget .sign-in has vertical-align: top), otherwise the switcher
   sat ~18px below the other header items. */
#header .header-widget .fp-lang-switcher {
    vertical-align: top;
}

/* Narrow header (hamburger, <=1024px): there is no room for the switcher -
   the right side wrapped to a second row. The languages are items of the
   mobile menu there (li.header-lang in parts/header.ejs). */
@media (max-width: 1024px) {
    #header .header-widget .fp-lang-switcher {
        display: none;
    }
}
.mm-menu .header-lang a.current {
    font-weight: 600;
    color: #f91942;
}

/* The header menu items appear one by one as the window widens (style.css:
   @media min-width 630 / 800 / 930 / 1010 / 1100 / 1160). Those thresholds
   were made for English labels and a header without the switcher; above
   1024px the switcher takes ~65px, and Spanish labels are longer. The same
   items appear later here, otherwise the right side of the header wraps to a
   second row. Checked on every width from 320 to 1600px (step 10), signed in
   and out, en and es. Items that are hidden stay in the mobile menu / the
   user menu. A new language with longer labels needs its own shifts. */
@media (min-width: 1025px) and (max-width: 1079px) {
    #header #navigation .header-pet-tags { display: none; }
}
@media (min-width: 1100px) and (max-width: 1199px) {
    #header #navigation .header-microchips { display: none; }
}
@media (min-width: 1160px) and (max-width: 1259px) {
    #header #navigation .header-dash-pets { display: none; }
}
@media (min-width: 630px) and (max-width: 679px) {
    html[lang="es"] #header #navigation .header-laf { display: none; }
}
@media (min-width: 800px) and (max-width: 839px) {
    html[lang="es"] #header #navigation .header-sbp { display: none; }
}
@media (min-width: 930px) and (max-width: 979px) {
    html[lang="es"] #header #navigation .header-microchip-lookup { display: none; }
}
@media (min-width: 1010px) and (max-width: 1099px) {
    html[lang="es"] #header #navigation .header-pet-tags { display: none; }
}
@media (min-width: 1100px) and (max-width: 1239px) {
    html[lang="es"] #header #navigation .header-microchips { display: none; }
}
/* the container stops at 1240px: signed in, the Spanish row never fits
   "Mis mascotas" - it stays in the user menu under the avatar */
@media (min-width: 1160px) {
    html[lang="es"] #header #navigation .header-dash-pets { display: none; }
}

/* Translations are longer than English (Spanish needs ~80px more in the
   desktop header): slightly tighter menu items keep the header on one row. */
#header #navigation.style-1 > ul > li > a {
    padding-left: 8px;
    padding-right: 8px;
}

.fp-lang-banner {
    position: relative;
    z-index: 1001;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 16px;
    padding: 9px 44px 9px 16px;
    background: #fff4e5;
    border-bottom: 1px solid #f3dcbc;
    color: #555;
    font-size: 14px;
    line-height: 1.35;
    text-align: center;
}
.fp-lang-banner-action {
    font-weight: 600;
    color: #f91942;
    white-space: nowrap;
}
.fp-lang-banner-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #888;
    font-size: 22px;
    line-height: 32px;
    cursor: pointer;
}
.fp-lang-banner-close:hover {
    color: #333;
}

.fp-footer-langs {
    margin-top: 8px;
}
.fp-footer-langs a {
    margin-right: 10px;
}
.fp-footer-langs a.current {
    font-weight: 600;
}

@media (max-width: 767px) {
    .fp-lang-switcher {
        margin-right: 6px;
    }
    .fp-lang-switcher > summary {
        padding: 8px 4px;
    }
}
