/* K-pop Trade Data (/en/trade) — Claude Design "Trade Data v2" 구현.
   Broadsheet 디자인 시스템 토큰·컴포넌트 중 이 화면이 쓰는 것만, 사이트 헤더/푸터와 섞이지 않게 .kt 아래로 스코프. */

.kt {
  --color-bg: #ffffff;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #0088b0;
  --color-accent-2: #d6006c;
  --color-divider: color-mix(in srgb, #201e1d 16%, transparent);
  --color-neutral-100: #f8f4f4;
  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-400: #bab6b6;
  --color-neutral-500: #9b9797;
  --color-neutral-600: #7d7979;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;
  --color-neutral-900: #2d2b2b;
  --color-accent-100: #e9f8ff;
  --color-accent-600: #1186ac;
  --color-accent-700: #006786;
  --color-accent-2-100: #fff1f4;
  --color-accent-2-700: #aa0b56;
  --color-process-yellow: #edbb00;
  --font-heading: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --radius-md: 2px;
  /* 그룹 색 — 시안 GROUPS */
  --g-flat: #605d5d;
  --g-album: #aa0b56;
  --g-broad: #006786;

  min-height: 100vh; background: #ffffff; color: var(--color-text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: auto;
}
.kt *, .kt *::before, .kt *::after { box-sizing: border-box; }
.kt h1, .kt h2 { font-family: var(--font-heading); font-weight: 600; margin: 0; }
.kt p { margin: 0; }
.kt a { color: var(--color-accent-700); text-underline-offset: 3px; }
.kt a:hover { color: var(--color-accent-600); }
.kt button:focus-visible, .kt [tabindex]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.kt ::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.kt .num { font-variant-numeric: tabular-nums; }

/* — Broadsheet: segmented control, ghost button — */
.kt .seg { display: inline-flex; overflow: hidden; border: 1px solid var(--color-divider); border-radius: var(--radius-md); }
.kt .seg-opt { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.kt .seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.kt .seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.kt .seg-opt:has(input:checked) { background: var(--color-accent); color: var(--color-bg); }
.kt .seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.kt .seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.kt .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  font-family: var(--font-heading); font-weight: 600; font-size: 14px; line-height: 1.2;
  background: transparent; border: 1px solid transparent; padding: 10px 18px; border-radius: var(--radius-md); }
.kt .btn-ghost { color: var(--color-accent); padding-inline: 5px; }
.kt .btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.kt .btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }

/* — 페이지 레이아웃 — */
.kt-main { max-width: 1180px; margin: 0 auto; padding: 0 24px 80px; }
.kt-kicker { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.kt-label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--color-neutral-700); }

.kt-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 22px 48px; padding: 34px 0 0; }
.kt-hero .kt-kicker { margin: 0 0 12px; color: var(--color-accent-2-700); }
.kt-hero h1 { font-size: clamp(46px, 8vw, 102px); line-height: 0.86; letter-spacing: -0.04em; }
.kt-hero-sub { margin: 14px 0 0 !important; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-neutral-600); }
.kt-hero-fig { padding: 0 0 4px; }
.kt-hero-fig .kt-headline { font-family: var(--font-heading); font-weight: 600; font-size: clamp(40px, 5.4vw, 70px); letter-spacing: -0.03em; line-height: 1; display: block; }
.kt-hero .kt-hero-updated { margin: 22px 0 0 !important; line-height: 1.3; letter-spacing: .08em; }
.kt-hero-fig .kt-hero-sub { letter-spacing: .06em; }

.kt-groups-note { max-width: 70ch; padding: 40px 0 0; font-size: 14px; line-height: 1.45; color: var(--color-neutral-700); }
.kt-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px 40px; padding: 14px 0 0; }
.kt-group { display: flex; flex-direction: column; }
.kt-group-def { margin: 10px 0 0 !important; padding: 9px 0 0; border-top: 1px solid color-mix(in srgb, var(--gc) 22%, transparent);
  font-size: 13px; line-height: 1.4; color: var(--color-neutral-700); }
.kt-group { border-top: 3px solid var(--gc); background: var(--gt); padding: 14px 16px 16px; }
.kt-group .kt-label { color: var(--gc); }
.kt-group-delta { margin: 10px 0 0 !important; font-family: var(--font-heading); font-weight: 600; font-size: clamp(30px, 4vw, 46px); line-height: 0.95; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.kt-group-markets { margin: 8px 0 0 !important; font-size: 14px; color: var(--color-neutral-700); }

.kt-traj { margin: 56px 0 0; }
.kt-traj-intro { max-width: 64ch; margin: 0 0 18px; }
.kt-traj-intro h2 { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 8px; }
.kt-traj-intro p { font-size: 15px; line-height: 1.5; color: var(--color-neutral-700); }
.kt-traj-box { position: relative; }
.kt-traj svg { width: 100%; height: auto; display: block; font-family: var(--font-body); }
.kt-traj-label { position: absolute; left: 79.5%; transform: translateY(-50%); display: flex; align-items: baseline; gap: 6px; white-space: nowrap; transition: opacity .2s; }
.kt-traj svg { touch-action: pan-y; cursor: crosshair; }
.kt-traj svg .kt-line, .kt-traj svg .kt-end, .kt-traj svg .kt-endtag { transition: stroke-opacity .2s, opacity .2s; }

/* 툴팁 (궤적·상세 공용) */
.kt-tip, .kt-dtip { position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; gap: 1px;
  min-width: 132px; padding: 7px 10px; background: #fff; border: 1px solid var(--color-neutral-300);
  box-shadow: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent); font-size: 12.5px; line-height: 1.35;
  color: var(--color-neutral-700); white-space: nowrap; transform: translate(12px, -50%); }
.kt-tip.is-left, .kt-dtip.is-left { transform: translate(calc(-100% - 12px), -50%); }
.kt-tip b, .kt-dtip b { font-size: 13.5px; color: var(--color-text); }
.kt-tip strong, .kt-dtip strong { color: var(--color-text); font-weight: 600; }

/* 국가 칩 */
.kt-chips { display: none; flex-wrap: wrap; gap: 6px 6px; padding: 14px 0 0; }
.kt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; font: inherit; font-size: 12.5px; color: var(--color-neutral-800);
  background: #fff; border: 1px solid var(--color-neutral-300); border-radius: 2px; cursor: pointer; }
.kt-chip i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kt-chip span { color: var(--color-neutral-600); }
.kt-chip:hover { border-color: var(--color-neutral-500); }
.kt-chip[aria-pressed="true"] { border-color: var(--color-text); background: var(--color-neutral-100); }

/* 상세 차트 오버레이 */
.kt-detail-plot { position: relative; touch-action: pan-y; cursor: crosshair; }
.kt-dmax { position: absolute; left: 0; top: 8.2%; transform: translateY(-110%); font-size: 11px; color: var(--color-neutral-600); }
.kt-dend { position: absolute; right: 0; transform: translateY(-135%); font-size: 12.5px; font-weight: 600; background: rgba(255,255,255,.85); padding: 0 2px; }
.kt-dend-dot { position: absolute; width: 7px; height: 7px; border-radius: 50%; transform: translate(-50%, -50%); }
.kt-dguide { position: absolute; top: 0; bottom: 11.7%; width: 0; border-left: 1px dashed var(--color-text); pointer-events: none; }
.kt-dtip { top: 42%; }
.kt-traj-label b { font-size: clamp(9px, 1.15vw, 14px); font-weight: 600; letter-spacing: .03em; }
.kt-traj-label span { font-size: clamp(9px, 1.05vw, 13px); color: var(--color-neutral-600); }
.kt figcaption { margin: 12px 0 0; font-size: 13px; color: var(--color-neutral-600); }

.kt-rank { padding: 66px 0 0; }
.kt-rank-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; }
.kt-rank-head h2 { font-size: clamp(26px, 3.4vw, 38px); line-height: 1; letter-spacing: -0.025em; margin-right: auto; }
.kt-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.kt-traj-filter { padding: 14px 0 0; }
.kt-rank-note { max-width: 70ch; padding: 12px 0 0; font-size: 14px; line-height: 1.45; color: var(--color-neutral-700); }
.kt-filter-cap { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--color-neutral-500); padding-right: 4px; }
.kt-fbtn { font-family: var(--font-body); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 7px 12px; cursor: pointer;
  border: 1px solid var(--color-neutral-300); background: transparent; color: var(--color-neutral-700); border-radius: 2px; transition: background .15s, border-color .15s; }
.kt-fbtn:hover { border-color: var(--color-accent); }
.kt-empty { padding: 26px 6px; font-size: 14px; color: var(--color-neutral-600); }
.kt-cols { display: grid; grid-template-columns: 46px minmax(0, 1.6fr) minmax(86px, 1fr) minmax(66px, .6fr) minmax(88px, .8fr); gap: 14px; }
.kt-thead { padding: 18px 6px 8px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--color-neutral-700); border-bottom: 2px solid var(--color-text); }
.kt-r { text-align: right; }
.kt-row { border-bottom: 1px solid var(--color-neutral-300); background: #fff; }
.kt-row-btn { align-items: center; padding: 13px 6px; cursor: pointer; transition: background .15s; }
.kt-row-btn:hover { background: rgba(214, 0, 108, .05); }
.kt-rank-no { font-family: var(--font-heading); font-weight: 600; font-size: clamp(26px, 3.2vw, 38px); line-height: 0.85; letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.kt-name-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kt-name { font-family: var(--font-heading); font-size: clamp(18px, 2.1vw, 23px); font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; }
.kt-move { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.kt-bars { display: flex; flex-direction: column; gap: 3px; padding: 8px 0 0; max-width: 300px; }
.kt-bar { display: flex; align-items: center; gap: 7px; }
.kt-bar span { font-size: 10px; color: var(--color-neutral-500); width: 18px; flex: none; font-variant-numeric: tabular-nums; }
.kt-bar i { display: block; height: 7px; min-width: 1px; transition: width .5s cubic-bezier(.2, .7, .2, 1); }
.kt-bar em { font-style: normal; font-size: 11px; color: var(--color-neutral-600); flex: none; }
.kt-val { font-size: clamp(16px, 1.8vw, 20px); font-variant-numeric: tabular-nums; }
.kt-delta { font-size: 15px; font-variant-numeric: tabular-nums; }
.kt-peak { font-size: 13px; color: var(--color-neutral-700); font-variant-numeric: tabular-nums; }

.kt-detail { padding: 4px 6px 26px 6px; }
.kt-detail-stats { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 0 0 14px; font-size: 13px; color: var(--color-neutral-700); }
.kt-detail-stats strong { color: var(--color-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.kt-detail svg { width: 100%; height: 140px; display: block; }
.kt-detail-axis { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0 0; font-size: 12px; color: var(--color-neutral-600); }
.kt-detail-empty { font-size: 13px; color: var(--color-neutral-600); padding: 20px 0; }

.kt-cats { padding: 64px 0 0; }
.kt-cats h2, .kt-notes h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--color-neutral-700); line-height: 1.12; }
.kt-cats h2 { margin: 0 0 18px; }
.kt-cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px 40px; }
.kt-cat { border-top: 1px solid var(--color-neutral-300); padding: 12px 0 0; }
.kt-cat .kt-label { margin: 0 0 10px; letter-spacing: .12em; }
.kt-cat-pair { display: flex; gap: 22px; }
.kt-cat-pair > div { flex: 1; }
.kt-cat-num { font-family: var(--font-heading); font-weight: 600; font-size: clamp(24px, 3vw, 34px); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kt-cat-cap { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--color-neutral-600); padding-top: 6px; }

.kt-notes { padding: 64px 0 0; max-width: 80ch; }
.kt-notes h2 { margin: 0 0 14px; }
.kt-notes ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--color-neutral-700); }

.kt-status { padding: 60px 0; font-size: 15px; color: var(--color-neutral-700); }

/* 모바일 — 순위표 5열은 375px에 안 들어간다: Peak 열을 접고 간격을 줄인다 (Peak은 펼침 상세에 그대로 있음) */
@media (max-width: 640px) {
  .kt-main { padding: 0 18px 64px; }
  .kt-cols { grid-template-columns: 34px minmax(0, 1fr) minmax(72px, auto) minmax(48px, auto); gap: 10px; }
  .kt-col-peak { display: none; }
  .kt-tip, .kt-dtip { min-width: 0; font-size: 12px; }
  .kt-chips { display: flex; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .kt-chip { flex: none; }
}

/* 로딩 — 데이터가 오기 전엔 본문을 숨기고 상태 문구만 */
.kt.is-loading .kt-loaded { display: none; }
.kt:not(.is-loading) .kt-status { display: none; }
.kt-tip[hidden], .kt-dtip[hidden], .kt-dguide[hidden] { display: none; }
