/*
 * 커피 기록 디자인 토큰. 색·글자·간격·모서리·그림자·움직임의 유일한 원본이다.
 * 계층: 원시 팔레트(--palette-*) → 역할 토큰(--color-*, --text-*, --space-* …) → 컴포넌트.
 * 컴포넌트·화면 CSS는 역할 토큰만 쓴다. 원시 값과 팔레트는 이 파일 밖에서 쓰지 않는다.
 * 규칙과 변경 절차: references/harness/design-system.md · 검사: python3 scripts/check_design.py
 */

@font-face {
  font-family: 'Pretendard Variable';
  src: url('/assets/fonts/PretendardVariable.woff2') format('woff2-variations');
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  /* 원시 팔레트: 따뜻한 모래색 중립 + 원두 갈색 + 상태 색 */
  --palette-sand-0: #ffffff;
  --palette-sand-25: #fbfaf7;
  --palette-sand-50: #f8f7f4;
  --palette-sand-100: #f3efe9;
  --palette-sand-150: #eeeae2;
  --palette-sand-200: #e9e5df;
  --palette-sand-300: #dcd7cc;
  --palette-sand-400: #c7b99f;
  --palette-sand-500: #9b9183;
  --palette-sand-700: #5f5b51;
  --palette-sand-800: #3e3a33;
  --palette-sand-900: #302c27;
  --palette-sand-950: #1b1916;
  --palette-brown-50: #f8f1e7;
  --palette-brown-100: #f4e7d4;
  --palette-brown-200: #e3d4c0;
  --palette-brown-400: #a98d71;
  --palette-brown-500: #79583e;
  --palette-brown-600: #6b4d32;
  --palette-brown-700: #513b2b;
  --palette-brown-300-dark: #c49a72;
  --palette-green-50: #edf1e9;
  --palette-green-600: #4e6248;
  --palette-blue-50: #eef3f6;
  --palette-blue-600: #4f6878;
  --palette-amber-50: #fbf3e6;
  --palette-amber-400: #c9a35d;
  --palette-amber-700: #7a5520;
  --palette-red-50: #f6ebe5;
  --palette-red-600: #a2382c;
  --palette-red-700: #863c2f;
  --palette-ink: 48 44 39;

  /* 표면: 바탕 → 보조 면 → 따뜻한 강조 면 → 눌린 면, 떠 있는 층과 반전 면 */
  --color-bg: var(--palette-sand-0);
  --color-surface: var(--palette-sand-0);
  --color-surface-subtle: var(--palette-sand-50);
  --color-surface-warm: var(--palette-sand-100);
  --color-surface-sunken: var(--palette-sand-150);
  --color-surface-raised: var(--palette-sand-0);
  --color-surface-hover: var(--palette-sand-50);
  --color-surface-inverse: var(--palette-sand-800);
  --color-overlay: rgb(var(--palette-ink) / .34);

  /* 글자: 본문 → 보조 → 흐림(메타) → 약함(자리표시·비활성) */
  --color-text: var(--palette-sand-900);
  --color-text-secondary: var(--palette-sand-700);
  --color-text-muted: #67615a;
  --color-text-subtle: #6e675e;
  --color-text-disabled: var(--palette-sand-500);
  --color-text-inverse: var(--palette-sand-0);

  /* 경계: 기본 구분선 → 입력·컨트롤 외곽 → 인용·장식 선 */
  --color-border: var(--palette-sand-200);
  --color-border-strong: var(--palette-sand-300);
  --color-border-accent: var(--palette-sand-400);

  /* 행동: 주 버튼·링크·선택 */
  --color-accent: var(--palette-brown-500);
  --color-accent-strong: var(--palette-brown-700);
  --color-accent-text: var(--palette-brown-600);
  --color-accent-soft: var(--palette-brown-100);
  --color-accent-subtle: var(--palette-brown-50);
  --color-accent-border: var(--palette-brown-200);
  --color-accent-muted: var(--palette-brown-400);
  --color-on-accent: var(--palette-sand-0);
  --color-focus-ring: var(--palette-brown-400);

  /* 상태: 배경·글자 쌍. 색만으로 의미를 전달하지 않고 글자와 함께 쓴다 */
  --color-success-bg: var(--palette-green-50);
  --color-success-text: var(--palette-green-600);
  --color-info-bg: var(--palette-blue-50);
  --color-info-text: var(--palette-blue-600);
  --color-warning-bg: var(--palette-amber-50);
  --color-warning-text: var(--palette-amber-700);
  --color-warning-dot: var(--palette-amber-400);
  --color-danger-bg: var(--palette-red-50);
  --color-danger-text: var(--palette-red-600);
  --color-danger-strong: var(--palette-red-700);

  /* 컵노트 향미 계열(점 표시 전용, 글자와 함께 씀) */
  --color-flavor-floral: #c58fb3;
  --color-flavor-citrus: #e2b23b;
  --color-flavor-berry: #a8455a;
  --color-flavor-stone: #e39a5b;
  --color-flavor-tropical: #d8c043;
  --color-flavor-sweet: #a16b3a;
  --color-flavor-nutty: #8a6a4b;
  --color-flavor-tea: #7f9a5c;
  --color-flavor-spice: #b5543a;
  --color-flavor-other: #9b9183;

  /* 로고·제품 사진 바탕: 두 테마 모두 밝게 유지 */
  --color-image-backdrop: var(--palette-sand-0);
  /* 로고·제품 사진 밝기: 다크에서만 낮춘다 */
  --image-filter: none;

  /* 차트 계열 */
  --color-chart-hot: #9b6f4d;
  --color-chart-ice: #7f9db0;
  --color-chart-espresso: #4f3a2b;

  /* 글자 */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 28px;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  /* 줄 간격: 제목·한 줄 UI는 tight·snug, 본문은 normal, 긴 글은 relaxed·loose */
  --leading-none: 1;
  --leading-tight: 1.3;
  --leading-snug: 1.45;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;
  --leading-loose: 1.9;
  /* 자간: 큰 글자일수록 좁힌다. 본문(md 이하)은 0 */
  --tracking-tight: -.025em;
  --tracking-tighter: -.04em;
  --tracking-display: -.055em;

  /* 간격: 4px 단위(작은 요소만 2px 반단계) */
  --space-05: 2px;
  --space-1: 4px;
  --space-15: 6px;
  --space-2: 8px;
  --space-25: 10px;
  --space-3: 12px;
  --space-35: 14px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;
  --space-30: 120px;

  /* 모서리 */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* 그림자: 경계 보조 → 떠 있는 카드 → 창·패널 */
  --shadow-sm: 0 1px 3px rgb(var(--palette-ink) / .06);
  --shadow-md: 0 6px 24px rgb(var(--palette-ink) / .08);
  --shadow-lg: 0 16px 65px rgb(var(--palette-ink) / .14);

  /* 레이아웃·층 */
  --layout-content: 1240px;
  --layout-sidebar: 224px;
  --control-height: 38px;
  --control-height-touch: 44px;
  /* 쌓임 순서: 컨테이너 안 고정 머리 → 앱 틀 → 대화 서랍 → 상세 패널 → 열린 선택 목록 → 알림 → 건너뛰기 링크 */
  --z-raised: 2;
  --z-chrome: 10;
  --z-drawer: 12;
  --z-popover: 20;
  --z-toast: 30;
  --z-skip: 100;

  /* 움직임 */
  --motion-fast: 120ms;
  --motion-normal: 200ms;
  --motion-loop: 1.4s;
  --motion-ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: light;
}

/* 다크 모드: 같은 역할 이름을 다시 정의한다. 시스템·밝게·어둡게 선택은 index.html의 테마 스크립트가
   data-theme(light|dark)로 확정하므로 다크 값은 이 블록 한 곳에만 둔다. */
:root[data-theme=dark] {
  --color-bg: #181614;
  --color-surface: #1f1d1a;
  --color-surface-subtle: #25221f;
  --color-surface-warm: #2b2723;
  --color-surface-sunken: #141210;
  --color-surface-raised: #272420;
  --color-surface-hover: #2c2925;
  --color-surface-inverse: #d8d1c6;
  --color-overlay: rgb(0 0 0 / .55);
  --color-text: #ddd6cb;
  --color-text-secondary: #c3bbaf;
  --color-text-muted: #a39b90;
  --color-text-subtle: #978f84;
  --color-text-disabled: #6f685f;
  --color-text-inverse: var(--palette-sand-950);
  --color-border: #35302a;
  --color-border-strong: #484137;
  --color-border-accent: #655646;
  --color-accent: #b48e6a;
  --color-accent-strong: #d4b08a;
  --color-accent-text: #cca47d;
  --color-accent-soft: #362c22;
  --color-accent-subtle: #28221c;
  --color-accent-border: #544434;
  --color-accent-muted: #987a5b;
  --color-on-accent: var(--palette-sand-950);
  --color-focus-ring: #b48e6a;
  --color-success-bg: #232c1d;
  --color-success-text: #a2bb95;
  --color-info-bg: #1d272d;
  --color-info-text: #9cb7c8;
  --color-warning-bg: #352a18;
  --color-warning-text: #d6ba84;
  --color-danger-bg: #36201b;
  --color-danger-text: #e2988b;
  --color-danger-strong: #d46a59;
  --color-chart-espresso: #c9a585;
  /* 이미지: 순백 바탕·밝은 사진이 어두운 화면에서 튀지 않게 */
  --color-image-backdrop: #d6cfc4;
  --image-filter: brightness(.86);
  /* 향미 점: 어두운 바탕에서 묻히는 짙은 색만 밝힌다 */
  --color-flavor-berry: #c4687a;
  --color-flavor-sweet: #b8875a;
  --color-flavor-nutty: #a68662;
  --color-flavor-tea: #93ac72;
  --color-flavor-spice: #c96d52;
  --color-chart-hot: #b58a68;
  --color-chart-ice: #8fadc0;
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .3);
  --shadow-md: 0 6px 24px rgb(0 0 0 / .35);
  --shadow-lg: 0 16px 65px rgb(0 0 0 / .5);
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-normal: 0ms;
  }
}
