/* ═══════════════════════════════════════════════
   blog-post.css  —  myhabla.com
   Estilos específicos para /blog/{slug}
   Sistema de diseño: Inter/Poppins · #0b1c2d · #2b7cff
   ═══════════════════════════════════════════════ */

/* ── Variables locales (heredan del sistema global) ── */
:root {
  --bp-navy:        #0b1c2d;
  --bp-blue:        #2b7cff;
  --bp-blue-dark:   #1e61d4;
  --bp-blue-light:  #eff6ff;
  --bp-blue-mid:    #bfdbfe;
  --bp-text:        #1e293b;
  --bp-muted:       #64748b;
  --bp-border:      #e2e8f0;
  --bp-surface:     #f8faff;
  --bp-white:       #ffffff;
  --bp-radius:      20px;
  --bp-radius-sm:   12px;
  --bp-shadow-sm:   0 4px 16px rgba(0,0,0,.06);
  --bp-shadow-md:   0 10px 30px rgba(43,124,255,.12);
  --bp-font-display: 'Poppins', 'Inter', system-ui, sans-serif;
  --bp-font-body:    'Inter', system-ui, sans-serif;
}

/* ────────────────────────────────────────────────
   HERO
   ──────────────────────────────────────────────── */
.bp-hero {
  position: relative;
  width: 100%;
  min-height: 480px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background-color: var(--bp-navy);
}

.bp-hero__bg {
  position: absolute;
  inset: 0;
}

.bp-hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  transform: scale(1.04);          /* se "destapa" con JS al cargar */
  transition: transform 1.2s cubic-bezier(.25,.46,.45,.94);
}

.bp-hero--loaded .bp-hero__bg img {
  transform: scale(1);
}

.bp-hero__bg--gradient {
  background: linear-gradient(135deg, #0b1c2d 0%, #152d47 40%, #1a3a5c 100%);
}

/* capa oscura sobre la imagen */
.bp-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(11,28,45,.90) 0%,
    rgba(11,28,45,.55) 50%,
    rgba(11,28,45,.20) 100%
  );
}

.bp-hero__content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 60px 40px 56px;
  color: #fff;

  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease .15s, transform .7s ease .15s;
}

.bp-hero--loaded .bp-hero__content {
  opacity: 1;
  transform: translateY(0);
}

/* Botón "← Blog" */
.bp-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color .2s, gap .2s;
  letter-spacing: .02em;
}
.bp-back:hover { color: #fff; gap: 12px; }

.bp-hero__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.bp-hero__date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.7);
  font-family: var(--bp-font-body);
}

.bp-hero__title {
  font-family: var(--bp-font-display);
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  margin: 0 0 18px;
  max-width: 720px;
}

.bp-hero__desc {
  font-size: 17px;
  line-height: 1.65;
  color: rgba(255,255,255,.82);
  max-width: 640px;
  margin: 0;
}

/* ────────────────────────────────────────────────
   LAYOUT: 3 columnas
   TOC | Artículo | CTA sidebar
   ──────────────────────────────────────────────── */
.bp-layout {
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  grid-template-areas: "toc article cta";
  gap: 0 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 40px 80px;
  align-items: start;
}

/* ────────────────────────────────────────────────
   TABLA DE CONTENIDOS (izquierda)
   ──────────────────────────────────────────────── */
.bp-toc {
  grid-area: toc;
  position: sticky;
  top: 88px;          /* debajo del header */
}

.bp-toc__inner {
  padding: 20px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius-sm);
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity .5s ease .3s, transform .5s ease .3s;
}

.bp-toc__inner.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.bp-toc__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--bp-muted);
  margin: 0 0 14px;
}

/* Generado por JS */
.bp-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.bp-toc-list li + li { margin-top: 4px; }

.bp-toc-list a {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--bp-muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
  border-left: 2px solid transparent;
  transition: color .2s, background .2s, border-color .2s;
  line-height: 1.4;
}

.bp-toc-list a:hover,
.bp-toc-list a.is-active {
  color: var(--bp-blue);
  background: var(--bp-blue-light);
  border-left-color: var(--bp-blue);
}

/* h3 dentro del TOC → indent */
.bp-toc-list li.toc-h3 a {
  padding-left: 20px;
  font-size: 12px;
}

/* ────────────────────────────────────────────────
   ARTÍCULO (centro)
   ──────────────────────────────────────────────── */
.bp-article {
  grid-area: article;
  min-width: 0;
}

/* El contenido renderizado desde Markdown */
.bp-content {
  font-family: var(--bp-font-body);
  font-size: 17px;
  line-height: 1.78;
  color: var(--bp-text);
}

/* — Párrafos — */
.bp-content p { margin: 0 0 1.5em; }

.bp-content li p {
  margin: 0;
}

/* — Headings — */
.bp-content h2 {
  font-family: var(--bp-font-display);
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 800;
  color: var(--bp-navy);
  margin: 2.4em 0 .6em;
  line-height: 1.2;
  scroll-margin-top: 100px;
}

.bp-content h2::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: var(--bp-blue);
  border-radius: 2px;
  margin-bottom: 10px;
}

.bp-content h3 {
  font-family: var(--bp-font-display);
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 700;
  color: var(--bp-navy);
  margin: 2em 0 .5em;
  scroll-margin-top: 100px;
}

.bp-content h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--bp-navy);
  margin: 1.6em 0 .4em;
}

/* — Listas — */
.bp-content ul,
.bp-content ol {
  padding-left: 1.5em;
  margin: 0 0 1.5em;
}

.bp-content li { margin-bottom: .5em; }

.bp-content ul li::marker { color: var(--bp-blue); }
.bp-content ol li::marker { color: var(--bp-blue); font-weight: 700; }

/* — Citas — */
.bp-content blockquote {
  margin: 2em 0;
  padding: 20px 24px;
  background: var(--bp-blue-light);
  border-left: 4px solid var(--bp-blue);
  border-radius: 0 var(--bp-radius-sm) var(--bp-radius-sm) 0;
  color: var(--bp-navy);
  font-style: italic;
  font-size: 18px;
  line-height: 1.6;
}

.bp-content blockquote p { margin: 0; }

/* — Código inline — */
.bp-content code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: .875em;
  font-family: 'Fira Code', 'Menlo', 'Monaco', monospace;
  color: #c026d3;
}

/* — Bloques de código — */
.bp-content pre {
  background: var(--bp-navy);
  border-radius: var(--bp-radius-sm);
  padding: 24px;
  overflow-x: auto;
  margin: 1.8em 0;
  border: 1px solid rgba(43,124,255,.2);
}

.bp-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.7;
}

/* — Imágenes — */
.bp-content img {
  width: 100%;
  height: auto;
  border-radius: var(--bp-radius-sm);
  margin: 1.8em 0;
  box-shadow: var(--bp-shadow-sm);
  display: block;
}

/* — Links — */
.bp-content a {
  color: var(--bp-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color .2s;
}
.bp-content a:hover { color: var(--bp-blue-dark); }

/* — Separadores — */
.bp-content hr {
  border: none;
  border-top: 2px solid var(--bp-border);
  margin: 3em 0;
}

/* — Tablas — */
.bp-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8em 0;
  font-size: 15px;
}

.bp-content th {
  background: var(--bp-navy);
  color: #fff;
  font-weight: 700;
  padding: 12px 16px;
  text-align: left;
}

.bp-content td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--bp-border);
}

.bp-content tr:nth-child(even) td { background: var(--bp-surface); }

/* — Primera letra destacada — */
.bp-content > p:first-of-type::first-letter {
  font-family: var(--bp-font-display);
  font-size: 3.8em;
  font-weight: 800;
  color: var(--bp-navy);
  float: left;
  line-height: .85;
  margin: .06em .12em 0 0;
}



/* ────────────────────────────────────────────────
   FOOTER DEL ARTÍCULO: compartir + volver
   ──────────────────────────────────────────────── */
.bp-article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 2px solid var(--bp-border);
}

.bp-share {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bp-share__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--bp-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.bp-share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}

.bp-share__btn:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.2); }
.bp-share__btn--tw   { background: #0f1419; }
.bp-share__btn--li   { background: #0077b5; }
.bp-share__btn--wa   { background: #25d366; }
.bp-share__btn--copy { background: var(--bp-navy); }
.bp-share__btn--copy.copied { background: #10b981; }

.bp-back-bottom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--bp-navy);
  text-decoration: none;
  transition: gap .2s, color .2s;
}
.bp-back-bottom:hover { color: var(--bp-blue); gap: 12px; }

/* ────────────────────────────────────────────────
   CTA SIDEBAR (derecha)
   ──────────────────────────────────────────────── */
.bp-cta-sidebar {
  grid-area: cta;
  position: sticky;
  top: 88px;
}

.bp-cta-card {
  background: var(--bp-white);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 28px 24px 24px;
  box-shadow: var(--bp-shadow-sm);
  text-align: center;
  position: relative;
  overflow: visible;

  opacity: 0;
  transform: translateX(12px);
  transition: opacity .5s ease .4s, transform .5s ease .4s;
}

.bp-cta-card.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.bp-cta-card:hover {
  border-color: var(--bp-blue-mid);
  box-shadow: var(--bp-shadow-md);
}

.bp-cta-card__avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bp-blue-light);
  margin: 0 auto 16px;
  display: block;
}

.bp-cta-card__tag {
  display: inline-block;
  background: var(--bp-blue-light);
  color: var(--bp-blue);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.bp-cta-card__title {
  font-family: var(--bp-font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--bp-navy);
  margin: 0 0 10px;
  line-height: 1.3;
}

.bp-cta-card__body {
  font-size: 13px;
  color: var(--bp-muted);
  line-height: 1.6;
  margin: 0 0 20px;
}

.bp-cta-card__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bp-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 50px;
  transition: background .2s, transform .2s, gap .2s;
  box-shadow: 0 6px 20px rgba(43,124,255,.3);
  margin-bottom: 16px;
}

.bp-cta-card__btn:hover {
  background: var(--bp-blue-dark);
  transform: translateY(-2px);
  gap: 12px;
}

.bp-cta-card__list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.bp-cta-card__list li {
  font-size: 12px;
  color: var(--bp-muted);
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.bp-cta-card__list i {
  color: #10b981;
  font-size: 11px;
}

/* Progreso de lectura: barra en la parte superior de la página */
#bp-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--bp-blue), #60a5fa);
  z-index: 9999;
  transition: width .1s linear;
}

/* ────────────────────────────────────────────────
   POSTS RELACIONADOS
   ──────────────────────────────────────────────── */
.bp-related {
  background: var(--bp-surface);
  border-top: 1px solid var(--bp-border);
  padding: 60px 40px 80px;
}

.bp-related__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.bp-related__heading {
  font-family: var(--bp-font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--bp-navy);
  margin: 0 0 36px;
}

/* Reutiliza .blog-grid y .blog-card del blog.css */

/* ────────────────────────────────────────────────
   RESPONSIVE
   ──────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1100px) {
  .bp-layout {
    grid-template-columns: 1fr 220px;
    grid-template-areas:
      "article cta"
      "article .";
    padding: 40px 28px 60px;
    gap: 0 28px;
  }
  .bp-toc { display: none; }
}

/* Mobile */
@media (max-width: 768px) {
  .bp-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "cta"
      "article";
    padding: 28px 20px 48px;
    gap: 28px 0;
  }

  .bp-cta-sidebar {
    position: static;
    order: -1;
  }

  .bp-cta-card {
    opacity: 1;
    transform: none;
  }

  .bp-hero {
    min-height: 380px;
  }

  .bp-hero__content {
    padding: 40px 20px 36px;
  }

  .bp-content { font-size: 16px; }
  .bp-content > p:first-of-type::first-letter { font-size: 3em; }

  .bp-article-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .bp-related { padding: 40px 20px 56px; }
}
.bp-content ul {
  list-style-type: disc;
  padding-left: 1.5em;
}

.bp-content ol {
  list-style-type: decimal;
  padding-left: 1.5em;
}

.bp-content ul ul {
  list-style-type: circle;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .bp-hero__bg img,
  .bp-hero__content,
  .bp-toc__inner,
  .bp-cta-card {
    transition: none;
    opacity: 1;
    transform: none;
  }
}