/* ==== Fichário ====
 *
 * Cores, botões, painel e chips vêm de /css/edicao.css. Aqui fica o que é só
 * do fichário: as duas vozes do corpo (citação e comentário), o cartão, e as
 * listas de vizinhança.
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--texto);
    background-color: var(--fundo);
    padding: 1.5rem;
}

.cabecalho,
main {
    max-width: 44rem;
    margin: 0 auto;
}

/* ---- Cabeçalho ---- */

h1 {
    font-size: 2.5em;
    margin-bottom: 0.1em;
}

.subtitulo {
    color: var(--texto-fraco);
    font-size: 0.95em;
}

.navegacao {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.75rem 0 0 -0.5rem;
}

.navegacao a {
    color: var(--texto);
    text-decoration: none;
    font-weight: bold;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navegacao a:hover {
    background-color: var(--hover);
}

.navegacao a.atual {
    background-color: var(--acento);
    color: var(--sobre-acento);
}

.rotulo-oculto {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---- Muro de quem não entrou ---- */

.muro {
    margin-top: 2rem;
    padding: 2rem 1.5rem;
    background: var(--cartao);
    border: 1px solid var(--borda);
    border-radius: 6px;
    text-align: center;
}

.muro h2 {
    font-size: 1.1em;
    margin-bottom: 0.5rem;
}

.muro p {
    color: var(--texto-fraco);
    font-size: 0.95em;
    max-width: 26rem;
    margin: 0 auto;
}

/* ---- Formulário ---- */

.painel textarea[name="corpo"] {
    min-height: 12rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.92em;
    line-height: 1.5;
}

.painel code {
    font-size: 0.95em;
    padding: 0 0.2em;
    border-radius: 3px;
    background: var(--hover);
}

.campo-local {
    flex: 0 1 11rem !important;
}

.campo-ano {
    flex: 0 1 6rem !important;
}

.linha-fonte {
    margin: -0.5rem 0 0.9rem;
}

.sugestoes .chip.prioritario {
    font-weight: bold;
}

/* A lista que aparece ao digitar [[ no corpo. */
.sugestoes-ligacao {
    list-style: none;
    margin: -0.6rem 0 0.9rem;
    border: 1px solid var(--borda-campo);
    border-radius: 4px;
    background: var(--cartao);
    max-height: 16rem;
    overflow-y: auto;
    font-size: 0.88em;
}

.sugestoes-ligacao li {
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.sugestoes-ligacao li + li {
    border-top: 1px solid var(--divisor);
}

.sugestoes-ligacao li[aria-selected="true"],
.sugestoes-ligacao li:hover {
    background: var(--hover);
}

.sugestoes-ligacao .meta {
    color: var(--texto-mudo);
    font-family: "Courier New", Courier, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45%;
}

.sugestoes-ligacao .nada {
    cursor: default;
    color: var(--texto-mudo);
}

/* ---- Filtros ---- */

.filtros {
    margin: 2rem 0 1rem;
    border-bottom: 1px solid var(--borda);
    padding-bottom: 1rem;
}

.campo-busca input,
.filtro-fonte select {
    width: 100%;
    font: inherit;
    color: inherit;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--borda-campo);
    border-radius: 4px;
    background: var(--cartao);
}

.campo-busca input:focus {
    outline: 2px solid var(--acento);
    outline-offset: 1px;
}

.linha-filtros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.9rem;
}

.grupo-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filtro-fonte {
    flex: 1 1 12rem;
}

.filtro-fonte select {
    padding: 0.3rem 0.5rem;
    font-size: 0.85em;
}

.temas {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.9rem;
}

.tema {
    font: inherit;
    font-size: 0.85em;
    color: var(--texto-2);
    background: transparent;
    border: 1px solid var(--borda-campo);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.tema:hover {
    background-color: var(--hover);
}

.tema[aria-pressed="true"] {
    background-color: var(--acento);
    border-color: var(--acento);
    color: var(--sobre-acento);
}

.contagem {
    margin-top: 0.9rem;
    font-size: 0.85em;
    color: var(--texto-mudo);
}

/* Aviso dos #temas escritos no corpo, logo abaixo dele. */
.temas-do-corpo {
    margin: -0.6rem 0 0.9rem;
    font-size: 0.8em;
    color: var(--sucesso);
}

/* ---- Cartão da ficha ---- */

.ficha {
    padding: 1.75rem 0;
    border-bottom: 1px solid var(--divisor);
}

.ficha:last-child {
    border-bottom: none;
}

.ficha.aberta {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--cartao);
    border: 1px solid var(--borda);
    border-radius: 6px;
}

.ficha.destaque {
    background-color: var(--destaque);
    box-shadow: 0 0 0 0.75rem var(--destaque);
    border-radius: 2px;
}

.ficha-topo {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.ficha-titulo {
    color: var(--texto);
    font-weight: bold;
    text-decoration: none;
}

.ficha-titulo.sem-titulo {
    font-weight: normal;
    color: var(--texto-fraco);
}

.ficha-titulo:hover {
    text-decoration: underline;
}

.ficha.aberta .ficha-titulo {
    font-size: 1.25em;
}

.selo {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0.45rem;
    border-radius: 3px;
    background: var(--destaque);
    border: 1px solid var(--destaque-borda);
    color: var(--texto-fraco);
    white-space: nowrap;
}

/* #tema dentro do texto: discreto, mas clicável para filtrar. */
.hashtag {
    font: inherit;
    color: var(--acento);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

button.hashtag:hover {
    text-decoration: underline;
}

/* ---- As duas vozes do corpo ----
 *
 * Citação: serifada, maior, com a barra à esquerda — é a fonte falando.
 * Comentário: o texto normal da página — é você.
 */

.corpo > * + * {
    margin-top: 0.9rem;
}

.corpo p + p {
    margin-top: 0.6em;
}

.corpo .citacao {
    font-family: "Times New Roman", Times, serif;
    font-size: 1.2em;
    line-height: 1.45;
    border-left: 3px solid var(--borda-campo);
    padding-left: 0.9rem;
}

.corpo .comentario {
    color: var(--texto-2);
}

.ligacao {
    color: var(--acento);
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
}

.ligacao:hover {
    text-decoration-style: solid;
}

.ligacao.quebrada {
    color: var(--perigo);
    text-decoration-style: wavy;
}

.ficha-pe {
    margin-top: 0.9rem;
    font-size: 0.88em;
}

.origem a {
    color: var(--texto-fraco);
    font-style: italic;
}

.origem .local {
    color: var(--texto-mudo);
}

.origem a + .local::before {
    content: " · ";
}

.tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.35rem;
}

.tags button {
    font: inherit;
    font-size: 0.92em;
    color: var(--texto-fraco);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.tags button:hover {
    color: var(--acento);
    text-decoration: underline;
}

/* ---- Ações ---- */

.acoes {
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.ficha:hover .acoes,
.ficha:focus-within .acoes,
.ficha.aberta .acoes {
    opacity: 1;
}

@media (hover: none) {
    .acoes {
        opacity: 1;
    }
}

.acao {
    font: inherit;
    font-size: 0.78em;
    color: var(--texto-2);
    background: none;
    border: 1px solid var(--borda-campo);
    border-radius: 4px;
    padding: 0.15rem 0.6rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.acao:hover {
    background-color: var(--hover);
}

.aviso {
    font-size: 0.78em;
    color: var(--sucesso);
    overflow-wrap: anywhere;
}

/* ---- Vizinhança de uma ficha ---- */

.passos {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.85em;
}

.passos a {
    color: var(--texto-fraco);
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.passos .meio {
    flex: 1;
    text-align: center;
    max-width: none;
}

.passos .anterior {
    order: 0;
}

.passos .proxima {
    order: 2;
}

.vizinhanca {
    margin-top: 2rem;
}

.vizinhanca h2 {
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--texto-mudo);
    border-bottom: 1px solid var(--divisor);
    padding-bottom: 0.3rem;
    margin-bottom: 0.4rem;
}

.nada {
    color: var(--texto-mudo);
    font-size: 0.9em;
}

.mini-lista,
.lista-fontes {
    list-style: none;
}

.mini-lista li,
.lista-fontes li {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--divisor);
}

.mini-lista li:last-child,
.lista-fontes li:last-child {
    border-bottom: none;
}

.mini-lista a,
.lista-fontes a {
    color: var(--texto);
    text-decoration: none;
}

.mini-lista a:hover,
.lista-fontes a:hover {
    text-decoration: underline;
}

.lista-fontes a {
    font-weight: bold;
}

.mini-lista .meta,
.lista-fontes .meta {
    display: block;
    font-size: 0.82em;
    color: var(--texto-mudo);
}

.mini-lista .quebrada {
    color: var(--perigo);
    font-size: 0.9em;
}

/* ---- Página de uma fonte ---- */

.ficha-fonte {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--cartao);
    border: 1px solid var(--borda);
    border-radius: 6px;
}

.ficha-fonte h2 {
    font-family: "Times New Roman", Times, serif;
    font-size: 1.6em;
    line-height: 1.25;
}

.ficha-fonte .autoria {
    color: var(--texto-fraco);
    margin-top: 0.2rem;
}

.ficha-fonte .link-externo {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.85em;
    color: var(--acento);
    overflow-wrap: anywhere;
}

.ficha-fonte .nota {
    margin-top: 0.6rem;
    white-space: pre-line;
}

.botoes-fonte {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.topo-fontes {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    margin: 1.5rem 0 0.5rem;
}

.topo-fontes .contagem {
    margin: 0;
}

.vazio,
.erro {
    padding: 2rem 0;
    color: var(--texto-mudo);
}

.erro {
    color: var(--perigo);
}

@media (max-width: 600px) {
    body {
        padding: 1rem;
    }

    h1 {
        font-size: 2em;
    }

    .corpo .citacao {
        font-size: 1.1em;
    }

    .ficha.aberta,
    .ficha-fonte {
        padding: 1rem;
    }
}
