/* chinamen.live
   Design notes: an ink-and-seal palette (muted vermillion + brass on a
   warm near-black), not the generic dark-mode-with-neon-accent look.
   Source Serif 4 for headings, Inter for UI text, Noto Serif/Sans SC
   as the matching pair for the Chinese version. One deliberate motion
   moment: the live-status pulse. Everything else holds still. */

:root {
  --serif: 'Source Serif 4', 'Noto Serif SC', Georgia, serif;
  --sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-card: 10px;
  --radius-pill: 999px;
  --radius-sm: 6px;

  --content-max: 1180px;
}

html[data-theme="dark"] {
  --bg: #171310;
  --surface: #201a15;
  --surface-raised: #29221b;
  --text: #ede6d9;
  --text-muted: #a89a86;
  --border: rgba(237, 230, 217, 0.09);
  --accent: #c1493a;
  --accent-strong: #d65c4b;
  --brass: #c9a15a;
  --offline-dim: 0.55;
  --shadow: 0 1px 0 rgba(0,0,0,0.4);
}

html[data-theme="light"] {
  --bg: #f2ede1;
  --surface: #faf7ee;
  --surface-raised: #ffffff;
  --text: #211c15;
  --text-muted: #6b5f4f;
  --border: rgba(33, 28, 21, 0.10);
  --accent: #a13327;
  --accent-strong: #8a2a20;
  --brass: #916321;
  --offline-dim: 0.6;
  --shadow: 0 1px 2px rgba(33,28,21,0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

/* ---------- brand mark ---------- */
.cml-mark {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  position: relative;
  flex: none;
}
.cml-mark::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  right: -3px;
  bottom: -3px;
  border-radius: 3px;
  background: var(--brass);
}

/* ---------- header ---------- */
.cml-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
}
.cml-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cml-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}
.cml-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cml-lang-toggle {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
}
.cml-lang-toggle:hover { color: var(--text); border-color: var(--accent); }

.cml-icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.cml-icon-btn:hover { border-color: var(--accent); }
.cml-icon--moon { display: none; }
html[data-theme="dark"] .cml-icon--sun { display: none; }
html[data-theme="dark"] .cml-icon--moon { display: block; }

/* ---------- main ---------- */
.cml-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.cml-intro { max-width: 62ch; margin-bottom: 24px; }
.cml-intro h1 { font-size: 1.7rem; }
.cml-intro p { color: var(--text-muted); margin: 0; }

.cml-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.cml-tabgroup, .cml-chipgroup {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cml-tab, .cml-chip-toggle {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 7px 13px;
  cursor: pointer;
}
.cml-tab.is-active, .cml-chip-toggle.is-active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.cml-tab .cml-count, .cml-chip-toggle .cml-count { opacity: 0.7; font-size: 0.85em; }

.cml-sortnote {
  margin: 0;
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---------- grid ---------- */
.cml-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}

.cml-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}
.cml-card:hover { border-color: var(--accent); }

.cml-thumb-wrap { position: relative; aspect-ratio: 4 / 3; background: var(--surface-raised); }
.cml-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cml-thumb--offline { filter: grayscale(1); opacity: var(--offline-dim); }

.cml-card-status {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 6px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
}
.cml-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #f4efe6;
  font-weight: 500;
}
.cml-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brass);
  flex: none;
}
.cml-status--offline .cml-dot { background: #8a8378; }
.cml-viewers, .cml-lastseen {
  margin-left: auto;
  font-weight: 400;
  color: #d9d1c2;
}

.cml-card-meta {
  padding: 9px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cml-username {
  font-size: 0.92rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cml-chips { display: flex; gap: 5px; }
.cml-chip {
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}

.cml-empty {
  grid-column: 1 / -1;
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
}

.cml-updated {
  margin: 22px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---------- FAQ ---------- */
.cml-faq { margin-top: 56px; max-width: 68ch; }
.cml-faq h2 { font-size: 1.3rem; }
.cml-faq-item { margin: 0 0 18px; }
.cml-faq-q { font-weight: 500; margin: 0 0 4px; }
.cml-faq-a { color: var(--text-muted); margin: 0; }

/* ---------- footer ---------- */
.cml-footer {
  border-top: 1px solid var(--border);
  padding: 22px 20px 40px;
}
.cml-footer p {
  max-width: var(--content-max);
  margin: 0 auto 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------- age gate ---------- */
.cml-agegate {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.cml-agegate[hidden] {
  display: none;
}
.cml-agegate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  max-width: 380px;
  padding: 28px 26px;
  text-align: center;
}
.cml-agegate-mark { margin: 0 0 14px; }
.cml-agegate-card h2 { font-size: 1.2rem; }
.cml-agegate-card p { color: var(--text-muted); margin: 0 0 18px; }
.cml-agegate-actions { display: flex; flex-direction: column; gap: 10px; }

.cml-btn {
  display: inline-block;
  text-decoration: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 0.92rem;
  font-family: var(--sans);
  cursor: pointer;
  border: 1px solid transparent;
}
.cml-btn--primary { background: var(--accent); color: #fff; }
.cml-btn--ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }

@media (min-width: 720px) {
  .cml-intro h1 { font-size: 2rem; }
  .cml-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
}
