/* ─────────────────────────────────────────────────────────────────────────────
   SwiftInference Blog — Main Stylesheet
   Light mode default · Dark mode via [data-theme="dark"]
   Font: Outfit (sans) + JetBrains Mono (code) — matches swiftinference.ai
   ───────────────────────────────────────────────────────────────────────────── */

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

/* ─── CSS Custom Properties ──────────────────────────────────────────────────── */

:root {
  /* Colours */
  --bg:               #f7f8fc;
  --surface:          #ffffff;
  --surface-2:        #f0f2f8;
  --border:           #e2e6f0;
  --text-primary:     #0f1117;
  --text-secondary:   #5a6070;
  --text-muted:       #8890a4;
  --accent:           #0066cc;          /* Logo blue */
  --accent-hover:     #0052a3;
  --accent-rgb:       0, 102, 204;
  --accent-orange:    #e84e0f;          /* Logo orange tail */
  --accent-orange-rgb: 232, 78, 15;
  --code-bg:          #f0f2f8;

  /* Badges */
  --badge-news-bg:       rgba(0,102,204,0.08);
  --badge-news-text:     #0055a8;
  --badge-industry-bg:   rgba(200,80,0,0.08);
  --badge-industry-text: #b84400;
  --badge-tech-bg:       rgba(10,110,60,0.08);
  --badge-tech-text:     #0a6e3c;

  /* Shadow */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.06);
  --shadow:     0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.12);

  /* Shape */
  --radius:    16px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* Transition */
  --trans: 0.2s ease;
}

[data-theme="dark"] {
  --bg:              #0a0a0f;
  --surface:         #13131a;
  --surface-2:       #1a1a24;
  --border:          rgba(255,255,255,0.09);
  --text-primary:    #f0f0ff;
  --text-secondary:  #9090b8;
  --text-muted:      #5050a0;
  --accent:          #00e5ff;
  --accent-hover:    #00b8cc;
  --accent-rgb:      0, 229, 255;
  --accent-orange:   #ff8c40;
  --accent-orange-rgb: 255, 140, 64;
  --code-bg:         #0d0d17;

  --badge-news-bg:       rgba(0,229,255,0.1);
  --badge-news-text:     #00e5ff;
  --badge-industry-bg:   rgba(255,140,64,0.1);
  --badge-industry-text: #ff8c40;
  --badge-tech-bg:       rgba(0,255,136,0.1);
  --badge-tech-text:     #00cc70;

  --shadow-sm:  0 1px 4px rgba(0,0,0,0.3);
  --shadow:     0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6);
}

/* ─── Reset ──────────────────────────────────────────────────────────────────── */

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

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

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background var(--trans), color var(--trans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a   { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.main-wrap {
  min-height: calc(100vh - 70px - 80px);
  padding: 0 0 80px;
}

/* ─── Navigation ─────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  transition: background var(--trans), border-color var(--trans);
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .nav {
  background: rgba(19,19,26,0.92);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 20px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 36px;
  width: auto;
}

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

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: color var(--trans), background var(--trans);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-2);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent);
}

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

/* ─── Dark mode toggle ───────────────────────────────────────────────────────── */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--trans);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
}

.toggle-moon { display: none; }

[data-theme="dark"] .toggle-sun  { display: none; }
[data-theme="dark"] .toggle-moon { display: inline; }

/* ─── Blog hero ──────────────────────────────────────────────────────────────── */

.blog-hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.blog-hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.blog-hero h1 span {
  background: linear-gradient(135deg, var(--accent), var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 520px;
}

/* ─── Post type filter tabs ──────────────────────────────────────────────────── */

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.filter-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--trans);
}

.filter-tab:hover,
.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ─── Post cards grid ────────────────────────────────────────────────────────── */

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

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

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--trans), transform var(--trans), border-color var(--trans);
  text-decoration: none;
  color: inherit;
}

.post-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(var(--accent-rgb), 0.3);
  text-decoration: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.post-card h2 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.post-card .excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
}

.read-more {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

.read-more::after {
  content: '→';
  transition: transform var(--trans);
}

.post-card:hover .read-more::after {
  transform: translateX(3px);
}

/* ─── Badges ─────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-news      { background: var(--badge-news-bg);     color: var(--badge-news-text); }
.badge-industry  { background: var(--badge-industry-bg); color: var(--badge-industry-text); }
.badge-technical { background: var(--badge-tech-bg);     color: var(--badge-tech-text); }

/* ─── Pagination ─────────────────────────────────────────────────────────────── */

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--trans);
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ─── Empty state ────────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  opacity: 0.3;
  margin: 0 auto 24px;
}

.empty-state h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ─── Single post ────────────────────────────────────────────────────────────── */

.post-header {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
  max-width: 800px;
}

.post-header .badge {
  margin-bottom: 20px;
}

.post-header h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.post-meta-sep { opacity: 0.4; }

.post-excerpt-lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  font-weight: 400;
}

/* ─── Post content ───────────────────────────────────────────────────────────── */

.post-content {
  max-width: 800px;
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-content h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 44px 0 16px;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--text-primary);
}

.post-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text-primary);
}

.post-content p {
  margin: 0 0 20px;
}

.post-content ul,
.post-content ol {
  padding-left: 28px;
  margin: 0 0 20px;
}

.post-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

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

.post-content em {
  font-style: italic;
}

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

.post-content a:hover {
  color: var(--accent-hover);
}

/* Code blocks */
.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  overflow-x: auto;
  margin: 28px 0;
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}

.post-content pre code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: transparent;
  padding: 0;
  border: none;
  border-radius: 0;
  font-size: inherit;
  color: var(--text-primary);
}

.post-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.875em;
  color: var(--accent-orange);
}

/* Blockquote */
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 28px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ─── Social share section ───────────────────────────────────────────────────── */

.share-section {
  margin-top: 64px;
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 800px;
}

.share-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.share-blocks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.share-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.share-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.share-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.share-copy-btn {
  padding: 5px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--trans);
  font-family: inherit;
}

.share-copy-btn:hover  { opacity: 0.85; }
.share-copy-btn.copied { background: #16a34a; }

.share-text {
  width: 100%;
  background: transparent;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  resize: vertical;
  min-height: 64px;
  outline: none;
}

/* ─── Back link ──────────────────────────────────────────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 40px;
  padding: 8px 0;
  transition: color var(--trans);
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.back-link::before { content: '←'; }

/* ─── CTA strip ──────────────────────────────────────────────────────────────── */

.cta-strip {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.06) 0%, rgba(var(--accent-orange-rgb),0.06) 100%);
  border: 1px solid rgba(var(--accent-rgb),0.15);
  border-radius: var(--radius);
  padding: 40px;
  margin-top: 48px;
  max-width: 800px;
  text-align: center;
}

.cta-strip h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.cta-strip p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.btn-primary {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: all var(--trans);
  font-family: inherit;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-block;
  padding: 10px 22px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all var(--trans);
}

.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ─── Footer ─────────────────────────────────────────────────────────────────── */

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  transition: background var(--trans), border-color var(--trans);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.footer-logo img { height: 28px; }

.footer-copy {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--trans);
}

.footer-links a:hover { color: var(--accent); }

/* ─── Loading skeleton ───────────────────────────────────────────────────────── */

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .blog-hero      { padding: 40px 0 32px; }
  .post-header    { padding: 40px 0 28px; }
  .share-section,
  .cta-strip      { padding: 24px; }
  .footer-inner   { flex-direction: column; align-items: flex-start; }
  .nav-center     { display: none; }
}

@media (max-width: 480px) {
  .container      { padding: 0 16px; }
  .post-card      { padding: 20px; }
  .filter-tabs    { gap: 6px; }
  .filter-tab     { font-size: 12px; padding: 5px 12px; }
}

/* ─── Utility ────────────────────────────────────────────────────────────────── */

.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.mt-4         { margin-top: 16px; }
.mt-6         { margin-top: 24px; }
.reading-time { font-size: 12px; color: var(--text-muted); }
