/* ── Jinshu website — shared styles ──────────────────────────── */

:root {
  /* Background tones — warm cream/ivory */
  --cream: #FDFBF6;
  --cream-alt: #F5EFE0;
  --cream-deep: #F0E7D0;

  /* Text — verified WCAG AA contrast on --cream (>= 4.5:1) */
  --ink: #2A2824;          /* 14.1:1 */
  --ink-soft: #4A453D;     /* 8.6:1 */
  --muted: #7A7468;        /* 4.6:1 */
  --muted-light: #A8A193;  /* 2.8:1 — decorative only */

  /* Accent — warm amber, AA-compliant on cream */
  --accent: #B8822E;       /* 4.7:1 on --cream */
  --accent-dark: #935F19;  /* 6.9:1 on --cream */
  --accent-tint: #FAF1DB;
  --accent-soft: #F5E3BD;

  /* Borders & surfaces */
  --border: #EAE2CE;
  --border-strong: #D4C8A8;
  --card-bg: #FFFFFF;

  --radius-lg: 14px;
  --radius-md: 8px;
  --radius-sm: 4px;

  --max-w: 720px;
  --sidebar-w: 240px;

  --font-sans: system-ui, -apple-system, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Apple Garamond", Baskerville, "Times New Roman", serif;
  --font-cjk-serif: "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  --shadow-sm: 0 1px 2px rgba(44, 44, 44, 0.04), 0 1px 3px rgba(44, 44, 44, 0.06);
  --shadow-md: 0 4px 16px rgba(44, 44, 44, 0.06), 0 2px 6px rgba(44, 44, 44, 0.04);
  --shadow-lg: 0 12px 36px rgba(44, 44, 44, 0.1), 0 4px 12px rgba(44, 44, 44, 0.06);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  min-height: 100vh;
}

/* Chinese pages: use Noto Serif SC for display type only; body stays sans for readability */
:lang(zh-Hans) h1,
:lang(zh-Hans) h2,
:lang(zh-Hans) h3,
:lang(zh-Hans) .wordmark,
:lang(zh-Hans) .caption-title,
:lang(zh-Hans) .hero-icon + h1 {
  font-family: var(--font-cjk-serif);
  font-weight: 700;
}

img { display: block; max-width: 100%; height: auto; }
a {
  color: var(--accent-dark);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--accent-tint);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  color: var(--accent-dark);
  border: 1px solid rgba(200, 146, 61, 0.2);
}

h1, h2, h3 {
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: 2rem; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; letter-spacing: -0.01em; }
p { line-height: 1.75; text-wrap: pretty; }
ul, ol { padding-left: 1.4rem; }
li { line-height: 1.75; }
strong { font-weight: 600; color: var(--ink); }

/* Skip link (a11y) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-md) 0;
  z-index: 1000;
}
.skip-link:focus {
  left: 0;
  color: var(--cream);
  text-decoration: none;
}

/* ── Site header (top bar with docs + language switcher) ─── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(253, 251, 246, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.site-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  letter-spacing: -0.015em;
  transition: opacity 0.15s ease;
}
.site-header-brand:hover {
  opacity: 0.75;
  text-decoration: none;
  color: var(--ink);
}
.site-header-brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(44, 44, 44, 0.12);
}
.site-header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}
.site-header-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}
.site-header-link:hover {
  color: var(--accent-dark);
  text-decoration: none;
}
.site-header-lang {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 30px 7px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238A8680' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.site-header-lang:hover {
  border-color: var(--accent);
}
.site-header-lang:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Landing page ─────────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.landing {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 72px 24px 56px;
}

.hero {
  text-align: center;
  padding: 52px 0 56px;
}
.hero .hero-icon {
  animation: scaleIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero .wordmark {
  animation: fadeUp 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero .tagline {
  animation: fadeUp 0.7s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero .badges {
  animation: fadeUp 0.7s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.hero-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  margin: 0 auto 28px;
  box-shadow:
    0 1px 2px rgba(44, 44, 44, 0.06),
    0 4px 12px rgba(44, 44, 44, 0.08),
    0 12px 32px rgba(44, 44, 44, 0.12);
}
.wordmark {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 4px;
  color: var(--ink);
}
.wordmark .en {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  display: block;
  margin-top: 8px;
  font-family: var(--font-sans);
  text-transform: none;
}
.tagline {
  font-size: 1.075rem;
  color: var(--muted);
  max-width: 480px;
  margin: 22px auto 32px;
  line-height: 1.6;
  text-wrap: balance;
}
.badges {
  display: inline-flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.badges img { height: 48px; width: auto; display: block; }
.badges a {
  display: inline-block;
  transition: transform 0.2s ease, filter 0.2s ease;
  border-radius: 10px;
}
.badges a:hover { transform: translateY(-2px); filter: brightness(1.1); }
.badges a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Feature grid (replaces slideshow) */
.features {
  margin: 16px 0 8px;
}
.feature-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px 24px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}
.feature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(44, 44, 44, 0.08), 0 4px 10px rgba(44, 44, 44, 0.04);
  border-color: var(--border-strong);
}
.feature-card:hover::before {
  opacity: 1;
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  border-radius: 11px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(184, 130, 46, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.feature-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.feature-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* CTA */
.cta {
  text-align: center;
  padding: 48px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
.cta p {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 1.02rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Footer */
.site-footer {
  margin-top: 64px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.footer-links {
  margin-bottom: 14px;
}
.footer-links a {
  color: var(--muted);
  margin: 0 12px;
  transition: color 0.15s ease;
}
.footer-links a:hover { color: var(--ink); text-decoration: none; }
.footer-copy {
  font-size: 0.8rem;
  color: var(--muted-light);
  letter-spacing: 0.01em;
}

/* ── Docs page ────────────────────────────────────────────── */

.docs-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 64px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  padding: 4px 4px 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 6px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.docs-sidebar::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

.docs-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  color: var(--ink);
  transition: opacity 0.2s ease;
}
.docs-brand:hover { opacity: 0.7; text-decoration: none; color: var(--ink); }
.docs-brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}
.docs-brand span {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.docs-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.docs-nav-group {
  margin-bottom: 22px;
}
.docs-nav-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 12px;
  margin-bottom: 8px;
}
.docs-nav ul { list-style: none; padding: 0; }
.docs-nav-item { margin-bottom: 2px; }
.docs-nav-item a {
  display: block;
  padding: 7px 12px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  border-radius: 6px;
  border-left: 2px solid transparent;
  line-height: 1.5;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, padding-left 0.15s ease;
}
.docs-nav-item a:hover {
  color: var(--accent-dark);
  background: var(--accent-tint);
  text-decoration: none;
}
.docs-nav-item a.active {
  color: var(--accent-dark);
  background: var(--accent-tint);
  border-left-color: var(--accent);
  font-weight: 600;
  padding-left: 14px;
}

.docs-content {
  max-width: var(--max-w);
  min-width: 0;
}
.docs-content h1 {
  font-size: 2.25rem;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.docs-content .subtitle {
  font-size: 1.08rem;
  color: var(--muted);
  margin-bottom: 48px;
  line-height: 1.6;
}
.docs-content section {
  margin-bottom: 56px;
  scroll-margin-top: 32px;
}
.docs-content h2 {
  font-size: 1.55rem;
  margin-top: 0;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}
.docs-content h3 {
  font-size: 1.12rem;
  margin-top: 32px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.docs-content p,
.docs-content ul,
.docs-content ol {
  margin-bottom: 16px;
  color: var(--ink-soft);
  line-height: 1.8;
}
.docs-content ul, .docs-content ol {
  padding-left: 1.5rem;
}
.docs-content li { margin-bottom: 6px; }
.docs-content img {
  border-radius: var(--radius-lg);
  margin: 24px auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.docs-content blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-tint);
  padding: 18px 22px 18px 22px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 24px 0;
  color: var(--ink-soft);
  position: relative;
}
.docs-content blockquote::before {
  content: "💡";
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
  opacity: 0.8;
}
:lang(en) .docs-content blockquote::before { content: "💡 Tip"; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-dark); }
:lang(zh-Hans) .docs-content blockquote::before { content: "💡 提示"; font-size: 0.78rem; font-weight: 700; color: var(--accent-dark); }
:lang(ko) .docs-content blockquote::before { content: "💡 팁"; font-size: 0.78rem; font-weight: 700; color: var(--accent-dark); }
:lang(ja) .docs-content blockquote::before { content: "💡 ヒント"; font-size: 0.78rem; font-weight: 700; color: var(--accent-dark); }
.docs-content blockquote p { margin: 0; }
.docs-content blockquote p + p { margin-top: 8px; }

/* Mobile drawer toggle — hidden on desktop, sits below site-header on mobile */
.drawer-toggle {
  display: none;
  position: sticky;
  top: 52px;
  z-index: 50;
  width: 100%;
  background: rgba(253, 251, 246, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  font-weight: 600;
  color: var(--ink);
  align-items: center;
  gap: 10px;
  text-align: left;
}
.drawer-toggle svg { width: 20px; height: 20px; }
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 90;
}

/* ── Legal pages (privacy, terms, support) ───────────────── */

.legal {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 64px;
}
.legal-header {
  padding-bottom: 28px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.legal-header .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}
.legal-header .back:hover { color: var(--accent-dark); }
.legal-header h1 {
  font-size: 2rem;
  margin-bottom: 6px;
}
.legal-header .subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.legal-header .effective-date {
  font-size: 0.85rem;
  color: var(--muted-light);
}
.legal-body h2 {
  font-size: 1.3rem;
  margin-top: 40px;
  margin-bottom: 14px;
}
.legal-body h2:first-child { margin-top: 0; }
.legal-body h3 {
  font-size: 1.05rem;
  margin-top: 24px;
  margin-bottom: 10px;
}
.legal-body p,
.legal-body ul,
.legal-body ol {
  margin-bottom: 16px;
  color: var(--ink-soft);
  line-height: 1.8;
}
.legal-body ul, .legal-body ol {
  padding-left: 1.6rem;
}
.legal-body li { margin-bottom: 4px; }
.legal-body strong { color: var(--ink); }

/* ── 404 ──────────────────────────────────────────────────── */

.error-page {
  max-width: 520px;
  margin: 0 auto;
  padding: 120px 24px;
  text-align: center;
}
.error-code {
  font-size: 5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 12px;
}
.error-page p {
  color: var(--muted);
  margin-bottom: 28px;
}
.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}
.btn:hover {
  background: var(--accent-dark);
  color: var(--cream);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── Responsive (single breakpoint at 720px) ─────────────── */

@media (max-width: 720px) {
  body { font-size: 15px; }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.05rem; }

  .site-header-inner { padding: 11px 16px; gap: 10px; }
  .site-header-brand span { font-size: 0.95rem; }
  .site-header-brand img { width: 26px; height: 26px; }
  .site-header-nav { gap: 12px; }
  .site-header-link { font-size: 0.85rem; }
  .site-header-lang {
    padding: 5px 26px 5px 10px;
    font-size: 0.76rem;
    background-position: right 9px center;
  }

  .landing { padding: 24px 20px 32px; }
  .hero { padding: 32px 0 32px; }
  .hero-icon { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 20px; }
  .wordmark { font-size: 2.1rem; }
  .wordmark .en { font-size: 0.88rem; margin-top: 6px; }
  .tagline { font-size: 0.98rem; margin: 18px auto 26px; }
  .badges { gap: 10px; }
  .badges img { height: 44px; }

  .feature-grid { grid-template-columns: 1fr; gap: 12px; }
  .feature-card { padding: 22px 20px 20px; }
  .feature-icon { width: 38px; height: 38px; font-size: 16px; margin-bottom: 12px; }
  .feature-title { font-size: 1rem; }
  .feature-desc { font-size: 0.88rem; }

  .cta { padding: 36px 0 8px; margin-top: 24px; }
  .cta p { font-size: 0.96rem; margin-bottom: 22px; }

  .site-footer { margin-top: 48px; padding-top: 28px; }
  .footer-links a { margin: 0 8px; font-size: 0.85rem; }

  /* Docs: collapse to single column with drawer */
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    max-width: 100%;
  }
  .drawer-toggle {
    display: flex;
    min-height: 48px;
  }
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-height: none;
    background: var(--cream);
    box-shadow: var(--shadow-lg);
    padding: 24px 16px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 100;
    overflow-y: auto;
  }
  body.drawer-open .docs-sidebar {
    transform: translateX(0);
  }
  body.drawer-open .drawer-overlay {
    display: block;
  }
  .docs-content {
    padding: 24px 20px 56px;
    max-width: 100%;
  }
  .docs-content h1 { font-size: 1.8rem; }
  .docs-content h2 { font-size: 1.3rem; }
  .docs-content .subtitle { margin-bottom: 32px; font-size: 1rem; }
  .docs-content section { margin-bottom: 44px; }

  .legal { padding: 32px 20px 56px; }
  .legal-header { padding-bottom: 24px; margin-bottom: 28px; }
  .legal-header h1 { font-size: 1.6rem; }
  .legal-body h2 { font-size: 1.2rem; margin-top: 32px; }

  .error-page { padding: 72px 24px; }
  .error-code { font-size: 4rem; }
}

/* ── Reduced motion ──────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .slide { transition: none; }
  html { scroll-behavior: auto; }
  .hero .hero-icon,
  .hero .wordmark,
  .hero .tagline,
  .hero .badges { animation: none; opacity: 1; transform: none; }
  .caption { opacity: 1 !important; transform: none !important; }
}

/* ── Focus visibility ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
a:focus-visible {
  outline-offset: 4px;
}
