/* blog.ioona.co — folha de estilo única do site público.
   Paleta derivada dos tokens do site institucional (ioona-site), em modo claro:
   corpo cinza-claro para leitura prolongada (pedido de UX) e cards brancos
   para dar hierarquia e reforçar o "isto é clicável".
   Servida como /blog.css com cache-busting por mtime (ver site/src/server.js),
   por isso as URLs terminam em ?v=... */

:root {
  /* superfícies */
  --page-bg: #f2f3f5;          /* cinza-claro do corpo do site */
  --card-bg: #ffffff;
  --card-bg-hover: #fbfcfd;
  --border: #e3e5e9;
  --border-strong: #d3d7dd;

  /* texto — os três tons passam AA (>=4.5:1) sobre o fundo cinza-claro e
     sobre os cards brancos */
  --text: #1b1b1f;
  --text-muted: #55585f;
  --text-faint: #676c74;

  /* marca */
  --accent: #ff5e00;           /* uso decorativo (blocos, kicker, ícones) */
  --accent-text: #c04400;      /* uso em texto: contraste AA sobre branco */
  --accent-soft: #fff1e8;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 22, 0.04), 0 8px 24px -16px rgba(16, 18, 22, 0.18);
  --shadow-hover: 0 2px 4px rgba(16, 18, 22, 0.06), 0 18px 40px -20px rgba(16, 18, 22, 0.28);

  --font-display: 'Bricolage Grotesque', 'Sora', -apple-system, system-ui, sans-serif;
  --font-body: 'Sora', -apple-system, system-ui, 'Segoe UI', sans-serif;

  color-scheme: light; /* design claro fixo: evita texto escuro sobre fundo escuro */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

img { max-width: 100%; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--card-bg); padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0; z-index: 10;
}
.skip-link:focus { left: 0; }

/* ---------- header / footer ---------- */

header.site {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 860px; margin: 0 auto; padding: 20px;
}
header.site .brand { display: flex; align-items: center; gap: 10px; }
header.site .brand img { height: 30px; width: auto; display: block; }
header.site .brand span {
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  color: var(--text-muted); letter-spacing: 0.01em;
  border-left: 1px solid var(--border-strong); padding-left: 10px;
}
header.site nav { display: flex; align-items: center; gap: 8px; }
header.site nav a {
  color: var(--text); font-weight: 500; font-size: 15px;
  padding: 8px 12px; border-radius: 999px;
}
header.site nav a:hover { background: rgba(16, 18, 22, 0.05); text-decoration: none; }
header.site nav a.btn-primary {
  background: var(--accent); color: #fff; font-weight: 600;
}
header.site nav a.btn-primary:hover { background: #e85500; }

footer.site {
  margin-top: 72px; padding: 28px 20px 48px;
  border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: 14px; text-align: center;
}
footer.site a { color: var(--text-muted); }
footer.site .sep { margin: 0 8px; opacity: 0.6; }

/* ---------- hero da listagem ---------- */

.hero { max-width: 860px; margin: 8px auto 32px; padding: 0 20px; }
.kicker {
  display: inline-block; margin: 0 0 14px;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5.4vw, 46px);
  line-height: 1.12; letter-spacing: -0.02em;
  margin: 0 0 14px; font-weight: 700;
}
.hero .sub { margin: 0; max-width: 62ch; color: var(--text-muted); font-size: 18px; }

/* ---------- lista de artigos ---------- */

.post-list { display: flex; flex-direction: column; gap: 28px; max-width: 860px; margin: 0 auto; padding: 0 20px; }

.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: var(--border-strong); }

/* Faixa larga em vez de 16:9: a capa é ambientação aqui, e assim o título e
   o trecho do texto aparecem sem exigir scroll. Não é link (o clique do card
   inteiro pertence ao título), só uma faixa de imagem. */
.card__cover { display: block; aspect-ratio: 21 / 9; overflow: hidden; background: #eceef1; }
.card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card__body { padding: 26px 28px 24px; }
.card__eyebrow { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.card__title {
  font-family: var(--font-display);
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.22; letter-spacing: -0.015em;
  margin: 0 0 10px; font-weight: 650;
}
.card__title a { color: var(--text); }
/* link esticado: o card inteiro vira área de clique, mantendo a semântica no título */
.card__title a::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.card__title a:hover { text-decoration: none; color: var(--accent-text); }

.card__meta { margin: 0 0 14px; font-size: 13.5px; color: var(--text-faint); }
.card__meta .dot, .post__meta .dot { margin: 0 7px; opacity: 0.6; }

/* Trecho do artigo, limitado por altura. O esmaecimento só entra quando o
   texto realmente continua além do que está na tela (`--clipped`), para
   artigos curtos não aparecerem com o fim do texto apagado. */
.card__teaser { position: relative; max-height: 158px; overflow: hidden; }
.card__teaser p { margin: 0; color: var(--text-muted); font-size: 16.5px; line-height: 1.72; }
.card__teaser--clipped::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 84px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--card-bg) 78%);
  pointer-events: none;
}

/* Afordância visual do card. O clique é do link do título (esticado), então
   este elemento é decorativo: nada de <a> aqui, para não duplicar link e
   atrapalhar leitores de tela. O feedback de hover vem do próprio card. */
.card__cta {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 18px; padding: 11px 20px;
  background: var(--accent-soft); color: var(--accent-text);
  border-radius: 999px; font-weight: 600; font-size: 15px;
  pointer-events: none;
}
.card:hover .card__cta { background: var(--accent); color: #fff; }
.card__cta .arrow { transition: transform 0.18s ease; }
.card:hover .card__cta .arrow { transform: translateX(3px); }

/* Botão de verdade, para CTAs soltos (ex. página 404). */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; background: var(--accent);
  color: #fff; font-weight: 600; font-size: 15px;
}
.btn:hover { background: #e85500; color: #fff; text-decoration: none; }
.btn .arrow { transition: transform 0.18s ease; }
.btn:hover .arrow { transform: translateX(3px); }

.tag {
  display: inline-block; background: var(--accent-soft); color: var(--accent-text);
  border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 500;
  letter-spacing: 0.01em;
}
/* Tag como link para a página de assunto. Dentro do card ela precisa vencer o
   link esticado do título (que cobre o card inteiro em z-index 0), senão o
   clique cairia sempre no artigo: `position: relative` + `z-index: 1` acima
   dele. O hover fica na cor cheia da marca, que é o sinal de "isto é link". */
a.tag { position: relative; z-index: 1; }
a.tag:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* Volta para a listagem completa no fim da página de assunto. */
.tag-back { max-width: 860px; margin: 32px auto 0; padding: 0 20px; font-size: 15px; font-weight: 500; }

.pagination { display: flex; justify-content: space-between; align-items: center; max-width: 860px; margin: 40px auto 0; padding: 0 20px; }
.pagination a, .pagination span {
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card-bg); font-size: 15px; font-weight: 500;
}
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .page-of { border: 0; background: transparent; color: var(--text-faint); font-size: 14px; }

.empty { max-width: 860px; margin: 0 auto; padding: 48px 20px; text-align: center; color: var(--text-muted); }

/* ---------- artigo ---------- */

.back-link { display: inline-block; margin: 0 0 20px; font-size: 15px; font-weight: 500; }

article.post { max-width: 760px; margin: 0 auto; padding: 0 20px; }
article.post h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.6vw, 40px);
  line-height: 1.15; letter-spacing: -0.02em;
  margin: 0 0 14px; font-weight: 700;
}
article.post .post__meta { font-size: 14px; color: var(--text-faint); margin: 0 0 14px; }
article.post .cover { width: 100%; border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; margin: 22px 0 4px; }

/* corpo vindo de HTML de terceiro — sem classes, então estilizamos por elemento */
.post__content { margin-top: 26px; }
.post__content > :first-child { margin-top: 0; }
.post__content p { margin: 0 0 1.15em; }
.post__content h2 {
  font-family: var(--font-display); font-size: 27px; line-height: 1.25;
  letter-spacing: -0.015em; margin: 1.9em 0 0.6em;
}
.post__content h3 {
  font-family: var(--font-display); font-size: 21px; line-height: 1.3;
  margin: 1.6em 0 0.5em;
}
.post__content ul, .post__content ol { margin: 0 0 1.15em; padding-left: 1.35em; }
.post__content li { margin-bottom: 0.45em; }
.post__content li::marker { color: var(--accent); }
.post__content a { text-decoration: underline; text-decoration-color: rgba(192, 68, 0, 0.35); text-underline-offset: 3px; }
.post__content a:hover { text-decoration-color: currentColor; }
.post__content img { border-radius: var(--radius-sm); height: auto; }
.post__content blockquote {
  margin: 1.5em 0; padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent); color: var(--text-muted); font-style: italic;
}
.post__content code {
  background: rgba(16, 18, 22, 0.06); padding: 2px 6px; border-radius: 6px;
  font-size: 0.9em;
}
.post__content pre {
  background: #1b1b1f; color: #f2f3f5; padding: 16px 18px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 14.5px; line-height: 1.6;
}
.post__content pre code { background: none; padding: 0; color: inherit; }
.post__content table { width: 100%; border-collapse: collapse; margin: 0 0 1.15em; font-size: 15.5px; }
.post__content th, .post__content td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; }
.post__content th { background: var(--card-bg); font-weight: 600; }
.post__content hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }

.post__tags { margin: 34px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- leia também (links internos automáticos) ---------- */

.related { margin-top: 40px; }
.related__title {
  font-family: var(--font-display);
  font-size: 19px; letter-spacing: -0.01em;
  margin: 0 0 14px; font-weight: 700;
}
.related__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.related__item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card-bg);
}
.related__link { font-weight: 600; }
.related__meta { color: var(--text-faint); font-size: 13px; white-space: nowrap; }

.read-more {
  margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--border);
}
.read-more a { font-weight: 600; }

@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .card__body { padding: 20px 20px 20px; }
  .card__teaser { max-height: 140px; }
  .hero { margin-bottom: 30px; }
  header.site { padding: 16px 20px; }
  header.site .brand span { display: none; }
  header.site nav a { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
}
