/* ==========================================================================
   Aeforma Blog Styles (aeforma.com/blog)
   Harmonized with Aeforma brand palette and design system
   ========================================================================== */

.blog-hero {
  padding-bottom: 2rem;
}

.blog-categories-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-bottom: 2.5rem;
  align-items: center;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 9999px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 42, 48, 0.03);
}

.cat-pill:hover {
  background: var(--soft);
  border-color: rgba(0, 90, 91, 0.35);
  color: var(--brand);
}

.cat-pill.is-active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0, 63, 67, 0.2);
}

.cat-count {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  background: rgba(0, 90, 91, 0.1);
  color: var(--brand);
}

.cat-pill.is-active .cat-count {
  background: rgba(255, 255, 255, 0.25);
  color: var(--white);
}

/* --------------------------------------------------------------------------
   Blog Cards Grid
   -------------------------------------------------------------------------- */
.blog-grid {
  margin-bottom: 3.5rem;
}

.blog-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 4px 16px rgba(0, 42, 48, 0.04);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 90, 91, 0.3);
  box-shadow: var(--shadow);
}

.blog-card__image-link {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.blog-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.blog-card:hover .blog-card__image {
  transform: scale(1.03);
}

.blog-card__content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 1.5rem;
}

.blog-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.blog-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(15, 143, 135, 0.1);
  color: var(--brand);
  font-weight: 750;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}

a.blog-tag:hover {
  background: rgba(15, 143, 135, 0.2);
  color: var(--brand-dark);
}

.blog-reading-time {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.blog-card__title {
  font-size: 1.25rem;
  line-height: 1.35;
  margin: 0.25rem 0 0.75rem;
  font-weight: 800;
}

.blog-card__title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.15s ease;
}

.blog-card__title a:hover {
  color: var(--brand);
}

.blog-card__excerpt {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__footer {
  margin-top: auto;
  padding-top: 0.5rem;
}

.blog-card__footer .text-link {
  color: var(--brand);
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: gap 0.2s ease, color 0.2s ease;
}

.blog-card__footer .text-link:hover {
  color: var(--brand-dark);
  gap: 0.6rem;
}

/* --------------------------------------------------------------------------
   Load More / Ver Más
   -------------------------------------------------------------------------- */
.blog-load-more-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 2.75rem;
}

.blog-load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 48px;
  padding: 0.75rem 2rem;
  background: var(--white);
  border: 1.5px solid var(--brand);
  border-radius: 8px;
  color: var(--brand-dark);
  font-size: 0.95rem;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 143, 135, 0.08);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-load-more-btn:hover {
  background: var(--brand);
  color: var(--white);
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(15, 143, 135, 0.22);
}

.blog-load-more-btn:active {
  transform: translateY(0);
}

.blog-load-more-btn:disabled,
.blog-load-more-btn[aria-busy="true"] {
  opacity: 0.75;
  cursor: wait;
  transform: none;
}

.blog-load-more-btn .btn-count {
  font-size: 0.825rem;
  opacity: 0.8;
  font-weight: 600;
}

.blog-load-more-btn:hover .btn-count {
  opacity: 0.95;
}

.blog-load-more-btn .btn-spinner {
  animation: blog-spin 0.75s linear infinite;
}

@keyframes blog-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.blog-load-more-status {
  margin: 0;
  font-size: 0.9rem;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-all-loaded-notice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: 999px;
  margin: 0.5rem 0 0;
}

.blog-load-error {
  color: #b91c1c;
  font-size: 0.875rem;
  font-weight: 600;
}

.blog-card--new {
  animation: blogCardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes blogCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.blog-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.btn-pagination {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-pagination:hover {
  background: var(--soft);
  border-color: var(--brand);
  color: var(--brand);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.blog-empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  max-width: 680px;
  margin: 2rem auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.blog-empty-state h3 {
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.blog-empty-state p {
  color: var(--muted);
}

.empty-state-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.75rem;
}

/* --------------------------------------------------------------------------
   Single Article Page (/blog/{slug})
   -------------------------------------------------------------------------- */
.blog-container-narrow {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.blog-container-media {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.blog-breadcrumbs {
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.blog-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
}

.blog-breadcrumbs li:not(:last-child)::after {
  content: "›";
  margin-left: 0.5rem;
  opacity: 0.6;
}

.blog-breadcrumbs a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.blog-breadcrumbs a:hover {
  text-decoration: underline;
}

.blog-breadcrumbs li[aria-current="page"] {
  color: var(--muted);
  font-weight: 500;
}

.blog-article-header {
  padding-top: 2rem;
  padding-bottom: 1.5rem;
}

.blog-article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.blog-article-title {
  font-size: clamp(2rem, 4vw + 0.5rem, 2.85rem);
  line-height: 1.18;
  font-weight: 850;
  letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
  color: var(--ink) !important;
}

.blog-article-lead {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--ink-soft) !important;
  margin-bottom: 0;
  font-weight: 450;
}

.blog-article-figure {
  margin: 1.75rem 0 2.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--soft);
  box-shadow: 0 4px 18px rgba(0, 42, 48, 0.04);
}

.blog-article-image {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  display: block;
}

.blog-article-figure figcaption {
  padding: 0.65rem 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  background: var(--soft);
  border-top: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   Article Prose Content
   -------------------------------------------------------------------------- */
.blog-prose {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--ink-soft) !important;
  margin-bottom: 3.5rem;
}

.blog-prose > * + * {
  margin-top: 1.5rem;
}

.blog-prose h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.25;
  font-weight: 850;
  color: var(--ink) !important;
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.blog-prose h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  line-height: 1.3;
  font-weight: 800;
  color: var(--ink) !important;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}

.blog-prose h4 {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--ink) !important;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.blog-prose p {
  margin-bottom: 1.35rem;
  color: var(--ink-soft) !important;
}

.blog-prose strong,
.blog-prose b {
  color: var(--ink) !important;
  font-weight: 750;
}

.blog-prose a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.15s ease;
}

.blog-prose a:hover {
  color: var(--brand-dark);
}

.blog-prose ul,
.blog-prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--ink-soft);
}

.blog-prose li {
  margin-bottom: 0.5rem;
}

.blog-prose blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--brand);
  background: var(--soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--ink);
  font-size: 1.1rem;
}

.blog-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--brand-dark);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.blog-prose pre {
  background: var(--ink);
  color: #f6faf9;
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
}

.blog-prose pre code {
  background: none;
  border: none;
  color: inherit;
  padding: 0;
}

.blog-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  overflow-x: auto;
  display: block;
}

.blog-prose th,
.blog-prose td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  text-align: left;
}

.blog-prose th {
  background: var(--soft);
  font-weight: 700;
  color: var(--ink);
}

.blog-prose tr:nth-child(even) td {
  background: rgba(246, 250, 249, 0.5);
}

/* --------------------------------------------------------------------------
   Callout for AI / LLMs
   -------------------------------------------------------------------------- */
.blog-agent-callout {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin: 2.5rem 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--soft);
}

.blog-agent-callout__icon {
  font-size: 1.75rem;
  line-height: 1;
}

.blog-agent-callout__text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.blog-agent-callout__text p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.blog-agent-callout__text a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Author Card
   -------------------------------------------------------------------------- */
.blog-author-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  margin-top: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 4px 14px rgba(0, 42, 48, 0.04);
}

.blog-author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 850;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.blog-author-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.blog-author-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 0.25rem;
}

.blog-author-bio {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Contextual CTA Section
   -------------------------------------------------------------------------- */
.blog-cta-section {
  padding: 4rem 1.5rem;
  background: var(--soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.blog-cta-section h2 {
  color: var(--ink);
}

.blog-cta-section .lead {
  color: var(--muted);
}

@media (max-width: 768px) {
  .blog-article-title {
    font-size: 1.85rem;
  }

  .blog-article-lead {
    font-size: 1.05rem;
  }

  .blog-prose {
    font-size: 1rem;
    line-height: 1.7;
  }

  .blog-card__image-link {
    aspect-ratio: 16 / 10;
  }

  .blog-author-card {
    flex-direction: column;
    text-align: center;
  }
}
