/* Componentes: card, botões, caixas da lateral, artigo, formulários, login e aviso */

.card {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* Faixa do topo do card e do artigo: cor da categoria ou imagem de capa */
.cover {
  position: relative;
  height: 130px;
  display: flex;
  align-items: flex-end;
  padding: 14px 22px;
  color: #1f2d33;
  overflow: hidden;
}
.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-cat {
  position: relative;
  font:
    600 20px/1.2 Fraunces,
    Georgia,
    serif;
  font-size-adjust: 0.52;
  color: inherit;
  text-decoration: none;
}
.cover.has-img .cover-cat {
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 12px;
  border-radius: 4px;
}
a.cover-cat:hover {
  text-decoration: underline;
}
.cover-cats {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.cover .cover-cat--more {
  font-size: 14px;
  font-weight: 600;
}
.cover--lg {
  height: 260px;
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 24px;
}
.cover--lg .cover-cat {
  font-size: 26px;
}
.cover--lg .cover-cat--more {
  font-size: 16px;
}
.cb {
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.cb h2 {
  font-size: 21px;
  line-height: 1.3;
  margin: 0 0 10px;
}
.cb h2 a {
  color: var(--ink);
  text-decoration: none;
}
.cb h2 a:hover {
  color: var(--ac);
}
.meta {
  font-size: 14px;
  color: var(--mut);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.meta > span + span:not(.draft)::before {
  content: '·';
  margin-right: 10px;
}
.meta .draft {
  margin-left: 0;
}
/* Autor com foto pequena (artigo, card e painel) */
.byline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--mut);
}
.byline strong {
  color: var(--ink);
  font-weight: 700;
}
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--chip);
  color: var(--chip-ink);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.avatar--lg {
  width: 96px;
  height: 96px;
  font-size: 38px;
  overflow: hidden;
}
.avatar--lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cb .meta {
  font-size: 13.5px;
}
.cb p {
  margin: 12px 0 18px;
  flex: 1;
  font-size: 16px;
  line-height: 1.65;
  color: color-mix(in srgb, var(--ink) 82%, var(--sf));
}
.grid .cb p {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.acts {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.btn {
  background: var(--ac);
  color: var(--ac2);
  border: 0;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
.btn.alt {
  background: none;
  color: var(--ac);
  border: 1px solid var(--ac);
}
.btn.del {
  background: none;
  color: var(--err);
  border: 1px solid var(--err);
}
.btn.sm {
  padding: 3px 10px;
  font-size: 14px;
}
.box {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 6px;
  padding: 18px;
  margin-bottom: 22px;
}
.box h3 {
  font-size: 17px;
  border-bottom: 2px solid var(--warm);
  padding-bottom: 6px;
}
.box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.box li {
  padding: 5px 0;
  border-bottom: 1px solid var(--ln);
}
.box li:last-child {
  border: 0;
}
.box li span {
  float: right;
  color: var(--mut);
}
.art {
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 6px;
  --pad: 32px;
  padding: var(--pad);
  max-width: 100%;
  overflow: hidden;
}
.art .body {
  font-family: Literata, Georgia, 'Times New Roman', serif; /* texto do artigo e do editor */
  font-size: 17px;
  line-height: 1.85;
  max-width: 68ch;
}
.body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  vertical-align: middle;
}
.body blockquote {
  margin: 1em 0;
  padding: 2px 0 2px 16px;
  border-left: 4px solid var(--warm);
  color: var(--mut);
}
.draft {
  background: var(--chip);
  color: var(--chip-ink);
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 3px;
  margin-left: 6px;
  font-family: 'Source Sans 3', sans-serif;
}
label {
  display: block;
  font-weight: 600;
  margin: 14px 0 4px;
}
input[type='text'],
input[type='email'],
input[type='password'],
textarea,
select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ln);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
}
input[type='file'] {
  max-width: 100%;
}
input::placeholder,
textarea::placeholder {
  color: var(--mut);
  opacity: 1;
}
/* Preenchimento automático do navegador: mantém as cores do tema */
input:-webkit-autofill,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100px var(--bg) inset;
  caret-color: var(--ink);
}
/* Editor visual de artigos */
.art--edit {
  overflow: visible; /* deixa a barra de ferramentas acompanhar a rolagem */
}
.rte-wrap {
  position: relative;
  border: 1px solid var(--ln);
  border-radius: 4px;
  background: var(--bg);
}
.rte-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 8px;
  background: var(--sf);
  border-bottom: 1px solid var(--ln);
  border-radius: 4px 4px 0 0;
}
.rte-tools select {
  width: auto;
  padding: 5px 8px;
  font-size: 15px;
}
.rte-group {
  display: inline-flex;
  gap: 2px;
}
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.rte-btn:hover {
  border-color: var(--ln);
  background: var(--bg);
}
.rte-btn[aria-pressed='true'] {
  background: var(--ac);
  color: var(--ac2);
}
.art .rte {
  min-height: 340px;
  max-width: none;
  padding: 14px 16px;
  overflow-wrap: anywhere;
  border-radius: 0 0 4px 4px;
}
.rte:focus-visible {
  outline-offset: -3px;
}
.rte img {
  cursor: pointer;
}
.rte img.rte-sel {
  outline: 3px solid var(--ac);
  outline-offset: 2px;
}
/* Botões sobre a imagem selecionada e linha que mostra onde a imagem arrastada vai ficar */
.rte-imgbar {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.rte-drop {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--warm);
  pointer-events: none;
}
.rte-imgbar[hidden],
.rte-drop[hidden] {
  display: none;
}
dialog {
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
  color: var(--ink);
  padding: 26px;
  width: min(380px, 92vw);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.err {
  color: var(--err);
  min-height: 1.4em;
  font-size: 15px;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#toast.on {
  opacity: 1;
}

/* Campo de imagem de capa no editor */
.img-field {
  border: 1px dashed var(--ln);
  border-radius: 6px;
  padding: 14px;
  background: var(--bg);
}
.img-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
label.sub {
  font-weight: 400;
  font-size: 15px;
  color: var(--mut);
}
.img-prev {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 12px;
}
.img-prev[hidden],
#imgrm[hidden],
dialog [hidden] {
  display: none;
}
.hint {
  font-size: 14px;
  color: var(--mut);
  margin-top: 8px;
}

/* Rodapé do card: "Ler artigo" à esquerda e, para o administrador, Editar/Excluir na extremidade direita */
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding-top: 14px;
  border-top: 1px solid var(--ln);
}
.card-foot .more {
  font-weight: 600;
  font-size: 15px;
}
.card-foot .views {
  font-size: 13.5px;
  color: var(--mut);
}
.card-foot .acts {
  margin: 0 0 0 auto;
}

/* Avisos, contador no menu e botão com cara de link */
.notice {
  border-left: 4px solid var(--warm);
  padding: 12px 16px;
}
.notice ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.pill {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--warm);
  color: #1e2b2a;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ac);
  text-decoration: underline;
  cursor: pointer;
}
.err.ok {
  color: var(--ac);
}
.draft--review {
  background: var(--warm);
  color: #1e2b2a;
}
.draft--returned {
  background: var(--err);
  color: var(--bg);
}

/* Escolha de categorias no editor */
.catpick {
  border: 0;
  padding: 0;
  margin: 14px 0 0;
}
.catpick legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 6px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 12px;
  border: 1px solid var(--ln);
  border-radius: 16px;
  background: var(--bg);
  font-weight: 400;
  cursor: pointer;
}
.chip:has(input:checked) {
  background: var(--chip);
  border-color: var(--ac);
  font-weight: 600;
}
.chip:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}
.chip input {
  width: auto;
  margin: 0;
}

/* Hover suave nos botões do blog */
.btn,
.rte-btn,
.chip,
.linkbtn,
.hero-nav {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease,
    transform 0.1s ease;
}
.btn:hover {
  background-color: color-mix(in srgb, var(--ac) 82%, #000);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.btn.alt:hover {
  background-color: color-mix(in srgb, var(--ac) 12%, transparent);
}
.btn.del:hover {
  background-color: color-mix(in srgb, var(--err) 12%, transparent);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn.alt:disabled:hover,
.btn.del:disabled:hover {
  background-color: transparent;
}
.btn:not(.alt):not(.del):disabled:hover {
  background-color: var(--ac);
}
.chip:hover {
  border-color: var(--ac);
}
.linkbtn:hover {
  opacity: 0.75;
}
@media (prefers-reduced-motion: reduce) {
  .btn,
  .rte-btn,
  .chip,
  .linkbtn,
  .hero-nav,
  .theme-btn,
  #nav a,
  #nav button,
  .ptabs a {
    transition: none;
  }
}

/* Texto justificado: hifeniza no fim da linha (pelos &shy; do site e pelo dicionário do navegador), sem espaços largos */
.art .body [style*='text-align:justify'],
.art .body [style*='text-align: justify'] {
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 6 2 3;
  overflow-wrap: break-word;
}

/* ---------- Artigo: mais respiro no título, nas informações e no texto ---------- */
.art {
  --pad: 44px;
}
/* coluna de leitura centralizada: título, informações e texto com a mesma largura */
.art:not(.art--edit) > :not(.cover--lg) {
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}
.art .cover--lg {
  margin-bottom: 36px;
}
.art > .meta {
  font-size: 14.5px;
  gap: 6px 12px;
  margin-bottom: 18px;
}
.art > .meta .avatar {
  width: 28px;
  height: 28px;
  font-size: 13px;
}
.art > h1 {
  font-size: 38px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 auto 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--ln);
}
.art .body {
  font-size: 18.5px;
  line-height: 1.8;
  max-width: 700px;
}
.art .body p,
.art .body ul,
.art .body ol {
  margin: 0 0 1.3em;
}
.art .body li + li {
  margin-top: 0.4em;
}
.art .body h2 {
  font-size: 26px;
  line-height: 1.3;
  margin: 1.8em 0 0.7em;
}
.art .body h3 {
  font-size: 21px;
  line-height: 1.35;
  margin: 1.6em 0 0.6em;
}
.art .body > :first-child {
  margin-top: 0;
}
.art .body blockquote {
  margin: 1.6em 0;
  padding: 6px 0 6px 22px;
  font-style: italic;
}
.art .body img {
  margin: 0.6em 0;
}
.art > .acts,
.art > p:last-child {
  margin-top: 40px;
}
.art .cover--lg {
  padding: 22px var(--pad); /* categoria alinhada com o texto */
}
.art:not(.art--edit) .cover--lg .cover-cats {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
}

/* Tab no texto: um caractere que avança até a próxima parada (a cada 5 espaços), como num editor de texto */
.art .body {
  tab-size: 5;
}
.body .tab {
  white-space: pre;
}

/* ---------- Curtir e compartilhar (abaixo do artigo) ---------- */
.post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 44px;
  padding: 22px 0;
  border-top: 1px solid var(--ln);
  border-bottom: 1px solid var(--ln);
}
.post-actions svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pa-like,
.pa-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--ln);
  border-radius: 20px;
  background: var(--sf);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.1s ease;
}
.pa-like[hidden] {
  display: none;
}
.pa-like:hover,
.pa-btn:hover {
  border-color: var(--ac);
  background: color-mix(in srgb, var(--ac) 8%, var(--sf));
}
.pa-like:active,
.pa-btn:active {
  transform: translateY(1px);
}
.pa-like[aria-pressed='true'] {
  color: #b3261e;
  border-color: color-mix(in srgb, #b3261e 45%, var(--ln));
  background: color-mix(in srgb, #b3261e 8%, var(--sf));
}
.pa-like[aria-pressed='true'] svg {
  fill: currentColor;
}
.pa-like {
  min-width: 40px;
  justify-content: center;
}
.pa-like:has(.pa-like-count:empty) {
  padding: 0; /* só o coração: botão redondo */
  width: 40px;
}
.pa-like-count {
  font-variant-numeric: tabular-nums;
}
.pa-like-count:empty {
  display: none;
}
.pa-pop svg {
  animation: pa-pop 0.35s ease;
}
@keyframes pa-pop {
  50% {
    transform: scale(1.3);
  }
}
.pa-share {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pa-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  min-width: 190px;
  padding: 6px;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
.pa-menu[hidden] {
  display: none;
}
.pa-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.pa-item:hover,
.pa-item:focus-visible {
  background: color-mix(in srgb, var(--ac) 10%, var(--sf));
  outline: none;
}
/* ícone oficial do WhatsApp (assets/icons/whatsapp.svg, Simple Icons, CC0) na cor da marca */
.pa-ico {
  width: 20px;
  height: 20px;
  flex: none;
  display: inline-block;
}
.pa-ico-wa {
  background: #25d366;
  -webkit-mask: url('../assets/icons/whatsapp.svg') center / contain no-repeat;
  mask: url('../assets/icons/whatsapp.svg') center / contain no-repeat;
}
.pa-hint {
  font-size: 14px;
  color: var(--ac);
  font-weight: 600;
}
.pa-hint:empty {
  display: none;
}
:root[data-theme='dark'] .pa-like[aria-pressed='true'] {
  color: #ff8a80;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .pa-like[aria-pressed='true'] {
    color: #ff8a80;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pa-like,
  .pa-btn {
    transition: none;
  }
  .pa-pop svg {
    animation: none;
  }
}

/* ---------- Imagem do artigo (uma por artigo): sempre centralizada, com tamanho, corte e legenda ---------- */
.body .fig {
  margin: 1.8em auto;
  max-width: 100%;
}
.body .fig-frame {
  overflow: hidden;
  border-radius: 6px;
  line-height: 0;
}
.body .fig img {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0;
  border-radius: 0;
}
.body .fig figcaption {
  margin-top: 10px;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--mut);
  text-align: center;
  font-style: italic;
}
/* no editor */
.rte .rte-fig {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.rte .rte-fig.rte-sel .fig-frame {
  outline: 3px solid var(--ac);
  outline-offset: 2px;
}
.rte .rte-fig.rte-cropping .fig-frame {
  outline: none;
  filter: brightness(0.55);
}
.rte-imgbar-main,
.rte-imgbar-crop {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rte-imgbar-main[hidden],
.rte-imgbar-crop[hidden] {
  display: none;
}
.rte-handles {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}
.rte-handles[hidden] {
  display: none;
}
.rte-h {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--sf);
  border: 2px solid var(--ac);
  border-radius: 3px;
  pointer-events: auto;
  touch-action: none;
}
.rte-h-nw { left: 0; top: 0; cursor: nwse-resize; }
.rte-h-n { left: 50%; top: 0; cursor: ns-resize; }
.rte-h-ne { left: 100%; top: 0; cursor: nesw-resize; }
.rte-h-e { left: 100%; top: 50%; cursor: ew-resize; }
.rte-h-se { left: 100%; top: 100%; cursor: nwse-resize; }
.rte-h-s { left: 50%; top: 100%; cursor: ns-resize; }
.rte-h-sw { left: 0; top: 100%; cursor: nesw-resize; }
.rte-h-w { left: 0; top: 50%; cursor: ew-resize; }
.rte-handles.cropping .rte-h {
  background: var(--warm);
  border-color: #fff;
}
/* área que fica depois do corte: mostra a imagem clara por cima da versão escurecida */
.rte-cropbox {
  position: absolute;
  border: 2px dashed #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  backdrop-filter: brightness(1.8);
  -webkit-backdrop-filter: brightness(1.8);
}
.rte-cropbox[hidden] {
  display: none;
}
.rte-size {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.rte-size:empty {
  display: none;
}
@media (pointer: coarse) {
  .rte-h {
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px; /* alças maiores para o dedo */
  }
}

/* Editor: as caixas ficam 17px mais largas de cada lado, para o texto digitado ocupar a mesma largura
   (e quebrar as linhas nos mesmos pontos) que o artigo publicado */
@media (min-width: 521px) {
  .art--edit form > input[type='text'],
  .art--edit form > textarea,
  .art--edit form > .img-field,
  .art--edit form > .rte-wrap {
    width: calc(100% + 34px);
    max-width: none;
    margin-left: -17px;
    margin-right: -17px;
  }
  .art--edit form > input[type='text'],
  .art--edit form > textarea,
  .art--edit form > .img-field {
    padding-left: 16px;
    padding-right: 16px;
  }
}
