/* ============================================================
   공통 디자인 시스템  (홈페이지 + 모든 앱이 재사용)
   ============================================================ */

/* 기본 = 다크. 사용자가 토글로 light를 고르면 data-theme="light" 가 덮어씁니다.
   (초기 테마는 각 페이지 <head>의 인라인 스크립트가 localStorage에서 즉시 적용) */
:root {
  color-scheme: dark;
  --bg:          #0f1115;
  --surface:     #171a21;
  --surface-2:   #1f242d;
  --text:        #e7ebf0;
  --muted:       #99a2ad;
  --border:      #2a303a;
  --accent:      #6f9bff;
  --accent-weak: #1b2740;
  --accent-ink:  #0f1115;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  --radius:        14px;
  --maxw:          1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Noto Sans KR", "Apple SD Gothic Neo", Helvetica, Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:          #f6f7f9;
  --surface:     #ffffff;
  --surface-2:   #f0f2f5;
  --text:        #1b1f24;
  --muted:       #5c6670;
  --border:      #e3e7ec;
  --accent:      #3b6ef0;
  --accent-weak: #e8effe;
  --accent-ink:  #ffffff;
  --shadow:      0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

/* ---------- 상단 메뉴바 ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.navbar .container {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #9b5bff));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: .9rem;
}
.nav-links {
  margin-left: auto;
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0; margin-block: 0;
}
.nav-links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .95rem;
  font-weight: 500;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--accent-weak); }

/* 테마 토글 버튼 */
.theme-toggle {
  margin-left: 4px;
  width: 38px; height: 38px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- 히어로 ---------- */
.hero {
  padding: 56px 0 28px;
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

/* ---------- 섹션 제목 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 28px 0 16px;
}
.section-head h2 { margin: 0; font-size: 1.25rem; }
.section-head .hint { color: var(--muted); font-size: .9rem; }

/* ---------- 카드 그리드 ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding-bottom: 56px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card { color: inherit; }
a.card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 2px 4px rgba(16,24,40,.08), 0 18px 40px rgba(16,24,40,.14);
}
.card .thumb {
  height: 132px;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 120% at 100% 0%, var(--accent-weak), transparent 60%),
    var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.card .thumb svg { width: 72px; height: 72px; color: var(--accent); }
.card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .body h3 { margin: 0; font-size: 1.1rem; }
.card .body p { margin: 0; color: var(--muted); font-size: .92rem; }
.card .tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: .75rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge.soon { background: transparent; border-style: dashed; }

/* 해시태그 (카드 분류용 — 나중에 이 칩들을 읽어 그룹핑/필터 적용) */
.card .hashtags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.hashtag {
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
}
.hashtag::before { content: "#"; opacity: .6; margin-right: 1px; }

.card.placeholder {
  border-style: dashed;
  box-shadow: none;
  opacity: .8;
}
.card.placeholder .thumb { background: var(--surface-2); }
.card.placeholder .thumb svg { color: var(--muted); }

/* ---------- 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  font-size: .88rem;
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 520px) {
  .nav-links a { padding: 8px 9px; }
  .hero { padding-top: 40px; }
}
