:root {
    --markets-navy: #091b2b;
    --markets-navy-light: #10283d;
    --markets-blue: #2e79c8;
    --markets-line: rgba(160, 190, 216, .24);
    --markets-green: #20c863;
    --markets-red: #ff554d;
}

body.test-theme-markets-page {
    background: var(--markets-navy) !important;
}

body.test-theme-markets-page .main-container,
body.test-theme-markets-page .default-template,
body.test-theme-markets-page .default-template .content,
.canada-markets-page,
.canada-markets-page > .side-content-inner {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.markets-page-main {
    min-height: 700px;
    padding-bottom: 58px;
    color: #fff;
    background: var(--markets-navy);
}

.markets-ticker {
    display: flex;
    width: min(calc(100% - 28px), 1420px);
    height: 36px;
    margin: 0 auto;
    overflow: hidden;
    color: #fff;
    background: #173a5f;
    border-bottom: 1px solid #2a74b9;
}

.markets-ticker__label {
    position: relative;
    z-index: 2;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 0 18px;
    color: #fff;
    background: #0c65b1;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
}

.markets-ticker__viewport {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    direction: ltr;
}

.markets-ticker__track {
    display: flex;
    width: max-content;
    min-width: 200%;
    height: 100%;
    animation: markets-ticker-ltr 24s linear infinite;
    will-change: transform;
}

.markets-ticker__viewport:hover .markets-ticker__track {
    animation-play-state: paused;
}

.markets-ticker__group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 50%;
    direction: rtl;
}

.markets-ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 18px;
    white-space: nowrap;
    font-size: 12px;
}

.markets-ticker__item b { font-weight: 800; }
.markets-ticker__item strong { font: 800 13px Arial, sans-serif; }
.markets-ticker__item em { font: 800 12px Arial, sans-serif; font-style: normal; }
.markets-ticker__divider { width: 1px; height: 18px; background: rgba(255,255,255,.24); }
.markets-ticker .is-up { color: var(--markets-green); }
.markets-ticker .is-down { color: var(--markets-red); }

@keyframes markets-ticker-ltr {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

.markets-shell {
    width: min(calc(100% - 28px), 1420px);
    padding-top: 28px;
}

.markets-page-title,
.markets-more-section > header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-top: 12px;
    border-top: 2px solid rgba(113, 153, 187, .2);
}

.markets-page-title span,
.markets-more-section > header span {
    width: 0;
    height: 0;
    border-top: 12px solid var(--markets-blue);
    border-left: 12px solid transparent;
}

.markets-page-title h1,
.markets-more-section h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(25px, 3vw, 36px);
    font-weight: 900;
}

.markets-lead-layout {
    display: grid;
    grid-template-areas: "rates stories";
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 20px;
    align-items: stretch;
}

.markets-rates-panel {
    grid-area: rates;
    align-self: start;
    padding: 0 8px 10px;
    background: #0b1d2d;
    border: 1px solid #30465a;
}

.markets-rates-panel > header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0 -8px;
    padding: 11px 12px 10px;
    border-bottom: 1px solid #30465a;
}

.markets-rates-panel > header span {
    width: 0;
    height: 0;
    border-top: 13px solid #2878d3;
    border-left: 13px solid transparent;
}

.markets-rates-panel h2 { margin: 0; color: #2878d3; font-size: 25px; font-weight: 900; }

.markets-rate-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "value change";
    align-items: center;
    gap: 10px;
    min-height: 77px;
    padding: 10px 0;
    border-bottom: 1px dotted rgba(166, 194, 216, .32);
}

.markets-rate-row:last-child { border-bottom: 0; }
.markets-rate-value { grid-area: value; text-align: right; }
.markets-rate-row h3 { margin: 0 0 5px; color: #fff; font-size: 17px; font-weight: 900; line-height: 1.25; }
.markets-rate-row p { margin: 0; color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; }
.markets-rate-row p strong { margin-inline-start: 4px; color: #fff; font: 900 15px Arial, sans-serif; }

.markets-rate-change {
    grid-area: change;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    direction: ltr;
    font: 900 13px Arial, sans-serif;
    min-width: 104px;
}

.markets-rate-change.is-up { color: var(--markets-green); }
.markets-rate-change.is-down { color: var(--markets-red); }
.markets-rate-change__label { color: #fff; direction: rtl; font-family: inherit; }
.markets-rate-change small { flex-basis: 100%; padding-inline-start: 16px; color: #fff; text-align: left; }
.markets-rates-date { margin: 13px 0 4px; color: #a9bbca; font-size: 11px; }
.markets-rates-source { color: #6eb4f3 !important; font-size: 11px; text-decoration: none !important; }
.markets-rates-unavailable { padding: 22px 5px; color: #b9c4cf; }

.markets-lead-stories {
    grid-area: stories;
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(230px, .8fr);
    gap: 16px;
}

.markets-lead-story,
.markets-side-story {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: #fff !important;
    text-decoration: none !important;
}

.markets-story-media {
    position: relative;
    display: block;
    overflow: hidden;
    background: #132b3f;
}

.markets-story-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,.08);
}

.markets-story-media img,
.markets-story-media .canada-card__placeholder {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.markets-lead-story .markets-story-media { height: 460px; }
.markets-side-stories { display: grid; gap: 18px; }
.markets-side-story .markets-story-media { height: 185px; }
.markets-lead-story:hover img,
.markets-side-story:hover img,
.markets-news-card:hover img { transform: scale(1.025); }

.markets-story-copy { display: block; padding-top: 11px; }
.markets-story-copy small,
.markets-news-card small { display: block; margin-bottom: 5px; color: var(--markets-blue); font-size: 11px; font-weight: 900; }
.markets-lead-story .markets-story-copy strong { font-size: clamp(22px, 2.1vw, 32px); line-height: 1.55; }
.markets-side-story .markets-story-copy strong { font-size: 16px; line-height: 1.65; }

.markets-empty {
    grid-column: 1 / -1;
    display: grid;
    place-content: center;
    min-height: 390px;
    padding: 30px;
    text-align: center;
    background: rgba(16, 40, 61, .72);
    border: 1px solid var(--markets-line);
}
.markets-empty h2 { margin: 0 0 8px; font-size: 24px; }
.markets-empty p { margin: 0; color: #a9bbca; }

.markets-more-section { margin-top: 42px; }
.markets-more-section h2 { font-size: 25px; }
.markets-news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.markets-news-card { min-width: 0; border-bottom: 1px solid var(--markets-line); padding-bottom: 15px; }
.markets-news-card .markets-story-media { height: 210px; margin-bottom: 12px; }
.markets-news-card h3 { margin: 0; font-size: 16px; line-height: 1.7; }
.markets-news-card h3 a { color: #fff !important; text-decoration: none !important; }
.markets-news-card time { display: block; margin-top: 8px; color: #8ca0b1; font-size: 11px; }

.markets-pagination ul { display: flex; justify-content: center; gap: 6px; margin: 28px 0 0; padding: 0; list-style: none; }
.markets-pagination a,
.markets-pagination span { display: grid; place-items: center; min-width: 38px; min-height: 38px; padding: 6px 10px; color: #fff !important; background: #173a5f; text-decoration: none !important; font-size: 12px; font-weight: 900; }
.markets-pagination .current,
.markets-pagination a:hover { background: var(--markets-blue); }

@media (max-width: 1100px) {
    .markets-lead-layout { grid-template-columns: 270px minmax(0, 1fr); }
    .markets-lead-story .markets-story-media { height: 390px; }
    .markets-side-story .markets-story-media { height: 155px; }
}

@media (max-width: 900px) {
    .markets-lead-layout { grid-template-areas: "stories" "rates"; grid-template-columns: 1fr; }
    .markets-rates-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
    .markets-rates-panel > header,
    .markets-rates-date,
    .markets-rates-source { grid-column: 1 / -1; }
    .markets-news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
    .markets-ticker { width: 100%; height: 40px; }
    .markets-ticker__label { padding-inline: 11px; font-size: 12px; }
    .markets-ticker__item { padding-inline: 12px; font-size: 11px; }
    .markets-shell { width: min(calc(100% - 20px), 1420px); padding-top: 18px; }
    .markets-lead-stories { grid-template-columns: 1fr; }
    .markets-lead-story .markets-story-media { height: 260px; }
    .markets-side-stories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .markets-side-story .markets-story-media { height: 120px; }
    .markets-rates-panel { grid-template-columns: 1fr; }
    .markets-rates-panel > header,
    .markets-rates-date,
    .markets-rates-source { grid-column: auto; }
    .markets-news-grid { grid-template-columns: 1fr; }
    .markets-news-card { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 12px; }
    .markets-news-card .markets-story-media { height: 100px; margin: 0; }
    .markets-news-card h3 { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .markets-ticker__track { animation: none; }
}
