/* ── FIX NAV — igualar tamaño con index.html ── */
#navbar {
  padding: 0 28px !important;
}

#navbar .logo {
  font-size: 1.5rem !important;
}

#navbar .nav-links a {
  font-size: 0.9rem !important;
  padding: 6px 14px !important;
}

/* ── SKELETON LOADERS ── */
.post-loading { margin-top: var(--nav-height); }

.skel-cover {
  width: 100%;
  height: 520px;
  background: var(--skel-base);
  animation: shimmer 1.4s infinite;
}

.post-body {
  max-width: 740px;
  margin: 40px auto;
  padding: 0 24px;
}

.skel-line {
  height: 18px;
  border-radius: 6px;
  background: var(--skel-base);
  margin-bottom: 14px;
  animation: shimmer 1.4s infinite;
}

.skel-line.wide   { width: 90%; }
.skel-line.medium { width: 65%; }
.skel-line.narrow { width: 40%; }

/* ── HERO DEL ARTÍCULO ── */
.post-hero {
  position: relative;
  margin-top: var(--nav-height);
  height: 520px;
  overflow: hidden;
}

.post-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.1) 55%, transparent 100%);
}

.post-hero-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 64px;
  color: white;
  max-width: 900px;
}

.post-category-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  color: white;
  margin-bottom: 14px;
}

.post-hero-title {
  font-family: 'Clash Display', sans-serif;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: bold;
  line-height: 1.15;
  margin-bottom: 16px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  opacity: 0.85;
}

.post-meta-author {
  font-weight: 600;
}

.post-meta-sep { opacity: 0.5; }

/* ── BARRA DE VOTOS ── */
.post-vote-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 64px;
  background: var(--white);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: var(--nav-height);
  z-index: 40;
}

.vote-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-vote-bar .vote-btn {
  width: 34px;
  height: 34px;
  font-size: 0.95rem;
}

.post-vote-bar .vote-score {
  font-size: 1.05rem;
  font-weight: 800;
  min-width: 28px;
  text-align: center;
}

.back-link {
  font-size: 0.88rem;
  color: var(--text-light);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.back-link:hover { color: var(--green-btn); }

/* ── LAYOUT DOS COLUMNAS ── */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 32px 80px;
  align-items: start;
}

/* ── CUERPO DEL ARTÍCULO ── */
.post-content {
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-dark);
}

.post-content p   { margin-bottom: 1.4em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.post-content h2  { font-family: 'Clash Display', sans-serif; font-size: 1.6rem; margin: 2em 0 0.6em; }
.post-content h3  { font-family: 'Clash Display', sans-serif; font-size: 1.25rem; margin: 1.6em 0 0.5em; }
.post-content ul,
.post-content ol  { padding-left: 1.6em; margin-bottom: 1.4em; }
.post-content li  { margin-bottom: 0.4em; }
.post-content blockquote {
  border-left: 3px solid var(--green-btn);
  margin: 1.6em 0;
  padding: 12px 20px;
  background: var(--green-light);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-mid);
}

/* ── SIDEBAR & ENTRADAS RELACIONADAS ── */
.post-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 60px);
}

.sidebar-related {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.08)),
    rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255,255,255,0.62);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    inset 0 0 20px -5px rgba(255,255,255,0.9),
    0 4px 16px rgba(0,0,0,0.07),
    0 12px 36px rgba(0,0,0,0.07);
}

/* Distorsión liquid glass detrás del tinte */
.sidebar-related::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  backdrop-filter: blur(14px) saturate(1.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  filter: url(#glass-distortion);
  pointer-events: none;
}

.sidebar-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

.related-card {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  position: relative;
  z-index: 1;
}

.related-card:last-child { border-bottom: none; }
.related-card:hover { opacity: 0.75; transform: translateX(3px); }

.related-card-img-wrap {
  position: relative;
  flex-shrink: 0;
  width: 68px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border-subtle);
}

.related-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-cat-dot {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid white;
}

.related-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.related-cat-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.related-card-title {
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-date {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-top: auto;
}

.related-loading {
  height: 180px;
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--bg-surface-2) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

.related-empty {
  font-size: 0.85rem;
  color: var(--text-light);
  text-align: center;
  padding: 20px 0;
}

/* dark mode sidebar */
[data-theme="dark"] .sidebar-related {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
    rgba(20, 35, 20, 0.70);
  border-color: rgba(255,255,255,0.07);
  box-shadow:
    inset 0 0 20px -5px rgba(255,255,255,0.10),
    0 4px 16px rgba(0,0,0,0.35),
    0 12px 36px rgba(0,0,0,0.30);
}

/* En dark mode el color inline de la categoría puede ser muy oscuro para leer.
   Lo convertimos en un pill con fondo semitransparente del mismo color + texto claro. */
[data-theme="dark"] .related-cat-label {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 18%, transparent);
  filter: brightness(1.6) saturate(1.2);
}

/* ── COMENTARIOS ── */
.comments-section {
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-subtle);
  padding: 48px 24px 80px;
}

.comments-inner {
  max-width: 740px;
  margin: 0 auto;
}

.comments-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 28px;
  color: var(--text-dark);
}

.comments-title span {
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 1rem;
  color: var(--text-light);
  font-weight: normal;
}

/* Formulario */
.comment-form {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.comment-form textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dark);
  background: transparent;
  min-height: 80px;
}

.comment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.comment-form-hint {
  font-size: 0.82rem;
  color: var(--text-light);
}

.btn-comment {
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--green-btn);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-comment:disabled { opacity: 0.45; cursor: default; }
.btn-comment:not(:disabled):hover { background: var(--green-hover); }

/* Ordenar */
.comments-sort {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.sort-btn {
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 0.83rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn.active { background: var(--text-dark); color: var(--bg-page); border-color: var(--text-dark); }

/* ── COMENTARIO INDIVIDUAL ── */
.comment {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  margin-bottom: 4px;
  /* Separador visual entre grupos raíz */
  border-bottom: 1px solid var(--border-subtle);
  /* Animación de entrada */
  opacity: 1;
}

/* Último comentario raíz no necesita separador inferior */
.comment:not(.reply):last-of-type {
  border-bottom: none;
}

/* Entrada escalonada */
.comment.comment-enter {
  opacity: 0;
  transform: translateY(10px);
  animation: comment-in 0.32s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes comment-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.comment.reply {
  margin-left: 44px;
  padding-left: 16px;
  border-left: 2px solid var(--border-subtle);
  border-bottom: none;
  padding-bottom: 12px;
  margin-bottom: 0;
}

/* Último reply de un grupo sí tiene separador inferior */
.comment.reply:last-child {
  padding-bottom: 20px;
  margin-bottom: 4px;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border-subtle);
}

/* Avatares de respuestas: más pequeños para jerarquía visual */
.comment-avatar.reply-avatar {
  width: 26px;
  height: 26px;
  margin-top: 2px;
}

.comment-body { flex: 1; }

.comment-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

/* Nombre como enlace al perfil */
.comment-username {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.15s;
}
.comment-username:hover { color: var(--green-btn); }

.comment-date {
  font-size: 0.78rem;
  color: var(--text-light);
}

.comment-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Pill de votos — reemplaza comment-vote-row ── */
.comment-vote-pill {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
  height: 26px;
}

.comment-vote-pill .vote-btn {
  /* Reset del .vote-btn base — aquí no queremos borde ni border-radius propios */
  width: 28px;
  height: 26px;
  border: none;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  font-size: 0; /* oculta texto plano si quedara alguno */
  box-shadow: none;
  padding: 0;
}

.comment-vote-pill .vote-btn:hover {
  background: var(--border-subtle);
  color: var(--text-dark);
}

.comment-vote-pill .vote-btn:active {
  transform: scale(0.88);
}

.comment-vote-pill .vote-btn.up.voted  { color: var(--green-btn); }
.comment-vote-pill .vote-btn.down.voted { color: #c62828; }

.comment-vote-pill .vote-score {
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dark);
  min-width: 20px;
  text-align: center;
  padding: 0 2px;
  /* Separadores verticales sutiles */
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  line-height: 26px;
}

.btn-reply {
  background: none;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.btn-reply:hover { color: var(--green-btn); }

.btn-delete-comment {
  background: none;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e0e0e0;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.btn-delete-comment:hover { color: #c62828; }

/* Formulario de respuesta inline */
.reply-form {
  margin-top: 10px;
  background: var(--bg-surface-2);
  border-radius: 8px;
  padding: 12px;
}

.reply-form textarea {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'Satoshi', Arial, sans-serif;
  font-size: 0.9rem;
  outline: none;
  resize: none;
  min-height: 60px;
}

.reply-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn-cancel-reply {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.83rem;
  cursor: pointer;
  color: var(--text-light);
}

.btn-submit-reply {
  background: var(--green-btn);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-submit-reply:hover { background: var(--green-hover); }

/* Indicador tiempo real */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--green-btn);
  font-weight: 600;
  margin-left: 12px;
}

.realtime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-btn);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: 1fr;
    padding: 32px 20px 60px;
    gap: 32px;
  }
  .post-sidebar {
    position: static;
    order: 2; /* sidebar al FINAL en móvil, después del contenido del artículo */
  }
  .sidebar-related {
    display: grid;
    grid-template-columns: 1fr;
  }
  /* en móvil mostramos solo 2 tarjetas en fila */
  #relatedPosts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .related-card {
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .related-card-img-wrap { width: 100%; height: 80px; }
}

@media (max-width: 768px) {
  .post-hero { height: 380px; }
  .post-hero-content { padding: 32px 24px; }
  .post-vote-bar { padding: 10px 20px; }
  .comment.reply { margin-left: 20px; }
}
/* ── DARK MODE OVERRIDES — post.css ── */
[data-theme="dark"] input,
[data-theme="dark"] textarea {
  color-scheme: dark;
}

/* Fondo de la sección de comentarios */
[data-theme="dark"] .comments-section {
  background: var(--bg-page);
}



/* ══════════════════════════════════════════
   DARK MODE — SECCIÓN COMENTARIOS (consolidado)
   Todos los grises del mismo nivel (bg-surface-2)
   para que formen una sola capa visual coherente.
   ══════════════════════════════════════════ */
[data-theme="dark"] .comments-section {
  background: var(--bg-page);
}

[data-theme="dark"] .comment-form {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
}

[data-theme="dark"] .comment-form textarea {
  background: transparent;
  color: var(--text-dark);
}

[data-theme="dark"] .comment-form textarea::placeholder {
  color: var(--text-light);
}

/* Sort btn: inactivo sutil, activo con contraste claro */
[data-theme="dark"] .sort-btn {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  color: var(--text-mid);
}

[data-theme="dark"] .sort-btn.active {
  background: var(--text-dark);
  color: var(--bg-page);
  border-color: var(--text-dark);
}
/* ══════════════════════════════════════════════════
   PATCH — Botones de voto y guardado
   Aplica al final de: blog.css  Y  post.css

   Problema: .vote-btn en blog.css ya tenía box-shadow
   y scale(0.90) en :active, pero post.css solo sobreescribía
   width/height sin heredar ese comportamiento visual.
   .save-btn / .post-save-btn carecían de sombra en reposo
   y de feedback táctil al presionar.
══════════════════════════════════════════════════ */

/* ── 1. vote-btn: sombra 1px reposo + scale(0.90) presionar ──
   blog.css ya lo tiene; garantizamos que post.css no lo pise.
   Usamos :where() para menor especificidad que la regla existente
   y así no hay conflicto si blog.css ya lo define bien. ──────── */

/* Re-declaramos explícitamente para post.css y para el
   .post-vote-bar que solo sobreescribía dimensiones: */
.post-vote-bar .vote-btn {
  box-shadow: 0 1px 3px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
  transition: background 0.15s, color 0.15s, border-color 0.15s,
              transform 0.10s cubic-bezier(.4,0,.2,1),
              box-shadow 0.10s;
}

.post-vote-bar .vote-btn:active {
  transform: scale(0.90);
  box-shadow: none;
}

/* Estados votados en post-vote-bar (hereda de blog.css si se importa
   en el mismo scope; si no, los redefinimos aquí): */
.post-vote-bar .vote-btn.up.voted {
  background: var(--green-light);
  color: var(--green-btn);
  border-color: var(--green-btn);
  box-shadow: 0 1px 4px rgba(46,125,50,0.18);
}

.post-vote-bar .vote-btn.down.voted {
  background: #fce4ec;
  color: #c62828;
  border-color: #c62828;
  box-shadow: 0 1px 4px rgba(198,40,40,0.14);
}

/* ── 2. .save-btn — sombra en reposo + feedback táctil ──────── */
.save-btn {
  box-shadow: 0 1px 3px rgba(0,0,0,0.09), 0 0 0 1px rgba(0,0,0,0.04);
  transition: color 0.18s, border-color 0.18s, background 0.18s,
              transform 0.10s cubic-bezier(.4,0,.2,1),
              box-shadow 0.10s;
}

.save-btn:active {
  transform: scale(0.90);
  box-shadow: none;
}

/* Estado guardado con sombra verde sutil */
.save-btn.saved {
  box-shadow: 0 1px 4px rgba(46,125,50,0.16);
}

/* ── 3. .post-save-btn (el botón "Guardado" en post-vote-bar) ── */
.post-save-btn {
  box-shadow: 0 1px 3px rgba(0,0,0,0.09), 0 0 0 1px rgba(0,0,0,0.04);
  transition: color 0.18s, border-color 0.18s, background 0.18s,
              transform 0.10s cubic-bezier(.4,0,.2,1),
              box-shadow 0.10s;
  width: auto;
  max-width: 120px;
  padding: 0 10px;
  gap: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
}

.post-share-btn {
  width: 34px;
  padding: 0;
  flex-shrink: 0;
  overflow: hidden;
  justify-content: center;
}

.post-share-btn .btn-label {
  display: none;
}

.post-save-btn:active {
  transform: scale(0.90);
  box-shadow: none;
}

.post-save-btn.saved {
  box-shadow: 0 1px 4px rgba(46,125,50,0.16);
}

/* ── Dark mode: sombras más suaves ── */
[data-theme="dark"] .save-btn,
[data-theme="dark"] .post-save-btn {
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

[data-theme="dark"] .save-btn.saved,
[data-theme="dark"] .post-save-btn.saved {
  box-shadow: 0 1px 6px rgba(76,175,80,0.20);
}

[data-theme="dark"] .vote-btn,
[data-theme="dark"] .post-vote-bar .vote-btn {
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* ── Barra de votos responsive ─────────────────────────────────────────── */
.back-text { display: inline; }

@media (max-width: 600px) {
  .back-text  { display: none; }
  .btn-label  { display: none; }
  .post-save-btn,
  .post-share-btn {
    width: 34px;
    max-width: 34px;
    padding: 0;
    gap: 0;
    overflow: hidden;
    justify-content: center;
    flex-shrink: 0;
  }
}

/* ── Toast de compartir ─────────────────────────────────────────────────── */
.share-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text-dark);
  color: var(--bg-surface);
  font-family: 'Satoshi', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
.share-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
