/* ---- HERO DE PÁGINA ---- */
.blog-hero {
  background: url('../assets/blog/Blog.jpg') center center / cover no-repeat;
  min-height: 420px;
  padding: calc(var(--navbar-height) + 5rem) 16rem 5rem;
  position: relative;
  overflow: hidden;
}

.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.blog-hero__label,
.blog-hero__title,
.blog-hero__sub {
  position: relative;
  z-index: 2;
}

.blog-hero__label {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1.5rem;
}

.blog-hero__title {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.08;
  margin-bottom: 1.25rem;
  max-width: 600px;
}

.blog-hero__sub {
  font-size: 1rem;
  color: #fff;
  line-height: 1.7;
  max-width: 460px;
}

/* ---- CATEGORÍAS / FILTROS ---- */
.blog-filters {
  background: #fff;
  padding: 2rem 16rem;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid #e0ddd6;
  color: #555;
  background: transparent;
  transition: all 0.18s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ---- FEATURED POST ---- */
.blog-featured {
  background: #fff;
  padding: 4rem 16rem 0;
}

.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-radius: 1.25rem;
  overflow: hidden;
  background: #f5f4ef;
  max-height: 240px;
}

.featured-card__img {
  background: #dedad2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0aa9e;
}

.featured-card__img svg {
  width: 40px;
  height: 40px;
}

.featured-card__body {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.6rem;
}

.featured-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.featured-tag {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.featured-card__title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1.2;
}

.featured-card__excerpt {
  font-size: 0.78rem;
  color: #666;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-card__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.7rem;
  color: #999;
}

.featured-card__meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.featured-card__meta svg {
  width: 12px;
  height: 12px;
}

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  width: fit-content;
  transition: background 0.2s, transform 0.15s;
}
.read-btn:hover { background: var(--color-primary); transform: translateY(-1px); }
.read-btn svg { width: 14px; height: 14px; }

/* ---- GRID DE ARTÍCULOS ---- */
.blog-grid-section {
  background: #fff;
  padding: 4rem 16rem 6rem;
}

.blog-grid-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2.5rem;
}

.blog-grid-section__title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #1a1a1a;
}

.blog-grid-section__link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}
.blog-grid-section__link:hover { text-decoration: underline; }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* Tarjeta de artículo */
.article-card {
  border-radius: 1rem;
  overflow: hidden;
  background: #f5f4ef;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.09);
}

.article-card__img {
  height: 130px;
  background: #dedad2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0aa9e;
  flex-shrink: 0;
}
.article-card__img svg { width: 28px; height: 28px; }

.article-card__body {
  padding: 1rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.article-card__cat {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.article-card__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.35;
}

.article-card__excerpt {
  font-size: 0.74rem;
  color: #666;
  line-height: 1.6;
  flex: 1;
}

.article-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e0ddd6;
}

.article-card__date {
  font-size: 0.68rem;
  color: #aaa;
  font-weight: 500;
}

.article-card__link {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.article-card__link svg { width: 11px; height: 11px; }
.article-card__link:hover { text-decoration: underline; }

/* ---- NEWSLETTER CTA ---- */
.newsletter {
  background: #f5f4ef;
  padding: 5rem 16rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.newsletter__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.newsletter__title {
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.newsletter__sub {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.7;
}

.newsletter__form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.newsletter__row {
  display: flex;
  gap: 0.75rem;
}

.newsletter__input {
  flex: 1;
  padding: 0.85rem 1.1rem;
  border: 1.5px solid #dedad2;
  border-radius: 999px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  transition: border-color 0.18s;
}
.newsletter__input:focus { border-color: var(--color-primary); }
.newsletter__input::placeholder { color: #bbb; }

.newsletter__btn {
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
}
.newsletter__btn:hover { background: var(--color-primary-dark); transform: translateY(-1px); }

.newsletter__note {
  font-size: 0.72rem;
  color: #aaa;
}

/* ---- PÁGINA DE ARTÍCULO INDIVIDUAL ---- */
.article-page {
  display: block;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--navbar-height) + 3rem) 1.5rem 4rem;
}

.article-page__loading,
.article-page__notfound {
  text-align: center;
  padding: 4rem 0;
  color: #999;
}
.article-page__notfound h1 { color: #1a1a1a; font-size: 1.4rem; margin-bottom: 0.5rem; }
.article-page__notfound p { margin-bottom: 1.5rem; }
.article-page__notfound .read-btn { margin: 0 auto; }

.article-page__header { margin-bottom: 2rem; }

.article-page__back {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  margin-bottom: 1.25rem;
}
.article-page__back:hover { text-decoration: underline; }

.article-page__cat {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}

.article-page__title {
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.article-page__meta {
  font-size: 0.82rem;
  color: #999;
}

.article-page__img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 1rem;
  margin-bottom: 2rem;
  background: #f5f4ef;
}

.article-page__body {
  font-size: 1rem;
  line-height: 1.85;
  color: #333;
}
.article-page__body p { margin-bottom: 1.25rem; }
.article-page__body p:last-child { margin-bottom: 0; }

.article-page__pdf {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid #e5e3da;
  background: #f5f4ef;
  padding: 1.6rem;
}

/* ---- Visor de PDF propio (páginas como canvas, sin chrome nativo) ---- */
.pdf-viewer__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 4rem 0;
  color: #999;
  font-size: 0.85rem;
  text-align: center;
}
.pdf-viewer__loading a { color: var(--color-primary); font-weight: 600; }
.pdf-viewer__spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid #e5e3da;
  border-top-color: var(--color-primary);
  animation: pdfViewerSpin 0.8s linear infinite;
}
@keyframes pdfViewerSpin { to { transform: rotate(360deg); } }

.pdf-viewer__page {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  background: #fff;
  border-radius: 0.4rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}
.pdf-viewer__page + .pdf-viewer__page { margin-top: 1.4rem; }

/* ---- Modal emergente del visor de PDF (usado desde blog.html) ---- */
.pdf-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.72);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  padding: 20px;
}
.pdf-modal-backdrop.open { display: flex; }

.pdf-modal {
  background: #f5f4ef;
  border-radius: 1.1rem;
  width: 100%;
  max-width: 880px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.pdf-modal__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.3rem;
  background: #fff;
  border-bottom: 1px solid #e5e3da;
  flex-shrink: 0;
}
.pdf-modal__title {
  font-weight: 800;
  font-size: 0.92rem;
  color: #1a1a1a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-modal__actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.pdf-modal__btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: #f2f1ec;
  color: #1a1a1a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.pdf-modal__btn svg { width: 15px; height: 15px; }
.pdf-modal__btn:hover { background: #e5e3da; }
.pdf-modal__close:hover { background: #f4d9d9; color: #b42318; }

.pdf-modal__body {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1.8rem;
}
/* Block y no flex: con justify-content:center no se puede hacer scroll
   hasta los bordes cuando el zoom agranda la página. El centrado lo da el
   margin auto de .pdf-viewer__page. */
.pdf-modal__pages { width: 100%; }

/* En el modal se quita el tope de 640px de .pdf-viewer__page, si no el
   zoom no se nota */
.pdf-modal__pages .pdf-viewer__page {
  width: auto;
  max-width: none;
  height: auto;
}

.article-page__cta {
  margin-top: 3rem;
  padding: 2rem;
  background: #f5f4ef;
  border-radius: 1rem;
  text-align: center;
}
.article-page__cta p {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 1rem;
}
.article-page__cta .read-btn { margin: 0 auto; }

/* ---- RESPONSIVE ---- */
@media (max-width: 1400px) {
  .blog-hero, .blog-filters, .blog-featured, .blog-grid-section, .newsletter { padding-left: 8rem; padding-right: 8rem; }
}
@media (max-width: 1100px) {
  .blog-hero, .blog-filters, .blog-featured, .blog-grid-section, .newsletter { padding-left: 4rem; padding-right: 4rem; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .newsletter { grid-template-columns: 1fr; gap: 2rem; }
}
@media (max-width: 768px) {
  .blog-hero, .blog-filters, .blog-featured, .blog-grid-section, .newsletter { padding-left: 2rem; padding-right: 2rem; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-card__img { min-height: 240px; }
  .blog-grid { grid-template-columns: 1fr; }
  .newsletter__row { flex-direction: column; }
}
@media (max-width: 520px) {
  .blog-hero { padding-top: 6rem; padding-bottom: 3rem; }
  .blog-hero, .blog-filters, .blog-featured, .blog-grid-section, .newsletter { padding-left: 1.25rem; padding-right: 1.25rem; }
}
