/* 自動補樣式：js/charts/line-chart.js（_build/style.py） */
/* ==========================================================================
   line-chart.js 補充樣式
   DOM：.c-chart > svg.c-chart__svg（內含 xaxis / gaps / markers / series / cursor / hit）
        + .c-chart__tip + .c-chart__legend + 視覺隱藏資料表；無資料時為 .c-chart__empty
   ========================================================================== */

/* ---------- x 軸標籤 ---------- */
.c-chart__xaxis {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.c-chart__xaxis text {
  fill: var(--text-3);
  font-size: 11px;
  letter-spacing: var(--ls-caption, 0.02em);
}

/* ---------- 斷點區間（未記錄） ---------- */
.c-chart__gaps {
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.c-chart__gaps rect {
  fill: var(--chart-gap);
  shape-rendering: crispEdges;
}
.c-chart__gaps text {
  fill: var(--text-3);
  font-size: 11px;
  letter-spacing: var(--ls-caption, 0.02em);
}

/* ---------- 劑量變更標記 ---------- */
.c-chart__markers {
  pointer-events: none;
}
.c-chart__markers line {
  stroke: var(--chart-marker);
  stroke-linecap: round;
  shape-rendering: crispEdges;
}

/* ---------- 系列 ---------- */
.c-chart__series {
  pointer-events: none;
}
.c-chart__series .c-chart__ma,
.c-chart__series .c-chart__line {
  vector-effect: non-scaling-stroke;
}

/* ---------- 資料點 ---------- */
.c-chart__dots {
  pointer-events: none;
}
.c-chart__dots circle {
  transition: r var(--dur-1) var(--ease);
}

/* ---------- 十字線與選取點 ---------- */
.c-chart__cursor {
  pointer-events: none;
}
.c-chart__cursor line {
  stroke: var(--text-3);
  stroke-linecap: round;
  shape-rendering: crispEdges;
}
.c-chart__cursor circle {
  fill: var(--surface);
  fill-opacity: .6;
  transition: cx var(--dur-1) var(--ease), cy var(--dur-1) var(--ease);
}

/* ---------- 互動感應區 ---------- */
.c-chart__hit {
  fill: transparent;
  touch-action: pan-y;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}
@media (hover: hover) and (pointer: fine) {
  .c-chart__hit {
    cursor: crosshair;
  }
}

/* ---------- 圖例 ---------- */
.c-chart__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1) var(--sp-3);
  margin-top: var(--sp-2);
  font-size: var(--fs-footnote);
  line-height: var(--lh-footnote);
  color: var(--text-2);
}
.c-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* 色塊（顏色由程式以 inline style 帶入） */
.c-chart__swatch {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0;
  border-radius: 50%;
  background: var(--chart-1);
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- 無資料 ---------- */
.c-chart__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  margin: 0;
  padding: var(--sp-6) var(--sp-4);
  border: 1px dashed var(--border);
  border-radius: var(--r-card);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: var(--fs-callout);
  line-height: var(--lh-callout);
  text-align: center;
}

/* ---------- 寬版：容器查詢 ---------- */
@container view (min-width: 600px) {
  .c-chart__legend {
    gap: var(--sp-2) var(--sp-4);
    margin-top: var(--sp-3);
  }
  .c-chart__empty {
    min-height: 220px;
  }
}
@container view (min-width: 960px) {
  .c-chart__empty {
    min-height: 280px;
  }
}

/* ---------- 矮螢幕（手機橫式） ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .c-chart__empty {
    min-height: 120px;
    padding: var(--sp-4);
  }
}

/* ---------- 減少動態 ---------- */
@media (prefers-reduced-motion: reduce) {
  .c-chart__dots circle,
  .c-chart__cursor circle {
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 列印 ---------- */
@media print {
  .c-chart__hit,
  .c-chart__cursor {
    display: none;
  }
  .c-chart__swatch {
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
