/* Market Activity (/market/activity).
   Every colour here resolves through the site tokens defined in site.css, so both themes and the
   high-contrast overrides follow automatically. Nothing in this file encodes a gain/loss meaning
   by colour alone — the sign glyph in the Change cell carries it too. */

/* ---------------------------------------------------------------- page rhythm */

/* The shared layout gives <main> 2.5rem of top padding and the breadcrumb another 1rem beneath
   it, which on this page left ~90px of empty band between the site header and the first thing
   worth reading and pushed the opening row of prices below the fold on a 768px-tall laptop.
   Scoped with :has() to this page's own wrapper rather than changed in the shared layout, so no
   other screen's rhythm moves; a browser without :has() simply keeps the old spacing. */
/* !important only because site.css sets the shared `main.container-fluid` padding shorthand with
   it; the inline padding is restated so this narrows the top alone. */
main.container-fluid:has(> .market-activity-page) {
    padding-top: .9rem !important;
}

main:has(> .market-activity-page) .seo-breadcrumb,
main:has(> .market-activity-page) .global-page-actions {
    margin-bottom: .5rem;
}

.market-activity-head {
    gap: .75rem;
}

.market-activity-head h1 {
    margin-bottom: .125rem;
}

/* Wide screens: the enriched column set fills the width on its own, but past this the row
   stretches far enough that the eye loses the line between the name and the numbers. */
.market-activity-shell {
    max-width: 1840px;
}

/* ---------------------------------------------------------------- board picker */

.activity-board-picker {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 3.25rem;
    padding: .55rem .8rem;
}

.activity-board-picker .form-select {
    width: min(22rem, 45vw);
}

/* ---------------------------------------------------------------- board header strip */

.activity-board-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-board-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .3rem .6rem;
    font-size: .78rem;
    color: var(--muted);
    min-width: 0;
}

.activity-board-source {
    max-width: 46ch;
}

.activity-board-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-left: auto;
}

.activity-filter {
    width: 12rem;
    max-width: 45vw;
}

.activity-count {
    font-size: .78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Session-schedule badge. Deliberately distinct from the data-freshness "as of" text next to it:
   one says whether the venue is trading, the other says which session the numbers came from. */
.activity-session[data-session="open"] {
    color: var(--gain);
    border-color: color-mix(in srgb, var(--gain) 55%, var(--border-color));
}

.activity-session[data-session="pre-open"],
.activity-session[data-session="break"] {
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 55%, var(--border-color));
}

.activity-session[data-session="closed"],
.activity-session[data-session="unknown"] {
    color: var(--muted);
    border-color: var(--border-color);
}

.activity-session {
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: .05rem .5rem;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- table */

.activity-table-wrap {
    max-height: min(70vh, 46rem);
    overflow: auto;
}

.activity-table {
    margin-bottom: 0;
}

.activity-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--panel-2);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 600;
}

.activity-sort {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.activity-sort .activity-sort-glyph {
    opacity: .35;
    font-size: .7em;
}

th[aria-sort="ascending"] .activity-sort-glyph,
th[aria-sort="descending"] .activity-sort-glyph {
    opacity: 1;
}

.activity-table td {
    font-size: .875rem;
}

/* Volume, scaled to the board's own maximum, so 14M against 86M reads without arithmetic. Drawn
   behind the figure rather than beside it, and hidden from assistive tech: the number is the
   accessible value and the bar only repeats it. */
.activity-vol {
    position: relative;
    display: block;
    isolation: isolate;
}

.activity-vol-bar {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1.05em;
    border-radius: 2px;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    z-index: -1;
}

/* Compact day low-high range. The marker sits where the close fell inside the day's own band. */
.activity-range {
    display: flex;
    align-items: center;
    gap: .35rem;
    justify-content: flex-end;
}

.activity-range-track {
    position: relative;
    width: 4.5rem;
    height: .35rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--body-color) 16%, transparent);
    flex: 0 0 auto;
}

.activity-range-mark {
    position: absolute;
    top: 50%;
    width: .38rem;
    height: .78rem;
    margin-left: -.19rem;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--body-color);
}

.activity-range-value {
    font-size: .76rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ---------------------------------------------------------------- states */

.activity-error {
    margin: 1rem;
}

.activity-skeleton td {
    padding-top: .9rem;
    padding-bottom: .9rem;
}

.activity-skeleton-cell {
    display: block;
    height: .72rem;
    border-radius: 3px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--body-color) 9%, transparent) 25%,
        color-mix(in srgb, var(--body-color) 16%, transparent) 50%,
        color-mix(in srgb, var(--body-color) 9%, transparent) 75%);
    background-size: 400% 100%;
    animation: activity-skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes activity-skeleton-sweep {
    from { background-position: 100% 50%; }
    to { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .activity-skeleton-cell { animation: none; }
}

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 767.98px) {
    .activity-board-picker {
        flex-wrap: wrap;
        gap: .4rem .65rem;
    }

    .activity-board-picker .form-select {
        flex: 1 1 calc(100% - 4rem);
        width: auto;
        min-width: 0;
    }

    .activity-board-picker > .text-secondary {
        width: 100%;
        padding-left: 3.35rem;
    }

    .activity-board-tools {
        margin-left: 0;
        width: 100%;
    }

    .activity-filter {
        flex: 1 1 auto;
        width: auto;
        max-width: none;
    }

    .activity-table-wrap {
        max-height: none;
    }
}
