/* =====================================================================
   EdgeWarden — blog (listagem, artigo, índice lateral)
   Usa os tokens e componentes do ew.css (.code, .note, .table-wrap, .chip,
   .cta-band, .page-hero). Aqui só o que é próprio do blog.
   ===================================================================== */

.blog-filter[hidden], .blog-empty[hidden], .post-card[hidden], .filter-btn[hidden] { display: none !important; }

/* Ícone do botão Copiar dos blocos de código */
.code__copy svg { width: 14px; height: 14px; }

/* ---------- Trilha ---------- */
.crumbs { margin-bottom: 22px; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; list-style: none; margin: 0; padding: 0; font: 500 var(--fs-xs) var(--font-mono); color: var(--text-4); }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before { content: "/"; margin: 0 10px; color: var(--line-strong); }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text-1); }
.crumbs [aria-current] { color: var(--text-2); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Cabeçalho do artigo ---------- */
.post-hero h1 { font-size: clamp(2rem, 1.25rem + 2.6vw, 3.4rem); line-height: 1.06; max-width: 22ch; text-wrap: balance; }
.post-hero .lead { max-width: 64ch; color: var(--text-2); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; list-style: none; margin: 26px 0 0; padding: 0; font-size: var(--fs-sm); color: var(--text-3); }
.post-meta li { display: inline-flex; align-items: center; gap: 8px; }
.post-meta svg { width: 16px; height: 16px; color: var(--in); flex: none; }
.post-vendor { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.post-vendor:hover { color: var(--text-1); }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 18px 0 0; padding: 0; }
.post-tag { display: inline-flex; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(12,24,48,.7); color: var(--text-3); font: 500 12px var(--font-mono); }
.post-tag:hover { color: var(--text-1); border-color: var(--in); }

/* Nível: três barras, preenchidas conforme a dificuldade */
.level { display: inline-flex; align-items: center; gap: 7px; padding: 3px 9px 3px 7px; border-radius: 6px; border: 1px solid; font-family: var(--font-body); font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.level__bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.level__bars i { width: 3px; border-radius: 1px; background: currentColor; opacity: .25; }
.level__bars i:nth-child(1) { height: 5px; }
.level__bars i:nth-child(2) { height: 8px; }
.level__bars i:nth-child(3) { height: 11px; }
.level__bars[data-bars="1"] i:nth-child(-n+1),
.level__bars[data-bars="2"] i:nth-child(-n+2),
.level__bars[data-bars="3"] i { opacity: 1; }
.level--basico { color: #8ff0bf; border-color: rgba(61,214,140,.35); background: rgba(61,214,140,.07); }
.level--intermediario { color: #9be6f5; border-color: rgba(60,198,228,.35); background: rgba(60,198,228,.07); }
.level--avancado { color: #c9b8ff; border-color: rgba(182,156,255,.38); background: rgba(182,156,255,.08); }

/* ---------- Layout do artigo: índice + texto ---------- */
.post-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.post-layout--single { grid-template-columns: minmax(0, 1fr); }
.post-toc { position: sticky; top: calc(var(--nav-h) + 24px); max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; overscroll-behavior: contain; padding: 20px 14px 20px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); font-size: var(--fs-sm); line-height: 1.45; scrollbar-width: thin; }
.post-toc__title { display: block; margin: 0 0 12px 4px; font: 500 var(--fs-xs) var(--font-mono); color: var(--text-3); list-style: none; }
.post-toc__title::-webkit-details-marker { display: none; }
@media (min-width: 901px) { .post-toc__title { pointer-events: none; } }
.post-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.post-toc li { counter-increment: toc; }
.post-toc a { display: grid; grid-template-columns: 22px 1fr; gap: 4px; padding: 6px 8px 6px 4px; border-left: 2px solid transparent; border-radius: 0 6px 6px 0; color: var(--text-3); transition: color .2s, background .2s, border-color .2s; }
.post-toc a::before { content: counter(toc, decimal-leading-zero); font: 500 11px/1.9 var(--font-mono); color: var(--text-4); }
.post-toc a:hover { color: var(--text-1); background: rgba(255,255,255,.03); }
.post-toc a.is-active { color: var(--text-1); border-left-color: var(--in); background: rgba(60,198,228,.06); }
.post-toc a.is-active::before { color: var(--in); }

/* ---------- Prosa ---------- */
.prose { min-width: 0; color: var(--text-2); font-size: 1.0625rem; line-height: 1.72; }
.prose > * { max-width: 72ch; }
.prose > .code, .prose > .table-wrap, .prose > figure { max-width: none; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: var(--fs-lg); line-height: 1.2; margin: 2.4em 0 .7em; padding-top: 1.5em; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 20px); }
.prose > h2:first-child { padding-top: 0; border-top: 0; }
.prose h3 { font-size: var(--fs-md); line-height: 1.3; margin: 1.9em 0 .55em; scroll-margin-top: calc(var(--nav-h) + 20px); }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.4em; }
.prose li { margin: .45em 0; padding-left: .2em; }
.prose li::marker { color: var(--text-4); }
.prose ol > li::marker { font: 500 .88em var(--font-mono); color: var(--in); }
.prose li > ul, .prose li > ol { margin: .4em 0 .2em; }
.prose strong { color: var(--text-1); font-weight: 600; }
.prose a { color: var(--in); text-decoration: underline; text-decoration-color: rgba(60,198,228,.35); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { color: #7fe3f7; text-decoration-color: currentColor; }
.prose hr { margin: 2.4em 0; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--line-strong); color: var(--text-3); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose .code { margin: 18px 0 26px; }
.prose .code pre { font-size: 13.5px; }
.prose .note { margin: 22px 0 26px; font-size: .95rem; }
.prose .note ul, .prose .note ol { margin: .4em 0 0; }
.prose .table-wrap { margin: 1.4em 0 1.8em; }
.prose td { color: var(--text-2); line-height: 1.5; }
.prose td:first-child { color: var(--text-1); }
.prose td code, .prose th code { white-space: nowrap; }
.prose .ta-center { text-align: center; }
.prose .ta-right { text-align: right; }
.post-figure { margin: 26px 0 30px; }
.post-figure img { border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }

@media (max-width: 1080px) {
  .post-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 36px; }
}
@media (max-width: 900px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .post-toc { position: static; max-height: none; padding: 0; }
  .post-toc__title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 14px 16px; cursor: pointer; color: var(--text-2); }
  .post-toc__title::after { content: ""; width: 8px; height: 8px; margin-right: 4px; border-right: 2px solid var(--in); border-bottom: 2px solid var(--in); transform: rotate(45deg) translateY(-2px); transition: transform .25s var(--ease-out); }
  .post-toc__box[open] .post-toc__title::after { transform: rotate(225deg) translateY(-2px); }
  .post-toc__box[open] .post-toc__title { border-bottom: 1px solid var(--line); }
  .post-toc nav { padding: 10px 10px 12px 12px; }
  .post-toc ol { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); column-gap: 12px; }
  .crumbs [aria-current] { max-width: 28ch; }
}
@media (max-width: 640px) {
  .prose { font-size: 1rem; line-height: 1.68; }
  .prose h2 { margin-top: 2em; padding-top: 1.2em; }
  .prose .code { margin-inline: calc(var(--gutter) * -1); border-radius: 0; border-inline: 0; }
  .prose .code pre { padding: 14px 16px; font-size: 12.5px; }
  .post-meta { gap: 8px 16px; }
  .crumbs li:last-child { display: none; }
}

/* ---------- Listagem ---------- */
.blog-hero h1 { max-width: 20ch; }
.blog-hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin: 26px 0 0; font: 500 var(--fs-xs) var(--font-mono); color: var(--text-3); }
.blog-hero__meta a { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); }
.blog-hero__meta a:hover { color: var(--text-1); }
.blog-hero__meta svg { width: 15px; height: 15px; color: var(--warn); }

.blog-filter { display: grid; gap: 14px; margin-bottom: clamp(28px, 4vw, 44px); padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(16,32,61,.55), rgba(12,24,48,.55)); }
.blog-filter__group { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: start; }
.blog-filter__label { padding-top: 6px; font: 500 var(--fs-xs) var(--font-mono); color: var(--text-3); }
.blog-filter__opts { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-btn { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(7,16,34,.6); color: var(--text-2); font: 500 var(--fs-xs) var(--font-body); cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.filter-btn[data-filter="tag"] { font-family: var(--font-mono); font-size: 12px; }
.filter-btn:hover { color: var(--text-1); border-color: var(--in); }
.filter-more { padding: 5px 10px; border: 0; background: none; color: var(--in); font: 500 12px var(--font-body); cursor: pointer; }
.filter-more:hover { color: #7fe3f7; text-decoration: underline; text-underline-offset: 3px; }
.filter-btn[aria-pressed="true"] { color: #fff; border-color: rgba(47,107,255,.8); background: rgba(47,107,255,.22); }
@media (max-width: 640px) {
  .blog-filter { padding: 14px; }
  .blog-filter__group { grid-template-columns: 1fr; gap: 8px; }
  .blog-filter__label { padding-top: 0; }
}

.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 22px); list-style: none; margin: 0; padding: 0; }
@media (max-width: 1024px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }

.post-card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 22px 22px 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(16,32,61,.72), rgba(12,24,48,.72)); transition: border-color .25s, transform .25s var(--ease-out), box-shadow .25s; }
.post-card::before { content: ""; position: absolute; left: 22px; right: 22px; top: -1px; height: 1px; background: linear-gradient(90deg, var(--in), transparent 70%); opacity: .55; }
.post-card:hover, .post-card:focus-within { border-color: rgba(60,198,228,.45); transform: translateY(-2px); box-shadow: 0 24px 60px -36px rgba(47,107,255,.8); }
.post-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; font: 500 12px var(--font-mono); color: var(--text-3); }
.post-card__title { margin: 0 0 10px; font-size: var(--fs-md); line-height: 1.25; letter-spacing: -.005em; text-wrap: balance; }
.post-card__title a { color: var(--text-1); }
.post-card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.post-card__title a:focus-visible { outline: none; }
.post-card:has(.post-card__title a:focus-visible) { outline: 2px solid var(--in); outline-offset: 3px; }
.post-card:hover .post-card__title a { color: #fff; }
.post-card__summary { flex: 1; margin: 0 0 18px; font-size: var(--fs-sm); line-height: 1.6; color: var(--text-3); }
.post-card__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; }
.post-card__vendor { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 500; }
.post-card__vendor svg { width: 14px; height: 14px; color: var(--in); }
.post-card__tags { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; font-family: var(--font-mono); color: var(--text-4); }
.post-card__more { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; font-size: var(--fs-xs); font-weight: 600; color: var(--in); }
.post-card__more svg { width: 15px; height: 15px; transition: transform .25s var(--ease-out); }
.post-card:hover .post-card__more svg { transform: translateX(3px); }

.blog-empty { padding: 40px 20px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.blog-empty p { margin: 0 auto 14px; }

/* ---------- Relacionados ---------- */
.post-related__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.post-related__head h2 { font-size: var(--fs-xl); margin: 0; }
.post-related__head .btn svg { width: 16px; height: 16px; }
