/*
 * Picks 법적 문서 공용 스타일.
 *
 * 개인정보 처리방침 / 이용약관 정적 페이지가 공유한다.
 * privacy/assets/style.css 와 terms/assets/style.css 는 동일한 내용이다.
 * 디자인 토큰은 앱 팔레트를 따른다 (accent #9810FA, bg #FAF5FF, text #364153).
 */

:root {
  --accent: #9810FA;          /* 브랜드 보라색 강조색 */
  --accent-weak: #FAF5FF;     /* 강조색의 옅은 배경 */
  --accent-border: #E9D4FF;   /* 강조색 계열 보더 */
  --text: #364153;            /* 본문 텍스트 */
  --heading: #1B1F27;         /* 제목 텍스트 */
  --muted: #6B7280;           /* 보조 텍스트 */
  --border: #E5E7EB;          /* 기본 보더 */
  --border-strong: #D1D5DC;   /* 강한 보더 */
  --surface: #FFFFFF;         /* 표면(카드) 배경 */
  --bg: #F9FAFB;              /* 페이지 배경 */
  --radius: 12px;             /* 기본 모서리 둥글기 */
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.10);
  --maxw: 760px;              /* 본문 최대 너비 */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Pretendard 가 설치돼 있으면 사용하고, 없으면 시스템 폰트로 폴백한다. */
  font-family: 'Pretendard', 'Pretendard Variable', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', 'Segoe UI', 'Noto Sans KR', 'Hiragino Sans', 'Yu Gothic',
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* JS 가 로드되기 전 원본 텍스트(<pre>)는 화면 밖으로 숨긴다.
 * JS 가 꺼져 있으면 .no-js 폴백 규칙으로 다시 보이게 한다. */
#legal-source { display: none; }
.no-js #legal-source {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: var(--maxw);
  margin: 24px auto;
  padding: 0 20px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

/* ── 상단 바 (브랜드 + 언어 전환) ───────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
/* 상단 바 로고 (로그인 화면에서 쓰는 Picks 워드마크). */
.brand-logo {
  display: block;
  height: 26px;
  width: auto;
}

/* ── 본문 ─────────────────────────────────────────────────── */
.doc {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 20px 24px;
}
.doc-title {
  font-size: 26px;
  line-height: 1.3;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.doc-meta .chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid var(--accent-border);
}

.doc-body { font-size: 15px; }
/* 본문 단락 — 원본의 들여쓰기/줄바꿈을 보존한다. */
.doc-body p {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 12px;
  color: var(--text);
}
/* 조(Article) 제목 */
.doc-body h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.01em;
  margin: 30px 0 12px;
  padding-top: 4px;
}
.doc-body h2:first-child { margin-top: 0; }
/* 인트로(전문) 단락은 살짝 강조 */
.doc-body .intro {
  color: #4B5563;
  background: #F3F4F6;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
}

/* ── 하단 바 (시행일 버전 선택) ───────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.ver-label {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--muted);
}
.ver-label strong {
  font-size: 14px;
  color: var(--heading);
  font-weight: 600;
}
.footer-note {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ── 커스텀 셀렉트(버전 선택) ─────────────────────────────── */
.version-select { position: relative; }

.vs-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--heading);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.vs-button:hover { background: #FCFAFF; border-color: var(--accent-border); }
.vs-button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.18);
}
.vs-button .vs-current { flex: 1; text-align: left; white-space: nowrap; }
.vs-button .vs-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.version-select.open .vs-button {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(152, 16, 250, 0.18);
}
.version-select.open .vs-chevron { transform: rotate(180deg); }

/* 팝업 리스트 — 페이지 하단이므로 위쪽으로 펼친다. */
.vs-list {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.version-select.open .vs-list {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.vs-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  transition: background 0.12s ease;
}
.vs-option:hover,
.vs-option.focused { background: var(--accent-weak); }
.vs-option .vs-check {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
  visibility: hidden;
}
.vs-option[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.vs-option[aria-selected="true"] .vs-check { visibility: visible; }
.vs-option .vs-date { flex: 1; white-space: nowrap; }
.vs-option .vs-badge {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-weak);
  border: 1px solid var(--accent-border);
  padding: 1px 7px;
  border-radius: 999px;
}

/* ── 리다이렉트(index) 안내 화면 ──────────────────────────── */
.redirect-note {
  max-width: 420px;
  margin: 18vh auto 0;
  padding: 0 24px;
  text-align: center;
  color: var(--muted);
}
.redirect-note .brand-logo { height: 28px; margin: 0 auto 14px; }
.redirect-note a { color: var(--accent); font-weight: 600; }

/* ── 반응형 ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .doc { padding: 28px 18px 20px; }
  .doc-title { font-size: 22px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .version-select { width: 100%; }
  .vs-button { width: 100%; }
  .vs-list { left: 0; right: 0; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
