/* ============================================
   ARTICLES — shared nav/layout overrides
   ============================================ */
#navbar {
  background: var(--nav-bg) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border) !important;
}

.articles-nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.articles-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-2);
  font-weight: 500;
  transition: color var(--transition);
}

.articles-back-link svg {
  width: 15px;
  height: 15px;
}

.articles-back-link:hover {
  color: var(--text-1);
}

footer a {
  color: var(--accent-2);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ============================================
   LISTING PAGE
   ============================================ */
.articles-section {
  padding: 6.5rem 0 7rem;
}

.articles-page-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* Blog brand — mirrors the portfolio hero name */
.blog-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.blog-name {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-1);
  margin: 0;
}

/* tw-accent is defined in styles.css — makes "Severo" appear in --accent-2 */

.blog-label {
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.blog-label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--accent);
}

/* 3-column card grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Loading dots */
.articles-loading {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 3rem 0;
}

.articles-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: ldot 1.2s ease infinite;
}

.articles-loading span:nth-child(2) { animation-delay: 0.2s; }
.articles-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ldot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40%            { opacity: 1;   transform: scale(1);   }
}

.articles-empty {
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 0.875rem;
  padding: 3rem 0;
}

/* Local dev notice */
.file-notice {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  color: var(--text-2);
  font-size: 0.9rem;
  line-height: 1.7;
}

.file-notice pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.file-notice code {
  font-family: var(--mono);
  color: var(--accent-2);
}

/* ============================================
   ARTICLE CARD — vertical grid layout
   ============================================ */
.article-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  opacity: 0;
  transform: translateY(14px);
  animation: cardIn 0.45s ease forwards;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.article-card:hover {
  border-color: var(--border-2);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

/* Cover (top) */
.article-card-cover {
  position: relative;
  overflow: hidden;
  height: 175px;
  flex-shrink: 0;
}

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

.article-card:hover .card-cover-img {
  transform: scale(1.05);
}

.card-cover-gradient {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.45s ease;
}

.article-card:hover .card-cover-gradient {
  filter: brightness(1.1);
}

.card-cover-gradient svg {
  width: 44px;
  height: 44px;
  opacity: 0.45;
}

/* Content (below cover) */
.article-card-content {
  padding: 1.25rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

/* Author row */
.article-card-author {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.card-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  flex-shrink: 0;
  border: 1px solid var(--border-2);
}

.card-author-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
}

/* Title */
.article-card-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Excerpt */
.article-card-excerpt {
  font-size: 0.825rem;
  color: var(--text-3);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer row: tags + date */
.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.article-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.article-card-meta {
  font-size: 0.68rem;
  font-family: var(--mono);
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.article-sep { color: var(--border-2); }

.atag {
  font-size: 0.67rem;
  font-family: var(--mono);
  color: var(--accent-2);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 1px 8px;
  border-radius: 20px;
}

/* ============================================
   READING PROGRESS BAR
   ============================================ */
#reading-progress {
  position: fixed;
  top: 64px;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 99;
  transition: width 0.08s linear;
}

/* ============================================
   ARTICLE READER PAGE
   ============================================ */
.article-reader {
  max-width: 720px;
  margin: 0 auto;
  padding: 7rem 2rem 5rem;
}

.article-header {
  margin-bottom: 3rem;
}

.article-h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-1);
  margin: 1rem 0 1rem;
}

.article-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-3);
}

.article-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0 0;
}

/* ============================================
   MARKDOWN BODY TYPOGRAPHY
   ============================================ */
.article-body {
  font-size: 1.075rem;
  line-height: 1.85;
  color: var(--text-2);
}

.article-body h2,
.article-body h3,
.article-body h4 {
  color: var(--text-1);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.article-body h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; padding-top: 0.5rem; }
.article-body h3 { font-size: 1.2rem; margin: 2rem 0 0.75rem; }
.article-body h4 { font-size: 1rem;   margin: 1.5rem 0 0.5rem; }

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

.article-body a {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(37, 99, 235, 0.35);
  transition: text-decoration-color var(--transition);
}

.article-body a:hover { text-decoration-color: var(--accent-2); }
.article-body strong  { color: var(--text-1); font-weight: 600; }

.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1.5rem; }
.article-body li { margin-bottom: 0.4rem; line-height: 1.7; }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  color: var(--text-2);
  font-style: italic;
}

.article-body blockquote p { margin-bottom: 0; }

.article-body code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-2);
}

.article-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.75rem 0;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.875rem;
  line-height: 1.65;
}

.article-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 2rem 0;
  border: 1px solid var(--border);
}

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

.article-body table { width: 100%; border-collapse: collapse; margin: 2rem 0; font-size: 0.9rem; }
.article-body th, .article-body td { padding: 0.625rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.article-body th { font-weight: 600; color: var(--text-1); border-bottom: 2px solid var(--border-2); }

/* Article reader cover */
.article-reader-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
}

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

.article-reader-cover-gradient {
  height: 100%;
}

/* Article footer */
.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1.5rem;
}

.article-footer-author {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.article-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  border: 1px solid var(--border);
}

.article-author-name  { display: block; font-size: 0.9rem;  font-weight: 600; color: var(--text-1); }
.article-author-role  { display: block; font-size: 0.75rem; font-family: var(--mono); color: var(--text-3); }

.article-footer-back {
  font-size: 0.875rem;
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.article-footer-back:hover { color: var(--text-1); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .articles-nav-center {
    display: none;
  }

  .article-reader {
    padding: 6rem 1.25rem 4rem;
  }

  .article-body {
    font-size: 1rem;
  }
}
