/* === blog.css === */
:root {
  --bg: #0A0D10;
  --surface: #11161B;
  --text: #E8ECF0;
  --muted: #7A8590;
  --accent: #00FF88;
  --accent-bold: #7FFFC0;
  --accent-bg: rgba(0, 255, 136, 0.15);
  --max: 680px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[data-lang="hi"] body {
  font-family: "Noto Sans Devanagari", "Inter", sans-serif;
}

/* === Sticky header === */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 13, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #1B2128;
}

.blog-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
}

.blog-header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: "Inter Tight", sans-serif;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.blog-header__logo span { color: var(--accent); }

.blog-header__back {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}

.blog-header__back:hover { color: var(--text); }

@media (max-width: 540px) {
  .blog-header__back { display: none; }
}

.lang-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 999px;
  padding: 4px;
}

.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  min-height: 36px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-toggle button.active {
  background: var(--accent);
  color: #001A0E;
}

.lang-toggle button:hover:not(.active) { color: var(--text); }

/* === Reading progress bar === */
.progress {
  position: sticky;
  top: 0;
  height: 2px;
  background: transparent;
  z-index: 99;
  pointer-events: none;
}

.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.05s linear;
}

/* === Article layout === */
.article {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.article__meta {
  color: var(--muted);
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.article h1 {
  font-family: "Inter Tight", sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
  color: #fff;
}

.article h2 {
  font-family: "Inter Tight", sans-serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 56px 0 20px;
  padding-left: 16px;
  border-left: 4px solid var(--accent);
  color: #fff;
  scroll-margin-top: 80px;
  position: relative;
}

.article h2 .anchor {
  opacity: 0;
  margin-left: 8px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.article h2:hover .anchor { opacity: 1; }

.article h3 {
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 19px;
  margin: 32px 0 14px;
  color: #fff;
}

.article p {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
}

.article p strong, .article li strong {
  font-weight: 600;
  color: var(--accent-bold);
}

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

.article a:hover { text-decoration: none; }

.article ul, .article ol {
  margin: 0 0 22px 0;
  padding-left: 0;
  list-style: none;
}

.article ul li, .article ol li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 10px;
  line-height: 1.7;
}

.article ul li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

.article ol {
  counter-reset: list;
}

.article ol li {
  counter-increment: list;
}

.article ol li::before {
  content: counter(list) ".";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
}

.article blockquote {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 20px 22px;
  margin: 28px 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.6;
  color: #fff;
  border-radius: 0 8px 8px 0;
}

.article blockquote p { margin: 0; font-size: 17px; }
.article blockquote p strong { color: var(--accent); }

/* === Tables === */
.article .table-wrap {
  margin: 28px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid #1B2128;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 14px;
  min-width: 480px;
}

.article thead th {
  background: #0E1418;
  color: var(--accent);
  font-weight: 600;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid #1B2128;
  font-family: "Inter", sans-serif;
}

.article tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #1B2128;
  vertical-align: top;
  line-height: 1.55;
}

.article tbody tr:last-child td { border-bottom: none; }
.article tbody tr:nth-child(even) td { background: rgba(255,255,255,0.015); }

.article td.num, .article th.num {
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}

/* === Final CTA === */
.cta {
  margin: 64px 0 0;
  padding: 36px 28px;
  background: linear-gradient(135deg, rgba(0,255,136,0.12), rgba(0,255,136,0.04));
  border: 1px solid rgba(0,255,136,0.3);
  border-radius: 12px;
  text-align: center;
}

.cta h3 {
  font-family: "Inter Tight", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

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

.cta a {
  display: inline-block;
  background: var(--accent);
  color: #001A0E;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  min-height: 44px;
  transition: transform 0.15s ease;
}

.cta a:hover { transform: translateY(-2px); }

/* === Blog index === */
.index-hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 20px 32px;
}

.index-hero h1 {
  font-family: "Inter Tight", sans-serif;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 12px;
}

.index-hero p {
  color: var(--muted);
  font-size: 17px;
  max-width: 540px;
}

.cards {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .cards { grid-template-columns: 1fr 1fr; gap: 24px; }
}

.card {
  background: var(--surface);
  border: 1px solid #1B2128;
  border-radius: 12px;
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card__meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.card h2 {
  font-family: "Inter Tight", sans-serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.card p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  margin-bottom: 20px;
  flex: 1;
}

.card__link {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  margin-top: auto;
}

/* === Footer === */
.blog-footer {
  border-top: 1px solid #1B2128;
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.blog-footer a { color: var(--muted); text-decoration: none; margin: 0 8px; }
.blog-footer a:hover { color: var(--accent); }

/* === Desktop refinements === */
@media (min-width: 768px) {
  .article { padding: 48px 24px 100px; }
  .article h1 { font-size: 44px; }
  .article h2 { font-size: 30px; }
  .article h3 { font-size: 22px; }
  .article p, .article li { font-size: 18px; line-height: 1.75; }
  .article blockquote { font-size: 19px; padding: 24px 28px; }
  .index-hero h1 { font-size: 48px; }
}

/* === Show only active language === */
[data-lang="en"] [lang="hi"] { display: none; }
[data-lang="hi"] [lang="en"] { display: none; }
