/* ==========================================================================
   DataLabs — shared stylesheet
   Pretendard webfont · design tokens · shared components
   ========================================================================== */

/* ---------- Pretendard ---------- */
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Thin.woff2') format('woff2');
  font-weight: 100;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraLight.woff2') format('woff2');
  font-weight: 200;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Light.woff2') format('woff2');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Medium.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/pretendard@1.0/Pretendard-Black.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
}

/* ==========================================================================
   Tokens — one blue accent family across the whole product.
   Chart series keep their own validated hues (identity must stay separable).
   ========================================================================== */
:root {
  color-scheme: light;

  --page:        #f7f8fa;
  --surface:     #ffffff;
  --surface-2:   #f2f4f7;
  --sidebar:     #ffffff;
  --field:       #ffffff;

  --ink:         #0b0b0b;
  --ink-2:       #4a4f57;
  --muted:       #868b94;

  --grid:        #e6e8ec;
  --baseline:    #c8ccd3;
  --border:      rgba(11, 11, 11, 0.10);
  --wash:        rgba(11, 11, 11, 0.04);

  /* accent = categorical slot 1 (blue). Everything chrome-side derives from it. */
  --accent:      #2a78d6;
  --accent-2:    #184f95;
  --accent-ink:  #ffffff;
  --accent-soft: #eaf2fd;
  --accent-line: #cde2fb;

  /* chart series — validated pair, light steps */
  --series-1:    #2a78d6;
  --series-2:    #008300;
  --track:       #cde2fb;

  /* status — reserved, never used for a series */
  --good:        #006300;
  --warn-ink:    #a06400;
  --warn-bg:     rgba(250, 178, 25, 0.20);
  --bad:         #d03b3b;

  --shadow-1: 0 1px 2px rgba(11, 11, 11, .05);
  --shadow-2: 0 1px 2px rgba(11, 11, 11, .05), 0 10px 30px -14px rgba(11, 11, 11, .18);
  --shadow-3: 0 20px 50px -18px rgba(11, 11, 11, .28);

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;

  --sans: 'Pretendard', system-ui, -apple-system, 'Segoe UI',
          'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, 'Consolas', monospace;
}

/* dark — selected steps, not an automatic flip */
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;

    --page:        #0d0d0d;
    --surface:     #1a1a19;
    --surface-2:   #232322;
    --sidebar:     #151514;
    --field:       #121211;

    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --muted:       #898781;

    --grid:        #2c2c2a;
    --baseline:    #383835;
    --border:      rgba(255, 255, 255, 0.10);
    --wash:        rgba(255, 255, 255, 0.05);

    --accent:      #3987e5;
    --accent-2:    #86b6ef;
    --accent-soft: #16283f;
    --accent-line: #184f95;

    --series-1:    #3987e5;
    --series-2:    #008300;
    --track:       #184f95;

    --good:        #0ca30c;
    --warn-ink:    #fab219;
    --warn-bg:     rgba(250, 178, 25, 0.16);
    --bad:         #e66767;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
    --shadow-3: 0 20px 50px -18px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;

  --page:        #0d0d0d;
  --surface:     #1a1a19;
  --surface-2:   #232322;
  --sidebar:     #151514;
  --field:       #121211;

  --ink:         #ffffff;
  --ink-2:       #c3c2b7;
  --muted:       #898781;

  --grid:        #2c2c2a;
  --baseline:    #383835;
  --border:      rgba(255, 255, 255, 0.10);
  --wash:        rgba(255, 255, 255, 0.05);

  --accent:      #3987e5;
  --accent-2:    #86b6ef;
  --accent-soft: #16283f;
  --accent-line: #184f95;

  --series-1:    #3987e5;
  --series-2:    #008300;
  --track:       #184f95;

  --good:        #0ca30c;
  --warn-ink:    #fab219;
  --warn-bg:     rgba(250, 178, 25, 0.16);
  --bad:         #e66767;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-3: 0 20px 50px -18px rgba(0, 0, 0, .8);
}

/* ==========================================================================
   Base — readability & Korean line breaking
   ========================================================================== */
* { box-sizing: border-box; }

html {
  /* 한글은 어절 단위로 끊어야 자연스럽다 — 단어 중간에서 잘리는 것을 막는다 */
  word-break: keep-all;
  overflow-wrap: break-word;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.005em;
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  line-height: 1.35;
  letter-spacing: -0.025em;
  text-wrap: balance;   /* 제목은 줄 길이를 고르게 */
  margin: 0;
}
p { text-wrap: pretty; margin: 0; }  /* 마지막 줄 외톨이 단어 방지 */

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.num, .tnum { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   Shared components
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.mark svg { display: block; flex: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: filter .15s, transform .04s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: default; filter: none; }
.btn--block { width: 100%; }
.btn--ghost {
  color: var(--ink-2);
  background: var(--surface);
  border-color: var(--border);
  font-weight: 500;
}
.btn--ghost:hover { color: var(--ink); background: var(--wash); filter: none; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--ink); background: var(--wash); }
.icon-btn svg { display: block; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pill--ok   { color: var(--good);     background: color-mix(in srgb, var(--good) 12%, transparent); }
.pill--warn { color: var(--warn-ink); background: var(--warn-bg); }
.pill--err  { color: var(--bad);      background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* Theme toggle icon swap.
   Scoped under .icon-btn on purpose: a bare `.icon-sun` (0,1,0) loses to
   `.icon-btn svg` (0,1,1) above and both icons would show at once. */
.icon-btn .icon-sun { display: none; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: block; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .icon-btn .icon-sun { display: block; }
  :root:where(:not([data-theme="light"])) .icon-btn .icon-moon { display: none; }
}

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