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

:root {
  --bg: #ffffff;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card2: #f1f5f9;
  --text: #253d63;
  --text-muted: #637290;
  --text-body: #334155;
  --text-h3: #1e293b;
  --primary: #1a365d;
  --accent: #2dd4bf;
  --accent-dark: #0f9488;
  --border: #e4e8ef;
  --header-bg: rgba(255,255,255,0.85);
  --cta-bg: linear-gradient(135deg, #e8f5f4 0%, #f0faf9 100%);
  --cta-border: #2dd4bf33;
  --select-option-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.07);
  --max-w: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card2: #162032;
    --text: #d8e2f0;
    --text-muted: #8fa3c2;
    --text-body: #cbd5e1;
    --text-h3: #e2e8f0;
    --primary: #2dd4bf;
    --accent: #2dd4bf;
    --accent-dark: #0f9488;
    --border: #303f5e;
    --header-bg: rgba(2,6,23,0.85);
    --cta-bg: linear-gradient(135deg, #162032 0%, #1a2a40 100%);
    --cta-border: #2dd4bf33;
    --select-option-bg: #1e293b;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
}

html.light {
  --bg: #ffffff;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card2: #f1f5f9;
  --text: #253d63;
  --text-muted: #637290;
  --text-body: #334155;
  --text-h3: #1e293b;
  --primary: #1a365d;
  --accent: #2dd4bf;
  --accent-dark: #0f9488;
  --border: #e4e8ef;
  --header-bg: rgba(255,255,255,0.85);
  --cta-bg: linear-gradient(135deg, #e8f5f4 0%, #f0faf9 100%);
  --cta-border: #2dd4bf33;
  --select-option-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.07);
}

html.dark {
  --bg: #020617;
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card2: #162032;
  --text: #d8e2f0;
  --text-muted: #8fa3c2;
  --text-body: #cbd5e1;
  --text-h3: #e2e8f0;
  --primary: #2dd4bf;
  --accent: #2dd4bf;
  --accent-dark: #0f9488;
  --border: #303f5e;
  --header-bg: rgba(2,6,23,0.85);
  --cta-bg: linear-gradient(135deg, #162032 0%, #1a2a40 100%);
  --cta-border: #2dd4bf33;
  --select-option-bg: #1e293b;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-footer { margin-top: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.4rem;
  background: linear-gradient(to right, #1a365d, #2dd4bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
html.dark .site-logo,
html:not(.light) .site-logo { background: linear-gradient(to right, #7eb8f7, #2dd4bf); -webkit-background-clip: text; background-clip: text; }
@media (prefers-color-scheme: dark) {
  html:not(.light) .site-logo { background: linear-gradient(to right, #7eb8f7, #2dd4bf); -webkit-background-clip: text; background-clip: text; }
}
.site-logo img { width: 28px; height: 28px; border-radius: 6px; }

.header-right { display: flex; align-items: center; gap: 0.75rem; }

.lang-select {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.lang-select:hover, .lang-select:focus { border-color: var(--accent); color: var(--text); outline: none; }
.lang-select option { background: var(--select-option-bg); color: var(--text); }

.header-cta {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.header-cta:hover { background: var(--accent-dark); text-decoration: none; }

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--accent); border-color: #94a3b8; transform: scale(1.05); }
.theme-toggle svg { width: 16px; height: 16px; }

/* ── Blog index ── */
.blog-hero {
  max-width: var(--max-w);
  margin: 3rem auto 2.5rem;
  padding: 0 1.5rem;
}
.blog-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  color: var(--primary);
}
.blog-hero p { color: var(--text-muted); font-size: 1.05rem; }

.post-grid {
  max-width: var(--max-w);
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(45,212,191,0.12); text-decoration: none; }
.post-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  gap: 1rem;
}
.post-card-lang {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.post-card h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.4rem; line-height: 1.35; color: var(--text); }
.post-card p { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ── Article ── */
.article-header {
  max-width: var(--max-w);
  margin: 3rem auto 2rem;
  padding: 0 1.5rem;
}
.article-header .breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.article-header .breadcrumb a { color: var(--text-muted); }
.article-header .breadcrumb a:hover { color: var(--accent); }
.article-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 1rem;
  color: var(--primary);
}
.article-meta {
  display: flex;
  gap: 1.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  align-items: center;
  flex-wrap: wrap;
}
.article-meta .lang-badge {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.article-divider {
  max-width: var(--max-w);
  margin: 0 auto 2.5rem;
  padding: 0 1.5rem;
  border: none;
  border-top: 1px solid var(--border);
}

article {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

article h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2.25rem 0 0.75rem;
  line-height: 1.3;
  color: var(--text);
}
article h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-h3);
}
article p { margin-bottom: 1.1rem; color: var(--text-body); }
article ul, article ol {
  margin: 0.5rem 0 1.25rem 1.4rem;
  color: var(--text-body);
}
article li { margin-bottom: 0.4rem; }
article strong { color: var(--text); }

article blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card2);
  border-radius: 0 8px 8px 0;
  color: var(--text-h3);
  font-style: italic;
}

.example-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
  color: var(--text-body);
  line-height: 1.8;
  box-shadow: var(--shadow);
}
.example-box .example-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ── CTA box ── */
.cta-box {
  background: var(--cta-bg);
  border: 1px solid var(--cta-border);
  border-radius: 16px;
  padding: 1.75rem;
  margin: 2.5rem 0;
  text-align: center;
}
.cta-box h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text); }
.cta-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.7rem 1.75rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s;
}
.cta-btn:hover { background: var(--accent-dark); text-decoration: none; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  background: var(--bg-card);
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .article-header h1 { font-size: 1.6rem; }
  .header-cta { display: none; }
}

/* ── Related articles ── */
.related-articles {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
  border-top: 1px solid var(--border);
}
.related-articles h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}
.related-link {
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.93rem;
  text-decoration: none;
  transition: color 0.15s;
}
.related-link:last-child { border-bottom: none; }
.related-link:hover { color: var(--accent); }
