/* ─────────────────────────────────────────────────────────────────────────
   SenVy — Blog & marketing stylesheet (One Surface, theme-aware)
   Mirrors the landing page: Geist type, single emerald accent, off-black,
   unified radii (card 14 / button 10 / modal 16), minimal shadow, VI/EN.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xl: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --maxw: 1120px;
}
html.dark {
  --bg: #0a0a0c;
  --bg-2: #101013;
  --surface: #151518;
  --surface-2: #1b1b1f;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.13);
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --shadow: 0 1px 2px rgba(0,0,0,0.30);
  --accent: #34d399;
  --accent-soft: rgba(52,211,153,0.12);
  --accent-line: rgba(52,211,153,0.26);
}
html.light {
  --bg: #f6f7f9;
  --bg-2: #eef0f3;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d7dbe0;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #6b7280;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
  --accent: #059669;
  --accent-soft: rgba(5,150,105,0.10);
  --accent-line: rgba(5,150,105,0.24);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.65; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  transition: background .4s var(--ease), color .4s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
/* Bilingual long-form: show only the active language (html lang set by site.js) */
html[lang="en"] .only-vi, html:not([lang="en"]) .only-en { display: none; }
svg { stroke-width: 1.75; }
::selection { background: var(--accent-soft); }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* Film grain — subtle texture */
.grain { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0.04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
html.light .grain { opacity: 0.03; mix-blend-mode: multiply; }

/* ── Nav ─────────────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.nav-right, .nav-links { display: flex; align-items: center; gap: 10px; }
.nav-link { color: var(--text-2); font-size: 14.5px; font-weight: 500; padding: 8px 12px; border-radius: 9px; transition: color .18s, background .18s; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }

/* ── Controls (Kitsu-style ghost buttons) ────────────────────────────── */
.ctrl { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent;
  color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: color .18s, border-color .18s, background .18s; }
.ctrl:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-strong); }
.ctrl:active { transform: scale(0.97); }
.ctrl svg { width: 16px; height: 16px; }
.ctrl-icon { width: 36px; padding: 0; justify-content: center; }
.ctrl .lng { text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: transform .12s var(--ease), background .18s, box-shadow .18s; }
.btn:active { transform: translateY(1px) scale(0.99); }
/* Signature button — matches Kitsu/utility-toolkit: vertical gradient, white text,
   inset top highlight, tinted shadow, hover-lift, twinkling sparkles. */
.btn-primary {
  position: relative; overflow: visible; color: #fff;
  background: linear-gradient(to bottom, #10b981, #059669);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.20), 0 6px 16px -6px rgba(5,150,105,0.55);
  --star: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cpath%20fill='%23ffffff'%20d='M12%200L13.6%2010.4L24%2012L13.6%2013.6L12%2024L10.4%2013.6L0%2012L10.4%2010.4Z'/%3E%3C/svg%3E");
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.26), 0 12px 26px -8px rgba(5,150,105,0.72); }
.btn-primary:active { transform: scale(0.98); }
/* Six twinkling sparkles on every primary button (two out-of-phase groups) */
.btn-primary::before, .btn-primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background-repeat: no-repeat;
}
.btn-primary::before {
  background-image: var(--star), var(--star), var(--star);
  background-position: 11px 4px, 43% 3px, calc(100% - 17px) 5px;
  background-size: 11px, 9px, 12px;
  animation: sparkle 2.4s var(--ease) infinite;
}
.btn-primary::after {
  background-image: var(--star), var(--star), var(--star);
  background-position: 27px calc(100% - 5px), 57% calc(100% - 4px), calc(100% - 11px) calc(100% - 5px);
  background-size: 8px, 9px, 8px;
  animation: sparkle 2.4s var(--ease) infinite; animation-delay: 1.15s;
}
@keyframes sparkle { 0%, 100% { opacity: 0; } 30% { opacity: .95; } 60% { opacity: .4; } 82% { opacity: .85; } }
@media (prefers-reduced-motion: reduce) { .btn-primary::before, .btn-primary::after { animation: none; opacity: .5; } }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 8px; }

/* ── Hero (blog headers) ─────────────────────────────────────────────── */
.hero { padding: 56px 0 8px; }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 700; margin: 0 0 14px; text-wrap: balance; }
.lead { font-size: 18px; color: var(--text-2); max-width: 60ch; margin: 0; text-wrap: pretty; }

/* ── Blog list ───────────────────────────────────────────────────────── */
section { padding: 40px 0 72px; }
.posts { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); transition: border-color .2s var(--ease); }
.post-card:hover { border-color: var(--border-strong); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; }
.post-card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.post-card p { margin: 0 0 16px; color: var(--text-2); font-size: 14.5px; text-wrap: pretty; }
.post-card .meta { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── Article ─────────────────────────────────────────────────────────── */
.article { max-width: 720px; margin: 0 auto; padding: 48px 0 72px; }
.breadcrumb { font-size: 14px; color: var(--text-3); margin-bottom: 20px; }
.breadcrumb a:hover { color: var(--text); }
.article .tag { margin-bottom: 16px; }
.article h1 { font-size: clamp(28px, 4.6vw, 42px); letter-spacing: -0.035em; margin: 0 0 14px; font-weight: 700; line-height: 1.08; text-wrap: balance; }
.article .meta { color: var(--text-3); font-size: 14px; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.article h2 { font-size: 24px; letter-spacing: -0.03em; margin: 36px 0 12px; font-weight: 700; text-wrap: balance; }
.article h3 { font-size: 19px; margin: 24px 0 8px; font-weight: 600; letter-spacing: -0.02em; }
.article p { color: var(--text-2); font-size: 17px; margin: 0 0 16px; text-wrap: pretty; }
.article ul, .article ol { color: var(--text-2); font-size: 17px; padding-left: 22px; margin: 0 0 16px; }
.article li { margin-bottom: 8px; }
.article strong { color: var(--text); font-weight: 600; }
.article blockquote { margin: 24px 0; padding: 16px 20px; border-left: 2px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.article a.inline { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
/* Compact, refined end-of-article CTA — text left, button right */
.article-cta { margin-top: 36px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; text-align: left; }
.article-cta .txt { min-width: 0; flex: 1; }
.article-cta h3 { margin: 0 0 2px; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.article-cta p { margin: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.article-cta .btn { flex: none; }
.article-cta .btn.btn-primary { height: 38px; padding: 0 16px; font-size: 13.5px; }
@media (max-width: 520px) { .article-cta .btn { width: 100%; justify-content: center; } }

/* ── Footer ──────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); padding: 32px 0; }
.foot-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; color: var(--text-3); font-size: 14px; }
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; }
.foot-links a { color: var(--text-2); }
.foot-links a:hover { color: var(--text); }

/* ── Responsive ──────────────────────────────────────────────────────── */
html, body { overflow-x: hidden; }   /* guard against stray horizontal scroll on phones */
@media (max-width: 860px) {
  .posts { grid-template-columns: 1fr; }
  .nav-link.hide-sm { display: none; }
  section { padding: 32px 0 56px; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .nav-inner { height: 58px; }
  .brand { font-size: 16px; }
  .brand img { width: 26px; height: 26px; }
  .hero { padding: 36px 0 4px; }
  .lead { font-size: 16px; }
  .post-card { padding: 20px; }
  .post-card h3 { font-size: 18px; }
  .article { padding: 28px 0 56px; }
  .article p, .article ul, .article ol { font-size: 16px; }   /* comfortable mobile reading */
  .article h2 { font-size: 21px; margin: 28px 0 10px; }
  .article h3 { font-size: 18px; }
  .article blockquote { padding: 14px 16px; }
  .foot-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
}
