/* ============================================================
 * SeraphTools Design Theme v1  (seraph-theme.css)
 * ------------------------------------------------------------
 * 단일 진실 공급원: /design/seraph-tokens.json
 * 이 파일은 토큰을 CSS 변수로 옮긴 것이다. 값 변경 시 두 파일을 함께 수정한다.
 * 접두사 --st- (SeraphTools). 컴포넌트 클래스는 seraph-components.css 참고.
 * 출처: Figma 웹앱 UI 실측 (2026-07-17)
 * ============================================================ */

/* Pretendard Variable: Inter 기반 한글 폰트. CDN 실패 시 시스템 폰트로 폴백. */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  /* ---------- font ---------- */
  --st-font-family: "Pretendard Variable", Pretendard, Inter, "Noto Sans KR",
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --st-font-family-mono: "Roboto Mono", Consolas, Monaco, "Courier New", monospace;
  --st-font-weight-default: 450;
  --st-font-weight-strong: 550;

  /* ---------- text (size / line-height / letter-spacing) ---------- */
  --st-text-body-small-size: 9px;
  --st-text-body-small-lh: 14px;
  --st-text-body-small-ls: 0.045px;
  --st-text-body-medium-size: 11px;   /* 기본 UI 텍스트 */
  --st-text-body-medium-lh: 16px;
  --st-text-body-medium-ls: 0.055px;
  --st-text-body-large-size: 13px;
  --st-text-body-large-lh: 22px;
  --st-text-body-large-ls: -0.032px;
  --st-text-heading-small-size: 13px;
  --st-text-heading-small-lh: 22px;
  --st-text-heading-medium-size: 15px;
  --st-text-heading-medium-lh: 24px;
  --st-text-heading-large-size: 24px;
  --st-text-heading-large-lh: 32px;

  /* ---------- ramp: grey ---------- */
  --st-grey-100: #f5f5f5;
  --st-grey-200: #e6e6e6;
  --st-grey-300: #d9d9d9;
  --st-grey-400: #b3b3b3;
  --st-grey-500: #757575;
  --st-grey-600: #444444;
  --st-grey-700: #383838;
  --st-grey-800: #2c2c2c;
  --st-grey-900: #1e1e1e;
  --st-grey-1000: #111111;

  /* ---------- ramp: blue ---------- */
  --st-blue-100: #f2f9ff;
  --st-blue-200: #e5f4ff;
  --st-blue-300: #bde3ff;
  --st-blue-400: #80caff;
  --st-blue-500: #0d99ff;
  --st-blue-600: #007be5;
  --st-blue-700: #0768cf;
  --st-blue-800: #034ac1;
  --st-blue-900: #093077;
  --st-blue-1000: #0d193f;

  /* ---------- ramp: red ---------- */
  --st-red-100: #fff5f5;
  --st-red-200: #ffe2e0;
  --st-red-300: #ffc7c2;
  --st-red-400: #ffafa3;
  --st-red-500: #f24822;
  --st-red-600: #dc3412;
  --st-red-700: #bd2915;
  --st-red-800: #9f1f18;
  --st-red-900: #771208;
  --st-red-1000: #660e0b;

  /* ---------- ramp: green ---------- */
  --st-green-100: #edf9ef;
  --st-green-200: #e0f6e5;
  --st-green-300: #b9ebc6;
  --st-green-400: #8ddda4;
  --st-green-500: #14ae5c;
  --st-green-600: #009951;
  --st-green-700: #008043;
  --st-green-800: #036838;
  --st-green-900: #024626;
  --st-green-1000: #083a23;

  /* ---------- ramp: yellow ---------- */
  --st-yellow-100: #fffbeb;
  --st-yellow-200: #fff1c2;
  --st-yellow-300: #ffe8a3;
  --st-yellow-400: #ffd966;
  --st-yellow-500: #ffcd29;
  --st-yellow-600: #ffc21a;
  --st-yellow-700: #fab815;
  --st-yellow-800: #eba611;
  --st-yellow-900: #dd940e;
  --st-yellow-1000: #b86200;

  /* ---------- semantic: background ---------- */
  --st-bg: #ffffff;
  --st-bg-secondary: var(--st-grey-100);
  --st-bg-tertiary: var(--st-grey-200);
  --st-bg-hover: var(--st-grey-100);
  --st-bg-pressed: var(--st-grey-200);
  --st-bg-disabled: var(--st-grey-300);
  --st-bg-selected: var(--st-blue-200);
  --st-bg-selected-hover: var(--st-blue-300);
  --st-bg-brand: var(--st-blue-500);
  --st-bg-brand-hover: var(--st-blue-600);
  --st-bg-brand-pressed: var(--st-blue-700);
  --st-bg-danger: var(--st-red-500);
  --st-bg-warning: var(--st-yellow-500);
  --st-bg-success: var(--st-green-500);
  --st-bg-toolbar: var(--st-grey-800);
  --st-bg-menu: var(--st-grey-900);
  --st-bg-inverse: var(--st-grey-800);
  --st-bg-canvas: var(--st-grey-100);
  --st-bg-overlay: rgba(0, 0, 0, 0.4);

  /* ---------- semantic: text ---------- */
  --st-text: rgba(0, 0, 0, 0.9);
  --st-text-secondary: rgba(0, 0, 0, 0.5);
  --st-text-tertiary: rgba(0, 0, 0, 0.3);
  --st-text-disabled: rgba(0, 0, 0, 0.3);
  --st-text-brand: var(--st-blue-600);
  --st-text-onbrand: #ffffff;
  --st-text-danger: var(--st-red-600);
  --st-text-success: var(--st-green-600);
  --st-text-warning: var(--st-yellow-1000);
  --st-text-menu: #ffffff;
  --st-text-menu-secondary: rgba(255, 255, 255, 0.7);
  --st-text-toolbar: #ffffff;

  /* ---------- semantic: icon ---------- */
  --st-icon: rgba(0, 0, 0, 0.9);
  --st-icon-secondary: rgba(0, 0, 0, 0.5);
  --st-icon-tertiary: rgba(0, 0, 0, 0.3);
  --st-icon-brand: var(--st-blue-600);
  --st-icon-onbrand: #ffffff;
  --st-icon-danger: var(--st-red-600);

  /* ---------- semantic: border ---------- */
  --st-border: var(--st-grey-200);
  --st-border-strong: var(--st-grey-800);
  --st-border-brand: var(--st-blue-300);
  --st-border-brand-strong: var(--st-blue-600);
  --st-border-selected: var(--st-blue-500);
  --st-border-danger: var(--st-red-300);
  --st-border-onmenu: rgba(255, 255, 255, 0.12);

  /* ---------- radius ---------- */
  --st-radius-small: 2px;
  --st-radius-medium: 5px;
  --st-radius-large: 13px;
  --st-radius-full: 9999px;

  /* ---------- space (4px 그리드) ---------- */
  --st-space-1: 4px;
  --st-space-2: 8px;
  --st-space-3: 12px;
  --st-space-4: 16px;
  --st-space-5: 20px;
  --st-space-6: 24px;
  --st-space-8: 32px;
  --st-space-10: 40px;

  /* ---------- size ---------- */
  --st-control-small: 24px;
  --st-control-medium: 32px;
  --st-control-large: 40px;
  --st-topbar-height: 48px;
  --st-panel-width: 240px;

  /* ---------- elevation ---------- */
  --st-elevation-100: 0 1px 3px 0 rgba(0, 0, 0, 0.15), 0 0 0.5px 0 rgba(0, 0, 0, 0.3);
  --st-elevation-200: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 8px 0 rgba(0, 0, 0, 0.1), 0 0 0.5px 0 rgba(0, 0, 0, 0.18);
  --st-elevation-300: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 5px 12px 0 rgba(0, 0, 0, 0.13), 0 0 0.5px 0 rgba(0, 0, 0, 0.15);
  --st-elevation-400: 0 2px 5px 0 rgba(0, 0, 0, 0.15), 0 10px 16px 0 rgba(0, 0, 0, 0.12), 0 0 0.5px 0 rgba(0, 0, 0, 0.12);
  --st-elevation-500: 0 2px 5px 0 rgba(0, 0, 0, 0.15), 0 10px 24px 0 rgba(0, 0, 0, 0.18), 0 0 0.5px 0 rgba(0, 0, 0, 0.08);

  /* ---------- motion / focus ---------- */
  --st-duration-fast: 100ms;
  --st-duration-normal: 180ms;
  --st-easing: cubic-bezier(0.2, 0, 0, 1);
  --st-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px var(--st-blue-500);
}

/* ============================================================
 * 베이스 스타일 — .st-app 스코프 안에서만 적용해 기존 화면과 충돌 방지.
 * 새로 만드는 화면은 <body class="st-app"> 로 시작한다.
 * ============================================================ */
.st-app {
  font-family: var(--st-font-family);
  font-weight: var(--st-font-weight-default);
  font-size: var(--st-text-body-medium-size);
  line-height: var(--st-text-body-medium-lh);
  letter-spacing: var(--st-text-body-medium-ls);
  color: var(--st-text);
  background: var(--st-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.st-app *,
.st-app *::before,
.st-app *::after { box-sizing: border-box; }

.st-app :focus-visible {
  outline: none;
  box-shadow: var(--st-focus-ring);
  border-radius: var(--st-radius-small);
}

/* ============================================================
 * .st-runtime — 밀도 스코프 (도구 UI 가 아닌 "업무 화면"용)
 * ------------------------------------------------------------
 * 기본 11px 는 Figma 형 도구 UI 를 위한 밀도다. 최종 사용자가 쓰는 업무 화면
 * (검색 폼 · 결과 그리드 · 리포트 · 뷰어)에 11px 를 강제하면 가독성 후퇴다.
 * 사용자층도 도구 사용자보다 훨씬 넓다.
 *
 *   <body class="st-app st-runtime">
 *
 * 바꾸는 것은 밀도뿐이다 — 색 · 라운딩 · 그림자 · 컴포넌트 구조는 완전히 동일.
 *   기본 텍스트  11 → 13 (body-large)
 *   그리드 행    28 → 36
 *   컨트롤 높이  변경 없음 (DS 기본 32 가 이미 업무 화면에 맞다)
 *
 * 쓰는 곳: dev-report-studio 런타임 프리뷰, PDF 뷰어 등 최종 사용자 화면.
 * ============================================================ */
.st-runtime {
  font-size: var(--st-text-body-large-size);
  line-height: var(--st-text-body-large-lh);
  letter-spacing: var(--st-text-body-large-ls);
}

/* 컨트롤·버튼·배지의 글자도 함께 올린다(높이는 DS 기본 유지) */
.st-runtime .st-input,
.st-runtime .st-select,
.st-runtime .st-textarea,
.st-runtime .st-btn,
.st-runtime .st-field > label,
.st-runtime .st-table th,
.st-runtime .st-table td {
  font-size: var(--st-text-body-large-size);
}

.st-runtime .st-help,
.st-runtime .st-error,
.st-runtime .st-file-sub {
  font-size: var(--st-text-body-medium-size);
}

/* 데이터 그리드: 28px 는 도구 밀도. 업무 화면은 36px. */
.st-runtime .st-grid th,
.st-runtime .st-grid td {
  height: 36px;
  font-size: var(--st-text-body-medium-size);
}

/* 타이포 유틸리티 */
.st-body-small  { font-size: var(--st-text-body-small-size);  line-height: var(--st-text-body-small-lh);  letter-spacing: var(--st-text-body-small-ls); }
.st-body-medium { font-size: var(--st-text-body-medium-size); line-height: var(--st-text-body-medium-lh); letter-spacing: var(--st-text-body-medium-ls); }
.st-body-large  { font-size: var(--st-text-body-large-size);  line-height: var(--st-text-body-large-lh);  letter-spacing: var(--st-text-body-large-ls); }
.st-heading-small  { font-size: var(--st-text-heading-small-size);  line-height: var(--st-text-heading-small-lh);  font-weight: var(--st-font-weight-strong); }
.st-heading-medium { font-size: var(--st-text-heading-medium-size); line-height: var(--st-text-heading-medium-lh); font-weight: var(--st-font-weight-strong); }
.st-heading-large  { font-size: var(--st-text-heading-large-size);  line-height: var(--st-text-heading-large-lh);  font-weight: var(--st-font-weight-strong); letter-spacing: -0.288px; }
.st-text-secondary { color: var(--st-text-secondary); }
.st-text-tertiary  { color: var(--st-text-tertiary); }
.st-strong { font-weight: var(--st-font-weight-strong); }
.st-mono { font-family: var(--st-font-family-mono); }
