/* BeautyBiz Mini App — WCAG AA, mobile-first, ≥16px body */

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #555555;
  --accent: #c0536a;
  --border: #e0e0e0;
  --rubric-bg: #f8f4f5;
  --rubric-text: #8b2a3e;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --text: #f0f0f0;
    --muted: #a0a0a0;
    --accent: #e07088;
    --border: #333333;
    --rubric-bg: #2a1f22;
    --rubric-text: #e07088;
  }
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding: 0 0 env(safe-area-inset-bottom) 0;
}

/* ── Typography ──────────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.75rem; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; margin: 1.5rem 0 0.5rem; }
p  { font-size: 1rem; margin-bottom: 1rem; }
a  { color: var(--accent); text-decoration: underline; }
a:hover { opacity: 0.8; }

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px;
}

/* ── Header bar ──────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
}
.header .back-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--accent);
  padding: 4px;
}
.header .title { font-weight: 600; font-size: 1rem; }

/* ── Rubric tag ──────────────────────────────────────────────── */
.rubric-tag {
  display: inline-block;
  background: var(--rubric-bg);
  color: var(--rubric-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Article ─────────────────────────────────────────────────── */
.article-header { margin-bottom: 1.25rem; }
.article-meta   { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.article-body   { font-size: 1.0625rem; }
.source-link    { font-size: 0.875rem; color: var(--muted); margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.source-link a  { color: var(--accent); }

/* ── Post list ───────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.post-list { padding: 0 16px; }

.post-card {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.post-card:last-child { border-bottom: none; }
.post-card:hover .post-title { color: var(--accent); }

.post-title   { font-size: 1rem; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.post-preview { font-size: 0.875rem; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-date    { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }

.stats-row {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  display: flex;
  gap: 10px;
}

/* ── Loading / empty states ──────────────────────────────────── */
.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 0.9rem;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px;
}
.pagination button {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
