/**
 * SnapVN static pages — light/dark (đồng bộ key ttd-theme với app React)
 */
:root {
  color-scheme: light;
  --brand: #fe2c55;
  --brand-soft: #f8eef1;
  --ink: #0f172a;
  --muted: #64748b;
  --subtle: #94a3b8;
  --bg: #f0f4fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --nav-bg: #f8fafc;
  --code-bg: #ffffff;
  --notice-bg: #fff7ed;
  --notice-border: #fed7aa;
  --notice-ink: #9a3412;
  --contact-bg: #f0fdf4;
  --contact-border: #bbf7d0;
  --pro-border: #f0d6d8;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  --topbar-bg: rgba(255, 255, 255, 0.85);
}

html.dark {
  color-scheme: dark;
  --brand: #fb7185;
  --brand-soft: rgba(254, 44, 85, 0.12);
  --ink: #f1f5f9;
  --muted: #cbd5e1;
  --subtle: #94a3b8;
  --bg: #0c1017;
  --surface: #1e293b;
  --border: #334155;
  --nav-bg: #1e293b;
  --code-bg: #0f172a;
  --notice-bg: rgba(180, 83, 9, 0.18);
  --notice-border: rgba(251, 191, 36, 0.35);
  --notice-ink: #fcd34d;
  --contact-bg: rgba(16, 185, 129, 0.12);
  --contact-border: rgba(52, 211, 153, 0.3);
  --pro-border: rgba(251, 113, 133, 0.35);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --topbar-bg: rgba(12, 16, 23, 0.88);
}

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

html {
  background-color: var(--bg);
}

body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
  line-height: 1.7;
  color: var(--muted);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

h1 {
  color: var(--ink);
  font-size: 1.75rem;
  margin: 0.25rem 0 0.5rem;
  line-height: 1.25;
}

h2 {
  color: var(--ink);
  font-size: 1.15rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

p {
  margin: 0.75rem 0;
}

a {
  color: var(--brand);
}

a:hover {
  text-decoration: underline;
}

strong {
  color: var(--ink);
  font-weight: 600;
}

code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

ol,
ul {
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.5rem;
}

.updated {
  color: var(--subtle);
  font-size: 0.875rem;
}

.back {
  color: var(--subtle);
  text-decoration: none;
  font-size: 0.9rem;
}

.back:hover {
  color: var(--brand);
}

/* Top bar: back + theme toggle */
.static-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -0.25rem 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-left: -0.25rem;
  margin-right: -0.25rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.static-topbar .back {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  min-width: 40px;
  padding: 0.4rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.theme-toggle .icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.box.pro {
  background: linear-gradient(180deg, var(--surface), var(--brand-soft));
  border-color: var(--pro-border);
}

nav.legal-nav,
nav[aria-label] {
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-size: 0.875rem;
}

nav.legal-nav a,
nav[aria-label] a {
  margin-right: 1rem;
  display: inline-block;
  margin-bottom: 0.25rem;
}

.notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 1.5rem 0;
  color: var(--notice-ink);
}

.notice strong {
  color: inherit;
}

.contact {
  background: var(--contact-bg);
  border: 1px solid var(--contact-border);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.contact p {
  margin: 0.4rem 0;
}

.contact .hint {
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--subtle);
}

.cta {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: #fe2c55;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 0.75rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(254, 44, 85, 0.35);
}

.cta:hover {
  filter: brightness(1.05);
}

.footer-meta {
  margin-top: 2.5rem;
  font-size: 0.875rem;
  color: var(--subtle);
}

.footer-meta a {
  color: var(--subtle);
}

.footer-meta a:hover {
  color: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none;
  }
}
