/* Shared styles for bfcache before/after demos */

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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #666;
  --accent: #7c6af7;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  padding-top: 40px;
}

/* ─── Feed page ─────────────────────────────────────────────── */
.feed-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.feed-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.feed-header p {
  font-size: 0.8rem;
  color: var(--muted);
}

.feed-hint {
  background: #1a1a2e;
  border: 1px solid #2a2a5a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 1rem 1.5rem;
  font-size: 0.78rem;
  color: #8888cc;
  line-height: 1.5;
}

.feed-hint strong { color: #aaaaee; }

.feed-list {
  list-style: none;
}

.feed-item {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.feed-item:hover { background: #161616; }

.feed-item a {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 0.25rem 1rem;
  padding: 1.1rem 1.5rem;
  text-decoration: none;
  color: inherit;
}

.item-category {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  grid-column: 1;
}

.item-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  grid-column: 1;
}

.item-meta {
  font-size: 0.7rem;
  color: var(--muted);
  grid-column: 1;
  display: flex;
  gap: 0.75rem;
}

.item-thumbnail {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

/* ─── Article page ───────────────────────────────────────────── */
.article-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8rem;
  margin-bottom: 2rem;
  transition: color 0.15s;
}

.article-back:hover { color: var(--text); }

.article-category {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.article-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.article-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

.article-hero {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #1a1a2e, #2a1a3a);
}

.article-body p {
  font-size: 0.95rem;
  line-height: 1.75;
  color: #ccc;
  margin-bottom: 1.25rem;
}

.article-body h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}

/* ─── Light theme ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f8f8;
    --surface: #ffffff;
    --border: #e2e2e2;
    --text: #111111;
    --muted: #777777;
    --accent: #6c5ce7;
  }

  :root:not([data-theme="dark"]) .feed-item:hover { background: #f5f5f5; }

  :root:not([data-theme="dark"]) .feed-hint {
    background: #eeeefc;
    border-color: #c8c8ee;
    color: #6666aa;
  }
  :root:not([data-theme="dark"]) .feed-hint strong { color: #5555cc; }

  :root:not([data-theme="dark"]) .article-hero {
    background: linear-gradient(135deg, #e0e0ff, #f0e0ff);
  }

  :root:not([data-theme="dark"]) .article-body p { color: #444; }
}

:root[data-theme="light"] {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #111111;
  --muted: #777777;
  --accent: #6c5ce7;
}

html[data-theme="light"] .feed-item:hover { background: #f5f5f5; }

html[data-theme="light"] .feed-hint {
  background: #eeeefc;
  border-color: #c8c8ee;
  color: #6666aa;
}
html[data-theme="light"] .feed-hint strong { color: #5555cc; }

html[data-theme="light"] .article-hero {
  background: linear-gradient(135deg, #e0e0ff, #f0e0ff);
}

html[data-theme="light"] .article-body p { color: #444; }
