:root {
  --bg: #fafafa;
  --card-bg: #ffffff;
  --text: #14161a;
  --muted: #767b85;
  --accent: #2f6bff;
  --accent-soft: #eaf0ff;
  --border: #ececef;
  --header-bg: rgba(250, 250, 250, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0f;
    --card-bg: #16181d;
    --text: #eceef1;
    --muted: #8a8f99;
    --accent: #5b8dff;
    --accent-soft: rgba(91, 141, 255, 0.14);
    --border: #24262c;
    --header-bg: rgba(11, 12, 15, 0.85);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard",
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 헤더 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 20px 14px;
}

.site-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
}

.generated-at {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0;
}

/* 주제 이동 탭 */
.topic-nav {
  position: sticky;
  top: 61px;
  z-index: 19;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topic-nav-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.topic-nav-inner::-webkit-scrollbar { display: none; }

.topic-pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* 본문 */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px 64px;
}

.topic-section {
  padding-top: 28px;
  scroll-margin-top: 116px;
}

.topic-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topic-section h2::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.stale-notice {
  background: var(--accent-soft);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-bottom: 16px;
}

/* 카드 */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 720px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .card-image { aspect-ratio: 16 / 10; }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 720px) {
  .card-link { height: 100%; }
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--border);
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.card-link:active .card-image img {
  transform: scale(1.02);
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--muted);
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
  letter-spacing: -0.01em;
}

.summary {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--muted);
}

/* 푸터 */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  padding: 28px 20px 40px;
}
