/* ============================================================
   forksheet — 공통 디자인 시스템
   기존 simulator.css 토큰을 계승하되 사이트 전역으로 확장.
   ============================================================ */

:root {
  /* 표면 */
  --bg: #ffffff;
  --bg-secondary: #f6f7f9;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;

  /* 텍스트 */
  --text: #16181d;
  --text-secondary: #5a6270;
  --text-muted: #9aa2b1;

  /* 보더 */
  --border: #e4e7ec;
  --border-strong: #d0d5dd;

  /* 브랜드 */
  --primary: #2f6fed;
  --primary-hover: #1f57c9;
  --primary-light: #eaf1fe;
  --primary-dark: #12233f;

  /* 시맨틱 */
  --success: #12855c;
  --success-light: #e6f5ef;
  --warning: #b5760a;
  --warning-light: #fdf4e3;
  --danger: #c9372c;
  --danger-light: #fdeceb;

  /* 개인/가족 영역 색 */
  --me-accent: #6b4ee6;
  --me-light: #f0ecfd;
  --family-accent: #e0632f;
  --family-light: #fdf0e9;

  /* 그림자 */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 2px 6px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.1), 0 2px 6px rgba(16, 24, 40, 0.05);

  /* 형태 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  /* 타이포 */
  --font: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard',
          'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;

  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e14;
    --bg-secondary: #12161f;
    --bg-card: #161b26;
    --bg-elevated: #1c2230;
    --text: #e8edf5;
    --text-secondary: #9aa5b8;
    --text-muted: #5d6779;
    --border: #242b3a;
    --border-strong: #333c4e;
    --primary: #6a9bff;
    --primary-hover: #8ab2ff;
    --primary-light: #17233c;
    --primary-dark: #cfe0ff;
    --success: #3fc78c;
    --success-light: #12261f;
    --warning: #e0a63a;
    --warning-light: #2a2113;
    --danger: #f0716a;
    --danger-light: #2c1717;
    --me-accent: #a08cff;
    --me-light: #1d1a33;
    --family-accent: #ff8a5c;
    --family-light: #2a1c14;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
  }
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

/* ===== 헤더 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--me-accent) 100%);
  display: grid; place-items: center;
  color: #fff; font-size: 0.8rem; font-weight: 800;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  padding: 7px 13px;
  border-radius: var(--radius-full);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.nav a:hover { background: var(--bg-secondary); color: var(--text); }
.nav a.active { background: var(--primary-light); color: var(--primary); }

/* ===== 레이아웃 ===== */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 20px 72px;
}
.wrap-narrow { max-width: 720px; }

.page-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.page-sub {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 0.95rem;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin: 36px 0 14px;
}

/* ===== 카드 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
.card-link:hover .card {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ===== 영역 카드 (홈 허브) ===== */
.areas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.area-card {
  position: relative;
  overflow: hidden;
}
.area-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
}
.area-card.a-me::before { background: var(--me-accent); }
.area-card.a-family::before { background: var(--family-accent); }
.area-card.a-tools::before { background: var(--primary); }

.area-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 1.25rem;
  margin-bottom: 14px;
}
.a-me .area-icon { background: var(--me-light); }
.a-family .area-icon { background: var(--family-light); }
.a-tools .area-icon { background: var(--primary-light); }

.area-title {
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.area-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 6px;
}
.area-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== 태그/뱃지 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tag.tag-me { background: var(--me-light); color: var(--me-accent); border-color: transparent; }
.tag.tag-family { background: var(--family-light); color: var(--family-accent); border-color: transparent; }
.tag.tag-tools { background: var(--primary-light); color: var(--primary); border-color: transparent; }
.tag.tag-soon { background: var(--warning-light); color: var(--warning); border-color: transparent; }

/* ===== 버튼 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-secondary); color: var(--text); }
.btn-block { width: 100%; }

/* ===== 입력 ===== */
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ===== 게이트 (비밀번호) ===== */
.gate {
  max-width: 380px;
  margin: 12vh auto 0;
}
.gate .card { padding: 28px 24px; }
.gate-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-size: 1.5rem;
  margin: 0 auto 18px;
  background: var(--primary-light);
}
.gate h1 {
  font-size: 1.2rem;
  font-weight: 750;
  text-align: center;
  letter-spacing: -0.02em;
}
.gate p {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 8px 0 20px;
}
.gate-error {
  color: var(--danger);
  font-size: 0.84rem;
  margin-top: 10px;
  text-align: center;
  min-height: 1.2em;
}

/* ===== 리스트 ===== */
.list { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}
a.list-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-weight: 650; font-size: 0.95rem; }
.list-item-desc { color: var(--text-secondary); font-size: 0.84rem; margin-top: 3px; }

/* ===== 푸터 ===== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 56px;
  padding: 24px 20px 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ===== 유틸 ===== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 32px; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== 모션 최소화 ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ===== 모바일 ===== */
@media (max-width: 560px) {
  .wrap { padding: 24px 16px 56px; }
  .site-header-inner { padding: 10px 16px; gap: 10px; }
  .nav a { padding: 6px 11px; font-size: 0.84rem; }
  .card { padding: 16px; border-radius: var(--radius); }
}
