/* =============================================
   POWER MEI — blog.css
   Estilos específicos do blog, feed REST API,
   single post (single.php) e paginação
   Agência PHN · v1.0.0
============================================= */

/* =============================================
   FEED / GRID DO BLOG
============================================= */
.s-blog { background: var(--white); }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.blog-card {
  background: var(--gray-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(84,171,225,0.1);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.blog-thumb-link {
  display: block;
  overflow: hidden;
}
.blog-thumb {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--dark-card), var(--dark));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.blog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.blog-card:hover .blog-thumb img {
  transform: scale(1.05);
}
.blog-thumb-label {
  font-family: var(--ff-display);
  font-size: 28px;
  font-weight: 800;
  color: rgba(99,220,226,0.2);
}

.blog-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--teal-dark);
  margin-bottom: 10px;
}
.blog-title {
  font-family: var(--ff-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.35;
  margin-bottom: 10px;
}
.blog-title a {
  color: inherit;
  transition: color var(--transition);
}
.blog-title a:hover { color: var(--teal-dark); }
.blog-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}
.blog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}
.blog-read {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--teal-dark);
  font-weight: 600;
  font-family: var(--ff-display);
  transition: gap var(--transition);
}
.blog-read:hover { gap: 8px; }
.blog-cta { text-align: center; }

/* =============================================
   ESTADO: loading / erro
============================================= */
.blog-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  font-size: 15px;
  color: var(--text-muted);
}
.blog-loading::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-light);
  border-top-color: var(--teal);
  border-radius: 50%;
  margin-right: 12px;
  vertical-align: -4px;
  animation: blog-spin 0.8s linear infinite;
}
@keyframes blog-spin {
  to { transform: rotate(360deg); }
}
.blog-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  font-size: 15px;
  color: var(--text-muted);
  background: rgba(220,53,69,0.05);
  border: 1px solid rgba(220,53,69,0.15);
  border-radius: var(--radius-md);
}
.blog-error a {
  color: var(--teal-dark);
  font-weight: 600;
  border-bottom: 1px solid;
}

/* =============================================
   PAGINAÇÃO
============================================= */
.blog-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 48px;
  flex-wrap: wrap;
}
.pagination-btn,
.blog-pagination a,
.blog-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  font-family: var(--ff-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-body);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.pagination-btn:hover,
.blog-pagination a:hover {
  background: var(--gray-light);
  border-color: var(--border-teal);
  color: var(--teal-dark);
}
.pagination-btn.active,
.pagination-btn[aria-current="page"],
.blog-pagination .current {
  background: var(--teal);
  color: var(--dark);
  border-color: var(--teal);
}
.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================
   POST INDIVIDUAL (single.php)
============================================= */
.hero-post {
  padding: 56px 0 40px;
}
.post-category {
  display: inline-block;
  font-family: var(--ff-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  background: rgba(99,220,226,0.1);
  border: 1px solid rgba(99,220,226,0.3);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.post-category a {
  color: inherit;
  text-decoration: none;
}
.hero-post h1 {
  font-family: var(--ff-display);
  font-size: clamp(28px, 3.8vw, 44px);
  font-weight: 800;
  color: var(--white);
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  max-width: 800px;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  flex-wrap: wrap;
}
.post-meta time { font-weight: 500; }
.post-meta-sep { color: rgba(255,255,255,0.3); }

/* Imagem destacada */
.post-featured-image {
  max-width: 1000px;
  margin: -28px auto 0;
  padding: 0 24px;
  position: relative;
  z-index: 2;
}
.post-featured-image img,
.post-thumb {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Corpo do post */
.post-body {
  max-width: 760px;
  margin: 56px auto 0;
  padding: 0 24px;
}
.post-content {
  font-size: 17px;
  color: var(--text-body);
  line-height: 1.8;
}
.post-content h2 {
  font-family: var(--ff-display);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 800;
  color: var(--dark);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 56px 0 20px;
}
.post-content h3 {
  font-family: var(--ff-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.35;
  margin: 36px 0 14px;
}
.post-content h4 {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  margin: 28px 0 10px;
}
.post-content p {
  font-size: 17px;
  color: var(--text-body);
  line-height: 1.8;
  margin-bottom: 20px;
}
.post-content p:first-of-type {
  font-size: 19px;
  color: var(--dark);
  font-weight: 400;
  line-height: 1.65;
}
.post-content ul,
.post-content ol {
  margin: 18px 0 22px 24px;
}
.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }
.post-content li {
  font-size: 17px;
  color: var(--text-body);
  line-height: 1.75;
  margin-bottom: 8px;
}
.post-content li::marker { color: var(--teal-dark); }
.post-content strong {
  color: var(--dark);
  font-weight: 700;
}
.post-content a {
  color: var(--teal-dark);
  font-weight: 600;
  border-bottom: 1px solid rgba(61,188,194,0.3);
  transition: border-color var(--transition);
}
.post-content a:hover { border-color: var(--teal-dark); }

.post-content blockquote {
  border-left: 4px solid var(--teal);
  background: var(--gray-light);
  padding: 20px 28px;
  margin: 28px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 18px;
  font-style: italic;
  color: var(--text-body);
}
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content img {
  border-radius: var(--radius-md);
  margin: 28px 0;
  box-shadow: var(--shadow-md);
}

.post-content figure {
  margin: 32px 0;
}
.post-content figcaption {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
  font-style: italic;
}

.post-content pre {
  background: var(--dark);
  color: var(--white);
  padding: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  margin: 24px 0;
}
.post-content code {
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(99,220,226,0.12);
  color: var(--dark);
  padding: 2px 6px;
  border-radius: 4px;
}
.post-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  font-size: 15px;
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.post-content th {
  background: var(--dark);
  color: var(--white);
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 14px;
  text-align: left;
  padding: 14px 18px;
}
.post-content td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-light);
}
.post-content tr:last-child td { border-bottom: none; }

/* Posts relacionados */
.post-related-posts {
  max-width: 1160px;
  margin: 64px auto;
  padding: 0 24px;
}
.post-related-posts h2 {
  font-family: var(--ff-display);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 800;
  color: var(--dark);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}
.blog-grid-related {
  margin-bottom: 0;
}

/* CTA dentro do single */
.s-cta.container-cta {
  padding-top: 56px;
  padding-bottom: 56px;
}

/* =============================================
   RESPONSIVO BLOG
============================================= */
@media (max-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .blog-grid { grid-template-columns: 1fr; }
  .post-featured-image { margin-top: 0; }
  .post-body { margin-top: 32px; }
  .post-content { font-size: 16px; }
  .post-content p { font-size: 16px; }
  .post-content p:first-of-type { font-size: 17px; }
  .hero-post { padding: 48px 0 32px; }
}
