/**
 * portal-polish.css — refinamento visual do site público (shell + módulos)
 * Layout e ordem das seções intactos. Ignorado em body.high-contrast.
 */

body:not(.high-contrast) {
    --border-subtle: rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08);
    --shadow-card-hover: 0 8px 24px rgba(37, 99, 235, 0.1);
    --radius-lg: 0.625rem;
    --radius-xl: 0.875rem;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --bg-body: #eef1f6;
    --bg-subtle: #f8fafc;
}

body:not(.high-contrast) {
    font-family: var(--font-family);
    font-size: 1.0625rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body:not(.high-contrast) .header,
body:not(.high-contrast) .nav-link,
body:not(.high-contrast) .btn-primary,
body:not(.high-contrast) .btn-outline,
body:not(.high-contrast) .search-box,
body:not(.high-contrast) .content-actions {
    font-family: var(--font-family);
}

/* ── Chrome: system bar, header, breadcrumb ── */
body:not(.high-contrast) .system-bar {
    background: linear-gradient(90deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}

body:not(.high-contrast) .header {
    box-shadow: 0 1px 0 var(--border-subtle), 0 4px 16px rgba(15, 23, 42, 0.04);
    border-bottom-color: var(--border-subtle);
}

body:not(.high-contrast) .breadcrumb-container {
    background: var(--bg-subtle);
    border-bottom-color: var(--border-subtle);
    padding: var(--spacing-sm) 0;
}

body:not(.high-contrast) .breadcrumb-item.active {
    font-weight: 500;
    max-width: min(42vw, 22rem);
    display: inline-block;
    vertical-align: bottom;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Hero e busca ── */
body:not(.high-contrast) .hero h1 {
    font-weight: 600;
    letter-spacing: -0.03em;
}

body:not(.high-contrast) .search-box {
    border-radius: var(--radius-xl);
    border-color: var(--border-subtle);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
    padding: 0.4rem 0.45rem 0.4rem var(--spacing-md);
}

body:not(.high-contrast) .search-box:focus-within {
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.18);
    border-color: rgba(59, 130, 246, 0.35);
}

body:not(.high-contrast) .search-box button {
    border-radius: var(--radius-lg);
    padding: 0.5rem var(--spacing-lg);
    font-weight: 600;
}

/* ── Carrossel de serviços ── */
body:not(.high-contrast) .service-card-title-minimal {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

body:not(.high-contrast) .service-icon-minimal {
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    background: var(--bg-subtle);
}

body:not(.high-contrast) .services-carousel-section {
    border-bottom-color: var(--border-subtle);
    background: var(--bg-card);
}

/* ── Abas e editais (home) ── */
body:not(.high-contrast) .home-tab-panel-title {
    text-transform: none;
    letter-spacing: -0.02em;
    font-weight: 600;
    font-size: var(--font-size-lg);
    background: transparent;
    border-left: 3px solid var(--primary-base);
    padding: var(--spacing-sm) 0 var(--spacing-sm) var(--spacing-md);
    border-radius: 0;
}

body:not(.high-contrast) .home-publicacoes-acesso-rapido .home-tab-panel-title {
    text-align: left;
}

body:not(.high-contrast) .publicacao-acesso-rapido-btn {
    text-transform: none;
    letter-spacing: -0.01em;
    font-weight: 600;
    font-size: var(--font-size-sm);
    min-height: 52px;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

body:not(.high-contrast) .forma-botoes-grupo {
    border-color: var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

body:not(.high-contrast) .forma-botoes-grupo-titulo {
    font-weight: 600;
    border-bottom-color: rgba(59, 130, 246, 0.2);
}

body:not(.high-contrast) .home-tabs-list {
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    padding: 4px;
}

body:not(.high-contrast) .home-tabs-list .home-tab-link.is-active {
    box-shadow: var(--shadow-sm);
}

/* ── Títulos de seção ── */
body:not(.high-contrast) .section-header h1,
body:not(.high-contrast) .section-header h2 {
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

body:not(.high-contrast) .section-header p {
    line-height: 1.6;
    max-width: 42rem;
}

body:not(.high-contrast) .ne-header h1 {
    font-weight: 600;
}

body:not(.high-contrast) .home-secretarias-titulo {
    font-weight: 600;
    text-transform: none;
    letter-spacing: -0.03em;
}

body:not(.high-contrast) .home-secretaria-sem-noticias {
    padding: var(--spacing-lg);
    background: var(--bg-subtle);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-subtle);
    text-align: center;
}

/* ── Cards e listagens ── */
body:not(.high-contrast) .content-card,
body:not(.high-contrast) .service-card,
body:not(.high-contrast) .ne-noticia-card,
body:not(.high-contrast) .ne-evento-card,
body:not(.high-contrast) .article-detail {
    border-color: var(--border-subtle);
    border-radius: var(--radius-xl);
}

body:not(.high-contrast) .content-card:hover,
body:not(.high-contrast) .service-card:hover,
body:not(.high-contrast) .ne-noticia-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(59, 130, 246, 0.35);
}

body:not(.high-contrast) .ne-evento-card:hover {
    transform: translateX(2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(59, 130, 246, 0.35);
}

body:not(.high-contrast) .content-card-image-wrap {
    background: linear-gradient(145deg, #e2e8f0 0%, #f1f5f9 100%);
}

body:not(.high-contrast) .content-card-body h2,
body:not(.high-contrast) .service-card-body h2 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

body:not(.high-contrast) .ne-chip {
    font-weight: 500;
    letter-spacing: 0;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.65rem;
}

body:not(.high-contrast) .ne-noticia-card__titulo {
    letter-spacing: -0.02em;
}

body:not(.high-contrast) .ne-noticia-card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(59, 130, 246, 0.08);
    text-decoration: none;
}

body:not(.high-contrast) .ne-noticia-card__link:hover {
    background: rgba(59, 130, 246, 0.14);
    text-decoration: none;
}

body:not(.high-contrast) .ne-noticia-card__link::after {
    content: "→";
    font-size: 0.9em;
    opacity: 0.85;
}

/* ── Botões globais ── */
body:not(.high-contrast) .btn-primary {
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(37, 99, 235, 0.2);
}

body:not(.high-contrast) .btn-primary:hover {
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.28);
}

body:not(.high-contrast) .btn-outline {
    border-radius: var(--radius-lg);
    border-width: 1px;
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body:not(.high-contrast) .btn-outline:hover {
    border-color: var(--primary-base);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

/* ── Navegação inferior: Voltar / Início / Secretaria (site inteiro) ── */
body:not(.high-contrast) .content-actions,
body:not(.high-contrast) .ne-actions.content-actions {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-subtle);
    gap: var(--spacing-sm);
    align-items: center;
}

body:not(.high-contrast) .content-actions .btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.15rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: -0.01em;
    background: var(--bg-card);
    color: var(--primary-dark, var(--primary-base));
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition:
        background var(--transition-base),
        border-color var(--transition-base),
        color var(--transition-base),
        box-shadow var(--transition-base),
        transform var(--transition-fast);
}

body:not(.high-contrast) .content-actions .btn-outline::before {
    content: "";
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    background: currentColor;
    opacity: 0.9;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Segundo botão (Início, Governo, etc.) — estilo secundário */
body:not(.high-contrast) .content-actions .btn-outline + .btn-outline {
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
    box-shadow: none;
}

body:not(.high-contrast) .content-actions .btn-outline + .btn-outline::before {
    display: none;
}

body:not(.high-contrast) .content-actions .btn-outline:hover {
    background: var(--primary-base);
    color: var(--text-inverse);
    border-color: var(--primary-base);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.22);
}

body:not(.high-contrast) .content-actions .btn-outline + .btn-outline:hover {
    background: var(--bg-card);
    color: var(--primary-base);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: var(--shadow-sm);
}

body:not(.high-contrast) .content-actions .btn-outline:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    body:not(.high-contrast) .content-actions .btn-outline {
        flex: 1 1 calc(50% - var(--spacing-sm));
        justify-content: center;
        min-width: min(100%, 10rem);
    }

    body:not(.high-contrast) .content-actions .btn-outline:only-child {
        flex: 1 1 100%;
    }
}

body:not(.high-contrast) .btn-secondary-soft {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    background: var(--bg-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    transition: background var(--transition-base), border-color var(--transition-base);
}

body:not(.high-contrast) .btn-secondary-soft:hover {
    background: var(--bg-card);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--primary-base);
}

/* ── Artigo / detalhe ── */
body:not(.high-contrast) .article-detail h1 {
    letter-spacing: -0.03em;
    font-weight: 600;
    line-height: 1.2;
}

body:not(.high-contrast) .article-detail .article-body {
    line-height: 1.75;
}

body:not(.high-contrast) .article-body-richtext a {
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

/* ── Busca: resultados e vazio ── */
body:not(.high-contrast) .search-results-section h2 {
    font-weight: 600;
    letter-spacing: -0.02em;
    border-bottom-width: 1px;
    border-bottom-color: var(--border-subtle);
}

body:not(.high-contrast) .search-no-results,
body:not(.high-contrast) .search-no-query {
    max-width: 40rem;
    margin-left: auto;
    margin-right: auto;
}

body:not(.high-contrast) .search-helpful-links {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-xl);
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    text-align: left;
}

body:not(.high-contrast) .search-helpful-links h3 {
    margin: 0 0 var(--spacing-md);
    font-size: var(--font-size-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
}

body:not(.high-contrast) .search-helpful-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

body:not(.high-contrast) .search-helpful-links .btn-primary {
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-sm);
}

body:not(.high-contrast) .search-helpful-links .btn-secondary-soft {
    padding: var(--spacing-sm) var(--spacing-lg);
}

body:not(.high-contrast) .search-no-query kbd {
    display: inline-block;
    padding: 0.1em 0.45em;
    font-size: 0.85em;
    font-family: inherit;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

/* ── Ouvidoria, vagas, ramais, nossa cidade (superfície comum) ── */
body:not(.high-contrast) .ouvidoria-page .ouv-hero,
body:not(.high-contrast) .vagas-header,
body:not(.high-contrast) .ramais-hero {
    border-radius: var(--radius-xl);
}

body:not(.high-contrast) .nc-hero-cta,
body:not(.high-contrast) .nh-hero-cta {
    border-radius: var(--radius-lg);
}

body:not(.high-contrast) .nc-card,
body:not(.high-contrast) .nh-bloco-imagem-wrap {
    border-radius: var(--radius-xl);
}

body:not(.high-contrast) .ouv-search-card,
body:not(.high-contrast) .ouv-form-card,
body:not(.high-contrast) .ouv-section,
body:not(.high-contrast) .ouv-result-card,
body:not(.high-contrast) .vaga-card,
body:not(.high-contrast) .ramais-card {
    border-color: var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

body:not(.high-contrast) .ouv-btn-submit,
body:not(.high-contrast) .vaga-btn-candidatar {
    border-radius: var(--radius-lg);
}

body:not(.high-contrast) .ouv-credential {
    border-radius: var(--radius-xl);
}

body:not(.high-contrast) .portal-callout {
    margin: var(--spacing-md) 0 0;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-sm);
    line-height: 1.55;
    color: var(--text-secondary);
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-lg);
}

body:not(.high-contrast) .portal-callout strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ── Páginas estáticas (chrome) ── */
body:not(.high-contrast) .pagina-capa {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

body:not(.high-contrast) .pagina-bloco-titulo {
    letter-spacing: -0.02em;
}

/* ── Footer e flutuantes ── */
body:not(.high-contrast) .info-municipio-header h2,
body:not(.high-contrast) .footer-grid h3 {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 600;
}

body:not(.high-contrast) .lgpd-banner {
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(8px);
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.2);
    padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom, 0px));
}

body:not(.high-contrast) .lgpd-banner-btn {
    border-radius: var(--radius-lg);
}

body:not(.high-contrast) .guia-portal-btn {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    height: 44px;
}

body:not(.high-contrast) .guia-portal-btn:hover {
    transform: translateY(-1px);
}

body:not(.high-contrast) .guia-portal-modal {
    border-radius: var(--radius-xl);
}

body:not(.high-contrast) .pagination a,
body:not(.high-contrast) .pagination span {
    border-radius: var(--radius-md);
}

/* ── Mobile: grids e tipografia ── */
@media (max-width: 768px) {
    body:not(.high-contrast) .forma-exibicao--botoes-agrupados .publicacoes-acesso-rapido-list {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
        gap: var(--spacing-sm);
    }

    body:not(.high-contrast) .publicacao-acesso-rapido-btn {
        min-height: 48px;
        padding: var(--spacing-sm) var(--spacing-md);
        hyphens: none;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    body:not(.high-contrast) .breadcrumb-item.active {
        max-width: 55vw;
    }

    body:not(.high-contrast) .lgpd-banner-inner {
        flex-direction: column;
        align-items: stretch;
    }

    body:not(.high-contrast) .guia-portal-btn-text {
        display: none;
    }
}
