/* ========================================
   TechMind AI - Premium Blog Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* === CSS Variables === */
:root {
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --primary-light: #8B83FF;
  --primary-glow: rgba(108, 99, 255, 0.15);
  --accent: #00D4AA;
  --accent-dark: #00B892;
  --bg-primary: #0A0E1A;
  --bg-secondary: #111827;
  --bg-card: #1A1F35;
  --bg-card-hover: #222842;
  --bg-elevated: #252B45;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(108, 99, 255, 0.3);
  --gradient-primary: linear-gradient(135deg, #6C63FF 0%, #00D4AA 100%);
  --gradient-card: linear-gradient(145deg, rgba(26,31,53,0.8) 0%, rgba(17,24,39,0.9) 100%);
  --gradient-hero: linear-gradient(160deg, #0A0E1A 0%, #1a1145 50%, #0A0E1A 100%);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --max-width: 1200px;
  --header-height: 72px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* === Header / Navbar === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: var(--transition);
}

.header.scrolled {
  background: rgba(10, 14, 26, 0.95);
  box-shadow: var(--shadow-md);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: white;
}

.logo span { background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: var(--primary-glow);
}

.nav-cta {
  background: var(--gradient-primary) !important;
  color: white !important;
  padding: 8px 20px !important;
  font-weight: 600 !important;
}

.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* === Hero Section === */
.hero {
  padding: 140px 24px 80px;
  background: var(--gradient-hero);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(108,99,255,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(0,212,170,0.06) 0%, transparent 50%);
  animation: heroFloat 20s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2%, 2%); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 750px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--primary-glow);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary-light);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 900;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero h1 .gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--gradient-primary);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(108,99,255,0.3);
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(108,99,255,0.4);
  color: white;
}

/* === Main Content === */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 60px 24px;
}

.section-header {
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* === Article Cards Grid === */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

.article-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.article-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.article-card-body {
  padding: 24px;
}

.article-card-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-glow);
  color: var(--primary-light);
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.article-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-title a {
  color: var(--text-primary);
}

.article-card-title a:hover {
  color: var(--primary-light);
}

.article-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}

.article-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-card-meta .read-time {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === Featured Article === */
.featured-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.featured-card .article-card-image {
  height: 100%;
  min-height: 320px;
}

.featured-card .article-card-body {
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-card .article-card-title {
  font-size: 1.6rem;
  -webkit-line-clamp: 3;
}

.featured-card .article-card-excerpt {
  -webkit-line-clamp: 4;
}

/* === Article Page === */
.article-page {
  padding-top: calc(var(--header-height) + 40px);
}

.article-header {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 0 24px;
  text-align: center;
}

.article-header .article-card-tag {
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.article-header .article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.article-cover {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 0 24px;
}

.article-cover img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.article-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.article-content h2 {
  font-size: 1.6rem;
  margin: 48px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.article-content h2:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.article-content h3 {
  font-size: 1.25rem;
  margin: 32px 0 12px;
  color: var(--primary-light);
}

.article-content p {
  margin-bottom: 18px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content ul, .article-content ol {
  margin: 0 0 20px 24px;
  color: var(--text-secondary);
}

.article-content li {
  margin-bottom: 10px;
  font-size: 1.02rem;
  line-height: 1.7;
}

.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-content a {
  color: var(--primary-light);
  text-decoration: underline;
  text-decoration-color: rgba(108,99,255,0.3);
  text-underline-offset: 3px;
}

.article-content a:hover {
  text-decoration-color: var(--primary-light);
}

.article-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 40px 0;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.article-content th {
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  text-align: left;
  padding: 14px 16px;
}

.article-content td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

.article-content tr:hover td {
  background: rgba(108,99,255,0.03);
}

.pro-tip {
  background: linear-gradient(135deg, rgba(0,212,170,0.08), rgba(108,99,255,0.08));
  border: 1px solid rgba(0,212,170,0.2);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin: 24px 0;
  font-size: 0.95rem;
}

.pro-tip strong { color: var(--accent); }

/* === Newsletter Section === */
.newsletter {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 60px 40px;
  text-align: center;
  margin: 60px 0;
  position: relative;
  overflow: hidden;
}

.newsletter::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(108,99,255,0.1) 0%, transparent 70%);
}

.newsletter h2 { font-size: 1.8rem; margin-bottom: 12px; }
.newsletter p { color: var(--text-secondary); margin-bottom: 28px; max-width: 500px; margin-left: auto; margin-right: auto; }

.newsletter-form {
  display: flex;
  gap: 12px;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.newsletter-form input {
  flex: 1;
  padding: 14px 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 50px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.newsletter-form input:focus { border-color: var(--primary); }
.newsletter-form input::placeholder { color: var(--text-muted); }

.newsletter-form button {
  padding: 14px 28px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.newsletter-form button:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }

/* === Footer === */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 60px 24px 30px;
}

.footer-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 12px;
  max-width: 300px;
}

.footer h4 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--primary-light);
  padding-left: 4px;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* === Page Header (for static pages) === */
.page-header {
  padding: calc(var(--header-height) + 60px) 24px 40px;
  text-align: center;
  background: var(--gradient-hero);
  position: relative;
}

.page-header h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.page-content h2 { font-size: 1.5rem; margin: 36px 0 12px; }
.page-content h3 { font-size: 1.2rem; margin: 28px 0 10px; color: var(--primary-light); }
.page-content p { color: var(--text-secondary); margin-bottom: 16px; line-height: 1.8; }
.page-content ul, .page-content ol { margin: 0 0 16px 20px; color: var(--text-secondary); }
.page-content li { margin-bottom: 8px; line-height: 1.7; }
.page-content strong { color: var(--text-primary); }
.page-content a { color: var(--primary-light); }

/* === Ad Placeholders === */
.ad-space {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 30px 0;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Animations === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.1s; }
.animate-in:nth-child(2) { animation-delay: 0.2s; }
.animate-in:nth-child(3) { animation-delay: 0.3s; }
.animate-in:nth-child(4) { animation-delay: 0.4s; }
.animate-in:nth-child(5) { animation-delay: 0.5s; }

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: flex; }
  
  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: rgba(10,14,26,0.98);
    backdrop-filter: blur(20px);
    padding: 20px;
    border-bottom: 1px solid var(--border);
  }

  .hero { padding: 120px 20px 60px; }
  .hero h1 { font-size: 2rem; }

  .articles-grid { grid-template-columns: 1fr; }
  
  .featured-card { grid-template-columns: 1fr; }
  .featured-card .article-card-image { min-height: 200px; }
  .featured-card .article-card-body { padding: 24px; }
  .featured-card .article-card-title { font-size: 1.3rem; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  
  .newsletter { padding: 40px 20px; }
  .newsletter-form { flex-direction: column; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 1.6rem; }
}

/* === Dynamic TOC === */
.article-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
}
.article-toc h3 {
  font-size: 1.1rem;
  margin: 0 0 16px 0;
  color: var(--text-primary);
}
.article-toc ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}
.article-toc li {
  margin-bottom: 8px;
}
.article-toc a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
}
.article-toc a:hover {
  color: var(--primary-light);
}

/* === Social Shares === */
.social-shares {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
.share-btn {
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  color: white !important;
  text-decoration: none !important;
  transition: var(--transition);
}
.share-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.share-btn.twitter { background: #000000; border: 1px solid #333; }
.share-btn.facebook { background: #1877F2; }
.share-btn.linkedin { background: #0A66C2; }

/* === Related Articles === */
.related-articles {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}
.related-articles h3 {
  font-size: 1.4rem;
  margin-bottom: 24px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.related-card {
  background: var(--bg-elevated);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  text-decoration: none !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.related-card:hover {
  border-color: var(--primary-light);
  transform: translateY(-2px);
}
.related-card h4 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}
.related-card .read-more {
  font-size: 0.85rem;
  color: var(--primary-light);
  font-weight: 600;
}
