/* KAIEN SOFTWARE TechBlog - Design System */
/* Optimized for readability, accessibility, and AI indexing */

:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --accent: #0891b2;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #059669;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --content-width: 780px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* Skip to content - Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  transition: top var(--transition);
}
.skip-link:focus { top: 0; }

/* Header / Navigation */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

.logo span { color: var(--primary); }

.main-nav { display: flex; align-items: center; gap: 8px; }

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

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary) !important;
  background: rgba(26, 86, 219, 0.06);
}

.lang-switch {
  display: flex;
  gap: 4px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 3px;
}

.lang-switch a {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary) !important;
  transition: all var(--transition);
}

.lang-switch a:hover {
  color: var(--primary) !important;
}

.lang-switch a.active {
  background: var(--bg);
  color: var(--primary) !important;
  box-shadow: var(--shadow);
}

/* Mobile menu */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.menu-toggle svg { width: 24px; height: 24px; }

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    box-shadow: var(--shadow-lg);
  }
  .main-nav.open { display: flex; }
  .main-nav a { width: 100%; }
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: 80px 24px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.15rem;
  color: #94a3b8;
  max-width: 640px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.85rem;
  color: #cbd5e1;
  margin-bottom: 24px;
}

.hero-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

/* Search (decorative - static HTML) */
.search-box {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1rem;
  font-family: var(--font-sans);
  outline: none;
  transition: all var(--transition);
}

.search-box input::placeholder { color: #64748b; }
.search-box input:focus { border-color: var(--primary-light); background: rgba(255,255,255,0.15); }

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Section titles */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 32px;
}

/* Categories bar */
.categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 24px 0;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar { display: none; }

a.category-tag,
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary) !important;
  white-space: nowrap;
  transition: all var(--transition);
  cursor: pointer;
}

a.category-tag:hover,
.category-tag:hover,
a.category-tag.active,
.category-tag.active {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
}

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

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

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.article-card .card-category {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(26, 86, 219, 0.08);
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  width: fit-content;
}

.article-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 10px;
  color: var(--text);
}

.article-card h3 a {
  color: inherit !important;
  transition: color var(--transition);
  text-decoration: none;
}

.article-card h3 a:hover { color: var(--primary) !important; }

.article-card .card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.article-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.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: 40px;
  padding: 40px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border: none;
}

.featured-card:hover { transform: translateY(-2px); }

.featured-card .card-category {
  background: rgba(255,255,255,0.15);
  color: #93c5fd;
}

.featured-card h3 { color: #fff; font-size: 1.5rem; }
.featured-card h3 a { color: #fff !important; }
.featured-card h3 a:hover { color: #93c5fd !important; }
.featured-card .card-excerpt { color: #94a3b8; }
.featured-card .card-meta { color: #64748b; border-color: rgba(255,255,255,0.1); }

@media (max-width: 768px) {
  .featured-card { grid-template-columns: 1fr; gap: 20px; padding: 28px; }
}

/* Article page */
.article-header {
  padding: 60px 24px 40px;
  text-align: center;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.article-header .breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.article-header .breadcrumb a { color: var(--text-secondary) !important; }
.article-header .breadcrumb a:hover { color: var(--primary) !important; }

.article-header .article-category {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(26, 86, 219, 0.08);
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.25;
  max-width: 800px;
  margin: 0 auto 16px;
  letter-spacing: -0.02em;
}

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

.article-header .article-meta span { display: flex; align-items: center; gap: 4px; }

/* Article content */
.article-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.article-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 48px 0 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--text);
}

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

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

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

.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 16px 24px;
  margin: 24px 0;
  background: var(--bg-alt);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.article-content code {
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--primary-dark);
}

.article-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 24px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
}

.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

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

.article-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.article-content th {
  background: var(--bg-alt);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--border);
}

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

/* Key takeaway box */
.key-takeaway {
  background: linear-gradient(135deg, rgba(26, 86, 219, 0.05), rgba(8, 145, 178, 0.05));
  border: 1px solid rgba(26, 86, 219, 0.15);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin: 32px 0;
}

.key-takeaway h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 12px;
}

/* CTA box */
.cta-box {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 40px;
  margin: 48px 0;
  text-align: center;
}

.cta-box h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.cta-box p {
  color: #94a3b8;
  margin-bottom: 24px;
  font-size: 1rem;
}

a.cta-btn,
.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff !important;
  padding: 14px 32px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition);
  text-decoration: none;
}

a.cta-btn:hover,
.cta-btn:hover { background: var(--primary-dark); color: #fff !important; transform: translateY(-1px); }

/* FAQ Section - Critical for AI */
.faq-section {
  margin: 48px 0;
}

.faq-section h2 {
  margin-bottom: 24px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-item summary {
  padding: 18px 24px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition);
}

.faq-item summary:hover { background: var(--bg-alt); }

.faq-item summary::after {
  content: '+';
  font-size: 1.3rem;
  font-weight: 300;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.faq-item[open] summary::after {
  content: '-';
}

.faq-item .faq-answer {
  padding: 0 24px 18px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Author box */
.author-box {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 40px 0;
}

.author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.author-info h4 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.author-info p { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }

/* Related articles */
.related-articles {
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.related-articles h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}

a.tag,
.tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--text-secondary) !important;
  transition: all var(--transition);
}

a.tag:hover,
.tag:hover { border-color: var(--primary); color: var(--primary) !important; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 0;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Footer */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 64px 24px 32px;
}

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

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

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

.footer-brand .logo { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 0.9rem; line-height: 1.6; color: #64748b; }

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  color: #64748b !important;
  font-size: 0.9rem;
  padding: 4px 0;
  transition: color var(--transition);
}

.footer-col a:hover { color: #e2e8f0 !important; }

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #475569;
  flex-wrap: wrap;
  gap: 16px;
}

/* Table of contents */
.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 32px 0;
}

.toc h4 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
  color: var(--text);
}

.toc ol {
  list-style: none;
  counter-reset: toc;
  padding: 0;
}

.toc li {
  counter-increment: toc;
  margin-bottom: 6px;
}

.toc li::before {
  content: counter(toc) ". ";
  color: var(--primary);
  font-weight: 600;
}

.toc a {
  color: var(--text-secondary) !important;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.toc a:hover { color: var(--primary) !important; }

/* Stats / Numbers */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 24px;
  margin: 32px 0;
}

.stat-item {
  text-align: center;
  padding: 24px;
  background: var(--bg-alt);
  border-radius: var(--radius);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

/* Print styles */
@media print {
  .site-header, .site-footer, .cta-box, .related-articles { display: none; }
  .article-content { max-width: 100%; padding: 0; }
  body { font-size: 12pt; }
}

/* Category index page */
.category-header {
  padding: 48px 24px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.category-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.category-header p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.article-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* Smooth transitions for all interactive elements */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
