/* =========================================================
   LEANDRUS.NET — BLOG & BITÁCORA STYLES (ZERO-BLOAT)
   Compatible con inner.css, sistema de temas (dark/light) y multi-idioma
   ========================================================= */

/* Variables de Color Dinámicas por Pilar */
body.pillar-coder,
body.page-coder {
  --accent: var(--accent-code, #0284c7);
  --accent-hover: var(--accent-code-hover, #38bdf8);
  --badge-active-bg: var(--badge-code-bg, rgba(2, 132, 199, 0.12));
}

body.pillar-simracer,
body.page-simracer {
  --accent: var(--accent-race, #e10600);
  --accent-hover: var(--accent-race-hover, #ff2a24);
  --badge-active-bg: var(--badge-bg, rgba(225, 6, 0, 0.12));
}

/* Hero del Blog */
.blog-hero {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 2.5rem;
}

.blog-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1.5px;
  margin-bottom: 0.75rem;
}

.blog-hero h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.blog-hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 1.75rem;
}

/* Barra de Filtros y Búsqueda */
.blog-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.blog-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
}

.filter-btn:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--surface);
  color: var(--text-main);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
}

.filter-btn[data-pillar="simracer"].active {
  border-color: var(--accent-race);
  color: var(--accent-race);
  background: var(--badge-bg);
}

.filter-btn[data-pillar="coder"].active {
  border-color: var(--accent-code);
  color: var(--accent-code);
  background: var(--badge-code-bg);
}

.filter-badge {
  background: var(--surface-border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.filter-btn.active .filter-badge {
  background: var(--text-main);
  color: var(--bg);
}

/* Buscador instantáneo */
.blog-search-box {
  position: relative;
  min-width: 240px;
  flex-grow: 1;
  max-width: 320px;
}

.blog-search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 0.55rem 1rem 0.55rem 2.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.blog-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.blog-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

/* Grid de Artículos */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.75rem;
  margin-bottom: 3.5rem;
}

@media (max-width: 640px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjeta de Artículo */
.post-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.25);
}

.post-card.pillar-simracer:hover {
  border-color: var(--accent-race);
}

.post-card.pillar-coder:hover {
  border-color: var(--accent-code);
}

/* Cover / Imagen de cabecera de la tarjeta */
.post-card-cover-wrap {
  width: 100%;
  height: 190px;
  overflow: hidden;
  position: relative;
  background: #14171d;
}

.post-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}

.post-card:hover .post-card-cover {
  transform: scale(1.04);
}

.post-card-cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(20, 23, 29, 0.95), rgba(34, 38, 48, 0.95));
  position: relative;
  border-bottom: 1px solid var(--surface-border);
}

.post-card-cover-fallback::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.15;
  background-size: 20px 20px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
}

.post-card-fallback-icon {
  font-size: 3rem;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

/* Contenido de la tarjeta */
.post-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-card-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

/* Badges de Pilar */
.pillar-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pillar-badge.simracer {
  background: var(--badge-bg);
  color: var(--accent-race);
  border: 1px solid rgba(225, 6, 0, 0.3);
}

.pillar-badge.coder {
  background: var(--badge-code-bg);
  color: var(--accent-code);
  border: 1px solid rgba(2, 132, 199, 0.3);
}

.post-reading-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
}

.post-card-title {
  font-size: 1.25rem;
  line-height: 1.35;
  margin-bottom: 0.65rem;
  font-weight: 700;
}

.post-card-title a {
  color: var(--text-main);
  text-decoration: none;
}

.post-card.pillar-simracer .post-card-title a:hover {
  color: var(--accent-race);
}

.post-card.pillar-coder .post-card-title a:hover {
  color: var(--accent-code);
}

.post-card-excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-footer {
  border-top: 1px solid var(--surface-border);
  padding-top: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.post-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.post-read-link {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: transform 0.2s;
}

.post-card.pillar-simracer .post-read-link {
  color: var(--accent-race);
}

.post-card.pillar-coder .post-read-link {
  color: var(--accent-code);
}

.post-read-link:hover {
  transform: translateX(3px);
}

/* Fallback alert */
.fallback-banner {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #ca8a04;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .fallback-banner {
  color: #facc15;
}

/* Estado Vacío */
.blog-empty {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--surface);
  border: 1px dashed var(--surface-border);
  border-radius: 12px;
  margin-bottom: 3.5rem;
}

.blog-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.blog-empty h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.blog-empty p {
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
}

/* =========================================================
   VISTA DE ARTÍCULO INDIVIDUAL (READER VIEW)
   ========================================================= */
.article-header {
  padding: 2rem 0 2rem;
  border-bottom: 1px solid var(--surface-border);
  margin-bottom: 2.5rem;
}

.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
}

.article-back-link:hover {
  color: var(--accent);
  transform: translateX(-3px);
}

.article-meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.article-category {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.article-title {
  font-size: 2.6rem;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}

@media (max-width: 640px) {
  .article-title {
    font-size: 2rem;
  }
}

.article-info-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
}

.article-info-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Imagen Principal del Artículo */
.article-featured-image {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2.5rem;
  border: 1px solid var(--surface-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Contenido del Artículo (Markdown Tipografía) */
.article-content {
  font-size: 1.12rem;
  line-height: 1.8;
  color: var(--text-main);
  margin-bottom: 3.5rem;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  color: var(--text-main);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-content h1 { font-size: 2rem; }
.article-content h2 { 
  font-size: 1.6rem; 
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 0.4rem;
}
.article-content h3 { font-size: 1.3rem; }

.article-content p {
  margin-bottom: 1.5rem;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.75rem;
}

.article-content li {
  margin-bottom: 0.4rem;
}

.article-content hr {
  border: 0;
  border-top: 1px solid var(--surface-border);
  margin: 2.5rem 0;
}

.article-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--text-main);
  font-style: italic;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
  overflow-x: auto;
  display: block;
}

.article-content th,
.article-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--surface-border);
  text-align: left;
}

.article-content th {
  background: var(--surface);
  font-weight: 700;
  color: var(--text-main);
}

.article-content tr:nth-child(even) {
  background: rgba(125, 125, 125, 0.04);
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
  margin: 1.5rem 0;
  display: block;
}

/* Video de Youtube embebido responsivo */
.blog-video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--surface-border);
}

.blog-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Código y Bloques de Sintaxis */
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  color: var(--accent);
}

.article-content pre {
  background: #0f1117;
  color: #e2e8f0;
  border: 1px solid #222630;
  border-radius: 10px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.75rem 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.6;
}

.article-content pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Pie del Artículo & Compartir */
.article-footer-box {
  border-top: 1px solid var(--surface-border);
  padding: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.article-tags-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.article-tag-pill {
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  text-decoration: none;
  transition: all 0.2s;
}

.article-tag-pill:hover {
  border-color: var(--accent);
  color: var(--text-main);
}

.article-share-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.share-btn {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
}

.share-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Artículos Relacionados */
.related-posts-section {
  border-top: 1px solid var(--surface-border);
  padding-top: 2.5rem;
  margin-bottom: 4rem;
}

.related-posts-title {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}
