/***************************************
 * PRICE SCALE
 * Results page and PDF (docs/ui-design-consistency-plan.md, 3.6)
 *
 * One horizontal layout on every screen and in the PDF:
 *   label above · bar (track + Jena blue range) · min / max values below the
 *   range ends · average above the bar (yellow = highlight, D2) with a tick
 *   on the bar at the exact average.
 * BITV 9.1.4.11: the range is Jena blue on a light track (> 3:1); the values
 * are text, the bar itself is role="img" with a full text alternative.
 *
 * Margins marked "token-lint: geometry" reserve room for the labels above
 * and below the bar.
 ***************************************/

.price-scale-container {
    width: 100%;
    margin-block: var(--jena-space-lg) 3.5rem; /* token-lint: geometry — room for min/max below */
}

.price-scale-label {
    margin-bottom: var(--jena-space-sm);
    font-weight: var(--jena-font-weight-bold);
    color: var(--jena-color-text-primary-default);
}

/* Room for the average label between the scale label and the bar */
.price-scale-container:has(.avg-marker) .price-scale-label {
    margin-bottom: 4rem; /* token-lint: geometry — two-line average label + pin */
}

.price-scale-bar {
    position: relative;
    width: 100%;
    height: var(--jena-space-md);
    background-color: var(--jena-color-bg-surface-subtle);
    border: var(--jena-border-width-sm) var(--jena-border-style) var(--jena-color-border-neutral-medium);
    border-radius: var(--jena-border-radius-sm);
}

.price-scale-range {
    position: absolute;
    inset-block: 0;
    left: var(--range-left, 0%);
    width: var(--range-width, 100%);
    background-color: var(--jena-color-data-range);
    border-radius: var(--jena-border-radius-sm);
}

/* Base values of the adjusted view: the reference range, quieter */
.price-scale-range-base {
    background-color: var(--jena-color-data-range-reference);
}

/* Value labels below the bar, aligned to their range end */
.price-marker {
    position: absolute;
    top: calc(100% + var(--jena-space-sm));
    left: var(--marker-offset, 0%);
    font-size: var(--jena-font-size-sm);
    line-height: var(--jena-line-height-tight);
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    transform: translateX(var(--marker-translate-x, 0%));
}

.price-marker .marker-label {
    color: var(--jena-color-text-primary-muted);
}

.price-marker .marker-value {
    font-weight: var(--jena-font-weight-bold);
    color: var(--jena-color-text-primary-default);
}

/* Average: highlight label above the bar … */
.avg-marker {
    top: auto;
    bottom: calc(100% + var(--jena-space-sm));
    z-index: 2;
    padding: var(--jena-space-xs) var(--jena-space-sm);
    background-color: var(--jena-color-data-highlight-bg);
    border: var(--jena-border-width-md) var(--jena-border-style) var(--jena-color-data-highlight-border);
    border-radius: var(--jena-border-radius-sm);
}

/* … pinned to the bar at the exact value. The label shifts to stay inside the
   bar but always covers this x position, so the pin connects label and bar. */
.price-tick {
    position: absolute;
    top: calc(-1 * var(--jena-space-sm));
    bottom: 0;
    left: var(--marker-offset, 50%);
    width: var(--jena-border-width-lg);
    background-color: var(--jena-color-data-marker);
    transform: translateX(-50%);
}
