/* ==========================================================================
   Contabify — Blog e Artigos (redesign 2026)
   Carregado DEPOIS de landing.css, que fornece tokens, header, footer e botões.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hero de página interior
   -------------------------------------------------------------------------- */
.page-hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 84px) var(--pad-x) clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page-hero h1 {
  font-size: clamp(34px, 5.4vw, 58px);
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.035em;
  max-width: 18ch;
  text-wrap: balance;
}
.page-hero .lead { max-width: 620px; }

/* --------------------------------------------------------------------------
   Grelha de artigos
   -------------------------------------------------------------------------- */
.blog-section {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x) clamp(64px, 10vw, 110px);
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.blog-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  border: 1px dashed var(--border-2);
  border-radius: 18px;
  color: var(--text-2);
  font-size: 15px;
}
.blog-state.is-error { color: #ff8080; border-color: rgba(255, 128, 128, 0.28); }
.blog-state h2 { font-size: 19px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

.blog-card {
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  border: 1px solid var(--border-2);
  background: var(--surface-card);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.blog-card:hover {
  transform: translateY(-4px);
  border-color: rgba(46, 230, 197, 0.34);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.55);
}
.blog-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  padding: 22px;
}
.blog-card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  text-wrap: pretty;
}
.blog-card:hover .blog-card-title { color: var(--accent-soft); }
.blog-card-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.blog-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted-2);
}
.read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.read-more::after { content: "→"; transition: transform 0.2s ease; }
.blog-card:hover .read-more::after { transform: translateX(3px); }

/* --------------------------------------------------------------------------
   Artigo
   -------------------------------------------------------------------------- */
.article-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 72px) var(--pad-x) clamp(64px, 10vw, 110px);
}
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 22px;
}
.article-back::before { content: "←"; }
.article-back:hover { color: var(--accent); }

.article-title {
  font-size: clamp(30px, 4.6vw, 50px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
}
.article-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--border-2);
  margin: 32px 0 8px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.5);
}

.article-content {
  font-size: 17px;
  line-height: 1.75;
  color: #cfcfd6;
  margin-top: 36px;
}
.article-content > *:first-child { margin-top: 0; }
.article-content p { margin: 0 0 1.35em; text-wrap: pretty; }

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.22;
  scroll-margin-top: 96px;
}
.article-content h1 { font-size: clamp(27px, 3.4vw, 36px); margin: 2.6em 0 0.7em; }
.article-content h2 { font-size: clamp(23px, 2.9vw, 30px); margin: 2.2em 0 0.65em; }
.article-content h3 { font-size: clamp(19px, 2.3vw, 23px); margin: 1.9em 0 0.6em; font-weight: 700; }
.article-content h4 { font-size: 18px; margin: 1.7em 0 0.55em; font-weight: 700; }
.article-content h5 { font-size: 16px; margin: 1.5em 0 0.5em; font-weight: 700; }
.article-content h6 {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1.5em 0 0.5em;
  font-weight: 600;
}

/* Índice / sumário */
.article-content h2#indice,
.article-content h2[id*="indice"],
.article-content h2[id*="sumario"] {
  font-size: 19px;
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  color: var(--accent-soft);
  margin-top: 2em;
}

.article-content a:not(.btn) {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(46, 230, 197, 0.4);
  word-break: break-word;
}
.article-content a:not(.btn):hover { color: var(--accent-hover); text-decoration-color: currentColor; }
.article-content a:not(.btn)[href^="http"]::after { content: " ↗"; font-size: 0.85em; opacity: 0.6; }
.article-content a:not(.btn)[href^="#"]::after,
.article-content a:not(.btn)[href^="/"]::after,
.article-content a:not(.btn)[href^="https://contabify.pt"]::after { content: ""; }

/* Botões dentro do artigo mantêm o estilo do sistema (texto escuro sobre o acento) */
.article-content a.btn { text-decoration: none; }
.article-content a.btn::after { content: ""; }
.article-content a.btn-primary,
.article-content a.btn-primary:hover { color: var(--accent-ink); }

.article-content strong { color: var(--text); font-weight: 700; }
.article-content em { color: #dcdce3; }

.article-content ul,
.article-content ol { margin: 1.35em 0; padding-left: 1.6em; display: block; }
.article-content li { margin-bottom: 0.6em; line-height: 1.7; list-style: none; position: relative; }
.article-content ul li::before {
  content: "▸";
  position: absolute;
  left: -1.25em;
  color: var(--accent);
  font-weight: 700;
}
.article-content ol { counter-reset: art-counter; }
.article-content ol li { counter-increment: art-counter; }
.article-content ol li::before {
  content: counter(art-counter) ".";
  position: absolute;
  left: -1.6em;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 0.9em;
}

.article-content blockquote {
  margin: 1.8em 0;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: rgba(46, 230, 197, 0.06);
  color: var(--text-2);
  font-style: italic;
}
.article-content blockquote p:last-child { margin-bottom: 0; }
.article-content blockquote strong { color: var(--accent); font-style: normal; }

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border-2);
  margin: 2em auto;
  display: block;
}
.article-content p img { max-height: 520px; object-fit: contain; }
.article-content ul img,
.article-content ol img,
.article-content table img { max-height: 300px; object-fit: contain; }

.article-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 2em 0;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.article-content table thead { display: table-header-group; }
.article-content table tbody { display: table-row-group; }
.article-content table tr { display: table-row; }
.article-content table th,
.article-content table td {
  display: table-cell;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
}
.article-content table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.article-content table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
.article-content table tbody tr:hover { background: rgba(46, 230, 197, 0.05); }
.article-content table td { color: #c7c7cf; }

.article-content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(46, 230, 197, 0.09);
  border: 1px solid rgba(46, 230, 197, 0.18);
  color: var(--accent-soft);
  padding: 0.15em 0.45em;
  border-radius: 6px;
}
.article-content pre {
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 20px;
  overflow-x: auto;
  margin: 2em 0;
}
.article-content pre code {
  background: none;
  border: 0;
  padding: 0;
  color: #e4e4e9;
  font-size: 13px;
  line-height: 1.65;
}
.article-content hr {
  border: 0;
  height: 1px;
  background: var(--border-2);
  margin: 2.6em 0;
}

/* Banner de conversão dentro do artigo */
.marketing-banner {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(46, 230, 197, 0.22);
  background: linear-gradient(120deg, rgba(46, 230, 197, 0.12), rgba(43, 127, 255, 0.1) 60%, rgba(255, 255, 255, 0.02));
  padding: clamp(26px, 5vw, 40px);
  margin: 2.8em 0;
  text-align: center;
}
.marketing-banner h3 {
  font-size: clamp(20px, 2.8vw, 26px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0 0 10px;
}
.marketing-banner p {
  color: #b6b6c0;
  font-size: 15px;
  line-height: 1.6;
  max-width: 52ch;
  margin: 0 auto 20px;
}
.marketing-banner .btn { font-size: 15px; padding: 13px 26px; border-radius: 12px; }

/* Estado de erro do artigo */
.article-missing { text-align: center; padding: clamp(60px, 12vw, 120px) 0; }
.article-missing h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -0.03em; }
.article-missing p { color: var(--text-2); margin: 12px 0 24px; }

@media (max-width: 760px) {
  .blog-grid { grid-template-columns: minmax(0, 1fr); }
  .article-content { font-size: 16px; }
}

/* --------------------------------------------------------------------------
   Estado ativo na navegação (páginas interiores)
   -------------------------------------------------------------------------- */
.nav-links a[aria-current="page"],
.nav-drawer a[aria-current="page"] { color: var(--accent); }
