/* ============================================================
   blog.css — Estilos de la grilla pública de publicaciones
   ============================================================ */

/* ── Skeleton loader ───────────────────────────────────────── */
.pub-grid-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.skel-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eaecf0;
}

.skel-img {
  height: 200px;
  background: linear-gradient(90deg, #f0f2f5 25%, #e4e7eb 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.skel-body { padding: 20px; }

.skel-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f0f2f5 25%, #e4e7eb 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 10px;
}
.skel-line.short  { width: 40%; }
.skel-line.medium { width: 70%; height: 16px; margin-bottom: 14px; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Grilla de tarjetas ────────────────────────────────────── */
#pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

/* ── Tarjeta individual ────────────────────────────────────── */
.pub-card {
  background: #ffffff;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.pub-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(13, 27, 42, 0.1);
  border-color: #d0d5df;
}

/* ── Imagen de portada ─────────────────────────────────────── */
.pub-card-cover {
  position: relative;
  overflow: hidden;
  height: 200px;
  background: #f0f2f5;
  flex-shrink: 0;
}

.pub-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.pub-card:hover .pub-card-img {
  transform: scale(1.04);
}

.pub-card-img--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0b8c8;
  background: #f4f6f9;
}

/* ── Cuerpo de la tarjeta ──────────────────────────────────── */
.pub-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 24px 24px;
}

.pub-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pub-card-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Colores por categoría */
.pub-card[data-tag="Tributación"] .pub-card-tag { background: #1e3a5f; }
.pub-card[data-tag="Finanzas"]    .pub-card-tag { background: #1a5276; }
.pub-card[data-tag="Legal"]       .pub-card-tag { background: #0D1B2A; }
.pub-card[data-tag="Consultoría"] .pub-card-tag { background: #2e4057; }
.pub-card[data-tag="Noticias"]    .pub-card-tag { background: #2e6da4; }

.pub-card-date {
  font-size: 11px;
  color: #9aa3b2;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pub-card-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #0D1B2A;
  line-height: 1.35;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pub-card-summary {
  font-size: 13.5px;
  color: #5a6477;
  line-height: 1.7;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0;
}

.pub-card-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0f2f5;
}

.pub-card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.18s, gap 0.18s;
}

.pub-card-link:hover {
  color: #0D1B2A;
  gap: 10px;
}

/* ── Estado vacío ──────────────────────────────────────────── */
.pub-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: #9aa3b2;
}

.pub-empty svg {
  display: block;
  margin: 0 auto 16px;
  opacity: 0.35;
}

.pub-empty p {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
}

/* ── Modal de artículo ─────────────────────────────────────── */
.article-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px 40px;
  overflow-y: auto;
}

.article-modal-overlay.open {
  display: flex;
}

.article-modal {
  background: #ffffff;
  border-radius: 16px;
  max-width: 760px;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  animation: modalIn 0.28s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.article-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 1px solid #eaecf0;
  font-size: 16px;
  color: #5a6477;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
}

.article-modal-close:hover {
  background: #0D1B2A;
  color: #fff;
  border-color: #0D1B2A;
}

.article-modal-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

.article-modal-body {
  padding: 32px 40px 48px;
}

.article-modal-tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.article-modal-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #0D1B2A;
  line-height: 1.25;
  margin-bottom: 8px;
}

.article-modal-date {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  color: #9aa3b2;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f2f5;
}

/* Contenido markdown renderizado */
.article-modal-content {
  font-size: 15px;
  color: #374151;
  line-height: 1.85;
}

.article-modal-content h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: #0D1B2A;
  margin: 28px 0 10px;
}

.article-modal-content h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #0D1B2A;
  margin: 22px 0 8px;
}

.article-modal-content p { margin-bottom: 16px; }

.article-modal-content ul { margin: 12px 0 16px 20px; }

.article-modal-content li { margin-bottom: 6px; }

.article-modal-content strong {
  font-weight: 700;
  color: #0D1B2A;
}

.article-modal-content em { font-style: italic; }

.article-modal-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 16px 0;
  padding: 10px 16px;
  color: #5a6477;
  background: #fafafa;
  border-radius: 0 6px 6px 0;
}

.article-modal-content hr {
  border: none;
  border-top: 1px solid #eaecf0;
  margin: 24px 0;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  #pub-grid { grid-template-columns: 1fr; }
  .pub-grid-skeleton { grid-template-columns: 1fr; }
  .article-modal-body { padding: 24px 24px 40px; }
  .article-modal-title { font-size: 20px; }
  .article-modal-img { height: 200px; }
}

@media (max-width: 480px) {
  .pub-card-body { padding: 18px 18px 20px; }
}