/* ===========================================
   BLOG POST STYLES — ivanvazquez.dev
   Glassmorphism dark theme
   =========================================== */

/* --- Blog Listing Page --- */
.blog-hero {
  padding: 120px 0 60px;
  text-align: center;
  position: relative;
}

.blog-hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.blog-hero h1 .gradient-text {
  background: linear-gradient(135deg, #3b82f6, #e11d48);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.blog-hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Category Filters */
.blog-filters {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2.5rem 0 3rem;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.filter-btn:hover,
.filter-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #3b82f6;
}

/* Blog Grid for listing */
.blog-listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.blog-listing-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.blog-listing-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, transparent 50%, rgba(59, 130, 246, 0.08) 100%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.blog-listing-card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 15px rgba(59, 130, 246, 0.15);
}

.blog-listing-card:hover::after {
  opacity: 1;
}

.blog-listing-card a {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.blog-listing-card .card-visual {
  aspect-ratio: 16 / 4.5;
  overflow: hidden;
}

.blog-listing-card .card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Imagen por defecto — Iván con portátil: 50% más pequeña + sin recorte */
.blog-listing-card .card-visual img[src*="blog-default"] {
  object-fit: contain;
  object-position: center;
  background: #000;
  transform: scale(0.5);
}

.blog-listing-card:hover .card-visual img {
  transform: scale(1.1);
}

.blog-listing-card:hover .card-visual img[src*="blog-default"] {
  transform: scale(0.55);
}

.blog-listing-card .card-body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.blog-listing-card .card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.blog-listing-card .meta-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.3s ease;
}

.blog-listing-card:hover .meta-tag {
  color: #f8fafc !important;
  background: #3b82f6;
  padding: 2px 8px;
  border-radius: 4px;
}

.blog-listing-card .meta-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.blog-listing-card .card-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  color: var(--text-primary);
}

.blog-listing-card .card-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.blog-listing-card .card-footer-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.75rem;
  margin-top: auto;
}

.blog-listing-card.hidden {
  display: none;
}

/* Pagination */
.blog-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 0 4rem;
}

.page-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
}

.page-btn:hover,
.page-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #3b82f6;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 1rem;
}

/* No results */
.no-results {
  display: none;
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 3rem;
  grid-column: 1 / -1;
}

.no-results.visible {
  display: block;
}

/* --- Individual Blog Post Page --- */
.blog-post-page {
  padding-top: 100px;
}

.blog-post-hero {
  padding: 2rem 0 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3b82f6;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.back-link:hover {
  color: #60a5fa;
  transform: translateX(-4px);
}

.blog-post-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #3b82f6;
  margin-bottom: 1rem;
}

.blog-post-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  flex-wrap: wrap;
}

/* Blog post content */
.blog-post-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.blog-post-body h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--text-primary);
}

.blog-post-body h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text-primary);
}

.blog-post-body p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.blog-post-body a {
  color: #3b82f6;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.blog-post-body a:hover {
  color: #60a5fa;
}

.blog-post-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.blog-post-body em {
  color: var(--text-primary);
  font-style: italic;
}

.blog-post-body ul,
.blog-post-body ol {
  margin: 1rem 0 1.5rem 1.5rem;
  color: var(--text-secondary);
}

.blog-post-body li {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 0.5rem;
}

.blog-post-body code {
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.9em;
  color: #60a5fa;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.blog-post-body pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.blog-post-body pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* Tables */
.blog-post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-post-body thead tr {
  background: rgba(59, 130, 246, 0.1);
  border-bottom: 2px solid rgba(59, 130, 246, 0.3);
}

.blog-post-body th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.blog-post-body td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.blog-post-body tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* TL;DR box */
.tldr-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 2rem 0;
}

.tldr-box p:first-child {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #3b82f6;
}

.tldr-box p:last-child {
  margin: 0;
  line-height: 1.6;
}

/* Blog post footer CTA */
.blog-post-cta {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  margin: 3rem 0;
}

.blog-post-cta h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.blog-post-cta p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Images in blog post */
.blog-post-body img {
  border-radius: 12px;
  margin: 1.5rem auto;
  display: block;
  width: auto;
  max-width: 60%;
  max-height: 280px;
  object-fit: cover;
}

/* ============================================================
   LIGHT MODE overrides — blog-post.css
   ============================================================ */

/* Listing page */
[data-theme="light"] .blog-hero h1 .gradient-text {
  background: linear-gradient(135deg, #2563eb, #be123c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .filter-btn {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(15, 23, 42, 0.03);
  color: var(--text-secondary);
}
[data-theme="light"] .filter-btn:hover,
[data-theme="light"] .filter-btn.active {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.35);
  color: #2563eb;
}

[data-theme="light"] .blog-listing-card {
  background: rgba(255, 255, 255, 0.80);
  border-color: rgba(15, 23, 42, 0.08);
}
[data-theme="light"] .blog-listing-card:hover {
  border-color: rgba(37, 99, 235, 0.30);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12), 0 0 15px rgba(37, 99, 235, 0.10);
}
[data-theme="light"] .blog-listing-card::after {
  background: linear-gradient(45deg, transparent 50%, rgba(37, 99, 235, 0.06) 100%);
}
[data-theme="light"] .blog-listing-card:hover .meta-tag {
  color: #f8fafc !important;
  background: #2563eb;
}
[data-theme="light"] .blog-listing-card .card-visual img[src*="blog-default"] {
  background: #f1f5f9;
}
[data-theme="light"] .blog-listing-card .card-footer-info {
  border-top-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .page-btn {
  border-color: rgba(15, 23, 42, 0.12);
  color: var(--text-secondary);
}
[data-theme="light"] .page-btn:hover,
[data-theme="light"] .page-btn.active {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.35);
  color: #2563eb;
}

/* Individual post page */
[data-theme="light"] .back-link {
  color: #2563eb;
}
[data-theme="light"] .back-link:hover {
  color: #1d4ed8;
}
[data-theme="light"] .blog-post-tag {
  color: #2563eb;
}

/* Prose */
[data-theme="light"] .blog-post-body a {
  color: #2563eb;
}
[data-theme="light"] .blog-post-body a:hover {
  color: #1d4ed8;
}
[data-theme="light"] .blog-post-body code {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}
[data-theme="light"] .blog-post-body pre {
  background: #1e293b;
  border-color: rgba(15, 23, 42, 0.15);
}
[data-theme="light"] .blog-post-body table {
  border-color: rgba(15, 23, 42, 0.10);
}
[data-theme="light"] .blog-post-body thead tr {
  background: rgba(37, 99, 235, 0.08);
  border-bottom-color: rgba(37, 99, 235, 0.25);
}
[data-theme="light"] .blog-post-body td {
  border-bottom-color: rgba(15, 23, 42, 0.06);
}
[data-theme="light"] .blog-post-body tbody tr:hover {
  background: rgba(15, 23, 42, 0.03);
}

/* TL;DR box */
[data-theme="light"] .tldr-box {
  background: rgba(37, 99, 235, 0.05);
  border-color: rgba(37, 99, 235, 0.20);
}
[data-theme="light"] .tldr-box p:first-child {
  color: #2563eb;
}

/* CTA block */
[data-theme="light"] .blog-post-cta {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.08);
}

/* Responsive for blog */
@media (max-width: 768px) {
  .blog-listing-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem 2rem;
  }

  .blog-post-body {
    padding: 0 1rem 2rem;
  }

  .blog-post-hero {
    padding: 1rem;
  }

  .blog-post-body h2 {
    font-size: 1.4rem;
  }

  .blog-post-body h3 {
    font-size: 1.2rem;
  }

  .blog-filters {
    gap: 0.5rem;
  }

  .filter-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}
