/*
 * Gymus 디자인 토큰 v0.1: 다른 화면에서도 그대로 가져다 쓰는 값만 정의
 * 팔레트·타이포 스케일은 TDS 공개 값, 화면은 의미 토큰(--bg, --text 등)만 참조
 * 다크 값은 TDS 다크 그레이 기준 추정치이며 공식 값 확인 필요
 */
:root {
    color-scheme: light dark;

    /* 팔레트 */
    --grey-50: #f9fafb;
    --grey-100: #f2f4f6;
    --grey-200: #e5e8eb;
    --grey-300: #d1d6db;
    --grey-400: #b0b8c1;
    --grey-500: #8b95a1;
    --grey-600: #6b7684;
    --grey-700: #4e5968;
    --grey-800: #333d4b;
    --grey-900: #191f28;
    --blue-50: #e8f3ff;
    --blue-300: #64a8ff;
    --blue-400: #4593fc;
    --blue-500: #3182f6;
    --blue-600: #2272eb;
    --blue-700: #1b64da;
    --blue-800: #1957c2;
    --red-50: #ffeeee;
    --red-300: #fb8890;
    --red-500: #f04452;
    --red-700: #d22030;
    --yellow-500: #ffc342;
    --green-300: #3fd599;
    --green-800: #028450;

    /* 의미 토큰: 라이트 */
    /* 밝은 회색 바탕 위에 테두리 없는 흰 카드, 입력칸은 회색 바탕(surface-2) */
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #ececf0;
    --border: #e5e5ea;
    --border-strong: #d2d2d7;
    --text: #1d1d1f;
    --text-2: #424245;
    --text-3: #6e6e73;
    --text-disabled: #a1a1a6;
    /* 흰 글자 대비 4.5:1 이상 */
    --primary: #0071e3;
    --primary-hover: #0062c4;
    --primary-weak: #e8f2fd;
    --text-link: #0066cc;
    --danger: #d70015;
    --danger-weak: #fdecee;
    --text-danger: #b3000f;
    --text-success: #1d7a36;
    /* 노출 중 상태 바탕, 확인이 필요한 안내(광고 이미지 비율 등) */
    --success-weak: #e6f6ea;
    --warn-weak: #fff4d6;
    --text-warn: #7a5200;
    --on-color: #ffffff;
    --focus-ring: rgba(0, 113, 227, 0.25);
    /* 켜진 스위치, 사이드바 바탕과 지금 메뉴 바탕, 떠 있는 저장 줄 바탕 */
    --switch-on: #34c759;
    --sidenav-bg: #fbfbfd;
    --nav-active: rgba(0, 0, 0, 0.07);
    --float-bg: rgba(255, 255, 255, 0.82);
    /* 빗금 표시(볼 수거 시간 등) */
    --hatch: var(--grey-500);
    /* 창 뒤 배경, 떠 있는 창 그림자 */
    --scrim: rgba(0, 0, 0, 0.36);
    --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.16);

    /* 실행 환경 배지 */
    --env-local: var(--grey-200);
    --env-local-text: var(--grey-700);
    --env-dev: var(--yellow-500);
    --env-dev-text: var(--grey-900);
    --env-prod: var(--red-700);
    --env-prod-text: #ffffff;

    /* 타이포 (TDS Typography 1-7) */
    --font-sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
    --t1: 30px; --t1-lh: 40px;
    --t2: 26px; --t2-lh: 35px;
    --t3: 22px; --t3-lh: 31px;
    --t4: 20px; --t4-lh: 29px;
    --t5: 17px; --t5-lh: 25.5px;
    --t6: 15px; --t6-lh: 22.5px;
    --t7: 13px; --t7-lh: 19.5px;

    /* 간격 */
    --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-16: 64px;

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

    /* 컨트롤 높이 */
    --control-sm: 30px;
    --control-md: 36px;
    --control-lg: 44px;

    /* 입력칸 폭: 담는 값의 길이로 정함 (숫자, 날짜, 코드, 이름·검색, 주소·제목) */
    --w-xs: 80px;
    --w-date: 148px;
    --w-md: 200px;
    --w-lg: 320px;
    --w-xl: 480px;
}

/* 의미 토큰: 다크. 직원이 테마를 고르지 않았으면 OS 설정 따름 (data-theme은 js/theme.js가 설정) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #161617;
        --surface: #1d1d1f;
        --surface-2: #2c2c2e;
        --border: #38383a;
        --border-strong: #48484a;
        --text: #f5f5f7;
        --text-2: #c7c7cc;
        --text-3: #a1a1a6;
        --text-disabled: #636366;
        --primary-hover: #0077ed;
        --primary-weak: #0a2a4d;
        --text-link: #2997ff;
        --danger: #ff453a;
        --danger-weak: #3a1215;
        --text-danger: #ff6961;
        --text-success: #30d158;
        --success-weak: #12301c;
        --warn-weak: #33270a;
        --text-warn: #ffd60a;
        --focus-ring: rgba(41, 151, 255, 0.4);
        --switch-on: #30d158;
        --sidenav-bg: #1a1a1c;
        --nav-active: rgba(255, 255, 255, 0.1);
        --float-bg: rgba(44, 44, 46, 0.82);
        --hatch: #a1a1a6;
        --scrim: rgba(0, 0, 0, 0.6);
        --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.5);
        --env-local: #38383a;
        --env-local-text: #e5e5ea;
    }
}
:root[data-theme="dark"] {
    --bg: #161617;
    --surface: #1d1d1f;
    --surface-2: #2c2c2e;
    --border: #38383a;
    --border-strong: #48484a;
    --text: #f5f5f7;
    --text-2: #c7c7cc;
    --text-3: #a1a1a6;
    --text-disabled: #636366;
    --primary-hover: #0077ed;
    --primary-weak: #0a2a4d;
    --text-link: #2997ff;
    --danger: #ff453a;
    --danger-weak: #3a1215;
    --text-danger: #ff6961;
    --text-success: #30d158;
    --success-weak: #12301c;
    --warn-weak: #33270a;
    --text-warn: #ffd60a;
    --focus-ring: rgba(41, 151, 255, 0.4);
    --switch-on: #30d158;
    --sidenav-bg: #1a1a1c;
    --nav-active: rgba(255, 255, 255, 0.1);
    --float-bg: rgba(44, 44, 46, 0.82);
    --hatch: #a1a1a6;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.5);
    --env-local: #38383a;
    --env-local-text: #e5e5ea;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
