/* AI Solutions · Blog: índice (/blog/) e posts (/blog/<slug>/). Depois de base.css (e de prosa.css + cta.css nos posts).
   Cartão de artigo, destaque curado, arquivo com pesquisa e filtro, faixa de novidades, cabeçalho do post,
   índice lateral ("Neste artigo") e afinação da prosa para leitura longa. */

/* estados controlados pelo blog.js: o [hidden] ganha sempre às classes com display */
.artigos > [hidden], .artigos__mais [hidden], .artigos__vazio[hidden], [data-destaque][hidden], .post__meta [hidden] { display: none !important; }
.js .artigos > [data-extra] { display: none; }
html:not(.js) .filtros, html:not(.js) .artigos__mais, html:not(.js) .partilhar { display: none; }

/* ---------- cartão de artigo ---------- */
.artigos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 22px); }
.artigo {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border-radius: 18px; border: 1px solid var(--traco); background: rgba(243, 240, 255, .03);
  transition: border-color .25s, background-color .25s, box-shadow .4s var(--ease-out);
}
.artigo:hover { border-color: rgba(228, 220, 255, .38); background: rgba(243, 240, 255, .05); box-shadow: 0 22px 44px -26px rgba(107, 83, 249, .8); }
.artigo__capa { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--indigo); }
.artigo__capa img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.artigo:hover .artigo__capa img { transform: scale(1.035); }
/* fio de luz por baixo da capa: acende no hover */
.artigo__capa::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, rgba(107, 83, 249, 0), #e4dcff 35%, rgba(107, 83, 249, .3) 70%, rgba(107, 83, 249, 0)); opacity: .35; transition: opacity .35s; }
.artigo:hover .artigo__capa::after { opacity: 1; box-shadow: 0 0 10px 1px rgba(107, 83, 249, .7); }
.artigo__cat { position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(10, 1, 48, .8); border: 1px solid rgba(243, 240, 255, .18); font-size: .72rem; font-weight: 650; letter-spacing: .02em; color: var(--luz); }
.artigo__corpo { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 18px 20px 16px; }
.artigo__titulo {
  margin: 0; font-family: var(--f-display); font-stretch: 112.5%; font-weight: 680; font-size: 1.1rem; line-height: 1.28; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.artigo__titulo a { color: var(--luz); text-decoration: none; }
/* o cartão inteiro é clicável: a ligação do título estende-se por cima dele */
.artigo__titulo a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 18px; }
.artigo__titulo a:focus-visible { outline: none; }
.artigo__titulo a:focus-visible::after { outline: 2px solid var(--halo); outline-offset: -3px; }
.artigo__resumo { margin: 0; font-size: .92rem; line-height: 1.55; color: var(--texto-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.artigo__data { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; font-size: .8rem; color: var(--texto-3); }
.artigo__data span { display: inline-flex; align-items: center; gap: 12px; }
.artigo__data span::before, .post__meta .prosa-meta li + li::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: #cfc6ff; }
.post__meta .prosa-meta li + li::before { display: inline-block; vertical-align: middle; margin: 0 12px 0 0; }
.artigo__rodape { margin-top: auto; display: flex; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--traco); }
.artigo__tags { display: flex; gap: 5px; flex: 1; min-width: 0; margin: 0; overflow: hidden; }
.artigo__tags span { min-width: 0; max-width: 13rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--traco); font-size: .72rem; line-height: 1.3; color: var(--texto-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artigo__tags .artigo__mais-tags { flex: none; }
.artigo__ler { position: relative; z-index: 2; flex: none; font-size: .85rem; font-weight: 600; color: var(--luz); text-decoration: underline; text-decoration-color: rgba(243, 240, 255, .35); text-underline-offset: .25em; }
.artigo__ler:hover { text-decoration-color: var(--luz); }

/* ---------- índice: destaque curado ---------- */
.blog__rotulo { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; font-family: var(--f-display); font-stretch: 112.5%; font-weight: 700; font-size: clamp(1.25rem, 1.7vw, 1.5rem); line-height: 1.1; letter-spacing: -.018em; }
.blog__rotulo::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(228, 220, 255, .45), rgba(107, 83, 249, 0) 70%); }
.destaque { padding-top: 0; }
.destaque__lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 22px); }
.artigo--destaque { border-color: rgba(107, 83, 249, .42); background: var(--superficie); }
.artigo--destaque .artigo__corpo { padding: 20px 22px 18px; gap: 12px; }
.artigo--destaque .artigo__titulo { font-size: clamp(1.15rem, 1.45vw, 1.34rem); line-height: 1.22; -webkit-line-clamp: 4; }

/* ---------- índice: arquivo com pesquisa ---------- */
.arquivo__cab { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px 32px; margin-bottom: clamp(22px, 3.4vh, 34px); }
.arquivo__cab .cabeca__texto { max-width: 34rem; }
.filtros { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.filtros__pesquisa { position: relative; display: flex; align-items: center; width: min(100%, 320px); }
.filtros__pesquisa svg { position: absolute; left: 15px; width: 18px; height: 18px; color: var(--texto-3); pointer-events: none; }
.filtros__pesquisa input { width: 100%; height: 46px; padding: 0 16px 0 44px; border-radius: 999px; border: 1px solid var(--traco-forte); background: #0D0238; color: var(--luz); font: 500 .95rem var(--f-texto); }
.filtros__pesquisa input::placeholder { color: #8C85C0; }
.filtros__pesquisa input:focus { outline: 2px solid var(--halo); outline-offset: 1px; border-color: transparent; }
.filtros__cats { display: flex; flex-wrap: wrap; gap: 6px; }
.filtro { height: 42px; padding: 0 17px; border-radius: 999px; border: 1px solid var(--traco-forte); background: rgba(17, 0, 67, .5); color: var(--texto-2); font-weight: 600; font-size: .9rem; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s; }
.filtro:hover { border-color: rgba(228, 220, 255, .5); color: var(--luz); }
.filtro[aria-pressed="true"] { background: var(--luz); border-color: var(--luz); color: var(--indigo); }
.artigos__mais { display: flex; justify-content: center; margin: 34px 0 0; }
.artigos__vazio { margin: 0; padding: 48px 0 8px; text-align: center; color: var(--texto-2); }

/* ---------- índice: novidades (newsletter) ---------- */
.novidades { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 27rem); align-items: center; gap: 1rem 1.6rem; margin: 0 var(--margem) var(--sec-y); padding: 24px 26px; border-radius: 18px; border: 1px solid rgba(107, 83, 249, .35); background: rgba(17, 0, 67, .55); }
.novidades::before { content: ""; position: absolute; left: 8%; right: 8%; top: -1px; height: 1px; background: linear-gradient(90deg, rgba(107, 83, 249, 0), #e4dcff 40%, rgba(107, 83, 249, 0)); box-shadow: 0 0 10px 1px rgba(107, 83, 249, .6); }
.novidades__icone { width: 42px; height: 42px; padding: 9px; border-radius: 12px; color: #cfc6ff; background: rgba(107, 83, 249, .16); border: 1px solid rgba(107, 83, 249, .35); }
.novidades__titulo { margin: 0 0 3px; font-family: var(--f-display); font-stretch: 112.5%; font-weight: 680; font-size: 1.15rem; line-height: 1.2; }
.novidades__texto p { margin: 0; color: var(--texto-2); font-size: .95rem; }
.novidades__form { display: flex; gap: 10px; }
.novidades__form .campo { flex: 1; }

/* ---------- post: cabeçalho ---------- */
.post { --col: 40rem; --lado: 16rem; --vao: clamp(40px, 5vw, 80px); --caixa: calc(var(--col) + var(--lado) + var(--vao)); position: relative; z-index: 2; }
.post__cab { box-sizing: content-box; max-width: var(--caixa); margin: 0 auto; }
/* o brilho do hero passa para o artigo inteiro: numa caixa centrada, o do .hero-sub deixava uma aresta à esquerda */
.post__cab::before { display: none; }
.post::before { content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0; height: min(900px, 100vh); pointer-events: none; background: radial-gradient(38% 55% at 14% 38%, rgba(29, 8, 110, .62), rgba(29, 8, 110, 0) 70%); }
.post__cab .migalhas li:last-child { min-width: 0; }
.post__cab .migalhas [aria-current] { display: inline-block; max-width: 38ch; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; vertical-align: bottom; }
.post__etiquetas { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 0; list-style: none; }
.etiqueta { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 11px; border-radius: 999px; border: 1px solid var(--traco-forte); background: rgba(243, 240, 255, .03); font-size: .78rem; font-weight: 600; line-height: 1.25; color: var(--texto-2); }
.etiqueta--cat { color: var(--luz); border-color: rgba(143, 125, 255, .55); background: rgba(107, 83, 249, .18); }
.post__cab .hero-sub__titulo { max-width: 30ch; margin-top: 12px; font-size: clamp(1.95rem, 3.1vw, 2.8rem); line-height: 1.08; }
.post__cab .hero-sub__resposta { max-width: var(--col); }
.post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--traco); }
.post__autor { display: flex; align-items: center; gap: 10px; margin: 0; font-size: .92rem; color: var(--texto-2); }
.post__autor img, .post__iniciais { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #1c0a66; box-shadow: 0 0 0 1px var(--traco-forte); }
.post__iniciais { display: grid; place-items: center; font: 700 .9rem/1 var(--f-display); color: var(--luz); }
.post__autor b { color: var(--luz); font-weight: 600; }
.post__meta .prosa-meta { gap: 6px 12px; }
.partilhar { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--traco-forte); background: rgba(243, 240, 255, .03); color: var(--luz); font-weight: 600; font-size: .88rem; cursor: pointer; transition: border-color .2s, background-color .2s; }
.partilhar:hover { border-color: rgba(228, 220, 255, .55); background: rgba(243, 240, 255, .07); }
.partilhar svg { width: 16px; height: 16px; }
.partilhar__estado { flex-basis: 100%; margin: -4px 0 0; font-size: .84rem; color: var(--verde); }
.partilhar__estado:empty { display: none; }

/* ---------- post: capa, corpo e índice lateral ---------- */
.post__grelha {
  box-sizing: content-box; max-width: var(--caixa); margin: 0 auto; padding: 0 var(--margem) var(--sec-y);
  display: grid; grid-template-columns: minmax(0, var(--col)) minmax(0, var(--lado)); column-gap: var(--vao); align-items: start;
}
.post__capa { grid-column: 1; margin: 0 0 clamp(28px, 4.5vh, 44px); }
.post__capa img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 18px; background: var(--indigo); box-shadow: 0 0 0 1px var(--traco), 0 30px 70px -40px rgba(107, 83, 249, .75); }
.post__lado { grid-column: 2; grid-row: 1 / span 3; position: sticky; top: calc(var(--nav-h) + 20px); }
.post__corpo, .post__voltar { grid-column: 1; }
.post__voltar { margin: clamp(36px, 5vh, 52px) 0 0; }

.indice { border: 1px solid var(--traco); border-radius: 16px; background: rgba(243, 240, 255, .03); }
.indice summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; font-family: var(--f-display); font-stretch: 112.5%; font-weight: 660; font-size: .95rem; }
.indice summary::-webkit-details-marker { display: none; }
.indice summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .3s var(--ease-out); }
.indice[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.indice ol { list-style: none; margin: 0; padding: 0 10px 14px 16px; max-height: calc(100vh - var(--nav-h) - 120px); overflow-y: auto; overscroll-behavior: contain; }
.indice a { display: block; padding: 6px 8px 6px 14px; border-left: 1px solid var(--traco-forte); font-size: .85rem; line-height: 1.38; color: var(--texto-2); text-decoration: none; transition: color .2s, border-color .2s; }
.indice a:hover { color: var(--luz); }
/* secção em leitura: o traço acende (o motivo da luz, em pequeno) */
.indice a[aria-current="true"] { color: var(--luz); border-left-color: #e4dcff; box-shadow: -1px 0 0 #e4dcff, -7px 0 12px -7px rgba(143, 125, 255, .95); }

/* ---------- post: prosa afinada para leitura longa ---------- */
.post__corpo { max-width: none; font-size: 1.075rem; line-height: 1.75; }
.post__corpo > :first-child { margin-top: 0; }
.post__corpo h2, .post__corpo h3, .post__corpo h4, .post__corpo h5 { scroll-margin-top: calc(var(--nav-h) + 20px); }
.post__corpo h2 { margin-top: 2.3em; padding-top: .2em; }
.post__corpo h5 { margin-top: 1.3em; font-family: var(--f-display); font-stretch: 112.5%; font-weight: 650; font-size: 1rem; color: var(--luz); }
.prosa .prosa__ancora { color: inherit; font-weight: inherit; text-decoration: none; }
.prosa .prosa__ancora::after { content: "#"; margin-left: .35em; color: #8f7dff; opacity: 0; transition: opacity .2s; }
.prosa .prosa__ancora:hover::after, .prosa .prosa__ancora:focus-visible::after { opacity: 1; }
.post__corpo li { line-height: 1.62; }
.post__corpo li + li { margin-top: .55em; }
.post__corpo li > p { margin: .45em 0 0; }
.post__corpo li > ul, .post__corpo li > ol { margin-top: .4em; }
.post__corpo ul ul { list-style-type: circle; }
.post__corpo ul ul li::marker { color: #9d90ff; }
.post__corpo ol ol { list-style-type: lower-alpha; }
/* listas de verificação ("- [ ]") */
.post__corpo li.tarefa { position: relative; list-style: none; padding-left: 1.75em; margin-left: -1.35em; }
.post__corpo li.tarefa::before { content: ""; position: absolute; left: 0; top: .34em; width: 1.05em; height: 1.05em; border-radius: 5px; border: 1.5px solid #8f7dff; background: rgba(107, 83, 249, .12); }
.post__corpo li.tarefa--feita::before { content: "✓"; display: grid; place-items: center; font-size: .75em; font-weight: 800; color: var(--indigo); background: var(--verde); border-color: var(--verde); }
/* tabelas: colunas com largura mínima; em ecrãs estreitos desliza na horizontal */
.post__corpo .prosa__tabela table { font-size: .9rem; }
/* sombras de scroll: aparecem só do lado onde a tabela tem mais para ver */
.post__corpo .prosa__tabela {
  background:
    linear-gradient(90deg, var(--noite) 30%, rgba(10, 1, 48, 0)) left center / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--noite) 30%, rgba(10, 1, 48, 0)) right center / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(143, 125, 255, .5), rgba(143, 125, 255, 0)) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(143, 125, 255, .5), rgba(143, 125, 255, 0)) right center / 14px 100% no-repeat scroll;
}
.post__corpo .prosa__tabela th, .post__corpo .prosa__tabela td { min-width: 6.5rem; }
.post__corpo pre, .post__corpo .prosa__diagrama { max-width: 100%; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .84rem; line-height: 1.55; }
.post__corpo .prosa__diagrama { white-space: pre; overflow-x: auto; padding: 14px 16px; border-radius: 12px; background: #0D0238; border: 1px solid var(--traco); color: #DAD5F7; }
.post__corpo .prosa__caixa { border-color: rgba(107, 83, 249, .45); }
.post__corpo a.botao { margin-top: .7em; color: var(--indigo); text-decoration: none; }

/* ---------- relacionados ---------- */
.relacionados .cabeca--linha { align-items: center; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .artigos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .destaque__lista { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .artigo--destaque:first-child { grid-column: 1 / -1; }
  .post { --caixa: var(--col); }
  .post__grelha { grid-template-columns: minmax(0, 1fr); }
  .post__lado { grid-column: 1; grid-row: auto; position: static; margin: 0 0 30px; }
  .indice ol { max-height: none; }
}
@media (max-width: 900px) {
  .novidades { grid-template-columns: auto minmax(0, 1fr); }
  .novidades__form { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .artigos, .destaque__lista { grid-template-columns: 1fr; }
  .artigo--destaque:first-child { grid-column: auto; }
  .artigo__corpo { padding: 16px 16px 14px; }
  /* no telemóvel as listas (arquivo e relacionados) ficam compactas: miniatura à esquerda, título, resumo curto e data */
  .artigos { gap: 12px; }
  .artigos .artigo { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); align-items: start; }
  .artigos .artigo__capa { aspect-ratio: 1; margin: 12px 0 12px 12px; border-radius: 12px; }
  .artigos .artigo__capa::after, .artigos .artigo__cat { display: none; }
  .artigos .artigo__corpo { gap: 7px; padding: 12px 14px 13px; }
  .artigos .artigo__titulo { font-size: .98rem; line-height: 1.3; }
  .artigos .artigo__resumo { font-size: .86rem; line-height: 1.5; -webkit-line-clamp: 2; }
  .artigos .artigo__rodape { display: none; }
  .arquivo__cab { align-items: stretch; }
  .filtros, .filtros__pesquisa { width: 100%; }
  .novidades { grid-template-columns: 1fr; padding: 20px; }
  .novidades__form { flex-direction: column; }
  .post__cab .migalhas [aria-current] { max-width: 20ch; }
  .post__cab .hero-sub__titulo { font-size: clamp(1.7rem, 7.4vw, 2.1rem); }
  .partilhar { margin-left: 0; }
  .post__meta .prosa-meta { flex-direction: column; gap: 3px; }
  .post__meta .prosa-meta li + li::before { display: none; }
  .post__corpo { font-size: 1.02rem; line-height: 1.72; }
  .post__corpo .prosa__tabela th, .post__corpo .prosa__tabela td { min-width: 8.5rem; }
  .post__capa img { border-radius: 14px; }
}
