/* ============================================
   NomadingSpot 디자인 토큰 — A안 "소프트 미니멀"
   - 모든 색·간격·모서리·그림자·글자 크기는 여기서만 정의한다.
   - 컴포넌트 CSS(style.css)는 하드코딩 값 대신 이 변수를 쓴다.
   - 하단 "레거시 별칭"은 기존 style.css 변수명을 새 토큰에 연결한다.
     (Phase 2에서 화면별로 정리하면서 제거 예정)
   ============================================ */

:root {
    /* ---------- 원시 팔레트 (직접 쓰지 말고 아래 시맨틱 토큰 사용) ---------- */
    --green-50:  #E7F4EC;
    --green-100: #C9E8D5;
    --green-500: #16794C;   /* 흰 배경 대비 5.4:1 */
    --green-600: #0F5C39;
    --green-700: #0B4A2E;

    --grey-0:   #FFFFFF;
    --grey-50:  #F7F8FA;
    --grey-100: #F2F4F6;
    --grey-200: #E5E8EB;
    --grey-300: #D1D6DB;
    --grey-400: #B0B8C1;
    --grey-500: #8B95A1;
    --grey-600: #6B7684;    /* 흰 배경 대비 4.6:1 — 보조 텍스트 최저선 */
    --grey-700: #4E5968;
    --grey-800: #333D4B;
    --grey-900: #191F28;

    --red-50:  #FEECEB;
    --red-200: #FBC7C3;
    --red-500: #D92D20;
    --red-700: #B42318;

    --amber-50:  #FFF6E0;
    --amber-200: #FCE3A6;
    --amber-500: #E8A317;
    --amber-700: #93590B;

    --blue-50:  #E8F1FD;
    --blue-200: #BCD5F8;
    --blue-500: #1B64DA;
    --blue-700: #1550B0;

    /* ---------- 시맨틱: 브랜드 ---------- */
    --brand:          var(--green-500);
    --brand-strong:   var(--green-600);
    --brand-weak:     var(--green-50);
    --on-brand:       #FFFFFF;
    --brand-tint-rgb: 22, 121, 76;   /* rgba(var(--brand-tint-rgb), .1) 용 */

    /* ---------- 시맨틱: 표면/텍스트/선 ---------- */
    --surface-page:    var(--grey-50);
    --surface-card:    var(--grey-0);
    --surface-sunken:  var(--grey-100);
    --surface-overlay: rgba(25, 31, 40, 0.48);

    --text-strong: var(--grey-900);
    --text-normal: var(--grey-700);
    --text-weak:   var(--grey-600);
    --text-disabled: var(--grey-400);

    --line:        var(--grey-200);
    --line-strong: var(--grey-300);
    --toast-bg:    rgba(25, 31, 40, 0.94);
    --toast-text:  #FFFFFF;

    /* ---------- 시맨틱: 상태 ---------- */
    --success:        var(--green-500);
    --success-bg:     var(--green-50);
    --success-border: var(--green-100);
    --success-text:   var(--green-600);

    --danger:         var(--red-500);
    --danger-bg:      var(--red-50);
    --danger-border:  var(--red-200);
    --danger-text:    var(--red-700);

    --warning:        var(--amber-500);
    --warning-bg:     var(--amber-50);
    --warning-border: var(--amber-200);
    --warning-text:   var(--amber-700);

    --info:           var(--blue-500);
    --info-bg:        var(--blue-50);
    --info-border:    var(--blue-200);
    --info-text:      var(--blue-700);

    /* ---------- 타이포 ---------- */
    --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    --font-xs:  0.75rem;    /* 12px 캡션 */
    --font-sm:  0.8125rem;  /* 13px 보조 */
    --font-base: 0.9375rem; /* 15px 본문 */
    --font-md:  1rem;       /* 16px 강조 본문 */
    --font-lg:  1.125rem;   /* 18px 소제목 */
    --font-xl:  1.375rem;   /* 22px 제목 */
    --font-2xl: 1.625rem;   /* 26px 대제목 */
    --font-3xl: 1.75rem;    /* 28px 상태 숫자 */
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-bold: 700;
    --weight-heavy: 800;
    --tracking-tight: -0.02em;

    /* ---------- 간격 (4px 단위) ---------- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* ---------- 모서리 ---------- */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* ---------- 그림자 ---------- */
    --shadow-sm: 0 1px 3px rgba(25, 31, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(25, 31, 40, 0.08);
    --shadow-lg: 0 12px 32px rgba(25, 31, 40, 0.12);
    --focus-ring: 0 0 0 3px rgba(var(--brand-tint-rgb), 0.28);

    /* ---------- 모션 ---------- */
    --ease-out: cubic-bezier(0.2, 0, 0, 1);
    --transition-fast: 0.15s var(--ease-out);
    --transition-base: 0.25s var(--ease-out);
    --transition-slow: 0.4s var(--ease-out);

    /* ---------- 레이아웃 ---------- */
    --bottom-nav-height: 56px;
    --bottom-nav-bottom: 0px;
    --tab-content-bottom: 56px;
    --drawer-peek-height: 48px;
    --drawer-bottom: 0px;
    --drawer-max-height: min(80dvh, 80vh, 600px);
    --top-search-bar-height: 52px;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    /* ---------- 레거시 별칭 (기존 style.css 변수명) ---------- */
    --primary-color: var(--brand);
    --primary: var(--brand);
    --primary-dark: var(--brand-strong);
    --secondary-color: var(--brand);
    --accent-color: var(--text-strong);
    /* 그라데이션 폐기: 기존 background/background-clip:text 사용처가 깨지지 않도록 단색 그라데이션으로 둔다 */
    --primary-gradient: linear-gradient(var(--brand), var(--brand));

    --bg-primary: var(--surface-card);
    --bg-secondary: var(--surface-page);
    --bg-tertiary: var(--surface-sunken);
    /* 글래스모피즘 폐기: 불투명 표면 + 블러 없음 */
    --bg-glass: var(--surface-card);
    --bg-glass-hover: var(--grey-50);
    --blur-sm: none;
    --blur-md: none;
    --blur-lg: none;

    --text-primary: var(--text-strong);
    --text-secondary: var(--text-normal);
    --text-tertiary: var(--text-weak);
    --text-muted: var(--text-weak);

    --border-color: var(--line);
    --shadow-glow: var(--focus-ring);
}

[data-theme="dark"] {
    --brand:        #1F8A57;   /* 흰 글자 대비 4.6:1, 어두운 배경 위에서도 식별 */
    --brand-strong: #3DBE7A;
    --brand-weak:   rgba(61, 190, 122, 0.14);
    --brand-tint-rgb: 61, 190, 122;

    --surface-page:   #121416;
    --surface-card:   #1E2125;
    --surface-sunken: #2A2E33;
    --surface-overlay: rgba(0, 0, 0, 0.6);

    --text-strong: #F2F4F6;
    --text-normal: #C3CAD2;
    --text-weak:   #9AA4AF;
    --text-disabled: #5F6873;

    --line:        rgba(255, 255, 255, 0.09);
    --toast-bg:    #3A3F47;
    --toast-text:  #F2F4F6;
    --line-strong: rgba(255, 255, 255, 0.16);

    --success:        #3DBE7A;
    --success-bg:     rgba(61, 190, 122, 0.14);
    --success-border: rgba(61, 190, 122, 0.32);
    --success-text:   #6FD69F;

    --danger:         #F0605A;
    --danger-bg:      rgba(240, 96, 90, 0.14);
    --danger-border:  rgba(240, 96, 90, 0.32);
    --danger-text:    #FF8F8A;

    --warning:        #F2B53A;
    --warning-bg:     rgba(242, 181, 58, 0.14);
    --warning-border: rgba(242, 181, 58, 0.32);
    --warning-text:   #F7CB6E;

    --info:           #5B93F0;
    --info-bg:        rgba(91, 147, 240, 0.14);
    --info-border:    rgba(91, 147, 240, 0.32);
    --info-text:      #8DB4F5;

    --bg-glass-hover: #262A2F;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
