/* Ferramentas do cabeçalho: alto contraste e idiomas */

.cchla-contrast-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
    flex-shrink: 0;
}

.cchla-contrast-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cchla-contrast-toggle:hover,
.cchla-contrast-toggle:focus-visible {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    outline: 2px solid #facc15;
    outline-offset: 2px;
}

.cchla-contrast-toggle__icon {
    display: block;
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    border: 1.5px solid #374151;
    background: linear-gradient(90deg, #1f2937 0 50%, #fff 50% 100%);
}

.cchla-contrast-tooltip {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    min-width: 12rem;
    padding: 0.45rem 0.65rem;
    border-radius: 0.375rem;
    background: #111827;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 12000;
}

.cchla-contrast-wrap:hover .cchla-contrast-tooltip,
.cchla-contrast-wrap:focus-within .cchla-contrast-tooltip {
    opacity: 1;
    visibility: visible;
}

.cchla-header-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.cchla-header-tools__search-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
}

.cchla-header-tools__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.cchla-primary-nav {
    justify-content: space-evenly;
    margin-left: 2rem;
    margin-right: 0.75rem;
    min-width: 0;
}

.cchla-lang-switcher {
    display: block;
}

.cchla-lang-switcher__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cchla-lang-switcher__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.4rem;
    border-radius: 0.375rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1;
    opacity: 0.82;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.cchla-lang-switcher__btn:hover,
.cchla-lang-switcher__btn:focus-visible {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.cchla-lang-switcher__btn.is-active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.18);
}

.cchla-lang-switcher__flag {
    position: relative;
    width: 1rem;
    height: 0.75rem;
    border-radius: 1px;
    display: inline-block;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.cchla-lang-switcher__flag--br {
    background: #009b3a;
    overflow: hidden;
}

.cchla-lang-switcher__flag--br::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fedf00;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.cchla-lang-switcher__flag--br::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44%;
    height: 58%;
    background: #002776;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.cchla-lang-switcher__flag--us {
    background:
        linear-gradient(180deg, #b22234 0 7.7%, #fff 7.7% 15.4%, #b22234 15.4% 23.1%, #fff 23.1% 30.8%, #b22234 30.8% 38.5%, #fff 38.5% 46.2%, #b22234 46.2% 53.9%, #fff 53.9% 61.6%, #b22234 61.6% 69.3%, #fff 69.3% 77%, #b22234 77% 84.7%, #fff 84.7% 92.4%, #b22234 92.4% 100%);
}

.cchla-lang-switcher__flag--us::before {
    content: '';
    position: absolute;
    width: 45%;
    height: 54%;
    background: #3c3b6e;
}

.cchla-lang-switcher__flag--es {
    background: linear-gradient(180deg, #c60b1e 0 25%, #ffc400 25% 75%, #c60b1e 75% 100%);
}

.cchla-lang-switcher__flag--fr {
    background: linear-gradient(90deg, #0055a4 0 33.33%, #fff 33.33% 66.66%, #ef4135 66.66% 100%);
}

/* Modo alto contraste */
html.cchla-high-contrast,
body.cchla-high-contrast {
    background: #000 !important;
    color: #ff0 !important;
}

html.cchla-high-contrast #site-header,
body.cchla-high-contrast #site-header {
    background: #000 !important;
    border-bottom: 3px solid #ff0 !important;
}

html.cchla-high-contrast #site-header > .max-w-screen-xl > nav > a,
html.cchla-high-contrast #site-header > .max-w-screen-xl > nav > .group > button,
body.cchla-high-contrast #site-header > .max-w-screen-xl > nav > a,
body.cchla-high-contrast #site-header > .max-w-screen-xl > nav > .group > button,
html.cchla-high-contrast .cchla-lang-switcher__btn,
body.cchla-high-contrast .cchla-lang-switcher__btn,
html.cchla-high-contrast .cchla-search-toggle,
body.cchla-high-contrast .cchla-search-toggle {
    color: #ff0 !important;
}

html.cchla-high-contrast a,
body.cchla-high-contrast a {
    color: #0ff !important;
    text-decoration: underline !important;
}

html.cchla-high-contrast a:hover,
html.cchla-high-contrast a:focus,
body.cchla-high-contrast a:hover,
body.cchla-high-contrast a:focus {
    color: #fff !important;
    background: #ff0 !important;
}

html.cchla-high-contrast #site-header nav ul,
body.cchla-high-contrast #site-header nav ul {
    background: #000 !important;
    border: 2px solid #ff0 !important;
}

html.cchla-high-contrast #site-header nav ul a,
body.cchla-high-contrast #site-header nav ul a {
    color: #ff0 !important;
}

html.cchla-high-contrast #site-header nav ul a:hover,
body.cchla-high-contrast #site-header nav ul a:hover {
    background: #ff0 !important;
    color: #000 !important;
}

html.cchla-high-contrast main,
html.cchla-high-contrast .entry-content,
html.cchla-high-contrast .post-content,
body.cchla-high-contrast main,
body.cchla-high-contrast .entry-content,
body.cchla-high-contrast .post-content {
    background: #000 !important;
    color: #ff0 !important;
}

html.cchla-high-contrast h1,
html.cchla-high-contrast h2,
html.cchla-high-contrast h3,
html.cchla-high-contrast h4,
body.cchla-high-contrast h1,
body.cchla-high-contrast h2,
body.cchla-high-contrast h3,
body.cchla-high-contrast h4 {
    color: #fff !important;
}

html.cchla-high-contrast button,
html.cchla-high-contrast input,
html.cchla-high-contrast select,
html.cchla-high-contrast textarea,
body.cchla-high-contrast button,
body.cchla-high-contrast input,
body.cchla-high-contrast select,
body.cchla-high-contrast textarea {
    background: #000 !important;
    color: #ff0 !important;
    border: 2px solid #ff0 !important;
}

html.cchla-high-contrast .cchla-contrast-toggle,
body.cchla-high-contrast .cchla-contrast-toggle {
    background: #ff0 !important;
    border: 2px solid #fff !important;
}

html.cchla-high-contrast .cchla-contrast-toggle__icon,
body.cchla-high-contrast .cchla-contrast-toggle__icon {
    border-color: #000 !important;
    background: linear-gradient(90deg, #000 0 50%, #ff0 50% 100%) !important;
}
