/* Charts, world clock, and radio. All rules are scoped to the public market tools. */

.market-tool {
    padding-block-end: 80px;
    background: var(--site-ivory, #f7f6f2);
    color: var(--site-text, #25384c);
}

.market-tool * {
    box-sizing: border-box;
}

.market-tool__breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-block: 24px;
    color: var(--site-muted, #536276);
    font-size: 13px;
    line-height: 1.4;
}

.market-tool__breadcrumb a {
    flex: 0 0 auto;
    color: var(--site-blue, #244a80) !important;
    text-decoration: none !important;
}

.market-tool__breadcrumb a:hover {
    text-decoration: underline !important;
}

.market-tool__breadcrumb [aria-current] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-tool__breadcrumb > [aria-hidden] {
    color: var(--site-line-strong, #b9c5d1);
}

.market-tool__intro {
    max-width: 840px;
    padding-block: 36px 40px;
    margin-block-end: 40px;
}

.market-tool__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--site-blue, #244a80);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.4;
}

.market-tool__eyebrow::before {
    content: "";
    width: 24px;
    height: 2px;
    background: var(--site-gold, #b58a3b);
}

.market-tool__intro h1 {
    margin: 12px 0 14px;
    color: var(--site-ink, #12243a);
    font-size: clamp(34px, 4vw, 52px);
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.025em;
}

.market-tool__intro p {
    margin: 0;
    color: var(--site-muted, #536276);
    font-size: 17px;
    line-height: 1.7;
}

/* Chart selector and embedded TradingView workspace */

.market-charts__layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.market-charts__selector,
.market-charts__panel,
.market-clock__card,
.market-radio__player {
    min-width: 0;
    border: 1px solid var(--site-line, #dce2e8);
    border-radius: var(--site-radius-lg, 12px);
    background: #fff;
    box-shadow: none;
}

.market-charts__selector {
    overflow: hidden;
}

.market-charts__selector-head {
    padding: 24px 24px 18px;
}

.market-charts__selector-head h2,
.market-charts__panel-head h2,
.market-clock__heading h2,
.market-radio__station h2 {
    margin: 0;
    color: var(--site-ink, #12243a);
    font-size: clamp(20px, 2vw, 24px);
    font-weight: 800;
    line-height: 1.3;
}

.market-charts__selector-head p,
.market-charts__panel-head p,
.market-clock__heading p,
.market-radio__station p {
    margin: 7px 0 0;
    color: var(--site-muted, #536276);
    font-size: 14px;
    line-height: 1.6;
}

.market-charts__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 24px 20px;
    border-block-end: 1px solid var(--site-line, #dce2e8);
}

.market-charts__category {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--site-line, #dce2e8);
    border-radius: 7px;
    background: #fff;
    color: var(--site-text, #25384c);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    cursor: pointer;
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        color 160ms ease;
}

.market-charts__category:hover {
    border-color: var(--site-blue, #244a80);
    color: var(--site-blue, #244a80);
}

.market-charts__category.is-active {
    border-color: var(--site-blue, #244a80);
    background: var(--site-blue, #244a80);
    color: #fff;
}

.market-charts__symbols {
    display: grid;
    gap: 0;
    max-height: 510px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.market-charts__symbol {
    display: grid;
    gap: 3px;
    min-height: 64px;
    padding: 11px 24px;
    border: 0;
    border-block-end: 1px solid var(--site-line, #dce2e8);
    background: #fff;
    color: var(--site-muted, #536276);
    text-align: start;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.market-charts__symbol:last-child {
    border-block-end: 0;
}

.market-charts__symbol:hover {
    background: #f5f7fa;
}

.market-charts__symbol.is-active {
    background: var(--site-blue-soft, #edf2f8);
    box-shadow: inset 3px 0 var(--site-blue, #244a80);
}

[dir="rtl"] .market-charts__symbol.is-active {
    box-shadow: inset -3px 0 var(--site-blue, #244a80);
}

.market-charts__symbol strong {
    color: var(--site-ink, #12243a);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    text-align: start;
    font-variant-numeric: tabular-nums;
}

.market-charts__symbol span {
    font-size: 12px;
    line-height: 1.35;
}

.market-charts__panel {
    scroll-margin-top: 130px;
    overflow: hidden;
}

.market-charts__panel-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    padding: 24px;
    border-block-end: 1px solid var(--site-line, #dce2e8);
}

.market-charts__provider {
    color: var(--site-muted, #536276);
    font-size: 12px;
    line-height: 1.4;
}

.market-charts__provider a {
    color: var(--site-blue, #244a80) !important;
    font-weight: 800;
    text-decoration: none !important;
}

.market-charts__provider a:hover {
    text-decoration: underline !important;
}

.market-charts__frame {
    position: relative;
    min-width: 0;
    min-height: 620px;
    overflow: hidden;
}

.market-charts__embed {
    width: 100%;
    min-width: 0;
    height: 620px;
    overflow: hidden;
}

.market-charts__embed :is(iframe, div) {
    max-width: 100%;
}

.market-charts__status {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 14px;
    padding: 24px;
    background: #fff;
    color: var(--site-muted, #536276);
    text-align: center;
}

.market-charts__status p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

.market-charts__status button {
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid var(--site-blue, #244a80);
    border-radius: 8px;
    background: var(--site-blue, #244a80);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

/* World clock */

.market-clock__heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px 32px;
    margin-block-end: 20px;
}

.market-clock__heading p {
    max-width: 620px;
    margin: 0;
    text-align: end;
}

.market-clock__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.market-clock__card {
    display: flex;
    flex-direction: column;
    min-height: 214px;
    padding: 22px;
}

.market-clock__city {
    display: flex;
    align-items: center;
    gap: 12px;
}

.market-clock__flag {
    display: grid;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid var(--site-line, #dce2e8);
    border-radius: 8px;
    background: var(--site-ivory, #f7f6f2);
    font-size: 22px;
    line-height: 1;
}

.market-clock__city h3 {
    margin: 0;
    color: var(--site-ink, #12243a);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.3;
}

.market-clock__city span:not(.market-clock__flag) {
    display: block;
    margin-block-start: 3px;
    color: var(--site-muted, #536276);
    font-size: 12px;
    line-height: 1.3;
}

.market-clock__time {
    display: block;
    margin-block: 25px 16px;
    color: var(--site-ink, #12243a);
    font-family: "Tajawal", system-ui, sans-serif;
    font-size: clamp(25px, 2.4vw, 33px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    text-align: start;
}

.market-clock__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-block-start: auto;
    padding-block-start: 14px;
    border-block-start: 1px solid var(--site-line, #dce2e8);
    color: var(--site-muted, #536276);
    font-size: 12px;
    line-height: 1.35;
}

.market-clock__offset {
    flex: 0 0 auto;
    color: var(--site-blue, #244a80);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Radio */

.market-tool--radio .market-tool__intro {
    margin-block-end: 32px;
}

.market-radio__player {
    max-width: 800px;
    margin-inline: auto;
    padding: clamp(24px, 4vw, 40px);
}

.market-radio__station {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-block-end: 28px;
    border-block-end: 1px solid var(--site-line, #dce2e8);
}

.market-radio__logo {
    display: grid;
    flex: 0 0 auto;
    width: 84px;
    height: 84px;
    place-items: center;
    padding: 12px;
    border: 1px solid var(--site-line, #dce2e8);
    border-radius: 10px;
    background: #fff;
}

.market-radio__logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.market-radio__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px 28px;
    padding-block: 32px 22px;
}

.market-radio__play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 188px;
    min-height: 54px;
    padding: 12px 24px;
    border: 1px solid var(--site-blue, #244a80);
    border-radius: 8px;
    background: var(--site-blue, #244a80);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color 160ms ease;
}

.market-radio__play:hover {
    background: var(--site-blue-hover, #1b3c6c);
}

.market-radio__play i {
    font-size: 17px;
}

.market-radio__volume {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.market-radio__volume button {
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--site-line, #dce2e8);
    border-radius: 8px;
    background: #fff;
    color: var(--site-blue, #244a80);
    cursor: pointer;
}

.market-radio__volume button:hover {
    border-color: var(--site-blue, #244a80);
}

.market-radio__volume input {
    width: min(20vw, 180px);
    min-width: 100px;
    accent-color: var(--site-blue, #244a80);
    cursor: pointer;
}

.market-radio__volume output {
    min-width: 38px;
    color: var(--site-muted, #536276);
    font-size: 13px;
    text-align: end;
    font-variant-numeric: tabular-nums;
}

.market-radio__status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    color: var(--site-muted, #536276);
    font-size: 14px;
    line-height: 1.5;
}

.market-radio__equalizer {
    display: flex;
    align-items: end;
    gap: 3px;
    width: 25px;
    height: 22px;
}

.market-radio__equalizer i {
    display: block;
    width: 4px;
    height: 9px;
    border-radius: 3px;
    background: var(--site-gold, #b58a3b);
    animation: market-radio-pulse 850ms ease-in-out infinite alternate;
}

.market-radio__equalizer i:nth-child(2) {
    animation-delay: 140ms;
}

.market-radio__equalizer i:nth-child(3) {
    animation-delay: 300ms;
}

.market-radio__equalizer i:nth-child(4) {
    animation-delay: 440ms;
}

@keyframes market-radio-pulse {
    to {
        height: 21px;
    }
}

.market-radio__direct {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-block-start: 20px;
    color: var(--site-blue, #244a80) !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
}

.market-radio__direct:hover {
    text-decoration: underline !important;
}

@media (max-width: 1050px) {
    .market-charts__layout {
        grid-template-columns: 260px minmax(0, 1fr);
        gap: 18px;
    }

    .market-clock__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .market-charts__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .market-charts__symbols {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 276px;
    }

    .market-charts__symbol {
        border-inline-end: 1px solid var(--site-line, #dce2e8);
    }

    .market-clock__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .market-clock__heading {
        align-items: start;
        flex-direction: column;
    }

    .market-clock__heading p {
        text-align: start;
    }
}

@media (max-width: 540px) {
    .market-tool {
        padding-block-end: 56px;
    }

    .market-tool__breadcrumb {
        padding-block: 18px;
    }

    .market-tool__intro {
        padding-block: 28px 30px;
        margin-block-end: 24px;
    }

    .market-tool__intro h1 {
        font-size: 36px;
    }

    .market-tool__intro p {
        font-size: 16px;
    }

    .market-charts__selector-head,
    .market-charts__panel-head {
        padding: 20px;
    }

    .market-charts__categories {
        flex-wrap: nowrap;
        padding: 0 20px 18px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .market-charts__category {
        flex: 0 0 auto;
    }

    .market-charts__symbol {
        min-height: 62px;
        padding: 10px 14px;
    }

    .market-charts__symbol strong {
        font-size: 13px;
    }

    .market-charts__symbol span {
        font-size: 11px;
    }

    .market-charts__frame,
    .market-charts__embed {
        min-height: 620px;
    }

    .market-clock__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .market-clock__card {
        min-height: 185px;
    }

    .market-clock__time {
        margin-block: 20px 12px;
        font-size: 31px;
    }

    .market-radio__station {
        align-items: start;
        gap: 14px;
    }

    .market-radio__logo {
        width: 64px;
        height: 64px;
        padding: 9px;
    }

    .market-radio__controls {
        align-items: stretch;
        flex-direction: column;
    }

    .market-radio__play {
        width: 100%;
    }

    .market-radio__volume {
        justify-content: space-between;
    }

    .market-radio__volume input {
        flex: 1;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-charts__category,
    .market-charts__symbol,
    .market-radio__play {
        transition: none;
    }

    .market-radio__equalizer i {
        animation: none;
        height: 12px;
    }
}
