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

/* ── CSS VARIABLES (copied from index.css dark theme) ── */
:root {
  --bg: linear-gradient(135deg, #0a0f1e 0%, #0f172a 50%, #0a0f1e 100%);
  --surface: rgba(30,41,59,0.85);
  --surface-solid: #1e293b;
  --nav: rgba(15,23,42,0.95);
  --border: rgba(255,255,255,0.08);
  --border-dashed: rgba(255,255,255,0.06);
  --text-1: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #a855f7;
  --radius: 16px;
  --font: 'Inter', 'Poppins', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

html { font-family: var(--font); }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-1);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 99px; }

/* ── UTILITIES ── */
.container { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── NAVBAR (identical to main site) ── */
.navbar {
  background: var(--nav);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}
.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.navbar-logo-icon {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 50%, var(--accent-3) 100%);
  border-radius: 12px;
  padding: 0.55rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(99,102,241,0.35);
  font-size: 1.3rem;
  transition: var(--transition);
}
.navbar-logo:hover .navbar-logo-icon { transform: scale(1.05); }
.navbar-logo-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-1);
}
.navbar-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  list-style: none;
  margin-left: auto;
}
.navbar-links a {
  text-decoration: none;
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.navbar-links a:hover, .navbar-links a.active {
  background: var(--surface);
  color: var(--accent);
}

/* ── BLOG LANGUAGE (blog-only, not main site) ── */
.blog-lang-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  margin: 1.25rem auto 0;
  max-width: 640px;
}
.blog-lang-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.blog-lang-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.blog-lang-btn {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.blog-lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.blog-lang-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}
.article-page .blog-lang-switcher {
  justify-content: flex-start;
  margin: 0 auto 1rem;
  max-width: 760px;
}
.blog-translation-notice {
  max-width: 760px;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.85rem;
  line-height: 1.5;
}
html[dir="rtl"] .article-page .blog-lang-switcher {
  justify-content: flex-end;
}
html[dir="rtl"] .article-body ul,
html[dir="rtl"] .article-body ol {
  margin-right: 1.25rem;
  margin-left: 0;
}
html[dir="rtl"] .article-body blockquote {
  border-left: none;
  border-right: 3px solid var(--accent);
  border-radius: 8px 0 0 8px;
}

/* ── BLOG HERO ── */
.blog-hero {
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  background: radial-gradient(circle at 50% 0%, rgba(99,102,241,0.08) 0%, transparent 60%);
}
.blog-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.blog-hero p {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── BLOG CARD GRID (mirrors calc-grid / calc-card) ── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 2rem 1.5rem 4rem;
  max-width: 1400px;
  margin: 0 auto;
}
.post-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.4rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99,102,241,0.3);
}
.post-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  background: #e2e8f0;
}
.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card-cover {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, var(--cover-from), var(--cover-to));
  color: #fff;
}
.post-card-cover-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}
.post-card-cover-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.95;
}
.post-card h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
}
.post-card p {
  font-size: 0.72rem;
  color: var(--text-3);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border-dashed);
  color: var(--text-3);
  width: fit-content;
}
.post-card-btn {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  border-radius: 8px;
  border: none;
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}
.post-card-btn:hover { filter: brightness(1.1); transform: scale(1.02); }

/* ── ARTICLE PAGE ── */
.article-page { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-dashed);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  margin-bottom: 1.5rem;
  font-family: var(--font);
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }

.article-hero {
  width: calc(100% + 5rem);
  margin: -2.5rem -2.5rem 1.5rem;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
}
.article-hero img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
}

.article-topic-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: -2.5rem -2.5rem 1.25rem;
  padding: 0.85rem 1.25rem;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, var(--cover-from), var(--cover-to));
  color: #fff;
}
.article-topic-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.article-topic-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-wrapper {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem;
}

.article-meta {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border-dashed);
  color: var(--accent);
  display: inline-flex;
  margin-bottom: 1rem;
}

.article-header h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.2;
  color: var(--text-1);
  margin-bottom: 2rem;
}

/* Article body typography */
.article-body {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.75;
}

.article-body h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-1);
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.5px;
}

.article-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 1.5rem 0 0.5rem;
}

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

.article-body ul, .article-body ol {
  margin: 0.5rem 0 1rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-2);
}

.article-body li {
  margin-bottom: 0.35rem;
  line-height: 1.6;
}

.article-body strong {
  color: var(--text-1);
  font-weight: 700;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  background: rgba(99,102,241,0.06);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: var(--text-2);
  font-style: italic;
}

/* Images inside articles */
.article-body img {
  max-width: 70%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  display: block;
  margin: 1.5rem auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Tables inside articles */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.8rem;
  border-radius: 12px;
  overflow: hidden;
}
.article-body th {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-body td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.article-body tr:hover td { background: rgba(99,102,241,0.04); }

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

.article-body .article-cta {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(99, 102, 241, 0.06);
}
.article-body .article-cta h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}
.article-body .article-cta ul {
  margin: 0;
  list-style: none;
  padding: 0;
}
.article-body .article-cta li {
  margin-bottom: 0.5rem;
}

/* ── FOOTER (identical to main site) ── */
.footer {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
  font-weight: 500;
}
.footer a {
  color: var(--text-3);
  text-decoration: none;
  transition: var(--transition);
  margin: 0 0.5rem;
}
.footer a:hover { color: var(--accent); }

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.post-card { animation: fadeInUp 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.post-card:nth-child(2) { animation-delay: 0.04s; }
.post-card:nth-child(3) { animation-delay: 0.08s; }
.post-card:nth-child(4) { animation-delay: 0.12s; }
.post-card:nth-child(5) { animation-delay: 0.16s; }
.post-card:nth-child(6) { animation-delay: 0.20s; }
.post-card:nth-child(n+7) { animation-delay: 0.24s; }

.article-wrapper { animation: fadeInUp 0.4s cubic-bezier(0.4,0,0.2,1) both; }

/* ── MOBILE ── */
@media (max-width: 768px) {
  .navbar-links { display: none; }
  .blog-hero { padding: 2.5rem 1rem 2rem; }
  .blog-hero h1 { font-size: 2rem; letter-spacing: -1px; }
  .blog-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 1rem; gap: 0.75rem; }
  .article-wrapper { padding: 1.5rem; }
  .article-topic-bar {
    margin: -1.5rem -1.5rem 1rem;
    border-radius: 12px 12px 0 0;
  }
  .article-hero {
    width: calc(100% + 3rem);
    margin: -1.5rem -1.5rem 1rem;
  }
  .article-body { font-size: 0.85rem; }
  .article-body img { max-width: 90%; max-height: 200px; }
}

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