/* =====================================================================
   ajustes.css — correções de experiência que valem para QUALQUER tema
   (carregado por último em todas as páginas)
   ===================================================================== */

/* Celular: cabeçalho compacto (antes ocupava quase meia tela) */
@media (max-width: 768px) {
    html body .ar-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 14px;
    }
    html body .ar-logo-container { gap: 10px; }
    html body .ar-logo { width: 36px; height: auto; }
    html body .ar-titles span,
    html body .ar-titles .ar-logo-text,
    html body .ar-logo-text { font-size: 1.2rem; margin: 0; }
    html body .ar-nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        width: 100%;
    }
    html body .ar-nav a,
    html body .ar-lang-btn {
        font-size: .8rem;
        padding: 7px 10px;
        gap: 6px;
    }
    /* havia um espaço vazio de 500px no fim das páginas no celular */
    html body { padding-bottom: 0; }
    html body .ar-hero h1 { font-size: 1.7rem; line-height: 1.2; }
}

/* Lang menu também abre com toque/teclado */
.ar-lang-selector:focus-within .ar-lang-menu { display: block; }

/* Links de pular para o conteúdo e foco visível (acessibilidade) */
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Respeita quem prefere menos animação */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Rolagem suave para os atalhos (#ficha, #galeria) sem esconder o título */
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 16px; }

@media (max-width: 768px) {
    /* o seletor "Agrupar por década" tinha largura fixa e ficava torto no celular */
    html body .ar-filter-group > div[style*="width: 250px"] { width: 100% !important; }
    html body .ar-filter-results { flex-wrap: wrap; gap: 8px; }
}

/* Contraste mínimo de leitura (acessibilidade) */
html body .ar-filter-reset { color: #ff6b7f; }
html body .ar-card-stat-lbl { color: #a3a3a3; }
html body .ar-card-versions-btn { color: #ff6b7f; }
html body .ar-mini-version-link { display: inline-block; min-height: 24px; line-height: 24px; }

/* Busca no cabeçalho (todas as páginas) */
.ar-busca-topo {
    display: flex; align-items: center; height: 36px; border-radius: 10px; overflow: hidden;
    border: 1px solid rgba(127,127,127,.35); background: rgba(127,127,127,.08);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.ar-busca-topo:focus-within { border-color: var(--ar-red); box-shadow: 0 0 0 3px rgba(224,38,63,.2); }
.ar-busca-topo input {
    width: 170px; height: 100%; border: 0; background: transparent; color: inherit;
    font: inherit; font-size: .88rem; padding: 0 4px 0 12px; outline: none;
}
.ar-busca-topo input::placeholder { color: #8b919a; }
.ar-busca-topo input::-webkit-search-cancel-button { display: none; }
.ar-busca-topo button {
    height: 100%; width: 38px; border: 0; background: transparent; color: #8b919a; cursor: pointer; font-size: .9rem;
}
.ar-busca-topo button:hover { color: var(--ar-red); }
@media (max-width: 1100px) { .ar-busca-topo input { width: 130px; } }
@media (max-width: 768px) {
    /* no celular: só a lupa, que abre a pesquisa com o campo pronto */
    html body .ar-busca-topo { width: auto; border: 0; background: transparent; height: auto; }
    html body .ar-busca-topo input { display: none; }
    html body .ar-busca-topo button { width: auto; padding: 7px 10px; font-size: .9rem; color: inherit; }
}

/* Cabeçalho no computador: nada quebra em duas linhas */
html body .ar-nav a, html body .ar-titles span, html body .ar-logo-text { white-space: nowrap; }
@media (min-width: 769px) {
    html body .ar-header { padding-left: 4%; padding-right: 4%; gap: 20px; }
    html body .ar-nav { gap: 6px; align-items: center; }
}
@media (min-width: 769px) and (max-width: 1180px) {
    html body .ar-header { flex-direction: column; gap: 10px; padding-top: 12px; padding-bottom: 12px; }
    html body .ar-nav { flex-wrap: wrap; justify-content: center; }
}

/* Rodapé no fluxo normal da página.
   Antes ele ficava "position: absolute" no fundo, com um espaço de 350-500px reservado no body;
   quando o conteúdo era maior que o espaço reservado, o rodapé subia por cima dos cartões. */
html body { padding-bottom: 0; }
html body .ar-footer { position: static; bottom: auto; margin-top: 60px; }

/* Conteúdo nunca mais largo que a tela (Sobre, Contato, Política, Termos) */
html body .ar-main-container { width: 100%; min-width: 0; box-sizing: border-box; overflow-wrap: anywhere; }

/* Anúncio que não carregou não deixa buraco na página (todas as páginas) */
.ar-ad-container:has(ins[data-ad-status="unfilled"]) { min-height: 0 !important; height: 0 !important; margin: 0 !important; overflow: hidden; }

/* =====================================================================
   CELULAR (até 768px)
   ===================================================================== */
@media (max-width: 768px) {
    /* Cabeçalho em 2 linhas: logo + lupa + idioma em cima, links embaixo */
    html body .ar-header { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; row-gap: 8px; column-gap: 4px; }
    html body .ar-header .ar-nav { display: contents; }
    html body .ar-header .ar-logo-container { order: 1; flex: 1 1 auto; min-width: 0; }
    html body .ar-header .ar-busca-topo { order: 2; }
    html body .ar-header .ar-lang-selector { order: 3; }
    html body .ar-header::after { content: ""; order: 4; flex-basis: 100%; height: 0; }
    html body .ar-header .ar-nav > a { order: 5; }
    html body .ar-lang-menu { right: 0; left: auto; }

    /* Banner: altura acompanha o texto (antes o título era cortado) */
    html body .ar-hero { height: auto !important; min-height: 170px; }
    html body .ar-hero-content { padding: 28px 16px; }
    html body .ar-hero p { font-size: .92rem; }

    /* Espaço reservado de anúncio menor no celular */
    html body .ar-ad-container { min-height: 0; margin: 12px 0 !important; }

    /* Paginação da pesquisa cabe na tela */
    html body .ar-pagination { gap: 6px; padding: 12px 0; flex-wrap: wrap; }
    html body .ar-pagination button { width: 34px; height: 34px; flex-shrink: 0; }
    html body .ar-page-numbers { gap: 2px; flex-wrap: wrap; justify-content: center; }
    html body .ar-page-numbers > * { min-width: 30px; }

    /* Nome da versão quebra linha em vez de cortar com "..." */
    html body .ar-vname { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }

    /* Títulos de seção um pouco menores */
    html body .ar-section-title { font-size: 1.45rem; line-height: 1.25; }

    /* Rodapé mais compacto */
    html body .ar-footer { margin-top: 40px; padding-top: 32px; }
    html body .ar-footer-content { gap: 24px; }
}
@media (max-width: 480px) {
    /* links do menu sem ícone, para caberem numa linha só */
    html body .ar-header .ar-nav > a > i { display: none; }
    html body .ar-header .ar-nav > a { padding: 6px 9px; font-size: .8rem; }
}
@media (max-width: 768px) {
    html body .ar-pagination { flex-wrap: nowrap; gap: 4px; }
    html body .ar-page-numbers { flex-wrap: nowrap; gap: 2px; }
    html body .ar-page-numbers > * { width: 32px; height: 32px; min-width: 0; font-size: .85rem; padding: 0; }
}
