/* ==========================================================================
   HUBDASH · BLOG
   Lista (/blog/), post (/blog/<slug>/) e autor (/blog/autor/<id>/).
   Páginas geradas por scripts/build-blog.mjs.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--hd-bg); color: var(--hd-ink); }
img { max-width: 100%; height: auto; }

.blog-main { position: relative; }

/* ---------- Topo com o fundo das páginas internas ---------- */
.blog-head, .post-head {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 148px var(--hd-gutter) 72px;
  background:
    radial-gradient(ellipse 52% 46% at 88% 4%, rgba(92,138,240,.20) 0%, transparent 70%),
    radial-gradient(ellipse 46% 42% at 4% 40%, rgba(111,201,247,.16) 0%, transparent 70%),
    linear-gradient(180deg, #EAF2FB 0%, #F5F9FD 60%, #FFFFFF 100%);
}
.grain::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1; opacity: .05;
  background-size: 180px 180px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px 8px 12px; border-radius: var(--hd-r-pill);
  border: 1px solid var(--hd-border-2); background: var(--hd-surface-alt);
  font-family: var(--hd-font-mono); font-size: .72rem; font-weight: var(--hd-w-medium); letter-spacing: .08em; text-transform: uppercase; color: var(--hd-ink-muted);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--hd-accent); box-shadow: 0 0 0 3px rgba(34,102,184,.16); }

.blog-head__inner { max-width: 760px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; }
.blog-head h1 { margin: 22px 0 0; font-size: var(--hd-text-h1); text-wrap: balance; }
.blog-head__sub { margin: 18px auto 0; max-width: 56ch; font-size: 1.1875rem; line-height: 1.6; color: var(--hd-ink-muted); }
.blog-head__role { margin: 10px 0 0; font-family: var(--hd-font-ui); font-weight: var(--hd-w-medium); color: var(--hd-accent); }

/* ---------- Lista de posts ---------- */
.blog-list, .blog-related { max-width: 1180px; margin: 0 auto; padding: 8px var(--hd-gutter) 104px; }
.blog-empty { text-align: center; color: var(--hd-ink-muted); }
.post-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.post-card { height: 100%; }
.post-card__link {
  overflow: hidden; height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 28px;
  background: #fff; border: 1px solid var(--hd-border-2); border-radius: 22px; text-decoration: none; color: inherit;
  transition: border-color var(--hd-dur) var(--hd-ease), box-shadow var(--hd-dur) var(--hd-ease);
}
.post-card__link:hover { border-color: var(--hd-border); box-shadow: var(--hd-shadow-sm); }
.post-card__link:hover .post-card__title { color: var(--hd-accent); }
.post-card__cat { align-self: flex-start; padding: 5px 11px; border-radius: var(--hd-r-pill); background: var(--hd-info-bg); color: var(--hd-accent); font-family: var(--hd-font-mono); font-size: .7rem; font-weight: var(--hd-w-medium); letter-spacing: .08em; text-transform: uppercase; }
.post-card__title { margin: 4px 0 0; font-family: var(--hd-font-display); font-size: 1.375rem; font-weight: var(--hd-w-light); line-height: 1.25; letter-spacing: -.02em; text-wrap: balance; transition: color var(--hd-dur) var(--hd-ease); }
.post-card__desc { margin: 0; font-size: 1rem; line-height: 1.55; color: var(--hd-ink-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card__meta { margin-top: auto; padding-top: 8px; font-family: var(--hd-font-mono); font-size: .75rem; color: var(--hd-ink-soft); }

.blog-related { padding-top: 0; }
.blog-related__title { margin: 0 0 24px; font-size: var(--hd-text-h3); font-weight: var(--hd-w-light); }

/* ---------- Post: topo ---------- */
.post-head { padding-bottom: 48px; }
.post-head__inner { max-width: 1016px; margin: 0 auto; }
.post-head h1 { max-width: 22ch; }
.post-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-family: var(--hd-font-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--hd-ink-soft); }
.post-crumbs a { color: var(--hd-ink-muted); text-decoration: none; }
.post-crumbs a:hover { color: var(--hd-accent); }
.post-head h1 { margin: 22px 0 0; font-size: clamp(2rem, 1.35rem + 2.5vw, 3.25rem); font-weight: var(--hd-w-light); line-height: 1.12; letter-spacing: -.03em; text-wrap: balance; }
.post-head__desc { margin: 18px 0 0; max-width: 62ch; font-size: 1.1875rem; line-height: 1.6; color: var(--hd-ink-muted); }

.post-byline { margin-top: 28px; display: flex; align-items: center; gap: 12px; }
.post-byline__avatar, .post-author__avatar, .author-avatar {
  flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--hd-grad-light); color: #fff; font-family: var(--hd-font-ui); font-weight: var(--hd-w-medium); text-decoration: none;
}
.post-byline__avatar { width: 44px; height: 44px; font-size: .95rem; }
.post-byline__name { display: block; font-family: var(--hd-font-ui); font-weight: var(--hd-w-medium); color: var(--hd-ink); text-decoration: none; }
.post-byline__name:hover { color: var(--hd-accent); }
.post-byline__meta { display: block; margin-top: 2px; font-size: .9375rem; color: var(--hd-ink-soft); }
.author-avatar { width: 84px; height: 84px; font-size: 1.75rem; }

/* ---------- Capa ---------- */
.post-cover { max-width: calc(1016px + 2 * var(--hd-gutter)); margin: 0 auto; padding: 0 var(--hd-gutter); }
.post-cover img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; border-radius: 24px; box-shadow: var(--hd-shadow-md); background: var(--hd-dark); }
.post-card__img { display: block; width: calc(100% + 56px); max-width: none; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; margin: -28px -28px 6px; border-radius: 21px 21px 0 0; background: var(--hd-dark); }
@media (max-width: 720px) {
  .post-cover img { border-radius: 16px; }
  .post-card__img { width: calc(100% + 48px); margin: -24px -24px 6px; }
}

/* ---------- Post: corpo ---------- */
.post-layout { max-width: 1180px; margin: 0 auto; padding: 48px var(--hd-gutter) 80px; display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; gap: 56px; }
@media (min-width: 1100px) {
  .post-layout:has(.post-toc) { grid-template-columns: 240px minmax(0, 720px); justify-content: center; }
  .post-toc { position: sticky; top: 104px; align-self: start; }
}

.post-toc { padding: 20px 22px; border: 1px solid var(--hd-border-2); border-radius: 18px; background: var(--hd-surface-alt); }
.post-toc__label { margin: 0 0 10px; font-family: var(--hd-font-mono); font-size: .7rem; font-weight: var(--hd-w-medium); letter-spacing: .08em; text-transform: uppercase; color: var(--hd-ink-soft); }
.post-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; display: grid; gap: 2px; }
.post-toc li { counter-increment: toc; }
.post-toc a { display: grid; grid-template-columns: 22px 1fr; padding: 6px 0; font-family: var(--hd-font-ui); font-size: .9rem; line-height: 1.35; color: var(--hd-ink-muted); text-decoration: none; }
.post-toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--hd-font-mono); font-size: .7rem; padding-top: 3px; color: var(--hd-ink-faint); }
.post-toc a:hover { color: var(--hd-accent); }
@media (max-width: 1099px) { .post-toc { margin-bottom: -16px; } }

.post-body { min-width: 0; font-family: var(--hd-font-body); font-size: 1.0625rem; font-weight: var(--hd-w-regular); line-height: 1.75; color: #1B2A42; }
@media (min-width: 720px) { .post-body { font-size: 1.125rem; } }
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.15em; }
.post-body h2 { margin: 2.1em 0 .6em; font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); font-weight: var(--hd-w-light); line-height: 1.2; letter-spacing: -.025em; color: var(--hd-ink); scroll-margin-top: 100px; }
.post-body h3 { margin: 1.8em 0 .5em; font-family: var(--hd-font-ui); font-size: 1.25rem; font-weight: var(--hd-w-medium); line-height: 1.3; letter-spacing: -.01em; color: var(--hd-ink); scroll-margin-top: 100px; }
.post-body strong { font-weight: var(--hd-w-semibold); color: var(--hd-ink); }
.post-body em { color: var(--hd-ink-muted); }
.post-body a { color: var(--hd-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.post-body a:hover { color: var(--hd-accent-strong); text-decoration-thickness: 2px; }
.post-body ul, .post-body ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.post-body li { margin: 0 0 .55em; padding-left: .2em; }
.post-body li::marker { color: var(--hd-accent); }
.post-body ol li::marker { font-family: var(--hd-font-ui); font-weight: var(--hd-w-medium); }
.post-body blockquote { margin: 1.6em 0; padding: 16px 22px; border-left: 3px solid var(--hd-accent); border-radius: 0 14px 14px 0; background: var(--hd-bg-2); color: var(--hd-ink); }
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body hr { margin: 2.4em 0; border: 0; border-top: 1px solid var(--hd-border-3); }
.post-body code { padding: 2px 6px; border-radius: 6px; background: var(--hd-bg-2); font-family: var(--hd-font-mono); font-size: .85em; }
.post-body pre { margin: 1.4em 0; padding: 18px 20px; overflow-x: auto; border-radius: 16px; background: var(--hd-dark-panel); color: #EAF4FF; font-family: var(--hd-font-mono); font-size: .875rem; line-height: 1.65; white-space: pre-wrap; word-break: break-all; }
.post-body pre code { padding: 0; background: none; font-size: inherit; color: inherit; }
.post-body img { display: block; margin: 1.6em 0; border-radius: 16px; border: 1px solid var(--hd-border-2); }

.post-table { margin: 1.6em 0; overflow-x: auto; border: 1px solid var(--hd-border-2); border-radius: 16px; background: #fff; }
.post-table:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; }
.post-table table { width: 100%; border-collapse: collapse; font-family: var(--hd-font-ui); font-size: .95rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
.post-table th { padding: 12px 16px; background: var(--hd-surface-alt); border-bottom: 1px solid var(--hd-border-3); font-family: var(--hd-font-mono); font-size: .7rem; font-weight: var(--hd-w-medium); letter-spacing: .06em; text-transform: uppercase; color: var(--hd-ink-soft); text-align: left; white-space: nowrap; }
.post-table td { padding: 13px 16px; border-top: 1px solid var(--hd-border-4); white-space: nowrap; color: var(--hd-ink); }
.post-table tr:first-child td { border-top: 0; }
.post-table td:first-child { font-weight: var(--hd-w-medium); }

/* ---------- CTA e autor ---------- */
.post-cta {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 2.6em 0 0; padding: 36px 36px 34px; border-radius: 26px;
  background: var(--hd-grad-panel); color: #F4F8FC; box-shadow: var(--hd-shadow-md);
}
.post-cta::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 280px; aspect-ratio: 1; right: -110px; top: -130px; border-radius: 50%; opacity: .35;
  background: var(--hd-grad-dark);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 40px), #000 calc(100% - 39px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 40px), #000 calc(100% - 39px));
}
.post-body .post-cta__title { margin: 0; max-width: 24ch; font-family: var(--hd-font-display); font-size: clamp(1.4rem, 1.2rem + .8vw, 1.75rem); font-weight: var(--hd-w-light); line-height: 1.2; letter-spacing: -.02em; color: #fff; }
.post-body .post-cta__text { margin: 12px 0 22px; max-width: 52ch; font-size: 1rem; line-height: 1.6; color: rgba(244,248,252,.78); }
.post-body .post-cta .hd-btn { text-decoration: none; color: var(--hd-ink); }

.post-author { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--hd-border-3); display: flex; gap: 16px; align-items: flex-start; }
.post-author__avatar { width: 56px; height: 56px; font-size: 1.1rem; }
.post-body .post-author__name { margin: 0; font-family: var(--hd-font-ui); font-weight: var(--hd-w-medium); }
.post-body .post-author__name a { color: var(--hd-ink); text-decoration: none; }
.post-body .post-author__bio { margin: 4px 0 0; font-size: .975rem; line-height: 1.6; color: var(--hd-ink-muted); }

@media (max-width: 720px) {
  .blog-head, .post-head { padding-top: 112px; padding-bottom: 44px; }
  .post-layout { padding-top: 32px; gap: 40px; }
  .post-cta { padding: 28px 24px; border-radius: 22px; }
  .post-card__link { padding: 24px; }
}

/* ---------- Rodapé (mesmas regras de tools.css) ---------- */
.hd-footer { background: var(--hd-bg-2); border-top: 1px solid var(--hd-border-3); }
.hd-footer__grid { max-width: var(--hd-maxw); margin: 0 auto; padding: var(--hd-8) var(--hd-gutter) var(--hd-6); display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: var(--hd-6); }
.hd-footer__logo { height: 26px; margin-bottom: 18px; }
.hd-footer__desc { font-size: .9rem; color: var(--hd-ink-muted); max-width: 280px; line-height: 1.6; }
.hd-footer__col .hd-label { margin-bottom: 18px; display: block; }
.hd-footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.hd-footer__links a { font-size: .9rem; color: var(--hd-ink-muted); text-decoration: none; }
.hd-footer__links a:hover { color: var(--hd-ink); }
.hd-footer__socials { display: flex; gap: 10px; }
.hd-footer__social { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--hd-border-2); background: #fff; display: flex; align-items: center; justify-content: center; color: var(--hd-ink-muted); transition: all .18s; }
.hd-footer__social:hover { border-color: var(--hd-accent); color: var(--hd-accent); }
.hd-footer__bar { border-top: 1px solid var(--hd-border-3); text-align: center; padding: 18px; font-size: .8125rem; color: var(--hd-ink-soft); }
@media (max-width: 900px) { .hd-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .hd-footer__grid { grid-template-columns: 1fr; } }
