/* Rocksosint · blog (layouts/rk_post.html.j2 e blog/index)
 *
 * Coluna de leitura de ~68ch com índice fixo à esquerda no desktop (mesma lógica
 * do .legal). Vinho só em detalhe: fio do "Key takeaways", sublinhado de link,
 * número das fontes. Só consome tokens.
 */

/* ============ Cabeçalho do post ============ */

.post__crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-6);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.post__crumbs a {
  color: var(--text-muted);
  text-decoration: none;
}

.post__crumbs a:hover {
  color: var(--text-strong);
}

.post__head {
  max-width: 52rem;
}

.post__kicker {
  margin-bottom: var(--sp-4);
  color: var(--text-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post__title {
  font-size: var(--text-display-s);
  line-height: 1.02;
  text-wrap: balance;
}

.post__lede {
  max-width: 60ch;
  margin-top: var(--sp-5);
  color: var(--text);
  font-size: var(--text-md);
  line-height: 1.45;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  margin-top: var(--sp-5);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.post__meta a {
  color: var(--text-strong);
  text-decoration: none;
}

.post__meta a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.post__cover {
  margin: var(--sp-7) 0 var(--sp-8);
}

.post__cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r-lg);
}

/* ============ Grade: índice + corpo ============ */

.post__grid {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: var(--sp-8);
  align-items: start;
}

.post__toc {
  position: sticky;
  top: calc(72px + var(--sp-5));
  display: grid;
  gap: var(--sp-1);
  max-height: calc(100dvh - 72px - var(--sp-7));
  overflow: auto;
  font-size: var(--text-sm);
}

.post__toc-head {
  margin-bottom: var(--sp-2);
  color: var(--text-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post__toc a {
  padding: var(--sp-1) 0;
  color: var(--text-muted);
  text-decoration: none;
  line-height: 1.35;
}

.post__toc a:hover {
  color: var(--text-strong);
}

/* ============ Corpo ============ */

.post__body {
  max-width: 68ch;
  color: var(--text);
  font-size: 1.0625rem;
}

.post__body h2 {
  margin: var(--sp-8) 0 var(--sp-4);
  font-size: var(--text-xl);
  line-height: 1.15;
  text-wrap: balance;
  scroll-margin-top: calc(72px + var(--sp-4));
}

.post__body h3 {
  margin: var(--sp-6) 0 var(--sp-2);
  font-size: var(--text-md);
  line-height: 1.25;
}

.post__body p,
.post__body li {
  margin: 0 0 var(--sp-4);
  line-height: 1.7;
}

.post__body ul,
.post__body ol {
  margin-bottom: var(--sp-5);
  padding-inline-start: var(--sp-5);
}

.post__body li {
  margin-bottom: var(--sp-2);
}

.post__body a {
  color: var(--text-strong);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.post__body strong {
  color: var(--text-strong);
}

.post__body code {
  padding: 0.1em 0.35em;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  font-family: var(--font-data);
  font-size: 0.9em;
}

/* Resumo no topo: o bloco que IA e leitor apressado leem primeiro */
.post__takeaways {
  margin: 0 0 var(--sp-7);
  padding: var(--sp-5) var(--sp-6);
  border: var(--rule) solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.post__takeaways-head {
  margin-bottom: var(--sp-3) !important;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-heavy);
}

.post__takeaways ul {
  margin: 0;
}

.post__takeaways li:last-child {
  margin-bottom: 0;
}

/* Nota curta dentro do texto (aviso, dica, achado nosso) */
.post__note {
  margin: var(--sp-5) 0 var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-1);
}

.post__note p:last-child {
  margin-bottom: 0;
}

/* Passos numerados */
.post__steps {
  counter-reset: step;
  list-style: none;
  padding-inline-start: 0 !important;
}

.post__steps > li {
  position: relative;
  padding-inline-start: var(--sp-7);
  counter-increment: step;
}

.post__steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  top: 0.15em;
  left: 0;
  color: var(--text-muted);
  font-family: var(--font-data);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

/* Tabela comparativa */
.post__table-wrap {
  margin: var(--sp-5) 0 var(--sp-6);
  overflow-x: auto;
}

.post__table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.post__table th,
.post__table td {
  padding: var(--sp-3);
  border-bottom: var(--rule) solid var(--line);
  text-align: start;
  vertical-align: top;
  line-height: 1.5;
}

.post__table thead th {
  color: var(--text-muted);
  font-weight: var(--weight-medium);
}

.post__table tbody th {
  color: var(--text-strong);
  font-weight: var(--weight-medium);
}

/* FAQ aberto (sem acordeão): a resposta precisa estar no HTML visível */
.post__faq {
  padding: var(--sp-4) 0;
  border-top: var(--rule) solid var(--line);
}

.post__faq h3 {
  margin-top: 0;
}

.post__faq p {
  margin-bottom: 0;
}

.post__sources {
  font-size: var(--text-sm);
}

.post__sources li {
  margin-bottom: var(--sp-2);
  font-variant-numeric: tabular-nums;
}

.post__sources li::marker {
  color: var(--accent-text);
}

.post__author {
  margin-top: var(--sp-7);
  padding-top: var(--sp-5);
  border-top: var(--rule) solid var(--line);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.post__author p {
  margin: 0;
}

/* ============ Busca no fim do post ============ */

.post__search {
  display: flex;
  flex: 1 1 26rem;
  gap: var(--sp-2);
  max-width: 34rem;
}

.post__search .input {
  flex: 1;
  font-family: var(--font-data);
}

/* ============ Índice do blog ============ */

.bl-list {
  display: grid;
  gap: var(--sp-6);
  margin-bottom: var(--sp-8);
}

.bl-card {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--sp-6);
  align-items: center;
  padding-top: var(--sp-6);
  border-top: var(--rule) solid var(--line);
  color: inherit;
  text-decoration: none;
}

.bl-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--r-md);
}

.bl-card__kicker {
  margin-bottom: var(--sp-3);
  color: var(--text-muted);
  font-family: var(--font-data);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bl-card__title {
  font-size: var(--text-xl);
  line-height: 1.15;
  text-wrap: balance;
}

.bl-card__text {
  margin-top: var(--sp-3);
  color: var(--text);
  line-height: 1.6;
}

.bl-card__meta {
  margin-top: var(--sp-4);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.bl-card:hover .bl-card__title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}

.bl-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
  border-radius: var(--r-sm);
}

@media (max-width: 1000px) {
  .post__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-6);
  }

  .post__toc {
    position: static;
    max-height: none;
    padding: var(--sp-4) var(--sp-5);
    border: var(--rule) solid var(--line);
    border-radius: var(--r-md);
  }
}

@media (max-width: 700px) {
  .bl-card {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-4);
  }

  .post__search {
    flex-direction: column;
  }

  .post__takeaways {
    padding: var(--sp-4) var(--sp-5);
  }
}
