/* ══════════════════════════════════════════════════════════════════════════
   Metal price-trend chart — styles for the #mp-chart block built by
   metal-prices.js. Shared by index.html (banner page) and metal-rates.html.

   Uses the site tokens (--ink, --mut, --line2, --amber…), which both pages
   define. The price uses the body sans, not the condensed display face:
   a figure the reader compares should look like a number, not a headline.
   ══════════════════════════════════════════════════════════════════════════ */
/* The chart sits ABOVE the rates table: it carries its own space below and
   none above, so it tucks under the section title on the banner page and
   leads the section on the Metal Rates tab. */
.mp-chart {
    margin: 0 0 28px;
    background: var(--navy2, #fff9f1);
    border: 1px solid var(--line2, rgba(40, 53, 70, .2));
    border-radius: 16px;
    padding: 22px 24px 16px;
    box-shadow: var(--shadow, none);
}
.mp-chart[hidden] { display: none; }
/* Metal Rates tab: chart first, then the "Current Rates" heading — give that
   heading room so it reads as the start of the table, not a chart caption. */
.mp-chart + .mp-head { margin-top: 44px; }

.mpc-title { font-family: var(--fd); font-weight: 800; font-size: 1.4rem; color: var(--ink); margin: 0; }
.mpc-title b { color: var(--amber-deep); }

/* One control row above the plot: which metal, then which range. */
.mpc-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap; margin-top: 14px; }
.mpc-metal { display: flex; align-items: center; gap: 10px; }
.mpc-metal span { font-family: var(--fb); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.mpc-metal select {
    font-family: var(--fb); font-size: .92rem; font-weight: 500; color: var(--ink);
    background: #fff; border: 1px solid var(--line2); border-radius: 10px;
    padding: 8px 34px 8px 12px; min-height: 38px; cursor: pointer;
}

.mpc-ranges { display: inline-flex; gap: 2px; padding: 3px; background: rgba(40, 53, 70, .05); border-radius: 11px; }
.mpc-ranges button {
    font-family: var(--fb); font-size: .82rem; font-weight: 600; color: var(--mut);
    background: transparent; border: 0; border-radius: 8px;
    min-width: 40px; min-height: 32px; padding: 0 10px; cursor: pointer;
    transition: background .15s, color .15s;
}
.mpc-ranges button:hover { color: var(--ink); background: rgba(40, 53, 70, .06); }
.mpc-ranges button[aria-pressed="true"] { color: var(--amber-deep); background: #fff; box-shadow: 0 1px 3px rgba(40, 53, 70, .16); }
.mpc-ranges button:focus-visible,
.mpc-metal select:focus-visible,
.mpc-tbl-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* The headline figure — proportional digits at this size, not tabular. */
.mpc-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 18px; font-family: var(--fb); }
.mpc-now { font-size: 2.1rem; font-weight: 600; line-height: 1.1; color: var(--ink); letter-spacing: -.01em; }
.mpc-unit { font-size: .88rem; color: var(--mut); }
.mpc-chg { font-size: 1rem; font-weight: 600; }
.mpc-per { font-size: .88rem; color: var(--mut); }
.mpc-note { margin: 6px 0 0; font-family: var(--fb); font-size: .8rem; line-height: 1.5; color: var(--mut); max-width: 70ch; }
.mpc-note[hidden], .mpc-empty[hidden], .mpc-table[hidden], .mpc-plot[hidden] { display: none; }
.mpc-empty { margin: 18px 0 6px; font-family: var(--fb); font-size: .9rem; color: var(--mut); }

.mpc-plot {
    position: relative; margin-top: 12px; border-radius: 8px;
    /* horizontal drags scrub the chart on touch; vertical still scrolls the page */
    touch-action: pan-y; cursor: crosshair; outline: none;
}
.mpc-plot:focus-visible { box-shadow: 0 0 0 2px var(--amber); }
.mpc-plot svg { display: block; overflow: visible; }

.mpc-grid line { stroke: rgba(40, 53, 70, .1); stroke-width: 1; shape-rendering: crispEdges; }
.mpc-axis text { font-family: var(--fb); font-size: 11px; font-weight: 500; fill: rgba(40, 53, 70, .62); font-variant-numeric: tabular-nums; }
.mpc-ref { stroke: rgba(40, 53, 70, .45); stroke-width: 1; stroke-dasharray: 2 4; }
.mpc-cross { stroke: rgba(40, 53, 70, .45); stroke-width: 1; shape-rendering: crispEdges; }

/* Value leads, date follows. */
.mpc-tip {
    position: absolute; top: 0; left: 0;
    background: #fff; border: 1px solid var(--line2); border-radius: 8px;
    padding: 6px 10px; box-shadow: 0 8px 20px -10px rgba(40, 53, 70, .45);
    font-family: var(--fb); font-size: .74rem; color: var(--mut);
    white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s;
}
.mpc-tip.on { opacity: 1; }
.mpc-tip b { display: block; font-size: .95rem; font-weight: 600; color: var(--ink); }

.mpc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.mpc-src { font-family: var(--fb); font-size: .76rem; color: var(--mut2); }
.mpc-tbl-btn {
    font-family: var(--fb); font-size: .8rem; font-weight: 600; color: var(--amber-deep);
    background: transparent; border: 1px solid var(--line2); border-radius: 8px;
    padding: 7px 12px; min-height: 34px; cursor: pointer;
}
.mpc-tbl-btn:hover { background: var(--amber-soft); }
.mpc-table { margin-top: 12px; }
/* the page's .mp-table is sized for five wide columns; this one has three */
.mpc-table .mp-table { min-width: 0; }

@media (max-width: 560px) {
    .mp-chart { padding: 18px 14px 14px; }
    .mpc-now { font-size: 1.7rem; }
    .mpc-controls { align-items: stretch; }
    .mpc-metal { width: 100%; }
    .mpc-metal select { flex: 1; }
    .mpc-ranges { width: 100%; justify-content: space-between; }
    .mpc-ranges button { min-width: 0; flex: 1; padding: 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .mpc-tip, .mpc-ranges button { transition: none; }
}
