/*
 * National STR Map — terminal chrome (str-terminal.js).
 *   .st-tape …   quote tape in #sm-ticker
 *   .st-pulse …  national pulse strip   } both inside #sm-terminal
 *   .st-board …  market-movers boards   }
 * Tokens (--sm-*) come from .sm in str-map.css.
 */
.sm-ticker, .sm-terminal, .sm-pulse-slot {
    --st-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
    --st-up: #34D399;
    --st-down: #F87171;
    --st-amber: #FBBF24;
    --st-info: #60A5FA;
    --st-ink: #05090F;
}
.sm-ticker:empty, .sm-terminal:empty { display: none; }

/* ==========================================================
   Ticker tape
   ========================================================== */
.sm-ticker {
    background: var(--st-ink);
    border-bottom: 1px solid var(--sm-line);
    position: relative;
}
/* The tape sits under the map, inside the stage panel — never wider than the map. */
.sm-stage { min-width: 0; }
.sm-stage .sm-ticker {
    border-bottom: 0; border-top: 1px solid var(--sm-line);
    border-radius: 0 0 15px 15px; overflow: hidden; min-width: 0; max-width: 100%;
}
.st-tape {
    display: flex; align-items: stretch;
    max-width: 100%; height: 40px; overflow: hidden;
}
.st-tape-label {
    flex: 0 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 1px;
    padding: 0 16px 0 24px; position: relative; z-index: 2;
    background: linear-gradient(180deg, #0E1A2C, #0A1322);
    border-right: 1px solid var(--sm-line);
    box-shadow: 10px 0 18px -6px var(--st-ink);
    cursor: default; white-space: nowrap;
}
.st-tape-name {
    font-family: var(--st-mono); font-size: .72rem; font-weight: 800; letter-spacing: .16em;
    color: var(--sm-accent); display: inline-flex; align-items: center; gap: 7px; line-height: 1.1;
}
.st-tape-name::before {
    content: ''; width: 6px; height: 6px; background: var(--sm-accent); border-radius: 1px;
    transform: rotate(45deg);
}
.st-tape-date {
    font-family: var(--st-mono); font-size: .6rem; font-weight: 600; letter-spacing: .08em;
    text-transform: uppercase; color: var(--sm-faint); line-height: 1.1; padding-left: 13px;
}

.st-tape-view {
    flex: 1 1 auto; min-width: 0; overflow: hidden; position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 36px), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 36px), transparent 100%);
}
.st-tape-track {
    display: flex; width: max-content; height: 100%;
    animation: stTape 600s linear infinite;
    will-change: transform;
}
.st-tape-set { display: flex; flex: 0 0 auto; height: 100%; }
@keyframes stTape { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-50%, 0, 0); } }

.st-tape:hover .st-tape-track,
.st-tape.is-paused .st-tape-track { animation-play-state: paused; }
/* Keyboard focus: JS swaps the transform for a scroll offset so any quote can be brought into view. */
.st-tape-track.is-frozen { animation: none; transform: none; }

.st-q {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; height: 100%;
    padding: 0 18px; margin: 0; background: transparent; border: 0;
    border-right: 1px solid rgba(38, 51, 76, .6);
    color: var(--sm-text); font-family: var(--st-mono); font-size: .78rem; line-height: 1;
    font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
    transition: background .15s ease;
}
.st-q:hover { background: rgba(52, 211, 153, .07); }
.st-q:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: -3px; background: rgba(52, 211, 153, .1); }
.st-q-sym { font-weight: 700; color: #fff; letter-spacing: .04em; }
.st-q-tag { font-size: .62rem; font-weight: 700; letter-spacing: .1em; color: var(--sm-faint); }
.st-q-val { font-weight: 700; color: #fff; }
.st-q-note {
    font-size: .58rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--st-amber); border: 1px solid rgba(251, 191, 36, .35); border-radius: 3px; padding: 2px 4px;
}
.st-q-chip { font-size: .72rem; font-weight: 700; padding: 3px 6px; border-radius: 4px; letter-spacing: .02em; }
.st-q-chip.is-up { color: var(--st-up); background: rgba(52, 211, 153, .12); }
.st-q-chip.is-down { color: var(--st-down); background: rgba(248, 113, 113, .12); }
.st-q-chip.is-flat { color: var(--sm-dim); background: rgba(150, 163, 188, .1); }
.st-q-chip.is-amber { color: var(--st-amber); background: rgba(251, 191, 36, .1); }
.st-q-chip.is-info { color: #93C5FD; background: rgba(96, 165, 250, .12); }
.st-q-chip.is-dim { color: var(--sm-dim); background: rgba(150, 163, 188, .1); }

.st-tape-pause {
    flex: 0 0 auto; width: 40px; display: grid; place-items: center;
    background: #0A1322; border: 0; border-left: 1px solid var(--sm-line);
    color: var(--sm-dim); cursor: pointer; position: relative; z-index: 2;
    transition: color .15s ease, background .15s ease;
}
.st-tape-pause:hover { color: #fff; background: var(--sm-raise); }
.st-tape-pause:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: -3px; }
.st-tape-pause-ic {
    width: 9px; height: 11px; box-sizing: border-box;
    border-left: 3px solid currentColor; border-right: 3px solid currentColor;
}
.st-tape-pause[aria-pressed="true"] { color: var(--sm-accent); }
.st-tape-pause[aria-pressed="true"] .st-tape-pause-ic {
    width: 0; height: 0; border: 0;
    border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid currentColor;
}

/* ==========================================================
   Terminal section shell
   ========================================================== */
.sm-terminal {
    border-top: 1px solid var(--sm-line);
    background:
        radial-gradient(900px 320px at 85% 0%, rgba(96, 165, 250, .06), transparent 60%),
        linear-gradient(180deg, #0A111E 0%, var(--sm-bg) 320px);
    padding: 34px 0 30px; margin-bottom: 28px;
}
.st-inner { max-width: 1880px; margin: 0 auto; padding: 0 24px; }
.st-block + .st-block { margin-top: 38px; }

.st-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 28px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.st-kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--st-mono); font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
    color: var(--sm-accent);
}
.st-kicker::before { content: ''; width: 18px; height: 2px; background: var(--sm-accent); }
.sm .st-title {
    margin: 6px 0 0; font-size: clamp(1.25rem, 2vw, 1.6rem); font-weight: 800; letter-spacing: -.02em;
    line-height: 1.15; color: #fff; font-family: inherit;
}
.sm .st-head-sub { margin: 0; max-width: 62ch; font-size: .84rem; line-height: 1.5; color: var(--sm-dim); }

/* ==========================================================
   National pulse strip
   ========================================================== */
.st-pulse {
    display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1px;
    background: var(--sm-line); border: 1px solid var(--sm-line); border-radius: 16px; overflow: hidden;
    list-style: none; margin: 0; padding: 0;
}
.st-pc {
    background: var(--sm-panel); padding: 15px 16px 14px; min-width: 0; position: relative;
    display: flex; flex-direction: column;
}
.st-pc::before {
    content: ''; position: absolute; left: 16px; top: 0; width: 22px; height: 2px; background: var(--sm-line);
}
.st-pc.is-accent::before, .st-pc.is-up::before { background: var(--st-up); }
.st-pc.is-down::before { background: var(--st-down); }
.st-pc.is-warn::before { background: var(--st-amber); }
.st-pc-l {
    font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sm-faint);
    line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-pc-v { margin-top: 7px; display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.st-pc-num {
    font-family: var(--st-mono); font-variant-numeric: tabular-nums;
    font-size: clamp(1.35rem, 1.75vw, 1.8rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.05; color: #fff;
}
.st-pc-unit { font-family: var(--st-mono); font-size: .74rem; font-weight: 600; color: var(--sm-faint); }
.st-pc.is-accent .st-pc-num, .st-pc.is-up .st-pc-num { color: var(--st-up); }
.st-pc.is-down .st-pc-num { color: var(--st-down); }
.st-pc.is-warn .st-pc-num { color: var(--st-amber); }
.st-pc-c { margin-top: 7px; font-size: .7rem; line-height: 1.4; color: var(--sm-faint); }

/* ==========================================================
   Boards
   ========================================================== */
.st-boards {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch;
}
.st-board {
    background: var(--sm-panel); border: 1px solid var(--sm-line); border-radius: 16px; overflow: hidden;
    display: flex; flex-direction: column; min-width: 0;
}
.st-board-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--sm-line); }
.st-board-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.st-board-code {
    flex: 0 0 auto; font-family: var(--st-mono); font-size: .62rem; font-weight: 800; letter-spacing: .1em;
    color: var(--sm-accent); background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .28);
    border-radius: 4px; padding: 3px 6px; line-height: 1;
}
.st-board--cooling .st-board-code, .st-board--strict .st-board-code {
    color: var(--st-down); background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .3);
}
.st-board--entry .st-board-code, .st-board--resort .st-board-code {
    color: #93C5FD; background: rgba(96, 165, 250, .1); border-color: rgba(96, 165, 250, .3);
}
.sm .st-board-title {
    margin: 0; font-size: .95rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; color: #fff;
    font-family: inherit; min-width: 0;
}
.sm .st-board-sub { margin: 7px 0 0; font-size: .75rem; line-height: 1.45; color: var(--sm-dim); min-height: 2.9em; }

/* Rows share any spare height so boards in one grid row end on the same line. */
.st-rows { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; display: grid; grid-auto-rows: 1fr; }
.st-li { margin: 0; padding: 0; display: flex; min-width: 0; }
.st-li + .st-li { border-top: 1px solid rgba(38, 51, 76, .55); }

.st-row {
    display: grid; align-items: center; column-gap: 12px; width: 100%;
    grid-template-columns: 22px minmax(0, 1fr) 74px 66px 70px;
    padding: 8px 16px 8px 13px; border: 0; border-left: 3px solid transparent;
    background: transparent; color: var(--sm-text); font-family: inherit; text-align: left;
    position: relative;
}
.st-cols-2 .st-row { grid-template-columns: 22px minmax(0, 1fr) 84px 74px; }
.st-board--opportunity .st-row { grid-template-columns: 22px minmax(0, 1fr) 92px 60px 82px; }
.st-board--entry .st-row { grid-template-columns: 22px minmax(0, 1fr) 74px 92px 62px; }
.st-board--friendly .st-row { grid-template-columns: 22px minmax(0, 1fr) 66px 82px 60px; }
.st-board--strict .st-row { grid-template-columns: 22px minmax(0, 1fr) 84px 58px; }
.st-board--resort .st-row { grid-template-columns: 22px minmax(0, 1fr) 70px 92px 70px; }

button.st-row { cursor: pointer; transition: background .14s ease, border-color .14s ease; }
button.st-row:hover { background: var(--sm-raise); border-left-color: var(--sm-accent); }
button.st-row:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: -2px; background: var(--sm-raise); border-left-color: var(--sm-accent); }

.st-row--head {
    padding-top: 7px; padding-bottom: 7px; background: rgba(5, 9, 15, .35);
    border-bottom: 1px solid var(--sm-line);
    font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sm-faint);
}

.st-c-rank {
    font-family: var(--st-mono); font-variant-numeric: tabular-nums; font-size: .72rem; font-weight: 700;
    color: var(--sm-faint); text-align: right;
}
.st-row.is-top .st-c-rank { color: var(--sm-accent); }
.st-c-mkt { min-width: 0; display: block; }
.st-mkt-line { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.st-mkt-city { font-size: .86rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.st-mkt-st { flex: 0 0 auto; font-family: var(--st-mono); font-size: .66rem; font-weight: 700; letter-spacing: .06em; color: var(--sm-faint); }
.st-mkt-sub {
    display: block; margin-top: 1px; font-size: .69rem; line-height: 1.4; color: var(--sm-faint);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-board--strict .st-mkt-sub { color: var(--sm-dim); }
/* One board per row on a phone: give the rule snippet a second line. */
@media (max-width: 760px) {
    .st-board--strict .st-mkt-sub {
        white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
        margin-top: 2px;
    }
    .st-board--strict button.st-row { align-items: start; }
    .st-board--strict button.st-row .st-c-rank, .st-board--strict button.st-row .st-c-fig { padding-top: 2px; }
}

.st-c-fig {
    font-family: var(--st-mono); font-variant-numeric: tabular-nums; font-size: .78rem; font-weight: 500;
    color: var(--sm-dim); text-align: right; white-space: nowrap; min-width: 0;
}
.st-row--head .st-c-fig { font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; }
.st-c-fig--1 { font-size: .86rem; font-weight: 700; color: #fff; }
.st-c-fig.is-up { color: var(--st-up); }
.st-c-fig.is-down { color: var(--st-down); }
.st-c-fig.is-amber { color: var(--st-amber); }
.st-c-fig.is-flat, .st-c-fig.is-dim { color: var(--sm-dim); }
.st-c-fig.is-text { font-family: inherit; font-size: .74rem; font-weight: 600; letter-spacing: 0; }
.st-c-fig--1.is-text { font-size: .76rem; font-weight: 700; }
.st-partial {
    display: inline-block; margin-right: 6px; vertical-align: 1px;
    font-family: 'Inter', system-ui, sans-serif; font-size: .55rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--st-amber); border: 1px solid rgba(251, 191, 36, .35); border-radius: 3px; padding: 1px 3px;
}

/* Hairline meter along the row's foot: value relative to the board leader. */
.st-meter {
    position: absolute; left: 0; bottom: -1px; height: 2px; max-width: 100%;
    background: linear-gradient(90deg, rgba(52, 211, 153, 0), rgba(52, 211, 153, .75));
    pointer-events: none; z-index: 1;
}
.st-meter.is-down { background: linear-gradient(90deg, rgba(248, 113, 113, 0), rgba(248, 113, 113, .75)); }
.st-meter.is-info { background: linear-gradient(90deg, rgba(96, 165, 250, 0), rgba(96, 165, 250, .7)); }

.st-board-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 12px 9px 16px; border-top: 1px solid var(--sm-line); background: rgba(5, 9, 15, .35);
}
.st-board-n { font-family: var(--st-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sm-faint); }
.st-board-map {
    background: transparent; border: 1px solid var(--sm-line); border-radius: 8px; padding: 6px 11px;
    font-family: inherit; font-size: .74rem; font-weight: 700; color: var(--sm-accent); cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease; white-space: nowrap;
}
.st-board-map:hover { border-color: var(--sm-accent); background: rgba(52, 211, 153, .1); color: #fff; }
.st-board-map:focus-visible { outline: 2px solid var(--sm-accent); outline-offset: 2px; }

/* ==========================================================
   Footer
   ========================================================== */
.st-foot {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px 28px; flex-wrap: wrap;
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--sm-line);
}
.sm .st-foot-note { margin: 0; flex: 1 1 520px; max-width: 110ch; font-size: .76rem; line-height: 1.6; color: var(--sm-faint); }
.st-basil {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--st-mono); font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: #93C5FD; border: 1px solid rgba(96, 165, 250, .28); background: rgba(96, 165, 250, .07);
    border-radius: 999px; padding: 5px 11px; white-space: nowrap;
}
.st-basil-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--st-info); }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 1380px) {
    .st-pulse { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
    .st-boards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* Nine boards in two columns leaves one over: the rules board takes the full row, where its snippets have room. */
    .st-board--strict { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .sm-terminal { padding: 26px 0 22px; }
    .st-inner { padding: 0 16px; }
    .st-boards { grid-template-columns: minmax(0, 1fr); }
    .st-rows { grid-auto-rows: auto; }
    .st-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm .st-board-sub { min-height: 0; }
    .st-tape-label { padding: 0 9px 0 12px; box-shadow: 6px 0 12px -6px var(--st-ink); }
    .st-tape-name { font-size: .64rem; letter-spacing: .1em; gap: 5px; }
    .st-tape-name::before { width: 5px; height: 5px; }
    .st-tape-date { font-size: .53rem; letter-spacing: .02em; padding-left: 10px; }
    .st-tape-pause { width: 34px; }
    .st-q { padding: 0 14px; }
}
@media (max-width: 480px) {
    /* Two figures per row on a phone: the third column drops so the market name stays readable. */
    .st-row,
    .st-board--entry .st-row,
    .st-board--opportunity .st-row,
    .st-board--friendly .st-row,
    .st-board--resort .st-row { grid-template-columns: 20px minmax(0, 1fr) 78px 70px; column-gap: 9px; padding-left: 10px; padding-right: 12px; }
    .st-board--opportunity .st-row { grid-template-columns: 20px minmax(0, 1fr) 90px 58px; }
    .st-board--entry .st-row { grid-template-columns: 20px minmax(0, 1fr) 70px 90px; }
    .st-board--friendly .st-row { grid-template-columns: 20px minmax(0, 1fr) 64px 80px; }
    .st-board--resort .st-row { grid-template-columns: 20px minmax(0, 1fr) 66px 88px; }
    .st-board--strict .st-row { grid-template-columns: 20px minmax(0, 1fr) 78px; }
    .st-cols-3 .st-c-fig--3, .st-board--strict .st-c-fig--2 { display: none; }
    .st-pc { padding: 13px 13px 12px; }
    .st-pc::before { left: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .st-tape-track { animation: none; transform: none; }
    .st-tape-set--clone { display: none; }
    .st-tape-view { overflow-x: auto; scrollbar-width: none; }
    .st-tape-view::-webkit-scrollbar { display: none; }
    .st-tape-pause { display: none; }
    .st-q, button.st-row, .st-board-map, .st-tape-pause { transition: none; }
}

/* ==========================================================
   National pulse as a grid under the map (slot #sm-pulse)
   ========================================================== */
.sm-center { min-width: 0; display: grid; gap: 14px; align-content: start; }
.sm-pulse-slot:empty { display: none; }
.sm-pulse-slot .st-block { margin: 0; }
.sm-pulse-slot .st-head { margin: 0 0 10px; padding: 0 2px; align-items: baseline; }
.sm-pulse-slot .st-title { font-size: 1.05rem; }
.sm-pulse-slot .st-head-sub { font-size: .74rem; }
.sm-pulse-slot .st-pulse { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sm-pulse-slot .st-pc { padding: 16px 18px 15px; transition: background .15s ease; }
.sm-pulse-slot .st-pc:hover { background: var(--sm-raise); }
@media (max-width: 720px) { .sm-pulse-slot .st-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
