/* Portal accessibility — shared across all themes (e-MAG) */

html {
    font-size: calc(16px * var(--portal-font-scale, 1));
}

.portal-skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 10000;
    background: #000;
    color: #fff;
    padding: 0.75rem 1rem;
    text-decoration: none;
    font-weight: 700;
}

.portal-skip-link:focus {
    position: fixed;
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    overflow: visible;
    outline: 3px solid #ffff00;
}

.portal-a11y-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    width: 100%;
    font-size: 0.8125rem;
    color: var(--portal-a11y-fg, inherit);
}

.bg-primary .portal-a11y-toolbar,
.portal-a11y-toolbar-host--dark .portal-a11y-toolbar {
    --portal-a11y-fg: rgba(255, 255, 255, 0.85);
}

.header-top .portal-a11y-toolbar,
.portal-a11y-toolbar-host--light .portal-a11y-toolbar {
    --portal-a11y-fg: var(--body-text-color, #757f95);
}

.portal-a11y-toolbar__group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.portal-a11y-toolbar__link,
.portal-a11y-toolbar__button {
    background: transparent;
    border: 0;
    color: var(--portal-a11y-fg, inherit);
    padding: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    line-height: 1.2;
}

.portal-a11y-toolbar__link:hover,
.portal-a11y-toolbar__button:hover {
    text-decoration: underline;
}

.portal-a11y-toolbar__button[aria-pressed="true"] {
    font-weight: 700;
    text-decoration: underline;
}

.portal-a11y-font-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.portal-a11y-font-controls__label {
    font-weight: 600;
}

.portal-a11y-font-controls__btn {
    min-width: 1.75rem;
    min-height: 1.75rem;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    border-radius: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.portal-a11y-font-controls__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.portal-a11y-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Alto contraste — paleta e-MAG */
html.high-contrast {
    --bs-primary: #ffff00;
    --bs-primary-rgb: 255, 255, 0;
    --institutional: #ffff00;
    --institutional-light: #ffff00;
    --institutional-rgb: 255, 255, 0;
}

html.high-contrast,
html.high-contrast body {
    background: #000 !important;
    color: #fff !important;
}

html.high-contrast a {
    color: #ffff00 !important;
}

html.high-contrast a:hover,
html.high-contrast a:focus {
    color: #000 !important;
    background: #ffff00 !important;
    outline: none;
}

html.high-contrast a:hover *,
html.high-contrast a:focus * {
    color: #000 !important;
}

html.high-contrast :focus-visible {
    outline: 3px solid #ffff00 !important;
    outline-offset: 2px;
}

html.high-contrast img,
html.high-contrast video {
    filter: grayscale(1) contrast(1.15);
}

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

html.high-contrast .btn-primary,
html.high-contrast .btn-primary:hover {
    background: #ffff00 !important;
    color: #000 !important;
    border-color: #ffff00 !important;
}

/* Painéis, cards e blocos com fundo claro — paleta e-MAG */
html.high-contrast :is(
    header,
    footer,
    .card,
    .card-default,
    .card-icon,
    .card-hover,
    .category-card,
    .service-card,
    .service-card-header,
    .service-card-body,
    .service-card-section,
    .service-card-content,
    .legislation-category-card,
    .legislation-search-card,
    .form-card,
    .portal-sitemap-section,
    .portal-accessibility-page,
    .news-card,
    .news-scroll,
    .council-card,
    .dropdown-menu,
    .bg-white,
    .bg-light
) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
}

html.high-contrast :is(
    .card,
    .card-default,
    .card-icon,
    .card-hover,
    .category-card,
    .service-card,
    .legislation-category-card,
    .legislation-search-card,
    .form-card,
    .portal-sitemap-section,
    .portal-accessibility-page,
    .news-card
) :is(
    h1, h2, h3, h4, h5, h6,
    p, span, li, label, small, strong, em, div,
    .category-card-title,
    .category-card-description,
    .service-card-title,
    .service-card-label,
    .service-card-text,
    .service-card-list,
    .legislation-category-card-title,
    .legislation-category-card-description,
    .card-title-md,
    .card-subtitle-sm,
    .card-text,
    .card-list-item,
    .card-title-small,
    .card-date-small,
    .section-title,
    .section-subtitle
) {
    color: #fff !important;
}

html.high-contrast :is(
    .category-card-icon-wrapper,
    .service-card-icon-wrapper,
    .legislation-category-card-icon-wrapper
) {
    background-color: #000 !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}

html.high-contrast .service-card-badge,
html.high-contrast .service-card-badge.green,
html.high-contrast .service-card-badge.blue {
    background-color: #000 !important;
    color: #ffff00 !important;
    border: 1px solid #ffff00 !important;
}

html.high-contrast .service-card-button.primary,
html.high-contrast .service-card-button.primary:hover {
    background-color: #ffff00 !important;
    color: #000 !important;
    border-color: #ffff00 !important;
}

html.high-contrast .service-card-button.outline,
html.high-contrast .service-card-button.outline:hover {
    background-color: #000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

html.high-contrast .text-muted,
html.high-contrast .text-white-50,
html.high-contrast .text-dark,
html.high-contrast .text-body,
html.high-contrast .text-secondary {
    color: #fff !important;
}

/* Barra de acessibilidade — cinza escuro + texto branco (sem amarelo) */
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) {
    background-color: #2b2b2b !important;
    color: #fff !important;
    border-bottom: 1px solid #fff !important;
}

html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-toolbar__link,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-toolbar__button,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-font-controls__label,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) a {
    color: #fff !important;
    border-color: #fff !important;
}

html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-font-controls__btn {
    color: #fff !important;
    background-color: #1a1a1a !important;
    border-color: #fff !important;
}

html.high-contrast .bg-primary:has(.portal-a11y-toolbar) a:hover,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) a:focus,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-toolbar__link:hover,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-toolbar__button:hover,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) .portal-a11y-font-controls__btn:hover {
    color: #fff !important;
    background-color: #444 !important;
}

html.high-contrast .bg-primary:has(.portal-a11y-toolbar) a:hover *,
html.high-contrast .bg-primary:has(.portal-a11y-toolbar) a:focus * {
    color: #fff !important;
}

/* Substituir azul/institucional por amarelo ou branco (e-MAG) */
html.high-contrast .text-primary,
html.high-contrast .text-institutional,
html.high-contrast .text-blue-100,
html.high-contrast .text-blue-200,
html.high-contrast .text-blue-600,
html.high-contrast .text-blue-700,
html.high-contrast .news-category,
html.high-contrast .category-card-link,
html.high-contrast .document-icon-wrapper,
html.high-contrast .link-text,
html.high-contrast .link-icon,
html.high-contrast .hover-text-institutional,
html.high-contrast .tabs-container .nav-link.active,
html.high-contrast .tabs-container .nav-link.active p {
    color: #ffff00 !important;
}

html.high-contrast .service-card i,
html.high-contrast .service-card-section i,
html.high-contrast .service-card-info-item i {
    color: #ffff00 !important;
}

html.high-contrast ::marker {
    color: #ffff00 !important;
}

/* Header principal — preto suave + menu branco (sem amarelo) */
html.high-contrast header,
html.high-contrast header[style*="gradient"],
html.high-contrast header.bg-institutional-light {
    background: #1a1a1a !important;
    background-image: none !important;
    color: #fff !important;
    border-bottom-color: #fff !important;
}

html.high-contrast header a,
html.high-contrast header .text-white,
html.high-contrast header .text-white-50,
html.high-contrast header h1,
html.high-contrast header h2,
html.high-contrast header h3,
html.high-contrast header span:not(.visually-hidden),
html.high-contrast header i {
    color: #fff !important;
}

html.high-contrast header .btn {
    background-color: transparent !important;
    border-color: #fff !important;
    color: #fff !important;
}

html.high-contrast header a:hover,
html.high-contrast header a:focus,
html.high-contrast header .btn:hover,
html.high-contrast header .btn:focus {
    color: #fff !important;
    background-color: #444 !important;
    border-color: #fff !important;
}

html.high-contrast header a:hover *,
html.high-contrast header a:focus *,
html.high-contrast header .btn:hover i,
html.high-contrast header .btn:focus i {
    color: #fff !important;
}

html.high-contrast .bg-institutional,
html.high-contrast .bg-institutional-light:not(header),
html.high-contrast .hover-bg-institutional-light {
    background: #000 !important;
    background-image: none !important;
}

html.high-contrast .border-l-4,
html.high-contrast .border-primary,
html.high-contrast .hover-border-primary,
html.high-contrast .tabs-container .nav-link.active {
    border-color: #ffff00 !important;
}

html.high-contrast .bg-primary:not(.bg-opacity-10):not(:has(.portal-a11y-toolbar)),
html.high-contrast .rounded-circle.bg-primary,
html.high-contrast .size-32.bg-primary {
    background-color: #ffff00 !important;
    color: #000 !important;
    border: 2px solid #ffff00 !important;
}

html.high-contrast .bg-primary.bg-opacity-10,
html.high-contrast .badge.bg-primary,
html.high-contrast .badge.text-primary {
    background-color: #000 !important;
    color: #ffff00 !important;
    border: 1px solid #ffff00 !important;
    opacity: 1 !important;
}

html.high-contrast .btn-outline-light-gray,
html.high-contrast .btn-outline-secondary {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

html.high-contrast .btn-outline-light-gray:hover,
html.high-contrast .btn-outline-secondary:hover,
html.high-contrast .btn-outline-primary:hover,
html.high-contrast .btn-outline-primary:focus {
    background-color: #ffff00 !important;
    color: #000 !important;
    border-color: #ffff00 !important;
}

html.high-contrast .btn:hover,
html.high-contrast .btn:focus,
html.high-contrast a.btn:hover,
html.high-contrast a.btn:focus,
html.high-contrast .service-card-button.primary:hover,
html.high-contrast .service-card-button.primary:focus {
    background-color: #ffff00 !important;
    color: #000 !important;
    border-color: #ffff00 !important;
}

html.high-contrast .btn:hover i,
html.high-contrast .btn:hover svg,
html.high-contrast .btn:focus i,
html.high-contrast a.btn:hover i,
html.high-contrast a.btn:hover svg,
html.high-contrast .btn-outline-light-gray:hover i,
html.high-contrast .btn-outline-primary:hover i,
html.high-contrast .service-card-button.primary:hover i {
    color: #000 !important;
}

/* Utilitários de hover do tema — fundo amarelo + texto preto */
html.high-contrast .hover-bg-gray-50:hover,
html.high-contrast .hover-bg-gray-100:hover,
html.high-contrast .hover-bg-primary:hover,
html.high-contrast .hover-bg-accent-yellow:hover,
html.high-contrast .hover-bg-warning:hover,
html.high-contrast .hover-bg-institutional-light:hover {
    background-color: #ffff00 !important;
}

html.high-contrast .hover-bg-gray-50:hover,
html.high-contrast .hover-bg-gray-100:hover,
html.high-contrast .news-scroll article:hover {
    color: #000 !important;
}

html.high-contrast .hover-bg-gray-50:hover *,
html.high-contrast .hover-bg-gray-100:hover *,
html.high-contrast .news-scroll article:hover *,
html.high-contrast .hover-text-white:hover,
html.high-contrast .hover-text-primary:hover {
    color: #000 !important;
}

/* Header + menu — hover com letras brancas (sobrescreve utilitários globais) */
html.high-contrast header .dropdown-menu a,
html.high-contrast header .dropdown-megamenu a {
    color: #fff !important;
    background-color: transparent !important;
}

html.high-contrast header a:hover,
html.high-contrast header a:focus,
html.high-contrast header a.hover-text-primary:hover,
html.high-contrast header a.hover-text-accent-yellow:hover,
html.high-contrast header .dropdown-menu a:hover,
html.high-contrast header .dropdown-menu a:focus,
html.high-contrast header .dropdown-megamenu a:hover,
html.high-contrast header .dropdown-megamenu a:focus {
    color: #fff !important;
    background-color: #444 !important;
}

html.high-contrast header a:hover *,
html.high-contrast header a:focus *,
html.high-contrast header .dropdown-menu a:hover *,
html.high-contrast header .dropdown-megamenu a:hover *,
html.high-contrast header nav a:hover i,
html.high-contrast header nav a:focus i {
    color: #fff !important;
}

html.high-contrast header .dropdown-megamenu h6,
html.high-contrast header .dropdown-menu h6 {
    color: #ffff00 !important;
}

html.high-contrast .category-card:hover .category-card-icon-wrapper,
html.high-contrast .legislation-category-card:hover .legislation-category-card-icon-wrapper,
html.high-contrast .legislation-category-card:hover .legislation-category-card-icon-wrapper.blue,
html.high-contrast .legislation-category-card:hover .legislation-category-card-icon-wrapper.orange,
html.high-contrast .legislation-category-card:hover .legislation-category-card-icon-wrapper.purple {
    background-color: #ffff00 !important;
    color: #000 !important;
    border-color: #ffff00 !important;
}

html.high-contrast a.category-card:hover,
html.high-contrast a.legislation-category-card:hover,
html.high-contrast a.card-hover:hover {
    background-color: #ffff00 !important;
    color: #000 !important;
}

html.high-contrast a.category-card:hover *,
html.high-contrast a.legislation-category-card:hover *,
html.high-contrast a.card-hover:hover * {
    color: #000 !important;
}

html.high-contrast .carousel-indicators [data-bs-target] {
    background-color: #fff !important;
}

html.high-contrast .carousel-indicators .active {
    background-color: #ffff00 !important;
}

/* Mapa do site */
.portal-sitemap-container {
    width: 100%;
}

.portal-sitemap-title {
    font-weight: 700;
}

.portal-sitemap-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

.portal-sitemap-section-title {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #334155;
}

.portal-sitemap-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.portal-sitemap-level-0 > .portal-sitemap-item + .portal-sitemap-item {
    margin-top: 0.35rem;
}

.portal-sitemap-level-1,
.portal-sitemap-level-2,
.portal-sitemap-level-3 {
    margin-top: 0.35rem;
    margin-left: 1rem;
    padding-left: 0.75rem;
    border-left: 2px solid #e2e8f0;
}

.portal-sitemap-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
}

.portal-sitemap-link:hover {
    text-decoration: underline;
}

.portal-sitemap-label {
    font-weight: 600;
}

html.high-contrast .portal-sitemap-section {
    border-color: #fff !important;
}

html.high-contrast .portal-sitemap-section-title {
    color: #fff !important;
}

html.high-contrast .portal-sitemap-level-1,
html.high-contrast .portal-sitemap-level-2,
html.high-contrast .portal-sitemap-level-3 {
    border-left-color: #ffff00 !important;
}

.portal-accessibility-page .portal-accessibility-section + .portal-accessibility-section {
    padding-top: 0.25rem;
}

.portal-accessibility-list {
    margin: 0;
    padding-left: 1.25rem;
}

.portal-accessibility-list li + li {
    margin-top: 0.5rem;
}

.portal-accessibility-list kbd {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.25rem;
    background: #f8fafc;
    color: #1e293b;
    font-size: 0.875em;
    font-family: inherit;
}

html.high-contrast .portal-accessibility-list kbd {
    background: #000 !important;
    color: #fff !important;
    border-color: #ffff00 !important;
}
