/* ==========================================================================
   TU PERMISO .pe — BLOG
   Estilos del blog público y de los artículos. Reutiliza los tokens y
   componentes de styles.css (container, btn, pill, header, footer).
   ========================================================================== */

.blog-page { background: var(--bg); }
.blog-page main { display: block; }

/* El header es fixed y transparente; cada vista del blog abre con una banda
   oscura para que el header se vea bien encima (igual que el hero del home). */

/* ============================ BLOG HERO ============================ */
.blog-hero {
  position: relative;
  overflow: hidden;
  padding: 150px 0 72px;
  background: var(--grad-why);
  color: #fff;
  isolation: isolate;
}
.blog-hero::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(60% 90% at 80% 0%, rgba(118,144,255,.30), transparent 60%);
}
.blog-hero-stars { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.blog-hero-stars .star {
  position: absolute; width: 3px; height: 3px;
  background: rgba(255,255,255,.9); border-radius: 50%;
  box-shadow: 0 0 8px 2px rgba(180,200,255,.6);
  animation: twinkle 4s ease-in-out infinite;
}
.blog-hero-inner { position: relative; text-align: center; max-width: 760px; }
.blog-hero-inner .pill-lime { margin-bottom: 18px; }
.blog-hero-title {
  color: #fff;
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.blog-hero-sub {
  color: rgba(255,255,255,.82);
  font-size: clamp(15px, 2vw, 18px);
  max-width: 620px;
  margin: 0 auto;
}

/* ============================ LISTA / GRID ============================ */
.blog-list-section { padding: 64px 0; background: var(--bg-soft); }
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.blog-empty {
  grid-column: 1 / -1; text-align: center;
  color: var(--mute); font-size: 16px; padding: 40px 0;
}

/* ============================ TARJETA POST ============================ */
.post-card {
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--sh-card);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.post-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--sh-card-h);
  border-color: rgba(69,96,255,.25);
}
.post-card-media {
  position: relative; display: block;
  aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--blue-50);
}
.post-card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.post-card:hover .post-card-media img { transform: scale(1.06); }
.post-card-tag {
  position: absolute; left: 14px; top: 14px;
  background: var(--lime-400); color: var(--ink);
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
  padding: 6px 11px; border-radius: 999px;
  box-shadow: 0 6px 16px -6px rgba(209,244,61,.7);
}
.post-card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.post-card-meta {
  display: flex; align-items: center; gap: 8px;
  color: var(--mute); font-size: 12.5px; font-weight: 600; margin-bottom: 10px;
}
.post-card-meta .dot { opacity: .5; }
.post-card-title {
  font-size: 19px; line-height: 1.3; font-weight: 700;
  margin-bottom: 10px; letter-spacing: -0.01em;
}
.post-card-title a { color: var(--ink); transition: color .2s ease; }
.post-card-title a:hover { color: var(--blue-500); }
.post-card-excerpt {
  color: var(--mute); font-size: 14.5px; line-height: 1.6;
  margin-bottom: 18px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-link {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--blue-500); font-weight: 700; font-size: 14px;
  margin-top: auto;
}
.post-card-link svg { width: 17px; height: 17px; transition: transform .2s ease; }
.post-card-link:hover svg { transform: translateX(4px); }

/* ============================ CTA BLOG ============================ */
.blog-cta { padding: 0 0 72px; background: var(--bg-soft); }
.blog-cta-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
  background: var(--grad-hero);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  box-shadow: var(--sh-stats);
}
.blog-cta-inner h2 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.blog-cta-inner p { color: rgba(255,255,255,.85); font-size: 15px; }

/* ============================ ARTÍCULO ============================ */
.post-article { background: var(--bg); }
.post-head {
  position: relative;
  padding: 140px 0 56px;
  background: var(--grad-why);
  color: #fff;
  overflow: hidden;
}
.post-head-bg {
  position: absolute; inset: 0;
  background: radial-gradient(50% 80% at 85% 0%, rgba(118,144,255,.35), transparent 60%);
}
.post-head-inner { position: relative; max-width: 820px; }
.post-back {
  display: inline-flex; align-items: center; gap: 7px;
  color: rgba(255,255,255,.82); font-weight: 600; font-size: 14px;
  margin-bottom: 22px; transition: color .2s ease;
}
.post-back:hover { color: var(--lime-400); }
.post-back svg { width: 18px; height: 18px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.post-tag {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 5px 12px; border-radius: 999px;
}
.post-title {
  color: #fff; font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 16px;
}
.post-deck {
  color: rgba(255,255,255,.85); font-size: clamp(16px, 2vw, 19px);
  line-height: 1.6; max-width: 680px; margin-bottom: 22px;
}
.post-byline {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  color: rgba(255,255,255,.75); font-size: 13.5px; font-weight: 600;
}
.post-byline .post-author { color: var(--lime-400); }
.post-byline .dot { opacity: .5; }

/* Portada que "flota" sobre la banda */
.post-cover {
  margin: -40px auto 0; max-width: 880px;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 30px 70px -28px rgba(15,27,61,.45);
  border: 1px solid var(--line);
  background: var(--blue-50);
}
.post-cover img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }

/* ---- Tipografía del cuerpo del artículo ---- */
.post-body {
  max-width: 740px; margin: 44px auto 0;
  font-size: 17.5px; line-height: 1.8; color: #2A3559;
}
.post-body > *:first-child { margin-top: 0; }
.post-body p { margin: 0 0 22px; }
.post-body h2 {
  font-size: clamp(23px, 3vw, 30px); color: var(--ink);
  letter-spacing: -0.01em; margin: 46px 0 16px; line-height: 1.25;
  position: relative; padding-left: 18px;
}
.post-body h2::before {
  content: ""; position: absolute; left: 0; top: .12em; bottom: .12em;
  width: 5px; border-radius: 3px;
  background: linear-gradient(180deg, var(--blue-500), var(--lime-400));
}
.post-body h3 {
  font-size: clamp(19px, 2.4vw, 23px); color: var(--ink);
  margin: 34px 0 12px; line-height: 1.3;
}
.post-body h4 { font-size: 18px; color: var(--ink); margin: 26px 0 10px; }
.post-body a { color: var(--blue-500); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.post-body a:hover { color: var(--blue-700); }
.post-body strong, .post-body b { color: var(--ink); font-weight: 700; }
.post-body ul, .post-body ol { margin: 0 0 24px; padding-left: 4px; }
.post-body li {
  list-style: none; position: relative; padding-left: 32px; margin-bottom: 12px;
}
.post-body ul li::before {
  content: ""; position: absolute; left: 6px; top: .62em;
  width: 9px; height: 9px; border-radius: 3px;
  background: var(--lime-400); box-shadow: 0 0 0 4px rgba(209,244,61,.22);
  transform: rotate(45deg);
}
.post-body ol { counter-reset: li; }
.post-body ol li { counter-increment: li; }
.post-body ol li::before {
  content: counter(li); position: absolute; left: 0; top: .05em;
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--blue-50); color: var(--blue-600);
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.post-body blockquote {
  margin: 28px 0; padding: 20px 24px;
  background: var(--blue-50); border-left: 5px solid var(--blue-500);
  border-radius: 0 14px 14px 0; color: var(--ink-2);
  font-size: 18px; font-style: italic;
}
.post-body img {
  width: 100%; height: auto; border-radius: var(--radius);
  margin: 14px 0; box-shadow: var(--sh-card); border: 1px solid var(--line);
}
.post-body figure { margin: 30px 0; }
.post-body figure img { margin: 0; }
.post-body figcaption {
  text-align: center; color: var(--mute); font-size: 13.5px; margin-top: 10px;
}
.post-body pre {
  background: var(--ink); color: #E7ECFF; padding: 18px 20px;
  border-radius: 14px; overflow-x: auto; font-size: 14px; margin: 0 0 24px;
}
.post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.post-body p code, .post-body li code {
  background: var(--blue-50); color: var(--blue-700);
  padding: 2px 6px; border-radius: 6px;
}
.post-body .post-callout {
  background: linear-gradient(135deg, var(--blue-50), #fff);
  border: 1px solid var(--blue-100); border-radius: 16px;
  padding: 18px 22px; margin: 0 0 24px;
}
.post-body table { width: 100%; border-collapse: collapse; margin: 0 0 26px; font-size: 15px; }
.post-body th, .post-body td { border: 1px solid var(--line); padding: 11px 14px; text-align: left; }
.post-body th { background: var(--bg-soft); font-weight: 700; }

/* ---- Caja de contacto al final ---- */
.post-share { max-width: 740px; margin: 48px auto 0; padding-bottom: 8px; }
.post-share-card {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  flex-wrap: wrap;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 24px 28px;
}
.post-share-card strong { display: block; font-size: 18px; color: var(--ink); margin-bottom: 2px; }
.post-share-card span { color: var(--mute); font-size: 14.5px; }

.blog-related { padding-top: 64px; padding-bottom: 80px; margin-top: 56px; }
.related-title {
  text-align: center; font-size: 26px; color: var(--ink); margin-bottom: 32px;
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 980px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .blog-hero { padding: 120px 0 56px; }
  .post-head { padding: 110px 0 48px; }
}
@media (max-width: 640px) {
  .post-grid { grid-template-columns: 1fr; }
  .blog-cta-inner { flex-direction: column; text-align: center; padding: 30px 24px; }
  .post-body { font-size: 16.5px; }
  .post-share-card { flex-direction: column; text-align: center; }
}
