/* =========================================================================
   market-widgets.css - shared market-dashboard chrome used by the Traditional
   Finance (Markets) pages, and available to any future market page. Card
   shell, signal gauge, status pill, segmented control, ticker tape, symbol
   switcher, layout grid, chart watermark, world-hours board. All themed from
   the global tokens. (The Crypto terminal ships its own copy for now; new
   pages should link this file.)
   ========================================================================= */

/* ---------- Ticker tape ---------- */
.term-tape { height: 44px; overflow: hidden; background: var(--color-surface); border-bottom: 1px solid var(--color-border); display: flex; align-items: center; }
.term-tape__track { display: inline-flex; align-items: center; white-space: nowrap; will-change: transform; animation: term-marquee 60s linear infinite; }
.term-tape:hover .term-tape__track { animation-play-state: paused; }
.term-tape__item { padding: 0 1.4rem; font-size: .84rem; color: var(--color-text); border-right: 1px solid var(--color-border); }
.term-tape__item b { color: var(--color-heading); font-weight: 700; }
.term-tape__item .up { color: #2e9e5b; font-weight: 600; } .term-tape__item .down { color: #cf5b5b; font-weight: 600; }
@keyframes term-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .term-tape__track { animation: none; } }

.term-hero-actions { margin-top: 1.2rem; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Symbol switcher ---------- */
.term-symbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.term-chip { padding: .48rem .95rem; border-radius: var(--radius-full); border: 1.5px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap; transition: all var(--transition); }
.term-chip:hover { border-color: var(--color-accent); color: var(--color-accent-deep); }
.term-chip.is-on { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
.term-sel { padding: .48rem .8rem; border-radius: var(--radius-full); border: 1.5px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; max-width: 210px; }
.term-sel:focus-visible { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 26%, transparent); }

/* ---------- Layout ---------- */
.term-wrap { display: grid; gap: 1.25rem; }
.term-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1080px) { .term-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 372px); align-items: stretch; } }
.term-rail { display: grid; gap: 1.25rem; align-content: start; }
.term-duo { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }

/* ---------- Card shell ---------- */
.tvw { display: flex; flex-direction: column; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.tvw__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1.15rem; border-bottom: 1px solid var(--color-border); }
.tvw__title { margin: 0; font-family: var(--font-head); font-size: .95rem; font-weight: 700; color: var(--color-heading); }
.tvw__hint { font-size: .78rem; color: var(--color-text-muted); white-space: nowrap; }
.tvw__hint b { color: var(--color-accent-deep); }
.tvw__price { font-variant-numeric: tabular-nums; color: var(--color-heading); font-weight: 700; margin-left: .35rem; }
.tvw__ctl { display: flex; align-items: center; gap: .6rem; padding: .6rem 1.15rem; border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.tvw__ctl-sp { flex: 1 1 auto; }
.term-mini-link { font-size: .78rem; font-weight: 700; color: var(--color-accent-deep); white-space: nowrap; }
.tvw__foot { padding: .6rem 1.15rem; border-top: 1px solid var(--color-border); background: color-mix(in srgb, var(--color-border) 18%, transparent); font-size: .74rem; line-height: 1.5; color: var(--color-text-muted); }
.tvw__foot a { color: var(--color-accent-deep); font-weight: 600; }
.tvw__body { position: relative; flex: 1 1 auto; contain: layout style paint; }
.tvw__body--chart { min-height: 520px; }
.tvw__body--gauge { min-height: 326px; }
.tvw__body--hours { min-height: 300px; }
@media (max-width: 600px) { .tvw__body--chart { min-height: 420px; } }

/* ---------- Chart + watermark + status ---------- */
.term-chart { position: absolute; inset: 0; }
.term-watermark { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 3; width: min(360px, 46%); height: 62px; background-image: var(--logo-img); background-repeat: no-repeat; background-position: center; background-size: contain; opacity: .09; pointer-events: none; }
.tvw__body:not(.is-live) .term-watermark { opacity: 0; }
.cs-status { position: absolute; top: .55rem; right: .6rem; z-index: 5; display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .6rem; border-radius: var(--radius-full); border: 1px solid var(--color-border); background: color-mix(in srgb, var(--color-surface) 82%, transparent); font-size: .7rem; font-weight: 700; color: var(--color-text-muted); }
.cs-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-text-muted); }
.cs-status.is-live { color: #2e9e5b; } .cs-status.is-live .dot { background: #2e9e5b; box-shadow: 0 0 0 3px color-mix(in srgb, #2e9e5b 22%, transparent); }
.cs-status.is-poll { color: #c98a1e; } .cs-status.is-poll .dot { background: #e0a52e; }
.cs-status.is-off { color: #cf5b5b; } .cs-status.is-off .dot { background: #cf5b5b; }

.tvw__body--chart::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(100deg, transparent 32%, color-mix(in srgb, var(--color-border) 55%, transparent) 50%, transparent 68%), var(--color-surface-2); background-size: 220% 100%, auto; animation: term-sheen 1.5s linear infinite; }
.tvw__body--chart::after { content: "Loading candles..."; position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; font-size: .85rem; color: var(--color-text-muted); }
.tvw__body--chart.is-live::before, .tvw__body--chart.is-live::after { content: none; }
@keyframes term-sheen { to { background-position: -120% 0, 0 0; } }
@media (prefers-reduced-motion: reduce) { .tvw__body--chart::before { animation: none; } }

/* ---------- Interval segmented control ---------- */
.cs-seg { display: inline-flex; border: 1.5px solid var(--color-border); border-radius: var(--radius-full); overflow: hidden; }
.cs-seg button { padding: .4rem .7rem; border: none; background: transparent; font: inherit; font-size: .78rem; font-weight: 700; color: var(--color-text-muted); cursor: pointer; transition: all var(--transition); }
.cs-seg button + button { border-left: 1px solid var(--color-border); }
.cs-seg button:hover { color: var(--color-accent-deep); }
.cs-seg button.is-on { background: var(--color-accent); color: var(--color-on-accent); }

/* ---------- Signal gauge ---------- */
.cs-gauge { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1.1rem 1.15rem 1.3rem; min-height: 326px; }
.cs-gauge-svg { width: 280px; max-width: 100%; height: auto; display: block; }
.cs-gauge-svg .cs-arc { fill: none; stroke-width: 15; stroke-linecap: round; }
.cs-gauge-svg .cs-needle { stroke: var(--color-heading); stroke-width: 4; stroke-linecap: round; }
.cs-gauge-svg .cs-arc--track { stroke-linecap: round; }
.cs-gauge-svg .cs-hub { fill: var(--color-accent); stroke: var(--color-surface); stroke-width: 2.5; }
.cs-gauge-svg .cs-gauge-tick { fill: var(--color-text-muted); font-size: 11px; font-weight: 700; font-family: var(--font-head); }
.cs-gauge-read { text-align: center; }
.cs-gauge-label { display: block; font-family: var(--font-head); font-weight: 800; font-size: 1.35rem; }
.cs-gauge-sub { display: block; font-size: .78rem; color: var(--color-text-muted); margin-top: .1rem; }
.cs-gauge-counts { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: .3rem; }
.cs-gc { display: inline-flex; flex-direction: column; align-items: center; min-width: 58px; padding: .4rem .6rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); }
.cs-gc b { font-size: 1.05rem; font-weight: 800; color: var(--color-heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.cs-gc--sell b { color: #cf5b5b; } .cs-gc--buy b { color: #2e9e5b; } .cs-gc--neutral b { color: var(--color-accent-deep); }
.cs-gauge-empty { display: grid; place-items: center; min-height: 200px; padding: 1.5rem; color: var(--color-text-muted); font-size: .9rem; text-align: center; }

/* ---------- World market hours ---------- */
.term-hours-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; padding: 1rem 1.15rem 1.2rem; }
.term-hour { border: 1px solid var(--color-border); border-radius: var(--radius); padding: .7rem .8rem; }
.term-hour__city { font-weight: 700; color: var(--color-heading); font-size: .9rem; }
.term-hour__mkt { font-size: .72rem; color: var(--color-text-muted); }
.term-hour__time { font-size: 1.25rem; font-weight: 700; color: var(--color-heading); font-variant-numeric: tabular-nums; margin-top: .25rem; }
.term-hour__st { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 700; margin-top: .2rem; }
.term-hour__st .dot { width: 7px; height: 7px; border-radius: 50%; }
.term-hour__st.open { color: #2e9e5b; } .term-hour__st.open .dot { background: #2e9e5b; box-shadow: 0 0 0 3px color-mix(in srgb, #2e9e5b 22%, transparent); }
.term-hour__st.closed { color: var(--color-text-muted); } .term-hour__st.closed .dot { background: var(--color-text-muted); }
.term-hour__st.always { color: var(--color-accent); } .term-hour__st.always .dot { background: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 22%, transparent); }

/* ---------- Prose ---------- */
.term-about p { color: var(--color-text-muted); font-size: .95rem; line-height: 1.7; max-width: 760px; }
.term-about p + p { margin-top: .9rem; }
.term-about a { color: var(--color-accent-deep); font-weight: 600; }
.term-note { margin-top: 1rem; font-size: .85rem; color: var(--color-text-muted); }
