/* VanStyle · 温圈 — mobile-first light shell
   Forced-light surfaces so OS dark mode does not invert cards. */

@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap");

:root {
  color-scheme: light;
  --vs-bg: #f5f5f7;
  --vs-bg-glow-a: rgba(196, 30, 58, 0.06);
  --vs-bg-glow-b: rgba(15, 23, 42, 0.04);
  --vs-surface: #ffffff;
  --vs-surface-2: #f8fafc;
  --vs-ink: #0f172a;
  --vs-ink-soft: #334155;
  --vs-muted: #64748b;
  --vs-line: #e2e8f0;
  --vs-line-strong: #cbd5e1;
  --vs-brand: #c41e3a;
  --vs-brand-deep: #9f1239;
  --vs-brand-soft: #fff1f2;
  --vs-brand-ring: rgba(196, 30, 58, 0.22);
  --vs-ad: #b45309;
  --vs-ad-bg: #fffbeb;
  --vs-ai: #4338ca;
  --vs-ai-bg: #eef2ff;
  --vs-ok: #15803d;
  --vs-danger: #b91c1c;
  --vs-danger-bg: #fef2f2;
  --vs-radius: 12px;
  --vs-radius-sm: 10px;
  --vs-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --vs-nav-h: 64px;
  --vs-safe-bottom: env(safe-area-inset-bottom, 0px);
  --vs-safe-top: env(safe-area-inset-top, 0px);
  --vs-font: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --vs-font-brand: "Outfit", var(--vs-font);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html { color-scheme: light; }

body {
  font-family: var(--vs-font);
  color: var(--vs-ink);
  background:
    radial-gradient(120% 80% at 0% -10%, var(--vs-bg-glow-a), transparent 55%),
    radial-gradient(100% 70% at 100% 0%, var(--vs-bg-glow-b), transparent 50%),
    var(--vs-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

a { color: var(--vs-brand-deep); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
.chip:focus-visible,
.icon-btn:focus-visible,
.topic:focus-visible,
.chooser a:focus-visible,
.feed-card:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--vs-brand);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: transparent;
  position: relative;
  padding-bottom: calc(var(--vs-nav-h) + var(--vs-safe-bottom) + 12px);
}

/* ── Top bar ───────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.7rem + var(--vs-safe-top)) 1rem 0.7rem;
  background: #ffffff;
  border-bottom: 1px solid var(--vs-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--vs-ink);
  min-height: 44px;
  max-width: calc(100% - 6.5rem);
}
.brand-logo {
  display: block;
  height: 40px;
  width: auto;
  max-width: 112px;
  object-fit: contain;
  object-position: left center;
  border-radius: 8px;
  background: #000;
  flex: none;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--vs-font-brand);
  font-weight: 700;
  font-size: 1.05rem;
  background: #000;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.45);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.brand-text strong {
  font-family: var(--vs-font-brand);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-text small {
  font-size: 0.72rem;
  color: var(--vs-muted);
  font-weight: 500;
}

.topbar-actions { display: flex; gap: 0.4rem; }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--vs-ink);
  background: var(--vs-surface-2);
  border: 1px solid var(--vs-line);
  font-size: 1.05rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  background: #fff;
  border-color: var(--vs-line-strong);
}

/* ── Page chrome ───────────────────────────────────── */
.page {
  padding: 0.85rem 1rem 1.5rem;
  animation: vs-fade-up 0.28s ease both;
}
@keyframes vs-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-size: clamp(1.25rem, 4.5vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.15rem 0 0.85rem;
  color: var(--vs-ink);
  line-height: 1.25;
}
.page-lead {
  margin: -0.35rem 0 1rem;
  color: var(--vs-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}
.hint {
  color: var(--vs-muted);
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0.75rem 0 0;
}
.section-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 1.1rem 0 0.7rem;
  padding-left: 0.55rem;
  border-left: 3px solid var(--vs-brand);
  color: var(--vs-ink);
}
.section-title[data-cat="local"] { border-color: #d81e2e; }
.section-title[data-cat="immigration"] { border-color: #6366f1; }
.section-title[data-cat="realestate"] { border-color: #0d9488; }
.section-title[data-cat="finance"] { border-color: #f59e0b; }
.section-title[data-cat="education"] { border-color: #2563eb; }
.section-title[data-cat="jobs"] { border-color: #0891b2; }
.section-title[data-cat="life"] { border-color: #ec4899; }
.section-title[data-cat="health"] { border-color: #16a34a; }
.section-title[data-cat="community"] { border-color: #ea580c; }
.section-title[data-cat="canada"] { border-color: #8b5cf6; }

.panel {
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius);
  box-shadow: var(--vs-shadow);
  padding: 1.1rem 1rem;
}

/* ── Chips / topics ────────────────────────────────── */
.area-row,
.topic-row {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.area-row::-webkit-scrollbar,
.topic-row::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--vs-line);
  background: var(--vs-surface);
  color: var(--vs-ink-soft);
  border-radius: 999px;
  min-height: 40px;
  padding: 0.4rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chip.active {
  background: var(--vs-brand-soft);
  border-color: #fecdd3;
  color: var(--vs-brand-deep);
  font-weight: 700;
}

.topic {
  flex: none;
  width: 4.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--vs-ink);
  font-size: 0.76rem;
  font-weight: 500;
}
.topic-ico {
  display: grid;
  place-items: center;
  width: 3.15rem;
  height: 3.15rem;
  margin: 0 auto 0.35rem;
  border-radius: 16px;
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  box-shadow: var(--vs-shadow);
  font-size: 1.15rem;
}

/* ── Feed / featured ───────────────────────────────── */
.featured { margin-top: 0.85rem; }
.featured-card {
  display: block;
  text-decoration: none;
  color: var(--vs-ink);
  background: var(--vs-surface);
  border-radius: var(--vs-radius);
  overflow: hidden;
  border: 1px solid var(--vs-line);
  box-shadow: var(--vs-shadow);
}
.featured-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #e2e8f0;
}
.featured-meta { padding: 0.9rem 1rem 1.05rem; }
.featured-meta h1 {
  font-size: clamp(1.05rem, 3.8vw, 1.2rem);
  margin: 0.4rem 0 0.35rem;
  line-height: 1.35;
  font-weight: 700;
}
.featured-meta p {
  margin: 0;
  color: var(--vs-muted);
  font-size: 0.8rem;
}

.feed-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--vs-ink);
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  border-radius: var(--vs-radius);
  padding: 0.9rem;
  margin-bottom: 0.65rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.feed-card:hover {
  border-color: var(--vs-line-strong);
  box-shadow: var(--vs-shadow);
}
.feed-body h3 {
  margin: 0.25rem 0;
  font-size: 0.98rem;
  line-height: 1.35;
  font-weight: 650;
}
.feed-body p {
  margin: 0.2rem 0;
  color: var(--vs-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}
.feed-body small {
  color: #94a3b8;
  font-size: 0.75rem;
}
.feed-thumb {
  width: 84px;
  height: 84px;
  border-radius: var(--vs-radius-sm);
  object-fit: cover;
  background: #e2e8f0;
}
.feed.muted .feed-card { background: var(--vs-surface-2); }

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--vs-ai-bg);
  color: var(--vs-ai);
  margin-right: 0.25rem;
}
.badge-ad { background: var(--vs-ad-bg); color: var(--vs-ad); }
.badge-ai { background: var(--vs-ai-bg); color: var(--vs-ai); }
.feed-tags { margin-bottom: 0.15rem; }

/* ── Bottom nav ────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  height: calc(var(--vs-nav-h) + var(--vs-safe-bottom));
  padding: 0.3rem 0.35rem var(--vs-safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #ffffff;
  border-top: 1px solid var(--vs-line);
  z-index: 30;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  text-decoration: none;
  color: var(--vs-muted);
  font-size: 0.68rem;
  font-weight: 600;
  min-height: 44px;
  border-radius: 10px;
  transition: color 0.15s ease, background 0.15s ease;
}
.bottom-nav a.active {
  color: var(--vs-brand);
  background: var(--vs-brand-soft);
}
.nav-ico { font-size: 1.12rem; line-height: 1; }

/* ── Buttons / forms ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1.1rem;
  border-radius: var(--vs-radius);
  background: linear-gradient(145deg, var(--vs-brand), var(--vs-brand-deep));
  color: #fff !important;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 10px 20px -10px rgba(196, 30, 58, 0.55);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.03); box-shadow: 0 12px 24px -10px rgba(196, 30, 58, 0.6); }
.btn:active { transform: translateY(1px) scale(0.997); }
.btn-secondary {
  background: var(--vs-surface);
  color: var(--vs-ink) !important;
  border: 1px solid var(--vs-line);
  box-shadow: none;
}
.btn-secondary:hover { filter: none; background: var(--vs-surface-2); border-color: var(--vs-line-strong); }
.btn-row { display: grid; gap: 0.6rem; margin-top: 1rem; }

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.95rem;
}
.field label {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--vs-ink);
}
.field .help {
  font-size: 0.78rem;
  color: var(--vs-muted);
  margin: 0;
}
.field-input,
.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"],
.search-form input {
  width: 100%;
  min-height: 48px;
  border-radius: var(--vs-radius);
  border: 1.5px solid var(--vs-line);
  background: #fff;
  color: var(--vs-ink);
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:hover,
.auth-form input:hover,
.search-form input:hover {
  border-color: var(--vs-line-strong);
}
.field-input:focus,
.auth-form input:focus,
.search-form input:focus {
  border-color: var(--vs-brand);
  box-shadow: 0 0 0 4px var(--vs-brand-ring);
  outline: none;
}
.field-input::placeholder,
.auth-form input::placeholder,
.search-form input::placeholder {
  color: #94a3b8;
}

.auth-card .auth-form { margin-top: 0.25rem; }
.auth-brand {
  display: flex;
  justify-content: center;
  margin: 0 0 1rem;
}
.auth-logo {
  display: block;
  width: min(100%, 280px);
  height: auto;
  border-radius: 12px;
  background: #000;
}
.branding-form { margin-top: 1.1rem; }
.brand-preview-label { margin-top: 0; }
.brand-preview .auth-logo { width: min(100%, 200px); }
.field input[type="file"] {
  width: 100%;
  font-size: 0.9rem;
  color: var(--vs-ink);
}
.flash-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.flash {
  padding: 0.7rem 0.85rem;
  border-radius: var(--vs-radius-sm);
  font-size: 0.88rem;
  line-height: 1.4;
  border: 1px solid var(--vs-line);
  background: var(--vs-surface);
  color: var(--vs-ink);
}
.flash-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: var(--vs-ok);
}
.flash-error {
  background: var(--vs-danger-bg);
  border-color: #fecaca;
  color: var(--vs-danger);
}
.auth-card .errorlist {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--vs-radius-sm);
  background: var(--vs-danger-bg);
  border: 1px solid #fecaca;
  color: var(--vs-danger);
  font-size: 0.86rem;
  line-height: 1.4;
}
.auth-card .errorlist li { margin: 0; }
.auth-sub {
  margin: 0 0 1.15rem;
  color: var(--vs-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.auth-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.86rem;
  color: var(--vs-muted);
}
.auth-foot a {
  color: var(--vs-brand-deep);
  font-weight: 650;
  text-decoration: none;
}
.auth-foot a:hover { text-decoration: underline; }

.chooser { display: grid; gap: 0.55rem; }
.chooser a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0.9rem 1rem;
  border-radius: var(--vs-radius);
  background: var(--vs-surface);
  border: 1px solid var(--vs-line);
  text-decoration: none;
  color: var(--vs-ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chooser a::after {
  content: "›";
  color: var(--vs-muted);
  font-size: 1.2rem;
  font-weight: 400;
}
.chooser a:hover {
  border-color: #fecdd3;
  background: var(--vs-brand-soft);
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.search-form button {
  border: none;
  border-radius: var(--vs-radius);
  background: linear-gradient(145deg, var(--vs-brand), var(--vs-brand-deep));
  color: #fff;
  padding: 0 1.1rem;
  font-weight: 700;
  min-height: 48px;
  cursor: pointer;
  touch-action: manipulation;
}

.empty {
  padding: 1.25rem 1rem;
  color: var(--vs-muted);
  background: var(--vs-surface);
  border: 1px dashed var(--vs-line);
  border-radius: var(--vs-radius);
  text-align: center;
  line-height: 1.5;
}
.empty code {
  font-size: 0.78rem;
  background: var(--vs-surface-2);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  color: var(--vs-ink-soft);
}

.profile-card .uname {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.profile-card .meta {
  margin: 0;
  color: var(--vs-muted);
  font-size: 0.88rem;
}

.article h1 {
  font-size: clamp(1.25rem, 4.2vw, 1.45rem);
  line-height: 1.3;
  margin: 0.5rem 0;
}
.article .meta { color: var(--vs-muted); font-size: 0.85rem; }
.article-hero {
  width: 100%;
  border-radius: var(--vs-radius);
  margin: 0.85rem 0;
  border: 1px solid var(--vs-line);
}
.article .lead {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--vs-ink-soft);
}

/* OS dark mode: keep forced-light readable surfaces */
@media (prefers-color-scheme: dark) {
  body {
    background: var(--vs-bg);
    color: var(--vs-ink);
  }
  .topbar,
  .bottom-nav,
  .panel,
  .feed-card,
  .featured-card,
  .chooser a,
  .empty,
  .chip,
  .topic-ico {
    background: #ffffff;
    color: var(--vs-ink);
  }
}

@media (min-width: 640px) {
  .btn { width: auto; min-width: 10rem; }
  .btn-row { grid-template-columns: auto auto; justify-content: start; }
}

@media (min-width: 768px) {
  .app-shell {
    box-shadow: 0 0 0 1px var(--vs-line), 0 24px 60px -30px rgba(15, 23, 42, 0.2);
    background: rgba(255, 255, 255, 0.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page { animation: none; }
  .btn, .icon-btn, .chip, .feed-card, .chooser a { transition: none; }
}
