/* map.arbou.live, the shell: the page, the toolbar (back arrow, view name and change) and the filter
   (index switches, period switches). The board, the chart and the PER panel have their own sheets. */

.hm {
    --hm-ink: #142033;
    --hm-muted: #66748a;
    --hm-line: #e6ebf2;
    --hm-track: #eef1f6;
    --hm-up: #0f7a57;
    --hm-down: #c2333b;
    --hm-gap: clamp(10px, 1.4vw, 20px);
    position: relative;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--hm-gap);
    background:
        radial-gradient(900px 520px at 92% -12%, #e5ebff 0, rgb(229 235 255 / 0%) 70%),
        radial-gradient(700px 420px at -8% 110%, #e8f6ee 0, rgb(232 246 238 / 0%) 70%),
        #f3f5f9;
    color: var(--hm-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.hm *,
.hm *::before,
.hm *::after {
    box-sizing: border-box;
}

.hm__card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 2 * var(--hm-gap));
    height: calc(100dvh - 2 * var(--hm-gap));
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--hm-line);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 30px 70px -40px rgb(20 32 51 / 35%), 0 2px 8px rgb(20 32 51 / 4%);
}

/* Toolbar: the back arrow, then the open view's name and its change. */
.hm__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px 16px;
}

.hm__group {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.hm__back {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--hm-line);
    border-radius: 12px;
    background: #ffffff;
    color: var(--hm-ink);
    cursor: pointer;
    transition: background-color .16s ease, opacity .16s ease;
}

.hm__back svg {
    width: 18px;
    height: 18px;
}

.hm__back:hover:not(:disabled) {
    background: var(--hm-track);
}

.hm__back:disabled {
    opacity: .35;
    cursor: default;
}

.hm__kpi {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
    margin: 0;
    color: var(--hm-ink);
    font-size: 15px;
    font-weight: 760;
    letter-spacing: -.015em;
}

.hm__kpi span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hm__kpi strong {
    flex: none;
    font-size: 15px;
    font-weight: 780;
    font-variant-numeric: tabular-nums;
}

.hm__kpi .is-up {
    color: var(--hm-up);
}

.hm__kpi .is-down {
    color: var(--hm-down);
}

/* Every index switched off: a line on the board instead of a blank. */
.hm__empty {
    margin: 0;
    padding: 56px 16px;
    color: #aab3c2;
    font-size: 14px;
    text-align: center;
}

/* Top right: the filter, one switch per index (S&P 500, Nasdaq, SOX, S&P 400, S&P 600) with its logo.
   Pressed, the index's companies are on the map; released, the switch greys out. */
.hm__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.hm__filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px 4px 7px;
    border: 1px solid var(--hm-line);
    border-radius: 999px;
    background: var(--hm-track);
    color: var(--hm-muted);
    font: inherit;
    font-size: 11.5px;
    font-weight: 760;
    letter-spacing: .01em;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.hm__filter svg {
    flex: none;
    width: 18px;
    height: 18px;
    opacity: .45;
    filter: grayscale(1);
    transition: opacity .16s ease, filter .16s ease;
}

.hm__filter[aria-pressed="false"] span {
    text-decoration: line-through;
    text-decoration-thickness: 1.25px;
}

.hm__filter[aria-pressed="true"] {
    border-color: #c9d2e0;
    background: #ffffff;
    box-shadow: 0 1px 4px rgb(20 32 51 / 8%);
    color: var(--hm-ink);
}

.hm__filter[aria-pressed="true"] svg {
    opacity: 1;
    filter: none;
}

.hm__filter:hover {
    border-color: #b7c2d3;
}

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

/* The period switches (1D, 1T, 1S, 1Y, 5Y), past a thin rule: periods, not indexes, so released
   they are plain, not struck through; the pressed one turns blue. They rest while a chart is open,
   and the pressed one pulses while its closes load. */
.hm__filter--period {
    padding-inline: 9px;
}

.hm__filter[data-filter] + .hm__filter--period {
    position: relative;
    margin-left: 9px;
}

.hm__filter[data-filter] + .hm__filter--period::before {
    content: '';
    position: absolute;
    top: 20%;
    bottom: 20%;
    left: -9px;
    width: 1px;
    background: var(--hm-line);
}

.hm__filter--period[aria-pressed="false"] span {
    text-decoration: none;
}

.hm__filter--period[aria-pressed="true"] {
    border-color: #9db1f2;
    background: #eef2ff;
    color: #2443b0;
}

.hm__filter--period[aria-busy="true"] span {
    animation: hm-period-pulse 1s ease-in-out infinite alternate;
}

.hm__filter--period:disabled {
    opacity: .45;
    cursor: default;
}

.hm__filter--period:disabled:hover {
    border-color: var(--hm-line);
}

@keyframes hm-period-pulse {
    from { opacity: .3; }
    to { opacity: 1; }
}

/* « sur 3 mois » … « sur 5 ans » after the view's change, while a period switch is on. */
.hm__kpi small {
    flex: none;
    color: var(--hm-muted);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0;
}

/* The page itself: full width, no sidebar (map.arbou.live). */
body.map {
    margin: 0;
    background: #f3f5f9;
}

/* Under the board: what the data is and where it comes from. */
.hm__footer {
    max-width: 980px;
    margin: 14px auto 0;
    padding: 0 4px 8px;
    color: var(--hm-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.hm__footer p {
    margin: 0 0 4px;
}
