/* ================ BLOG STYLES ================ */

/* Blog Page Layout */
.blog-section {
  padding: var(--section-py) 0;
}

/* Blog Hero / Header */
.blog-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 80px;
}

.blog-header h1 {
  font-size: clamp(2.6rem, 5.5vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 20px;
  line-height: 1.1;
}

.blog-header p {
  font-size: 1.1rem;
  color: var(--text-2);
  line-height: 1.75;
}

/* Blog Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 120px;
}

@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

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

/* Blog Card */
.blog-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.blog-card.glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.02) 100%);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.18);
  border-left-color: rgba(255,255,255,0.12);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 60px rgba(139,92,246,0.15);
}

/* Blog Card Image */
.blog-card-img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.blog-card-img-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.5);
}

/* Blog Card Content */
.blog-card-content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  color: var(--text-3);
}

.blog-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-card h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 12px 0;
  line-height: 1.4;
  width: 100%;
  flex-grow: 1;
}

.blog-card-excerpt {
  color: var(--text-2);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.blog-card-reading-time {
  font-size: 0.875rem;
  color: var(--text-3);
}

.blog-card-arrow {
  color: #818cf8;
  font-size: 1.2rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card:hover .blog-card-arrow {
  transform: translateX(4px);
}

/* Overlay clickeable en toda la card */
.blog-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.blog-card-arrow {
  position: relative;
  z-index: 2;
}

/* ================ ARTICLE PAGE ================ */

/* Hero section fullwidth */
.article-hero {
  padding: calc(var(--nav-h) + 64px) 0 72px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.article-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.article-hero-inner {
  max-width: var(--container, 1180px);
  margin: 0 auto;
  padding: 0 40px;
  position: relative;
  z-index: 1;
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.article-breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-breadcrumb a:hover {
  color: #818cf8;
}

.article-breadcrumb-sep {
  color: rgba(255,255,255,0.15);
  font-size: 0.7rem;
}

.article-tag {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}

.article-title {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-1);
  margin-bottom: 28px;
  line-height: 1.1;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  color: var(--text-3);
  font-size: 0.875rem;
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 20px;
  margin-right: 20px;
  border-right: 1px solid rgba(255,255,255,0.08);
}

.article-meta-item:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

/* Two-column layout */
.article-page {
  padding: 80px 0 120px;
}

.article-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 72px;
  max-width: var(--container, 1180px);
  margin: 0 auto;
  padding: 0 40px;
  align-items: start;
}

/* Sidebar */
.article-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 40px);
}

.article-toc {
  padding: 24px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
}

.article-toc-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 16px;
}

.article-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-toc-list a {
  display: block;
  font-size: 0.85rem;
  color: var(--text-3);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

.article-toc-list a:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.04);
  border-left-color: #8b5cf6;
}

.article-toc-list a.active {
  color: #818cf8;
  border-left-color: #8b5cf6;
  background: rgba(99,102,241,0.06);
}

.article-sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 24px 0;
}

.article-author-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
}

.article-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.article-author-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-1);
}

.article-author-role {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Article Body / Content */
.article-body {
  min-width: 0;
  line-height: 1.8;
}

.article-body h2 {
  font-size: 1.95rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 48px 0 24px;
  line-height: 1.25;
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 36px 0 16px;
  line-height: 1.3;
}

.article-body p {
  font-size: 1.05rem;
  color: var(--text-2);
  margin-bottom: 24px;
  line-height: 1.8;
}

.article-body ul,
.article-body ol {
  margin: 24px 0 24px 32px;
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-body li {
  margin-bottom: 12px;
}

.article-body a {
  color: #818cf8;
  text-decoration: none;
  border-bottom: 1px solid rgba(129, 140, 248, 0.3);
  transition: all 0.3s ease;
}

.article-body a:hover {
  border-bottom-color: #818cf8;
  color: #a78bfa;
}

.article-body blockquote {
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 4px solid #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-style: italic;
  color: var(--text-2);
  font-size: 1.1rem;
}

.article-body code {
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #c084fc;
}

.article-body pre {
  background: rgba(0,0,0,0.3);
  padding: 24px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid rgba(255,255,255,0.08);
}

.article-body pre code {
  background: none;
  padding: 0;
  color: #a78bfa;
  font-size: 0.95rem;
  line-height: 1.6;
}

.article-body img {
  width: 100%;
  height: auto;
  border-radius: var(--r-md);
  margin: 40px 0;
}

/* Article CTA Section */
.article-cta {
  margin-top: 72px;
  padding: 48px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-top-color: rgba(139, 92, 246, 0.3);
}

.article-cta h3 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 12px;
}

.article-cta p {
  color: var(--text-2);
  margin-bottom: 28px;
  font-size: 1rem;
  max-width: 480px;
  font-size: 1rem;
}

/* Related Posts */
.related-posts {
  margin-top: 100px;
  padding-top: 60px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.related-posts h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 40px;
  text-align: center;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

@media (max-width: 1024px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 0 24px;
  }

  .article-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .article-sidebar-divider {
    display: none;
  }
}

@media (max-width: 768px) {
  .article-hero {
    padding: calc(var(--nav-h) + 40px) 0 56px;
  }

  .article-hero-inner {
    padding: 0 20px;
  }

  .article-title {
    font-size: clamp(1.9rem, 7vw, 2.6rem);
  }

  .article-layout {
    padding: 0 20px;
  }

  .article-sidebar {
    grid-template-columns: 1fr;
  }

  .article-page {
    padding: 48px 0 80px;
  }

  .article-body h2 {
    font-size: 1.6rem;
  }

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

  .article-cta {
    padding: 28px;
    margin-top: 48px;
  }

  .article-cta h3 {
    font-size: 1.3rem;
  }
}

/* Animations for reveal (compatible con main.js) */
.blog-card {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.blog-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
  z-index: 300;
  width: 0%;
}
