/* ==========================================================================
   Blog TKI — página inicial do blog e artigos
   Carregado depois do finance.css; usa os mesmos tokens.
   ========================================================================== */

/* ---------- Barra de progresso de leitura ---------- */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; background: var(--grad-tx); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Hero do blog ---------- */
.blog-hero { padding: 96px 0 72px; }
.blog-hero .display { max-width: 19ch; }
.blog-search { max-width: 520px; margin: 34px auto 0; position: relative; }
.blog-search input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  padding: 15px 18px 15px 48px; border-radius: 12px;
  border: 1px solid var(--line-2); background: rgba(255,255,255,.9);
  box-shadow: 0 6px 24px -10px rgba(11,18,32,.18);
}
.blog-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.blog-search svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }

/* ---------- Filtro por categoria ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 40px; }
.chip {
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: rgba(0,64,240,.35); color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip b { font-weight: 500; opacity: .6; margin-left: 4px; }

/* ---------- Destaque ---------- */
.post-featured {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; align-items: stretch;
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #fff;
  margin-bottom: 56px; transition: box-shadow .2s ease, border-color .2s ease;
}
.post-featured:hover { border-color: rgba(0,64,240,.22); box-shadow: 0 24px 56px -22px rgba(0,64,240,.28); }
.post-featured__img { position: relative; min-height: 300px; background: var(--bg-3); }
.post-featured__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-featured__body { padding: 44px 44px 40px; display: flex; flex-direction: column; justify-content: center; }
.post-featured__body h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.12; letter-spacing: -0.025em; font-weight: 600; margin: 14px 0 14px; }
.post-featured__body p { color: var(--ink-2); font-size: 16.5px; line-height: 1.65; margin: 0 0 22px; }
@media (max-width: 860px) {
  .post-featured { grid-template-columns: 1fr; }
  .post-featured__img { min-height: 0; aspect-ratio: 16 / 9; }
  .post-featured__body { padding: 28px 24px 30px; }
}

/* ---------- Cards de artigo ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 980px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .post-grid { grid-template-columns: 1fr; } }
.post-card {
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.post-card:hover { border-color: rgba(0,64,240,.22); box-shadow: 0 18px 42px -16px rgba(0,64,240,.24); transform: translateY(-4px); }
.post-card__img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-3); }
.post-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.3,1); }
.post-card:hover .post-card__img img { transform: scale(1.04); }
.post-card__body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.post-card h3 { font-size: 18.5px; line-height: 1.3; letter-spacing: -0.015em; font-weight: 600; margin: 12px 0 8px; }
.post-card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin: 0 0 18px; }
.post-card .post-meta { margin-top: auto; }
.post-grid .post-card[hidden] { display: none; }
.blog-empty { text-align: center; color: var(--ink-3); padding: 40px 0; }

.cat {
  display: inline-block; align-self: flex-start;
  font-family: "JetBrains Mono", monospace; font-size: 11.5px; font-weight: 500;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 6px;
}
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--ink-3); }
.post-meta span { display: inline-flex; align-items: center; gap: 6px; }
.post-meta svg { width: 14px; height: 14px; }

/* ==========================================================================
   ARTIGO
   ========================================================================== */
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 22px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--ink-4); }
.crumbs a:hover { color: var(--accent); }

.post-head { padding: 64px 0 40px; background: var(--grad-bg); border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.post-head .container { position: relative; }
.post-head__inner { max-width: 820px; }
.post-head h1 {
  font-size: clamp(32px, 4.6vw, 54px); line-height: 1.08; letter-spacing: -0.032em;
  font-weight: 600; margin: 16px 0 18px; text-wrap: balance;
}
.post-head .lede { margin: 0 0 26px; max-width: 720px; text-align: left; }
.post-head .post-meta { font-size: 13.5px; }
.post-head .post-meta .author { color: var(--ink); font-weight: 600; }
.post-head .post-meta .author img { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1px solid var(--line); padding: 3px;  object-fit: contain; }

.post-cover { margin: 40px auto 0; max-width: 1104px; }
.post-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 20px; background: var(--bg-3); box-shadow: 0 30px 70px -40px rgba(11,18,32,.45); }
.post-cover figcaption { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; text-align: right; }
.post-cover figcaption a { text-decoration: underline; text-underline-offset: 2px; }

.post-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 72px;
  max-width: 1104px; margin: 0 auto; padding: 56px 0 96px;
}
@media (max-width: 1040px) { .post-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 32px; } }

/* Índice */
.toc { position: sticky; top: 96px; align-self: start; font-size: 14px; }
.toc__title { font-family: "JetBrains Mono", monospace; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 14px; }
.toc ol { list-style: none; border-left: 1px solid var(--line-2); }
.toc li a { display: block; padding: 7px 0 7px 16px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-3); line-height: 1.4; transition: color .15s ease, border-color .15s ease; }
.toc li a:hover { color: var(--ink); }
.toc li a.is-current { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.toc__share { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.toc-mobile { display: none; }
@media (max-width: 1040px) {
  .toc { display: none; }
  .toc-mobile { display: block; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); margin: 0 0 36px; }
  .toc-mobile summary { cursor: pointer; padding: 15px 18px; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile summary::after { content: "+"; font-size: 20px; color: var(--accent); font-weight: 400; }
  .toc-mobile[open] summary::after { content: "−"; }
  .toc-mobile ol { padding: 0 18px 16px 38px; }
  .toc-mobile li { padding: 5px 0; font-size: 15px; }
  .toc-mobile a { color: var(--ink-2); }
}

/* Compartilhar */
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.share a, .share button {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line-2); color: var(--ink-2); background: #fff; transition: color .15s, border-color .15s, background-color .15s;
}
.share a:hover, .share button:hover { color: var(--accent); border-color: rgba(0,64,240,.35); background: var(--accent-soft); }
.share svg { width: 17px; height: 17px; }
.share button.is-copied { color: var(--green); border-color: var(--green); }

/* ---------- Tipografia do texto ---------- */
.prose { font-size: 18px; line-height: 1.78; color: #1f2a3d; max-width: 740px; }
.prose > * { margin: 0 0 1.15em; }
.prose .lead { font-size: 21px; line-height: 1.65; color: var(--ink); font-weight: 500; letter-spacing: -0.005em; margin-bottom: 1.4em; }
.prose h2 { font-size: clamp(25px, 2.6vw, 31px); line-height: 1.2; letter-spacing: -0.022em; font-weight: 600; color: var(--ink); margin: 2.1em 0 .7em; scroll-margin-top: 96px; }
.prose h3 { font-size: 21px; line-height: 1.3; letter-spacing: -0.012em; font-weight: 600; color: var(--ink); margin: 1.7em 0 .5em; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(0,64,240,.3); text-underline-offset: 3px; text-decoration-thickness: 1.5px; transition: text-decoration-color .15s; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .4em 0; padding-left: .2em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); font-size: 20px; line-height: 1.6; color: var(--ink); font-style: normal; }
.prose code { font-family: "JetBrains Mono", monospace; font-size: .86em; background: var(--bg-3); padding: 2px 6px; border-radius: 5px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
@media (max-width: 620px) {
  .prose { font-size: 17px; }
  .prose .lead { font-size: 19px; }
}

/* Passo a passo */
.prose ol.steps { list-style: none; padding: 0; counter-reset: step; }
.prose ol.steps > li { counter-increment: step; position: relative; padding: 0 0 0 54px; margin: 0 0 1.1em; }
.prose ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 15px;
}

/* Destaques */
.prose .callout { background: var(--accent-soft); border: 1px solid rgba(0,64,240,.16); border-radius: 14px; padding: 20px 24px; margin: 1.8em 0; font-size: 16.5px; line-height: 1.7; }
.prose .callout > strong:first-child { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; font-family: "JetBrains Mono", monospace; font-weight: 500; }
.prose .callout p { margin: 0 0 .6em; }
.prose .callout p:last-child, .prose .callout ul:last-child { margin-bottom: 0; }
.prose .callout--tip { background: #effaf3; border-color: rgba(22,163,74,.22); }
.prose .callout--tip > strong:first-child { color: #15803d; }
.prose .callout--warn { background: #fff8eb; border-color: rgba(217,119,6,.25); }
.prose .callout--warn > strong:first-child { color: #b45309; }

.prose .keypoints { border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px; margin: 1.8em 0; background: #fff; box-shadow: 0 12px 34px -24px rgba(11,18,32,.3); }
.prose .keypoints h3 { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.prose .keypoints h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.prose .keypoints ul { margin: 0; font-size: 16.5px; line-height: 1.65; }

/* Tabela */
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; margin: 1.8em 0; -webkit-overflow-scrolling: touch; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; min-width: 520px; }
.prose th { background: var(--bg-2); text-align: left; font-weight: 600; color: var(--ink); padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.prose td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.prose tr:last-child td { border-bottom: 0; }
.prose td:first-child { color: var(--ink); font-weight: 600; }

/* Glossário */
.prose dl.glossary { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 1.8em 0; }
.prose dl.glossary > div { display: grid; grid-template-columns: 200px 1fr; gap: 18px; padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 16px; line-height: 1.6; }
.prose dl.glossary > div:last-child { border-bottom: 0; }
.prose dl.glossary > div:nth-child(odd) { background: var(--bg-2); }
.prose dl.glossary dt { font-weight: 600; color: var(--ink); }
.prose dl.glossary dd { color: var(--ink-2); }
@media (max-width: 620px) { .prose dl.glossary > div { grid-template-columns: 1fr; gap: 4px; } }

/* Números */
.prose .stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 1.8em 0; }
.prose .stat { border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px; background: linear-gradient(180deg, var(--accent-soft), #fff 80%); }
.prose .stat b { display: block; font-size: 28px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; background: var(--grad-tx); -webkit-background-clip: text; background-clip: text; color: transparent; }
.prose .stat span { display: block; margin-top: 8px; font-size: 13.5px; line-height: 1.45; color: var(--ink-3); }

/* Figuras */
.prose figure { margin: 2em 0; }
.prose figure.diagram { border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px 18px; background: #fff; }
.prose figure.diagram svg { display: block; width: 100%; height: auto; }
.prose figure.photo img { width: 100%; border-radius: 14px; }
.prose figcaption { font-size: 13.5px; line-height: 1.5; color: var(--ink-3); margin-top: 12px; text-align: center; }

/* FAQ */
.post-faq { margin-top: 64px; }
.post-faq h2 { margin-top: 0; }
.faq-item { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; background: #fff; transition: border-color .15s; }
.faq-item[open] { border-color: rgba(0,64,240,.28); }
.faq-item summary { cursor: pointer; list-style: none; padding: 18px 54px 18px 22px; font-weight: 600; font-size: 17px; line-height: 1.45; color: var(--ink); position: relative; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 22px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 400; color: var(--accent); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0; padding: 0 22px 20px; font-size: 16.5px; line-height: 1.7; color: var(--ink-2); }

/* Fontes */
.post-sources { margin-top: 48px; padding: 24px 26px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
.post-sources h2 { font-size: 15px !important; margin: 0 0 10px !important; font-family: "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: .05em; font-weight: 500 !important; color: var(--ink-3) !important; }
.post-sources ul { margin: 0; font-size: 15px; line-height: 1.6; }
.post-sources li { margin: .3em 0; }
.post-sources p { font-size: 13.5px; color: var(--ink-3); margin: 14px 0 0; line-height: 1.6; }

/* Assinatura */
.post-author { display: flex; gap: 18px; align-items: center; margin-top: 40px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 16px; }
.post-author img { width: 52px; height: 52px; flex-shrink: 0; border-radius: 14px; border: 1px solid var(--line); padding: 8px; background: #fff;  object-fit: contain; }
.post-author b { display: block; font-size: 16px; color: var(--ink); }
.post-author p { margin: 4px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.post-share-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 28px; font-size: 14px; color: var(--ink-3); }

/* Relacionados */
.related { padding: 88px 0; background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.related .sec-head { margin-bottom: 40px; }

/* Diagramas no celular: mantém o texto legível e rola na horizontal */
@media (max-width: 620px) {
  .prose figure.diagram { padding: 18px 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .prose figure.diagram svg { min-width: 640px; padding: 0 14px; }
  .prose figure.diagram figcaption { padding: 0 14px; position: sticky; left: 0; max-width: calc(100vw - 42px); }
}
