/* =========================================================
   BLOG PAGE — Kellyxy Design System
   Extends style.css; assumes design tokens from :root
   ========================================================= */

/* Nav override for blog page — always visible */
#site-nav.nav-scrolled {
  opacity: 1 !important;
}

/* =========================================================
   BLOG HERO
   ========================================================= */
#blog-hero {
  padding: clamp(6rem, 14vw, 10rem) 0 clamp(3rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
}

#blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 30% 40%, rgba(201,168,76,0.06) 0%, transparent 70%),
              radial-gradient(ellipse 60% 80% at 80% 80%, rgba(123,94,167,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.blog-hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 1.25rem;
  opacity: 0.8;
}

.blog-hero-heading {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.05;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  letter-spacing: -0.03em;
}

.blog-hero-accent {
  color: var(--accent-gold);
}

.blog-hero-sub {
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.blog-author-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.blog-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 1px solid rgba(201,168,76,0.35);
  flex-shrink: 0;
}

.blog-author-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.blog-author-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}

.blog-author-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* =========================================================
   CATEGORY FILTERS
   ========================================================= */
.blog-filters-wrap {
  position: sticky;
  top: 60px;
  z-index: 40;
  background: rgba(8,8,8,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 0.75rem 0;
}

.blog-filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  -ms-overflow-style: none;
}

.blog-filters::-webkit-scrollbar { display: none; }

.blog-filter-pill {
  flex-shrink: 0;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.blog-filter-pill:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: rgba(201,168,76,0.06);
}

.blog-filter-pill.active {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #080808;
  font-weight: 600;
}

/* =========================================================
   ARTICLES SECTION
   ========================================================= */
#blog-articles {
  padding: 3rem clamp(1.5rem, 5vw, 3rem) 5rem;
}

/* =========================================================
   BLOG CARD BASE
   ========================================================= */
.blog-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 2rem 2rem 1.75rem;
  transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
  position: relative;
  overflow: hidden;
}

.blog-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,168,76,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.blog-card:hover {
  border-color: rgba(201,168,76,0.25);
  transform: translateY(-3px);
  background: rgba(255,255,255,0.04);
}

.blog-card:hover::before {
  opacity: 1;
}

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

.blog-date,
.blog-readtime {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Category badges */
.blog-cat {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 600;
}

.blog-cat--ai      { background: rgba(62,207,178,0.12); color: var(--accent-mint); border: 1px solid rgba(62,207,178,0.2); }
.blog-cat--llm     { background: rgba(123,94,167,0.12); color: var(--accent-violet); border: 1px solid rgba(123,94,167,0.2); }
.blog-cat--ml      { background: rgba(201,168,76,0.12); color: var(--accent-gold); border: 1px solid rgba(201,168,76,0.2); }
.blog-cat--calculus{ background: rgba(212,96,58,0.12); color: var(--accent-rust); border: 1px solid rgba(212,96,58,0.2); }
.blog-cat--algebra { background: rgba(62,207,178,0.10); color: #7FE4C8; border: 1px solid rgba(62,207,178,0.15); }
.blog-cat--automation { background: rgba(201,168,76,0.10); color: #E8C97A; border: 1px solid rgba(201,168,76,0.15); }
.blog-cat--math    { background: rgba(123,94,167,0.10); color: #9E80CC; border: 1px solid rgba(123,94,167,0.15); }
.blog-cat--education { background: rgba(212,96,58,0.10); color: #E88060; border: 1px solid rgba(212,96,58,0.15); }
.blog-cat--product { background: rgba(62,207,178,0.10); color: var(--accent-mint); border: 1px solid rgba(62,207,178,0.15); }
.blog-cat--seo     { background: rgba(201,168,76,0.12); color: var(--accent-gold); border: 1px solid rgba(201,168,76,0.2); }
.blog-cat--design  { background: rgba(123,94,167,0.12); color: var(--accent-violet); border: 1px solid rgba(123,94,167,0.2); }

.blog-read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: gap 0.2s ease, opacity 0.2s ease;
}

.blog-read-btn:hover {
  gap: 0.7rem;
  opacity: 0.8;
}

/* =========================================================
   FEATURED ARTICLE
   ========================================================= */
.blog-featured {
  margin-bottom: 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 2.5rem;
  background: rgba(201,168,76,0.04);
  border-color: rgba(201,168,76,0.15);
  position: relative;
}

.blog-featured::after {
  content: '"';
  position: absolute;
  right: 2rem;
  top: 1.5rem;
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 1;
  color: rgba(201,168,76,0.08);
  pointer-events: none;
}

.blog-featured-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 1rem;
  opacity: 0.7;
}

.blog-featured-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.blog-excerpt {
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 65ch;
}

.blog-featured .blog-excerpt {
  font-size: 0.95rem;
}

/* =========================================================
   ARTICLE GRID
   ========================================================= */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.blog-grid-card {
  display: flex;
  flex-direction: column;
}

.blog-grid-card .blog-excerpt {
  flex: 1;
}

.blog-card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

/* =========================================================
   ARTICLE READER OVERLAY
   ========================================================= */
#article-reader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-void);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#article-reader.reader-open {
  opacity: 1;
  pointer-events: auto;
}

.reader-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8,8,8,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.reader-close {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reader-close:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.reader-meta-top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reader-category {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.reader-date,
.reader-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.reader-body {
  max-width: 740px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

/* Reader typography */
.reader-content h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}

.reader-content .article-lead {
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.75;
  color: rgba(255,255,255,0.75);
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.reader-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.02em;
}

.reader-content h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin: 2rem 0 0.75rem;
}

.reader-content p {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.85;
  color: rgba(255,255,255,0.7);
  margin-bottom: 1.25rem;
}

.reader-content em {
  font-style: italic;
  color: rgba(255,255,255,0.85);
}

.reader-content strong {
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.reader-content ul,
.reader-content ol {
  margin: 0 0 1.25rem 1.5rem;
}

.reader-content li {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.4rem;
}

.reader-content blockquote {
  border-left: 3px solid var(--accent-gold);
  margin: 1.75rem 0;
  padding: 0.75rem 1.5rem;
  background: rgba(201,168,76,0.04);
  border-radius: 0 8px 8px 0;
}

.reader-content blockquote p {
  font-style: italic;
  color: rgba(255,255,255,0.65);
  margin: 0;
}

.reader-content a {
  color: var(--accent-gold);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}

.reader-content a:hover {
  opacity: 0.75;
}

.reader-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.07);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-mint);
}

/* =========================================================
   BLOG FOOTER
   ========================================================= */
#blog-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 2.5rem 0;
}

.blog-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.blog-footer-copy {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.blog-footer-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--accent-gold);
  text-decoration: none;
  transition: opacity 0.2s;
}

.blog-footer-link:hover { opacity: 0.7; }

/* =========================================================
   SITENEXIS BACKLINK BANNER
   ========================================================= */
.sitenexis-banner {
  background: rgba(62,207,178,0.04);
  border: 1px solid rgba(62,207,178,0.15);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sitenexis-banner-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-mint);
  flex-shrink: 0;
}

.sitenexis-banner-text {
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--text-muted);
  flex: 1;
  min-width: 200px;
}

.sitenexis-banner-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--accent-mint);
  text-decoration: none;
  border: 1px solid rgba(62,207,178,0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sitenexis-banner-link:hover {
  background: rgba(62,207,178,0.08);
}

/* =========================================================
   SITENEXIS SECTION
   ========================================================= */
.sitenexis-section {
  margin-top: 4rem;
  padding: 3rem 0 0; /* explicit shorthand resets the section rule's bottom padding */
  border-top: 1px solid rgba(255,255,255,0.05);
}

.sn-section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.sn-section-sub {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 50ch;
}

/* =========================================================
   SMART NAV — hide/show on scroll direction
   ========================================================= */
#site-nav {
  transition: transform 0.4s ease, background 0.4s ease,
              backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, opacity 0.5s ease;
}

#site-nav.nav-hidden {
  transform: translateY(-100%);
}

/* =========================================================
   HIDDEN WHILE FILTERED
   ========================================================= */
.blog-card[hidden] {
  display: none;
}

/* =========================================================
   MOBILE NAV — blog page overrides
   style.css sets .mobile-nav-links a to opacity:0 for main.js
   to animate; blog.js has no such animation so we reset here
   ========================================================= */
#mobile-menu .mobile-nav-links a {
  opacity: 1;
  transform: none;
}

/* iOS momentum scroll inside article reader */
#article-reader {
  -webkit-overflow-scrolling: touch;
}

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

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

  .blog-featured { padding: 1.75rem; }
  .blog-featured::after { display: none; }

  .reader-header { padding: 0.75rem 1rem; }
  .reader-meta-top { display: none; }
  .reader-body { padding: 2rem 1.25rem 4rem; }

  .blog-footer-inner { justify-content: center; text-align: center; }
}
