/*
 * Compartilhar e versão impressa do post — tema eGestor.
 *
 * Arquivo à parte da folha do tema porque só o post usa: lá dentro ele pesaria
 * no orçamento de CSS de toda página do blog. Lê os tokens do tema (`--bg`,
 * `--primary-cta`, `--radius-*`, a atmosfera `--atmo-*`), então acompanha o
 * modo escuro sozinho.
 *
 * A marcação é de `_core/partials/compartilhar.html.twig`.
 */

/* A cor de cada destino. `--cp-tinta` é o que vai escrito sobre ela. */
.compartilhar a,
.compartilhar button { --cp-cor: var(--text-primary); --cp-tinta: var(--bg); }
.compartilhar .cp-whatsapp { --cp-cor: #1daa61; --cp-tinta: #fff; }
.compartilhar .cp-facebook { --cp-cor: #1877f2; --cp-tinta: #fff; }
.compartilhar .cp-linkedin { --cp-cor: #0a66c2; --cp-tinta: #fff; }
.compartilhar .cp-x { --cp-cor: #17161a; --cp-tinta: #fff; }
.compartilhar .cp-email { --cp-cor: var(--eg-red-500); --cp-tinta: #fff; }

.compartilhar ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.compartilhar a,
.compartilhar button {
  margin: 0;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.compartilhar svg { flex: none; }
.compartilhar button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Copiar e imprimir dependem de script: sem ele, somem em vez de não responder. */
@media (scripting: none) {
  .compartilhar li:has(> button),
  .compartilhar .cp-link,
  .compartilhar .cp-pdf { display: none; }
}

/* ── Topo: a fileira de ícones ao lado da assinatura ──────────────────── */

.compartilhar-topo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.compartilhar-topo .cp-titulo { color: var(--text-muted); font-size: .8125rem; font-weight: 600; }
.compartilhar-topo ul { gap: 6px; }
.compartilhar-topo a,
.compartilhar-topo button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-primary);
  transition: var(--t-color), transform var(--dur-fast) var(--ease-out);
}
.compartilhar-topo .cp-ico { display: contents; }
.compartilhar-topo svg { width: 18px; height: 18px; }
.compartilhar-topo .cp-nome { display: none; font-size: .8125rem; font-weight: 600; }
.compartilhar-topo a:hover,
.compartilhar-topo button:hover { border-color: var(--cp-cor); background: var(--cp-cor); color: var(--cp-tinta); transform: translateY(var(--lift)); }
.compartilhar-topo .cp-feito,
.compartilhar-topo .cp-feito:hover { padding: 0 14px; border-color: #1a8f4c; background: #1a8f4c; color: #fff; }
.compartilhar-topo .cp-feito .cp-nome { display: inline; }

/* ── Fim do texto: o painel ───────────────────────────────────────────── */

.compartilhar-fim {
  position: relative;
  isolation: isolate;
  overflow: clip;
  margin: 0 0 3rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  box-shadow: 0 28px 48px -32px rgba(31, 30, 32, .38);
}
/* A mesma atmosfera do hero da home: as duas manchas da marca, ao fundo. */
.compartilhar-fim::before,
.compartilhar-fim::after {
  content: "";
  position: absolute;
  inset: -30% -10%;
  z-index: -1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: .8;
}
.compartilhar-fim::before { background-image: var(--atmo-01-a); }
.compartilhar-fim::after { background-image: var(--atmo-01-b); }

.cp-cabeca { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.cp-selo {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--eg-red-500), var(--eg-orange-500));
  color: #fff;
  box-shadow: 0 12px 22px -12px rgba(235, 50, 55, .75);
}
.compartilhar-fim .cp-titulo {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.015em;
}
.compartilhar-fim .cp-apoio { margin: .25rem 0 0; color: var(--text-secondary); font-size: .9375rem; line-height: 1.5; }

/* As redes: um cartão por destino, com o disco na cor de cada um. */
.cp-redes { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.cp-redes a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-primary);
  font-size: .875rem;
  font-weight: 700;
  line-height: 1;
  transition: var(--t-color), transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.cp-redes .cp-ico {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--cp-cor);
  color: var(--cp-tinta);
  transition: transform var(--dur-base) var(--ease-out);
}
.cp-redes svg { width: 22px; height: 22px; }
.cp-redes a:hover {
  border-color: var(--cp-cor);
  color: var(--text-primary);
  box-shadow: 0 16px 26px -18px var(--cp-cor);
  transform: translateY(-3px);
}
.cp-redes a:hover .cp-ico { transform: scale(1.08); }

/* O endereço, como nas janelas de compartilhar: campo de um lado, botão do outro. */
.cp-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.cp-link svg { width: 18px; height: 18px; }
.cp-url {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: .875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-link button {
  flex: none;
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: var(--bg);
  font-size: .875rem;
  font-weight: 700;
  transition: var(--t-color);
}
.cp-link button:hover { background: var(--primary-cta); color: var(--cp-botao-tinta, #fff); }
.cp-link .cp-feito,
.cp-link .cp-feito:hover { background: #1a8f4c; color: #fff; }

/* A versão em PDF: separada das redes, porque é outro gesto. */
.cp-pdf {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.cp-folha { flex: none; line-height: 0; filter: drop-shadow(0 6px 8px rgba(31, 30, 32, .12)); }
.cp-f-papel { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1.5; }
.cp-f-dobra { stroke: var(--border-strong); stroke-width: 1.5; }
.cp-f-linhas { stroke: var(--border-strong); stroke-width: 2; stroke-linecap: round; }
.cp-f-selo { fill: var(--eg-red-500); }
.cp-f-pdf { fill: #fff; font-family: var(--font-sans); }
.cp-pdf-texto { flex: 1; min-width: 0; }
.cp-pdf-titulo { margin: 0; color: var(--text-primary); font-size: 1.0625rem; font-weight: 800; line-height: 1.3; }
.cp-pdf-apoio { margin: .125rem 0 0; color: var(--text-secondary); font-size: .875rem; line-height: 1.5; }
.cp-pdf button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--primary-cta);
  color: var(--cp-botao-tinta, #fff);
  font-size: .9375rem;
  font-weight: 700;
  white-space: nowrap;
  transition: var(--t-color), transform var(--dur-fast) var(--ease-out);
}
.cp-pdf button:hover { background: var(--primary-active); transform: translateY(var(--lift)); }

@media (prefers-reduced-motion: reduce) {
  .compartilhar a:hover,
  .compartilhar button:hover,
  .cp-redes a:hover .cp-ico { transform: none; }
}

@media (max-width: 40rem) {
  .compartilhar-fim { padding: 1.25rem; }
  .cp-selo { width: 44px; height: 44px; }
  .compartilhar-fim .cp-titulo { font-size: 1.25rem; }
  /* No celular, os cinco discos numa fileira, como a folha de compartilhar do aparelho. */
  .cp-redes { gap: 4px; }
  .cp-redes a { padding: 4px 0; border: 0; background: none; font-size: .6875rem; font-weight: 600; box-shadow: none; }
  .cp-redes a:hover { box-shadow: none; transform: none; }
  .cp-link { margin-top: 1.25rem; }
  .cp-pdf { flex-wrap: wrap; }
  .cp-pdf button { justify-content: center; width: 100%; }
}

@media (prefers-color-scheme: dark) {
  .compartilhar-fim { background: var(--bg-subtle); box-shadow: none; --cp-botao-tinta: #16151a; }
  /* No escuro o tema apaga as manchas do hero; aqui também. */
  .compartilhar-fim::before, .compartilhar-fim::after { content: none; }
  .compartilhar .cp-x { --cp-cor: #f2eeee; --cp-tinta: #16151a; }
  @media (min-width: 40.01rem) {
    .cp-redes a { background: var(--surface-muted); }
  }
  .cp-link { background: var(--bg); }
  .cp-folha { filter: none; }
}

/* ── Versão impressa ──────────────────────────────────────────────────── *
 *
 * O que vai para o papel (ou para o PDF): a marca, o título com a assinatura,
 * a imagem principal, o texto e uma linha com o endereço do artigo. Menu,
 * busca, trilha, colunas laterais, etiquetas, vizinhos, autor, chamadas de
 * produto e rodapé ficam de fora.
 */

@media print {
  @page {
    margin: 16mm 16mm 20mm;
    /* Número da página no pé, para quem grampeia. */
    @bottom-right { content: counter(page) " / " counter(pages); color: #6b696e; font: 600 8pt "Open Sans", sans-serif; }
  }

  /* O papel é branco mesmo para quem lê o site no escuro. */
  :root {
    --bg: #fff;
    --bg-subtle: #faf8f8;
    --surface-muted: #f6f1f1;
    --border: #ece7e7;
    --border-strong: #dad4d4;
    --text-primary: #1f1e20;
    --text-secondary: #4c4b4c;
    --text-muted: #6b696e;
    --text-brand: #d3282d;
    --text-tagline: #c2461a;
  }

  body { background: #fff; color: #1f1e20; font-size: 11pt; }

  .pular,
  header.site > :not(.topo),
  header.site .topo > :not(.marca),
  main > :not(article),
  body > aside,
  footer.site,
  article aside,
  .post-rodape > :not(.impresso),
  .compartilhar,
  .content form,
  .content iframe { display: none !important; }

  header.site { position: static; margin: 0 0 8mm; border-bottom: 2px solid #eb3237; background: none; }
  header.site .topo { min-height: 0; padding: 0 0 4mm; }
  header.site .marca img { width: auto; height: 34px; }

  .post-hero,
  figure.destacada,
  .post-corpo,
  .post-rodape { max-width: none; margin-inline: 0; padding: 0; }
  .post-hero h1 { max-width: none; font-size: 24pt; line-height: 1.15; }
  .post-hero .lead { font-size: 13pt; }
  figure.destacada { margin-top: 6mm; }
  figure.destacada img { max-height: 85mm; object-fit: cover; }
  .post-corpo { display: block; padding-top: 6mm; }
  .content { max-width: none; }
  .content a { color: inherit; }
  /* Foto de largura inteira ocupa meia folha: no papel ela encolhe. */
  .content img { width: auto; max-width: 100%; max-height: 75mm; }

  h2, h3, h4 { break-after: avoid; }
  figure, img, table, pre, blockquote, .faq-item { break-inside: avoid; }
  p, li { orphans: 3; widows: 3; }

  /* O fecho: de onde veio o artigo e onde está a versão viva dele. */
  .impresso {
    display: block !important;
    break-inside: avoid;
    margin: 12mm 0 0;
    padding: 6mm 7mm;
    border: 1px solid #f3c7c8;
    border-radius: 4mm;
    background: #fdecec;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .impresso p { margin: 0; }
  .imp-marca { color: #d3282d; font-size: 8pt; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .imp-texto { margin-top: 1.5mm !important; color: #4c4b4c; font-size: 9.5pt; line-height: 1.45; }
  .imp-url { margin-top: 1.5mm !important; color: #1f1e20; font-size: 10.5pt; font-weight: 700; overflow-wrap: anywhere; }
}
