/* ═══════════════════════════════════════════════════════════
   ChineseNameCraft.com — Design System v1.0
   Theme: Ink & Cinnabar (墨朱) — Dark, minimal, cultural
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds */
  --bg-primary:    #0C0E18;
  --bg-card:       #13151F;
  --bg-surface:    #1A1C28;
  --bg-hover:      #1F2130;

  /* Text */
  --text-primary:  #EDE8E0;
  --text-secondary:#9A96A3;
  --text-muted:    #58566080;

  /* Borders */
  --border:        #2A2B3A;
  --border-hover:  #C8402A;

  /* Accent: Cinnabar Red (朱砂) */
  --red:           #C8402A;
  --red-dim:       #8B2D1E;
  --red-glow:      rgba(200,64,42,0.15);
  --red-border:    rgba(200,64,42,0.35);

  /* Secondary accent: Ink Gold */
  --gold:          #B89040;
  --gold-dim:      rgba(184,144,64,0.15);

  /* Five elements (reused) */
  --wood:   #4A7A38;
  --fire:   #C8402A;
  --earth:  #A07820;
  --metal:  #909090;
  --water:  #1A4068;

  /* Typography */
  --font-serif:    'Playfair Display', Georgia, serif;
  --font-sans:     'Inter', system-ui, -apple-system, sans-serif;
  --font-cn:       'Noto Serif SC', serif;

  /* Shape */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --transition: all 0.22s ease-out;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
/* Allow text selection in inputs and results */
input, textarea, .selectable { user-select: text; -webkit-user-select: text; }

/* ── Nav ──────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 100; background: rgba(12,14,24,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.nav__inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; height: 60px; gap: 32px; }
.nav__logo { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; color: var(--text-primary); text-decoration: none; letter-spacing: -.01em; }
.nav__logo span { color: var(--red); }
.nav__links { display: flex; list-style: none; gap: 4px; margin-left: auto; }
.nav__links a { padding: 6px 12px; font-size: .875rem; font-weight: 500; color: var(--text-secondary); text-decoration: none; border-radius: var(--radius-sm); transition: var(--transition); }
.nav__links a:hover, .nav__links a.active { color: var(--text-primary); background: var(--bg-surface); }
.nav__hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; margin-left: auto; }
.nav__hamburger span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: var(--transition); }
@media(max-width:768px) {
  .nav__hamburger { display: flex; }
  .nav__links { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); flex-direction: column; padding: 12px 24px 20px; gap: 4px; }
  .nav__links.open { display: flex; }
}

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section--sm { padding: 48px 0; }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
.overline { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--red); font-weight: 600; }
.accent-bar { width: 40px; height: 3px; background: var(--red); border-radius: 2px; margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card:hover { border-color: rgba(200,64,42,0.2); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: var(--radius-md);
  font-size: .9375rem; font-weight: 600; cursor: pointer;
  border: none; transition: var(--transition); text-decoration: none;
}
.btn--red {
  background: var(--red); color: #fff;
  box-shadow: 0 4px 20px rgba(200,64,42,0.3);
}
.btn--red:hover { background: #d94730; box-shadow: 0 6px 24px rgba(200,64,42,0.45); transform: translateY(-1px); }
.btn--outline {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn--outline:hover { border-color: var(--red); color: var(--red); }
.btn--full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Form ─────────────────────────────────────────────────── */
label { font-size: .875rem; font-weight: 500; color: var(--text-secondary); }
input[type="text"], input[type="number"] {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-sans);
  transition: var(--transition);
  user-select: text;
  -webkit-user-select: text;
}
input:focus { outline: none; border-color: var(--red); background: var(--bg-hover); }
input::placeholder { color: var(--text-muted); }

/* ── Gender / Style Toggle ────────────────────────────────── */
.toggle-row { display: flex; gap: 8px; }
.toggle-btn {
  flex: 1; padding: 10px 8px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-surface);
  color: var(--text-secondary); font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-align: center;
}
.toggle-btn.selected {
  border-color: var(--red); color: var(--text-primary);
  background: var(--red-glow);
}
.toggle-btn:hover:not(.selected) { border-color: rgba(200,64,42,0.4); color: var(--text-primary); }

/* Style grid */
.style-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.style-btn {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 12px; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg-surface);
}
.style-btn.selected { border-color: var(--red); background: var(--red-glow); }
.style-btn:hover:not(.selected) { border-color: rgba(200,64,42,0.3); }
.style-btn__icon { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.style-btn__name { font-size: .875rem; font-weight: 600; color: var(--text-primary); }
.style-btn__desc { font-size: .7rem; color: var(--text-muted); margin-top: 3px; }

/* Vibe chips */
.vibe-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.vibe-chip {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-size: .8125rem; cursor: pointer; transition: var(--transition);
  color: var(--text-secondary); background: var(--bg-surface);
}
.vibe-chip.selected { border-color: var(--red); color: var(--text-primary); background: var(--red-glow); }

/* ── Results ──────────────────────────────────────────────── */
.results-grid { display: grid; gap: 16px; margin-top: 24px; }
.name-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  animation: fadeUp .4s ease-out both;
  position: relative; overflow: hidden;
}
.name-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--red), transparent);
}
.name-card__rank {
  position: absolute; top: 16px; right: 18px;
  font-size: .7rem; color: var(--text-muted); letter-spacing: .06em;
}
.name-card__chinese {
  font-family: var(--font-cn); font-size: 3rem; color: var(--red);
  line-height: 1; margin-bottom: 8px; display: block;
}
.name-card__pinyin { font-size: 1rem; color: var(--gold); font-style: italic; margin-bottom: 4px; }
.name-card__meaning { font-size: .9375rem; color: var(--text-primary); font-weight: 600; margin-bottom: 12px; }
.name-card__chars { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.char-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.char-pill__glyph { font-family: var(--font-cn); font-size: 1.5rem; color: var(--red); }
.char-pill__info { font-size: .75rem; color: var(--text-secondary); line-height: 1.5; }
.char-pill__info strong { color: var(--text-primary); display: block; }
.name-card__meta { font-size: .8rem; color: var(--text-muted); }
.name-card__actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.action-btn {
  padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-surface); color: var(--text-secondary);
  font-size: .8rem; cursor: pointer; transition: var(--transition);
}
.action-btn:hover { border-color: var(--red); color: var(--text-primary); }

/* ── Privacy badge ────────────────────────────────────────── */
.privacy-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .75rem; color: var(--text-muted);
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px;
}

/* ── Advanced Options ─────────────────────────────────────── */
.advanced-toggle {
  background: none; border: none; color: var(--text-muted);
  font-size: .8125rem; cursor: pointer; padding: 8px 0;
  display: flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.advanced-toggle:hover { color: var(--text-primary); }
.advanced-panel { display: none; margin-top: 12px; padding: 16px; background: var(--bg-surface); border-radius: var(--radius-md); border: 1px solid var(--border); }
.advanced-panel.open { display: block; }

/* ── Feature section ──────────────────────────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 20px; }
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  transition: var(--transition);
}
.feature-card:hover { border-color: var(--red-border); transform: translateY(-2px); }
.feature-card__icon { font-size: 2rem; margin-bottom: 14px; display: block; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.feature-card p { font-size: .875rem; color: var(--text-secondary); line-height: 1.65; }

/* ── Trust bar ────────────────────────────────────────────── */
.trust-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 24px; flex-wrap: wrap; padding: 16px 24px;
  background: var(--bg-card); border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.trust-item { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--text-secondary); }
.trust-item span:first-child { font-size: 1rem; }

/* ── FAQ ──────────────────────────────────────────────────── */
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  width: 100%; background: none; border: none;
  text-align: left; padding: 18px 0;
  font-size: .9375rem; font-weight: 600; color: var(--text-primary);
  cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  transition: var(--transition);
}
.faq-q:hover { color: var(--red); }
.faq-q::after { content: '+'; font-size: 1.2rem; color: var(--text-muted); transition: var(--transition); flex-shrink: 0; }
.faq-q.open::after { content: '−'; color: var(--red); }
.faq-a { display: none; padding: 0 0 18px; font-size: .9rem; color: var(--text-secondary); line-height: 1.75; }
.faq-a.open { display: block; }

/* ── Popular Names Grid ───────────────────────────────────── */
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
.name-tile {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px 14px;
  text-align: center; text-decoration: none;
  transition: var(--transition); display: block;
}
.name-tile:hover { border-color: var(--red-border); transform: translateY(-1px); }
.name-tile__cn { font-family: var(--font-cn); font-size: 1.6rem; color: var(--red); display: block; margin-bottom: 4px; line-height: 1.2; }
.name-tile__en { font-size: .8125rem; color: var(--text-secondary); }

/* ── Loader ───────────────────────────────────────────────── */
.loader {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--red); border-radius: 50%;
  animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }

/* ── Hero layout ──────────────────────────────────────────── */
.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 52px;
  align-items: start;
}
@media(max-width: 900px) {
  .hero-layout { grid-template-columns: 1fr; }
  .hero-right { display: none; }
}

/* ── Decorative Chinese chars (hero bg) ──────────────────── */
.hero-deco {
  position: absolute; right: 0; top: 0; bottom: 0;
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; gap: 8px; opacity: .04; pointer-events: none;
  font-family: var(--font-cn); font-size: 5rem; line-height: 1.1;
  color: var(--red); writing-mode: vertical-rl; letter-spacing: .1em;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer { padding: 56px 0 0; border-top: 1px solid var(--border); background: var(--bg-card); }
.footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
.footer__brand p { font-size: .875rem; color: var(--text-secondary); line-height: 1.7; margin-top: 12px; }
.footer__col h5 { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--red); margin-bottom: 14px; }
.footer__col ul { list-style: none; }
.footer__col li { margin-bottom: 8px; }
.footer__col a { font-size: .875rem; color: var(--text-secondary); text-decoration: none; transition: var(--transition); }
.footer__col a:hover { color: var(--text-primary); }
.footer__bottom { padding: 20px 0 28px; text-align: center; border-top: 1px solid rgba(255,255,255,.05); margin-top: 8px; }
.footer__disclaimer { font-size: .78rem; color: var(--text-muted); line-height: 1.7; max-width: 600px; margin: 0 auto 10px; }
.footer__copy { font-size: .8rem; color: var(--text-muted); }
.footer__copy a { color: var(--text-muted); text-decoration: none; }
.footer__copy a:hover { color: var(--red); }
@media(max-width: 768px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media(max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
  .style-grid { grid-template-columns: 1fr 1fr; }
}
