/* map.arbou.live, the chart: a segment's or a company's candles (Labo Tech's history-chart.js,
   restyled under .hm-chart), its controls and index lines. */

/* The chart takes the board's place, on white like Labo Tech's: the legend and its controls on top,
   then the candles. */
.hm__canvas[hidden],
.hm-chart[hidden] {
    display: none;
}

.hm-chart {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    margin: 0 12px 12px;
    padding: 12px 14px 8px;
    border: 1px solid var(--hm-line);
    border-radius: 18px;
    background: #ffffff;
}

/* The bar: the Cours / PER switch at the left, then the candles' details beside the controls. */
.hm-chart__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.hm-chart__head > .tech-chart-legend {
    margin-left: auto;
}

.hm-chart__controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.hm-seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 12px;
    background: var(--hm-track);
}

.hm-seg button {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    min-height: 30px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--hm-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 680;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.hm-seg--icons button {
    width: 32px;
    padding: 0;
}

.hm-seg svg {
    width: 16px;
    height: 16px;
}

.hm-seg button:hover {
    background: rgb(255 255 255 / 70%);
    color: var(--hm-ink);
}

.hm-seg button[aria-pressed="true"] {
    background: #ffffff;
    color: var(--hm-ink);
    box-shadow: 0 1px 2px rgb(20 32 51 / 10%), 0 3px 10px rgb(20 32 51 / 7%);
}

.hm-seg button:focus-visible {
    outline: 3px solid #8fb0ff;
    outline-offset: 2px;
}

.hm-seg[hidden] {
    display: none;
}

/* The index switches (SOX, Nasdaq-100), on their members' charts: the badge's logo and the
   index's name, in its colour when on. */
.hm-seg .hm-chart__line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hm-seg .hm-chart__line[aria-pressed="true"] {
    color: var(--line-color);
}

.hm-chart__plot {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}

/* While another chart loads, or when there is none to show, only the message remains. */
.hm-chart.is-empty .hm-chart__plot,
.hm-chart.is-empty .tech-chart-legend {
    visibility: hidden;
}

.hm-chart__status {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    max-width: calc(100% - 48px);
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgb(255 255 255 / 94%);
    box-shadow: 0 8px 24px -12px rgb(20 32 51 / 35%);
    color: var(--hm-muted);
    font-size: 13px;
    text-align: center;
    transform: translate(-50%, -50%);
}

.hm-chart__status[hidden] {
    display: none;
}

/* The chart's legend and Ar_indicator panels, as in Labo Tech. */
.hm-chart .tech-chart-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    min-height: 30px;
}

/* The toolbar already names the chart: the legend starts with the company count. */
.hm-chart .tech-chart-legend__name {
    display: none;
}

.hm-chart .tech-chart-legend > strong {
    padding: 3px 9px;
    border-radius: 999px;
    background: #f3f5f9;
    color: var(--hm-ink);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.hm-chart .tech-chart-legend > strong.is-up {
    background: #e7f6f0;
    color: var(--hm-up);
}

.hm-chart .tech-chart-legend > strong.is-down {
    background: #fdecef;
    color: var(--hm-down);
}

.hm-chart .tech-chart-legend__caption {
    color: var(--hm-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* A segment's company count, beside its name. */
.hm-chart .tech-chart-legend__note {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--hm-track);
    color: var(--hm-muted);
    font-size: 12.5px;
    font-weight: 680;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hm-chart .tech-chart-legend__ohlc {
    color: var(--hm-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: pre;
}

/* The index line's change over the same candles, in its colour, then the gap between the
   company and the index. */
.hm-chart .tech-chart-legend__compare {
    padding: 3px 9px;
    border-radius: 999px;
    background: #efe9ff;
    background: color-mix(in srgb, var(--swatch, #6d3fd8) 12%, #ffffff);
    color: var(--swatch, #6d3fd8);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hm-chart .tech-chart-legend__gap {
    color: var(--hm-ink);
    font-size: 12.5px;
    font-weight: 680;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hm-chart .tech-chart-badges {
    position: absolute;
    top: 8px;
    right: 72px;
    z-index: 3;
    display: flex;
    gap: 6px;
    pointer-events: none;
}

.hm-chart .tech-chart-badges--bottom {
    top: auto;
    bottom: 30px;
}

.hm-chart .tech-chart-badges span {
    padding: 3px 9px;
    border-radius: 4px;
    background: rgb(254 234 250 / 45%);
    color: rgb(20 32 51 / 88%);
    font-size: 11px;
    font-weight: 560;
    white-space: nowrap;
}

.hm-chart .tech-chart-badges span.has-swatch::before {
    display: inline-block;
    width: 12px;
    height: 2px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 1px;
    background: var(--swatch);
    content: '';
}

.hm-chart .tech-chart-badges span.is-accent {
    background: rgb(203 192 211 / 40%);
}

@media (max-width: 760px) {
    .hm-chart {
        margin: 0 8px 8px;
        padding: 10px 10px 6px;
        border-radius: 14px;
    }

    .hm-chart .tech-chart-badges:not(.tech-chart-badges--bottom) {
        right: 56px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .hm-chart .tech-chart-legend__ohlc,
    .hm-chart .tech-chart-legend__caption {
        font-size: 10.5px;
    }
}
