/*
 * SVG 그래프의 공용 모양 — 범례 · 그래프 자리 · 눈금 · 선 · 점 · 세로줄 · 값 상자 · 표로 보기.
 * 아이템 화면 시세 그래프(pages/item.css)와 첫 화면 경매장별 매물 수(pages/home.css)가 함께 쓴다.
 * 계열마다의 색은 그 화면 CSS 가 정한다. 그리는 스크립트의 공용 조각은 assets/js/chart-svg.js.
 */

/* 범례 — 계열 표시(짧은 선)와 이름 */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.chart-legend > * {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.chart-caption {
    font-size: 0.8125rem;
}

/* 범례와 그 아래 설명 한 줄은 한 덩어리로 붙인다 */
.panel > .chart-legend + .chart-caption {
    margin-top: var(--space-xs);
}

.chart {
    position: relative;
    min-height: 2.5rem;
}

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

.chart__svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart__grid line {
    stroke: var(--color-border);
    stroke-width: 1;
}

.chart__tick {
    fill: var(--color-muted);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}

.chart__axis-title {
    fill: var(--color-muted);
    font-size: 0.6875rem;
}

.chart__line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart__area {
    stroke: none;
    opacity: 0.1;
}

.chart__dot {
    stroke: var(--color-surface);
    stroke-width: 2;
}

.chart__cross line {
    stroke: var(--color-muted);
    stroke-width: 1;
}

/* 범례와 값 상자의 계열 표시 — 상자가 아니라 짧은 선. 색은 화면 CSS 가 border-top-color 로 */
.chart__key {
    display: inline-block;
    width: 0.875rem;
    height: 0;
    border-top: 2px solid transparent;
    border-radius: 0.125rem;
}

.chart__tip {
    position: absolute;
    z-index: 5;
    min-width: 10.625rem;
    padding: 0.5rem 0.625rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-popup);
    font-size: 0.8125rem;
    pointer-events: none;
}

.chart__tip[hidden] {
    display: none;
}

.chart__tip-title {
    margin-bottom: 0.25rem;
    color: var(--color-muted);
}

.chart__tip-row {
    display: grid;
    grid-template-columns: 0.875rem auto 1fr;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.6;
}

.chart__tip-row strong {
    font-variant-numeric: tabular-nums;
}

.chart__tip-row span:last-child {
    color: var(--color-muted);
}

.chart-table summary {
    cursor: pointer;
    color: var(--color-accent);
    font-size: 0.875rem;
}

.chart-table .table-wrap {
    max-height: 20rem;
    overflow-y: auto;
    margin-top: var(--space-sm);
}
