/**
 * Bully Friends: ajustes de integração com o WordPress.
 *
 * Nada aqui altera o visual do layout. São regras para:
 * - elementos que no protótipo eram <button> e viraram links reais (SEO e acessibilidade);
 * - imagens reais no lugar dos placeholders (capas, fotos, avatar);
 * - barra de administração, classes padrão do WordPress e do editor de blocos.
 */

/* -------------------------------------------------------------------------
 * Base herdada do ambiente onde os protótipos foram renderizados.
 * O corpo em 14px define o tamanho de tudo que usa unidades relativas ao pai
 * (links do rodapé, listas etc.). Sem isso, o tema ficaria alguns pixels maior.
 * ---------------------------------------------------------------------- */
:root {
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { font-size: 14px; }

/* -------------------------------------------------------------------------
 * Acessibilidade
 * ---------------------------------------------------------------------- */
.screen-reader-text {
  border: 0; clip: rect(1px,1px,1px,1px); clip-path: inset(50%);
  height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0;
  position: absolute !important; word-wrap: normal !important;
}
.skip-link:focus {
  clip: auto; clip-path: none; height: auto; width: auto; margin: 0;
  top: .75rem; left: .75rem; z-index: 100000;
  padding: .7rem 1.1rem; border-radius: .5rem;
  background: #fff; color: #1E0E04; font-weight: 600;
  box-shadow: 0 6px 18px rgba(30,14,4,.18);
}
[hidden]:not([hidden=until-found i]) { display: none !important; }

/* Estilos globais do WordPress sublinham links; o layout não. */
a:where(:not(.wp-element-button)) { text-decoration: none; }

/* Sem JavaScript, os elementos animados aparecem direto. */
.no-js .fu, .no-js .fl, .no-js .fr { opacity: 1; transform: none; }

/* -------------------------------------------------------------------------
 * Barra de administração (usuário logado)
 * ---------------------------------------------------------------------- */
.admin-bar .site-header { top: 32px; }
.admin-bar .filter-bar { top: calc(66px + 32px); }
.admin-bar .mob-nav, .admin-bar .nav-overlay { top: 32px; }
@media (min-width: 961px) {
  .admin-bar .post-sidebar { top: calc(var(--header-h, 66px) + 1.5rem + 32px); }
}
@media screen and (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
  .admin-bar .filter-bar { top: calc(66px + 46px); }
  .admin-bar .mob-nav, .admin-bar .nav-overlay { top: 46px; }
}
@media screen and (max-width: 600px) {
  /* Abaixo de 600px a admin bar deixa de ser fixa. */
  .admin-bar .site-header { top: 0; }
  .admin-bar .filter-bar { top: 66px; }
  .admin-bar .mob-nav, .admin-bar .nav-overlay { top: 0; }
}

/* -------------------------------------------------------------------------
 * Home: foto real nos blocos da raça
 * ---------------------------------------------------------------------- */
.b-photo .b-photo-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center bottom;
}

/* -------------------------------------------------------------------------
 * Listagem: pílulas e paginação agora são links
 * ---------------------------------------------------------------------- */
a.cat-pill {
  display: inline-block;
  /* Mesma fonte que o <button> original herdava do navegador. */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font: -webkit-small-control;
  font-size: .78rem; font-weight: 500; line-height: 1;
}
a.pg-btn, span.pg-btn { text-decoration: none; }
.pg-btn.is-disabled { opacity: .38; cursor: default; }
.pg-btn.is-disabled:hover { background: var(--surface); color: var(--fg-sub); }
.pg-btn.is-gap { opacity: 1; min-width: 28px; border-color: transparent; background: transparent; }
.pg-btn.is-gap:hover { background: transparent; }
span.pg-btn.active { cursor: default; }

.search-wrap .search-input::-webkit-search-cancel-button { cursor: pointer; }

/* Card com imagem destacada */
.card-thumb-fill.has-img img { width: 100%; height: 100%; object-fit: cover; }

/* -------------------------------------------------------------------------
 * Single e páginas
 * ---------------------------------------------------------------------- */
.post-cover.has-img > img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.post-cover .cover-cat-badge { z-index: 1; }
.recent-thumb.has-img img { width: 100%; height: 100%; object-fit: cover; }
.author-avatar.has-img { overflow: hidden; }
.author-avatar.has-img img { width: 100%; height: 100%; object-fit: cover; }
.page-layout { grid-template-columns: minmax(0, 1fr); }
a.share-btn { text-decoration: none; line-height: normal; }

/* Editor de blocos dentro do artigo */
.article-content > *:first-child { margin-block-start: 0; }
.article-content figure.wp-block-table { margin-block: 0; overflow: visible; }
.article-content .wp-block-table table { border-collapse: collapse; }
.article-content .wp-block-table thead,
.article-content .wp-block-table tfoot { border: 0; }
.article-content .wp-block-table th { border: 0; border-block-end: 2px solid var(--border); padding: .65rem 1rem; }
.article-content .wp-block-table td { border: 0; border-block-end: 1px solid var(--border); padding: .6rem 1rem; }
.article-content .wp-block-table tr:last-child td { border-block-end: none; }
.article-content .wp-block-quote { border-inline-start: 3px solid var(--amber); }
.article-content .wp-block-image,
.article-content .wp-block-image img { max-width: 100%; }
.article-content img { height: auto; }
.article-content .alignleft  { float: left;  margin: .3rem 1.5rem 1rem 0; }
.article-content .alignright { float: right; margin: .3rem 0 1rem 1.5rem; }
.article-content .aligncenter { margin-inline: auto; text-align: center; }
.article-content .wp-caption-text,
.article-content .wp-element-caption {
  margin-block-start: .6rem; font-size: .8rem; color: var(--fg-sub);
  text-align: center; font-style: italic;
}
.article-content iframe, .article-content video, .article-content embed { max-width: 100%; }
.article-content .wp-block-embed { margin-block: 2rem; }
.article-content .page-links { margin-block-start: 2rem; font-size: .85rem; }
.article-content .page-links a { margin-inline-start: .4rem; }
.sticky, .bypostauthor, .gallery-caption { /* classes padrão do WordPress */ }

/* -------------------------------------------------------------------------
 * Seletor de modo de cores (claro/escuro) no cabeçalho
 * O modo ativo fica em <html data-theme="light|dark">, definido no <head>.
 * ---------------------------------------------------------------------- */
.header-end { display: flex; align-items: center; gap: .5rem; }
.header-end > nav,
.header-end > .nav-list { margin-inline-end: 1.25rem; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-sub);
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s, transform .3s var(--ease, ease);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active { transform: rotate(-20deg) scale(.94); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .tt-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .tt-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .tt-moon { display: none; }
.no-js .theme-toggle { display: none; }

/* Controles nativos (barra de rolagem, campos) acompanham o modo escolhido. */
:root[data-theme="dark"] { color-scheme: dark; }

/* O logotipo do blog e das páginas internas usa a cor --ink, que o layout
   não redefine no modo escuro (ficava quase invisível no cabeçalho escuro).
   A home não entra aqui porque o cabeçalho dela é sempre branco. */
:root[data-theme="dark"] body:not(.home) .site-header .logo { color: var(--fg); }
/* Na home o cabeçalho é sempre branco: a borda do botão usa um tom escuro. */
:root[data-theme="dark"] body.home .theme-toggle { border-color: rgba(30,14,4,.12); }

/* -------------------------------------------------------------------------
 * Correções de rolagem horizontal no celular (post)
 * ---------------------------------------------------------------------- */
/* A coluna única do post crescia até a largura mínima da tabela (500px).
   Com minmax(0, 1fr) ela respeita a tela e a tabela rola dentro do .table-wrap. */
@media (max-width: 960px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
}
/* A barra de compartilhar do topo não quebrava linha em telas estreitas. */
.share-bar { flex-wrap: wrap; row-gap: .5rem; }
.share-btn { white-space: nowrap; }
