/* Trading-hours ribbon (Desktop) — a centered "world markets" strip. The visual weight tells the
   story at a glance: open markets are alive (tinted, accented, pulsing dot, session progress);
   closed markets recede. Tokens-only; rendered by wwwroot/js/trading-hours.js. */
.th-bar {
    display: flex; justify-content: center; align-items: stretch;
    flex-wrap: nowrap; gap: 10px; flex: 0 0 auto;
    align-self: center; width: max-content; max-width: 100%;
    overflow-x: auto; overflow-y: visible;
    padding: 2px 2px 4px;
    scrollbar-width: none;
}
.th-bar::-webkit-scrollbar { display: none; }

.th-bar .th-item {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 9px;
    flex: 0 0 190px; width: 190px; height: 52px; padding: 8px 14px;
    background: var(--fn-bg-alt);
    border: var(--fn-border-width) solid var(--fn-border);
    border-radius: var(--fn-radius-lg);
    transition: border-color .18s ease, background .18s ease, opacity .18s ease;
    cursor: pointer;
}
.th-bar .th-item:hover,
.th-bar .th-item.active { border-color: var(--fn-border-strong); background: var(--fn-bg-muted); }
.th-bar .th-item:focus-visible { outline: none; box-shadow: var(--fn-focus-ring); }

/* Open markets keep the old, subtle border signal without turning the strip into an alarm row. */
.th-bar .th-item.open { background: color-mix(in srgb, var(--fn-success-soft) 48%, var(--fn-bg-alt)); border-color: color-mix(in srgb, var(--fn-success) 62%, var(--fn-border)); }
/* Closed markets recede slightly until hovered. */
.th-bar .th-item.closed { opacity: .76; }
.th-bar .th-item.closed:hover { opacity: 1; }

/* Country code as a quiet mono pill; turns into a success outline when open. */
.th-bar .th-flag {
    flex: 0 0 auto;
    font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; letter-spacing: .4px;
    color: var(--fn-text-secondary);
    background: var(--fn-bg-muted);
    border: var(--fn-border-width) solid var(--fn-border);
    border-radius: var(--fn-radius-sm); padding: 3px 6px; line-height: 1;
}
.th-bar .th-item.open .th-flag { color: color-mix(in srgb, var(--fn-success) 78%, var(--fn-text-secondary)); border-color: color-mix(in srgb, var(--fn-success) 62%, var(--fn-border)); background: transparent; }

.th-bar .th-body { display: flex; flex-direction: column; min-width: 0; }
.th-bar .th-name { font-size: 13px; line-height: 1.2; font-weight: 600; color: var(--fn-text-secondary); letter-spacing: 0; }
.th-bar .th-status {
    display: flex; align-items: center; gap: 5px; margin-top: 1px; white-space: nowrap;
    line-height: 1.15;
    font-family: ui-monospace, monospace; font-size: 10px; color: var(--fn-text-tertiary);
}

.th-bar .th-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: var(--fn-radius-round); background: var(--fn-text-tertiary); }
.th-bar .th-item.open .th-dot { background: color-mix(in srgb, var(--fn-success) 78%, var(--fn-text-secondary)); }

/* Soft live pulse around the dot of open markets. */
@keyframes th-pulse {
    0% { box-shadow: 0 0 0 0 var(--fn-success); }
    70% { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Session progress — a thin bar along the bottom edge of open markets. */
.th-bar .th-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--fn-bg-muted); }
.th-bar .th-prog > span { display: block; height: 100%; background: color-mix(in srgb, var(--fn-success) 70%, var(--fn-bg-muted)); border-radius: 0 var(--fn-radius-sm) var(--fn-radius-sm) 0; transition: width .6s ease; }

.th-flyout {
    position: fixed;
    z-index: 1200;
    width: 390px;
    max-width: calc(100vw - 28px);
    padding: 12px 14px;
    color: var(--fn-text-secondary);
    background: color-mix(in srgb, var(--fn-bg-alt) 96%, transparent);
    border: var(--fn-border-width) solid var(--fn-border-strong);
    border-radius: var(--fn-radius-lg);
    box-shadow: var(--fn-elevation-3);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
}
.th-flyout.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity .22s ease, transform .22s ease, visibility 0s;
}
.th-flyout-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.th-flyout-title { color: var(--fn-text); font-size: 14px; font-weight: var(--fn-font-weight-semibold); }
.th-flyout-status { color: var(--fn-success); font-family: ui-monospace, monospace; font-size: 11px; }
.th-flyout-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.th-flyout-grid span {
    display: block;
    margin-bottom: 3px;
    color: var(--fn-text-tertiary);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.th-flyout-grid b {
    display: block;
    color: var(--fn-text-secondary);
    font-size: 12px;
    font-weight: var(--fn-font-weight-medium);
    line-height: 1.35;
}

@media (prefers-reduced-motion: reduce) {
    .th-bar .th-item.open .th-dot { animation: none; }
    .th-flyout { transition: none; transform: none; }
}
/* On narrow screens, fall back to a horizontal scroll strip. */
@media (max-width: 920px) {
    .th-bar {
        justify-content: flex-start;
    }
}
