/* tokens.css — 연락처 손쉽게 추가 · 디자인 토큰 단일 출처
 *
 * 색은 OKLCH가 아니라 hex를 씁니다. Hallmark 기본 규칙에서 의도적으로 벗어난 부분으로,
 * 대상 사용자(65세+)의 구형 안드로이드 WebView에서 oklch()가 파싱되지 않으면
 * 색이 통째로 사라지기 때문입니다. 디자인 규칙보다 "기기에서 실제로 보이는 것"이 우선.
 *
 * 대비는 전부 흰 배경(라이트) / --surface-1(다크) 기준으로 실측했습니다.
 * 본문 4.5:1, 아이콘·큰글씨 3:1 (WCAG 2.1 AA).
 */

:root {
  /* ---- 면(surface) ---- */
  --bg: #f2f4f6;
  --surface-1: #ffffff;   /* 카드 */
  --surface-2: #f2f4f6;   /* 눌린 면·표 헤더 */
  --surface-3: #e9edf1;   /* 한 단계 더 */
  --line: #dde2e8;        /* 테두리 (흰 배경 대비 1.4:1 — 구조선이므로 허용) */
  --line-soft: #eef1f4;   /* 행 구분선 */

  /* ---- 글자 ---- */
  --text-1: #191f28;      /* 15.8:1  본문·제목 */
  --text-2: #4e5968;      /*  7.0:1  부제·설명 */
  /* --text-3은 흰 면(4.5:1)이 아니라 가장 어두운 배경인 --bg(#f2f4f6) 기준으로 잡습니다.
   * 흰 배경만 보고 정하면 회색 면 위에서 4.2:1로 미달합니다. */
  --text-3: #646e7b;      /*  --bg 위 4.7:1 · 흰 면 위 5.2:1 */
  --text-4: #8b95a1;      /*  3.0:1  아이콘·비활성 전용. 글자에 쓰지 말 것 */

  /* ---- 액센트 ----
   * --accent      : 테두리·아이콘·활성 표시 전용 (흰 배경 3.7:1)
   * --accent-fill : 글자를 얹는 모든 채움면. --on-accent와 5.4:1
   * --accent-ink  : 흰/연한 면 위의 파란 글자 (5.4:1)
   */
  --accent: #3182f6;
  --accent-fill: #1b64da;
  --accent-fill-hover: #1657bd;
  --accent-ink: #1b64da;
  --accent-tint: #eaf2ff;
  --on-accent: #ffffff;

  /* ---- 상태 ---- */
  --ok: #0f7a3d;
  --ok-tint: #e6f4ec;
  --warn-ink: #a15c00;    /* --warn-tint 위 4.7:1 */
  --warn-tint: #fdf3e5;
  --danger-ink: #c8323f;  /* 흰 배경 5.1:1 */
  --danger-tint: #fdecee;

  /* ---- 간격 (4pt) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ---- 타입 스케일 ----
   * 13px가 바닥선입니다(NF4 노년층). 시안의 11.5·12px는 전부 올렸습니다.
   */
  --text-xs: 13px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-md: 17px;
  --text-lg: 19px;
  --text-xl: 22px;
  --text-2xl: 26px;

  --lh-tight: 1.28;
  --lh-normal: 1.5;
  --lh-loose: 1.65;

  /* ---- 모서리 ---- */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* ---- 글꼴 ----
   * Pretendard는 로컬 번들이 없으면 조용히 폴백됩니다(시안의 실제 동작).
   * 폴백 전제로 자간·크기를 맞춰 두었으므로 번들 추가 여부와 무관하게 읽힙니다.
   */
  --font-body: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;

  /* ---- 모션 ---- */
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.7, 0, .84, 0);
  --ease-in-out: cubic-bezier(.87, 0, .13, 1);

  /* ---- 그림자 ---- */
  --shadow-1: 0 2px 8px rgba(25, 31, 40, .06);
  --shadow-2: 0 8px 22px -12px rgba(25, 31, 40, .28);

  /* ---- 터치 타깃 바닥선 (WCAG 2.5.8 + 노년층) ---- */
  --tap: 44px;

  color-scheme: light dark;
}

/* 다크모드 — 채움면 위 글자를 흰색이 아니라 어두운 잉크로 뒤집습니다.
 * 밝은 파랑(#4a90ff)에 흰 글자는 3.1:1로 미달, 어두운 잉크는 6.2:1로 통과.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12;
    --surface-1: #191b1f;
    --surface-2: #20232a;
    --surface-3: #272b33;
    --line: #333841;
    --line-soft: #23262d;

    --text-1: #f0f2f4;
    --text-2: #aab2bd;
    --text-3: #97a0ac;      /* --surface-1 대비 6.3:1 */
    --text-4: #626b78;      /* --surface-1 대비 3.2:1 */

    --accent: #4a90ff;
    --accent-fill: #4a90ff;
    --accent-fill-hover: #6aa5ff;
    --accent-ink: #a7c8ff;
    --accent-tint: #152238;
    --on-accent: #0e0f12;

    --ok: #4ade80;
    --ok-tint: #14301f;
    --warn-ink: #f0be6e;
    --warn-tint: #2c2415;
    --danger-ink: #ff8a93;
    --danger-tint: #2e1a1d;

    --shadow-1: 0 2px 10px rgba(0, 0, 0, .4);
    --shadow-2: 0 8px 22px -12px rgba(0, 0, 0, .6);
  }
}

/* 수동 토글(사용자가 명시적으로 고른 경우) — 미디어쿼리보다 우선 */
:root[data-theme="dark"] {
  --bg: #0e0f12;
  --surface-1: #191b1f;
  --surface-2: #20232a;
  --surface-3: #272b33;
  --line: #333841;
  --line-soft: #23262d;

  --text-1: #f0f2f4;
  --text-2: #aab2bd;
  --text-3: #97a0ac;
  --text-4: #626b78;

  --accent: #4a90ff;
  --accent-fill: #4a90ff;
  --accent-fill-hover: #6aa5ff;
  --accent-ink: #a7c8ff;
  --accent-tint: #152238;
  --on-accent: #0e0f12;

  --ok: #4ade80;
  --ok-tint: #14301f;
  --warn-ink: #f0be6e;
  --warn-tint: #2c2415;
  --danger-ink: #ff8a93;
  --danger-tint: #2e1a1d;

  --shadow-1: 0 2px 10px rgba(0, 0, 0, .4);
  --shadow-2: 0 8px 22px -12px rgba(0, 0, 0, .6);
}
