/* ─────────────────────────────────────────────────────────────
   knotty blog — folha compartilhada
   Reutiliza a paleta do site institucional (comecar.html).
   ───────────────────────────────────────────────────────────── */

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

:root {
  --g: #4CAF50;
  --gd: #388E3C;
  --gl: #E8F5E9;
  --gl2: #C8E6C9;
  --dark: #0D1117;
  --dark2: #161B22;
  --text: #1A1F2E;
  --mid: #4A5568;
  --muted: #8A94A6;
  --border: #E2E8F0;
  --white: #FFFFFF;
  --bg: #F7F9FC;
  --warning: #F57F17;
  --danger: #C62828;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.10);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', system-ui, -apple-system, Arial, sans-serif;
  background: var(--white);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: var(--g); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gd); }

img { max-width: 100%; height: auto; display: block; }

/* ── NAV (idêntica ao comecar.html) ──────────────────────────── */
nav.knotty-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6%;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: box-shadow 0.3s;
}
nav.knotty-nav.scrolled { box-shadow: 0 4px 24px rgba(0,0,0,0.08); }

.knotty-nav .logo {
  display: flex; align-items: center; gap: 10px;
}
.knotty-nav .logo-icon {
  width: 38px; height: 38px;
  background: var(--g);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.knotty-nav .logo-name {
  font-size: 22px; font-weight: 800;
  color: var(--g); letter-spacing: -0.8px;
}

.knotty-nav .nav-links {
  display: flex; align-items: center; gap: 28px;
}
.knotty-nav .nav-links a {
  font-size: 14px; font-weight: 500; color: var(--mid);
}
.knotty-nav .nav-links a:hover { color: var(--g); }
.knotty-nav .nav-links a.active { color: var(--g); font-weight: 600; }

.knotty-nav .nav-actions {
  display: flex; align-items: center; gap: 12px;
}
.btn-ghost {
  font-size: 13px; font-weight: 600; color: var(--mid);
  padding: 9px 18px; border-radius: 8px;
  border: 1.5px solid var(--border); background: white;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--g); color: var(--g); }

.btn-green {
  font-size: 13px; font-weight: 700; color: white !important;
  padding: 10px 20px; border-radius: 8px; background: var(--g);
  box-shadow: 0 2px 12px rgba(76,175,80,0.3);
  transition: all 0.2s;
}
.btn-green:hover { background: var(--gd); transform: translateY(-1px); }

.btn-green-lg {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: white !important;
  padding: 16px 32px; border-radius: 12px; background: var(--g);
  box-shadow: 0 4px 20px rgba(76,175,80,0.32);
  transition: all 0.2s;
}
.btn-green-lg:hover { background: var(--gd); transform: translateY(-2px); }

/* ── Container & layout base ────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
main { padding-top: 68px; min-height: 80vh; }

/* ── HERO (página /blog) ────────────────────────────────────── */
.blog-hero {
  background: linear-gradient(180deg, var(--bg) 0%, white 100%);
  padding: 80px 0 56px;
  border-bottom: 1px solid var(--border);
}
.blog-hero .container { text-align: center; }
.blog-hero .eyebrow {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--g); text-transform: uppercase;
  background: var(--gl); padding: 6px 14px; border-radius: 20px;
  margin-bottom: 20px;
}
.blog-hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800; letter-spacing: -1.5px;
  line-height: 1.1; margin-bottom: 20px;
  color: var(--text);
}
.blog-hero h1 .accent { color: var(--g); }
.blog-hero p {
  font-size: 18px; color: var(--mid); max-width: 680px;
  margin: 0 auto 32px;
}

/* ── Featured article ───────────────────────────────────────── */
.featured-section { padding: 56px 0 24px; }
.featured-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  background: white; border-radius: 20px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  transition: box-shadow 0.25s, transform 0.25s;
}
.featured-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.featured-card .img {
  background: var(--gl);
  display: flex; align-items: center; justify-content: center;
  min-height: 360px;
}
.featured-card .img img { width: 100%; height: 100%; object-fit: cover; }
.featured-card .body {
  padding: 48px; display: flex; flex-direction: column; justify-content: center;
}
.featured-card .badge-featured {
  display: inline-block; align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: white; background: var(--text); padding: 5px 12px; border-radius: 6px;
  text-transform: uppercase; margin-bottom: 16px;
}
.featured-card .category {
  display: inline-block; align-self: flex-start;
  font-size: 12px; font-weight: 600; color: var(--g);
  background: var(--gl); padding: 4px 12px; border-radius: 16px;
  margin-bottom: 16px;
}
.featured-card h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800; letter-spacing: -0.8px; line-height: 1.2;
  margin-bottom: 16px; color: var(--text);
}
.featured-card .excerpt { color: var(--mid); margin-bottom: 24px; font-size: 16px; }
.featured-card .meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 13px; color: var(--muted); margin-bottom: 24px;
}

/* ── Filtros e busca ────────────────────────────────────────── */
.controls {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 68px; background: white; z-index: 50;
}
.controls .row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  font-size: 13px; font-weight: 600; color: var(--mid);
  padding: 8px 16px; border-radius: 24px;
  border: 1.5px solid var(--border); background: white;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.chip:hover { border-color: var(--g); color: var(--g); }
.chip.active { border-color: var(--g); background: var(--g); color: white; }

.search-box {
  position: relative;
  min-width: 260px; flex: 0 0 auto;
}
.search-box input {
  width: 100%;
  font-family: inherit; font-size: 14px; color: var(--text);
  padding: 10px 16px 10px 40px;
  border: 1.5px solid var(--border); border-radius: 24px;
  background: white; outline: none; transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--g); }
.search-box .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted);
}

/* ── Grid de artigos ────────────────────────────────────────── */
.posts-section { padding: 48px 0 80px; }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}
.post-card {
  background: white; border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; transition: all 0.25s;
  display: flex; flex-direction: column;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gl2);
}
.post-card .cover {
  aspect-ratio: 16/9; background: var(--gl); overflow: hidden;
}
.post-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.post-card .body {
  padding: 24px; display: flex; flex-direction: column; flex: 1;
}
.post-card .category {
  align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--g); background: var(--gl);
  padding: 4px 10px; border-radius: 12px;
  text-transform: uppercase; margin-bottom: 12px;
}
.post-card h3 {
  font-size: 19px; font-weight: 700; letter-spacing: -0.4px;
  line-height: 1.3; margin-bottom: 12px; color: var(--text);
}
.post-card .excerpt {
  font-size: 14px; color: var(--mid); margin-bottom: 16px;
  flex: 1;
}
.post-card .meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: auto;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.post-card .read-link {
  font-size: 13px; font-weight: 700; color: var(--g);
}

.empty-state {
  text-align: center; padding: 80px 24px; color: var(--mid);
}
.empty-state strong { display: block; font-size: 18px; color: var(--text); margin-bottom: 8px; }

/* ── Página individual de artigo ────────────────────────────── */
.article-hero {
  background: var(--bg); padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
}
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin-bottom: 20px;
}
.breadcrumb a { color: var(--mid); }
.breadcrumb a:hover { color: var(--g); }
.breadcrumb .sep { color: var(--muted); }

.article-hero .category-pill {
  display: inline-block;
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--g); background: var(--gl);
  padding: 5px 14px; border-radius: 20px;
  text-transform: uppercase; margin-bottom: 20px;
}
.article-hero h1 {
  font-size: clamp(30px, 4.5vw, 46px);
  font-weight: 800; letter-spacing: -1px;
  line-height: 1.15; margin-bottom: 16px;
  color: var(--text); max-width: 880px;
}
.article-hero .lead {
  font-size: 18px; color: var(--mid); max-width: 720px; margin-bottom: 24px;
}
.article-hero .meta {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.article-hero .meta strong { color: var(--text); font-weight: 600; }
.article-hero .meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }

.cover-image {
  margin: 0 auto; max-width: 1200px; padding: 0 24px;
}
.cover-image img {
  width: 100%; border-radius: 16px;
  box-shadow: var(--shadow-md);
  margin-top: -32px; position: relative; z-index: 2;
}

/* ── Layout artigo + sidebar ────────────────────────────────── */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px;
  align-items: start;
}

.article-content {
  font-size: 17px; color: var(--text); line-height: 1.75;
}
.article-content > * + * { margin-top: 1em; }
.article-content h2 {
  font-size: clamp(24px, 2.8vw, 30px);
  font-weight: 800; letter-spacing: -0.5px; line-height: 1.25;
  margin: 56px 0 20px; color: var(--text);
  scroll-margin-top: 100px;
}
.article-content h3 {
  font-size: 21px; font-weight: 700; letter-spacing: -0.3px;
  margin: 36px 0 12px; color: var(--text);
}
.article-content p { color: var(--text); }
.article-content ul, .article-content ol {
  padding-left: 28px; color: var(--text);
}
.article-content ul li, .article-content ol li {
  margin-bottom: 10px;
}
.article-content ul li::marker { color: var(--g); }
.article-content strong { font-weight: 700; color: var(--text); }
.article-content a { color: var(--g); border-bottom: 1px solid var(--gl2); }
.article-content a:hover { color: var(--gd); border-bottom-color: var(--gd); }

.article-content blockquote {
  border-left: 4px solid var(--g);
  background: var(--gl);
  padding: 20px 24px;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text);
  margin: 24px 0;
}

.article-content table {
  width: 100%; border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
  border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.article-content table thead {
  background: var(--g); color: white;
}
.article-content table th {
  font-weight: 700; padding: 14px 16px; text-align: left;
  font-size: 14px;
}
.article-content table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article-content table tbody tr:nth-child(even) { background: var(--bg); }
.article-content table tbody tr:hover { background: var(--gl); }
.article-content .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.article-content .callout {
  background: var(--gl);
  border: 1px solid var(--gl2);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
}
.article-content .callout strong { color: var(--gd); }

/* CTA inline (depois da seção "Como o Knotty ajuda") */
.cta-inline {
  background: linear-gradient(135deg, var(--text) 0%, #2C3E50 100%);
  color: white;
  padding: 36px 40px;
  border-radius: 16px;
  margin: 48px 0;
  text-align: center;
}
.cta-inline h3 { color: white !important; font-size: 22px; margin-bottom: 12px; }
.cta-inline p { color: rgba(255,255,255,0.85); margin-bottom: 24px; max-width: 560px; margin-left: auto; margin-right: auto; }

/* FAQ */
.faq-section { margin-top: 56px; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  background: white;
}
.faq-item summary {
  list-style: none;
  padding: 18px 24px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text);
  transition: background 0.2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; font-size: 24px; color: var(--g); font-weight: 400;
  transition: transform 0.2s;
}
.faq-item[open] summary { background: var(--gl); }
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-body {
  padding: 0 24px 20px;
  color: var(--mid);
  font-size: 15px;
  line-height: 1.7;
}

/* CTA final do artigo */
.cta-final {
  background: white;
  border: 2px solid var(--g);
  border-radius: 20px;
  padding: 48px;
  margin: 64px 0 32px;
  text-align: center;
}
.cta-final h3 {
  font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  color: var(--text); margin-bottom: 16px;
}
.cta-final p {
  color: var(--mid); font-size: 16px; margin-bottom: 28px;
  max-width: 600px; margin-left: auto; margin-right: auto;
}
.cta-final .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Sidebar (sticky no desktop) ────────────────────────────── */
.article-sidebar {
  position: sticky;
  top: 88px;
  display: flex; flex-direction: column; gap: 24px;
}

.sidebar-cta {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s, transform 0.25s;
  display: flex;
  flex-direction: column;
}
.sidebar-cta:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.sidebar-cta-image {
  display: block;
  width: 100%;
  /* Mostra só a parte superior da imagem (logo + headline + features),
     cortando o teclado/notebook que estava esticando demais o card */
  max-height: 380px;
  overflow: hidden;
  background: var(--bg);
}
.sidebar-cta-image img {
  width: 100%;
  height: auto;
  display: block;
  /* Empurra a imagem ligeiramente pra cima pra mostrar o melhor recorte */
  margin-top: 0;
}
.sidebar-cta-body {
  padding: 18px 20px 20px;
  text-align: center;
  background: white;
  border-top: 1px solid var(--border);
}
.sidebar-cta-body h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.sidebar-cta-body p {
  font-size: 13px;
  color: var(--mid);
  margin-bottom: 14px;
  line-height: 1.5;
}
.sidebar-cta-body .btn-green {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px 16px;
  font-size: 14px;
}

.sidebar-block {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.sidebar-block h4 {
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}

.toc-list { list-style: none; padding: 0; }
.toc-list li { margin-bottom: 8px; }
.toc-list a {
  font-size: 14px; color: var(--mid); display: block;
  padding: 6px 10px; border-radius: 6px;
  border-bottom: none !important;
  line-height: 1.4;
  transition: all 0.15s;
}
.toc-list a:hover { background: var(--gl); color: var(--g); }
.toc-list a.active {
  background: var(--gl); color: var(--g); font-weight: 600;
  border-left: 3px solid var(--g); padding-left: 7px;
}

.related-list { list-style: none; padding: 0; }
.related-list li { margin-bottom: 14px; }
.related-list li:last-child { margin-bottom: 0; }
.related-list a {
  display: block; font-size: 14px; color: var(--text); font-weight: 600;
  border-bottom: none !important; line-height: 1.4;
}
.related-list a:hover { color: var(--g); }
.related-list .meta-tag {
  display: block; font-size: 11px; color: var(--g); font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 4px;
}

/* ── Footer ─────────────────────────────────────────────────── */
footer.knotty-footer {
  background: var(--text);
  color: white;
  padding: 56px 0 32px;
  margin-top: 80px;
}
.knotty-footer .footer-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center;
}
.knotty-footer .footer-logo {
  display: flex; align-items: center; gap: 10px;
}
.knotty-footer .footer-logo .logo-icon {
  width: 32px; height: 32px;
  background: var(--g); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.knotty-footer .footer-logo-text { font-size: 18px; font-weight: 800; color: var(--g); }
.knotty-footer p { color: rgba(255,255,255,0.7); font-size: 13px; }
.knotty-footer .footer-links {
  display: flex; gap: 24px; margin-top: 8px; flex-wrap: wrap;
  justify-content: center;
}
.knotty-footer .footer-links a {
  color: rgba(255,255,255,0.85);
  font-size: 13px;
}
.knotty-footer .footer-links a:hover { color: var(--g); }

/* ── Responsivo ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .article-sidebar {
    position: static;
    order: 2;
  }
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .img { min-height: 240px; }
  .featured-card .body { padding: 32px; }
}

@media (max-width: 768px) {
  .knotty-nav { padding: 0 4%; }
  .knotty-nav .nav-links { display: none; }
  .knotty-nav .btn-ghost { display: none; }
  main { padding-top: 68px; }

  .blog-hero { padding: 56px 0 40px; }
  .featured-section { padding: 40px 0 16px; }
  .featured-card .body { padding: 24px; }

  .controls { position: static; padding: 20px 0; }
  .controls .row { flex-direction: column; align-items: stretch; gap: 16px; }
  .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .chip { flex: 0 0 auto; }
  .search-box { min-width: 100%; }

  .posts-grid { grid-template-columns: 1fr; gap: 20px; }
  .article-layout { padding: 32px 16px; gap: 32px; }
  .cover-image { padding: 0 16px; }
  .cover-image img { margin-top: -20px; border-radius: 12px; }
  .article-content { font-size: 16px; }
  .article-content h2 { margin: 40px 0 16px; }
  .cta-inline { padding: 28px 24px; }
  .cta-final { padding: 32px 24px; }
}

/* ── Acessibilidade ─────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--g);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* Print */
@media print {
  nav.knotty-nav, .article-sidebar, .cta-inline, .cta-final, .controls { display: none; }
  .article-layout { grid-template-columns: 1fr; padding: 0; }
}
