feat(i18n): responsive locale-switcher with SVG flags (closes #75)

This commit is contained in:
Hermes
2026-06-04 09:44:40 +00:00
parent 4b1c779846
commit 0186de90ec
4 changed files with 322 additions and 19 deletions

View File

@@ -1316,3 +1316,122 @@ footer {
text-align: center;
}
}
/* LOCALE SWITCHER (sub-Issue D) */
.locale-switcher {
display: flex;
align-items: center;
gap: 0.25rem;
list-style: none;
margin: 0;
padding: 0;
}
.locale-switcher__item {
display: flex;
}
.locale-switcher__option {
display: inline-flex;
align-items: center;
gap: 0.4rem;
min-height: 44px;
min-width: 44px;
padding: 0.45rem 0.55rem;
border: 1px solid transparent;
border-radius: 4px;
text-decoration: none;
font-size: 0.78rem;
font-weight: 500;
letter-spacing: 0.04em;
color: rgb(255 255 255 / 90%);
background: transparent;
transition:
background 0.2s,
border-color 0.2s,
color 0.2s,
transform 0.15s;
cursor: pointer;
}
.locale-switcher__option:hover,
.locale-switcher__option:focus-visible {
background: rgb(255 255 255 / 14%);
border-color: rgb(255 255 255 / 30%);
color: var(--white);
transform: translateY(-1px);
}
.locale-switcher__option.is-current {
background: rgb(255 255 255 / 20%);
border-color: var(--accent-light);
color: var(--white);
cursor: default;
}
.locale-switcher__option.is-current:hover {
transform: none;
}
nav.scrolled .locale-switcher__option {
color: var(--stone);
}
nav.scrolled .locale-switcher__option:hover,
nav.scrolled .locale-switcher__option:focus-visible {
background: var(--warm);
border-color: var(--stone);
color: var(--dark);
}
nav.scrolled .locale-switcher__option.is-current {
background: var(--cream);
border-color: var(--accent);
color: var(--dark);
}
.locale-switcher__option .flag {
width: 24px;
height: 16px;
flex: 0 0 24px;
border-radius: 2px;
box-shadow: 0 0 0 1px rgb(0 0 0 / 15%);
display: block;
}
.locale-switcher__label {
white-space: nowrap;
}
/* Hide labels on small screens, keep the 44px flag target */
@media (width <= 720px) {
.locale-switcher__label {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
.locale-switcher__option {
min-width: 44px;
padding: 0.55rem;
}
}
/* VISUALLY HIDDEN (a11y) */
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}