/* mdx-summary.css — "why is it moving" periods on a page chart (window.MDXSummary, /js/mdx-summary.js).
   Design: docs/pseo/summary-chart-ui.md. Built ONLY from the design tokens (mdx-tokens.css) and the chart card's
   own conventions (.ex-index-t type, .seg pills, white + --shadow-std surfaces) so it reads as part of the page. */

/* ── in the chart SVG: the selected period + thin dividers. Neutral only — green/red belong to the price line. ── */
.sx-band { fill: transparent; transition: fill .15s; }
.sx-band.hov { fill: rgba(0, 0, 0, .025); }
.sx-band.on { fill: rgba(0, 0, 0, .05); }
.sx-div { stroke: rgba(0, 0, 0, .16); stroke-width: 1; stroke-dasharray: 2 4; }
.sx-nocov { fill: rgba(0, 0, 0, .035); }
.sx-nocov-t { font-size: 11px; font-weight: 600; fill: var(--muted); }

/* ── rail: the period buttons under the x-axis, aligned to the chart (selection lives here, not on the chart:
   a tap on the chart opens the mobile alert editor) ── */
.sx-rail { position: relative; height: 34px; margin-top: 4px; }
.sx-rail[hidden] { display: none; }
/* skeleton (SSR, until the client draws the rail): right-aligned pills like a typical rail — older · middle · Latest */
.sx-rail.sx-rail-sk { display: flex; justify-content: flex-end; align-items: center; gap: 4px; padding-right: 4px; }
.sx-rail.sx-rail-sk i { height: 28px; border-radius: var(--pill); }
.sx-rail.sx-rail-sk i:nth-child(1) { width: 40px; } .sx-rail.sx-rail-sk i:nth-child(2) { width: 22%; } .sx-rail.sx-rail-sk i:nth-child(3) { width: 60px; }
.sx-seg { position: absolute; top: 3px; height: 28px; padding: 0 6px; border: 0; border-radius: var(--pill);
  background: var(--ivory); color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: background .15s, color .15s; }
.sx-seg span { pointer-events: none; }
.sx-seg:hover { background: #e7e4dd; color: var(--black); }
.sx-seg.on { background: var(--black); color: var(--ivory); }
.sx-seg:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
@media (pointer: coarse) { .sx-seg::before { content: ''; position: absolute; inset: -8px 0; } }   /* ≥44px tap target */

/* ── the summary block under the chart card ── */
.sx { max-width: var(--ex-page); margin-inline: auto; padding: 2px 40px 24px; }
.sx[hidden] { display: none; }
.sx-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.sx-q { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--black); }   /* = .ex-index-t */
.sx-nav { display: flex; gap: 6px; }
/* → the why page (asset): a pill beside ‹ ›, same height as them */
.sx-all { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: var(--pill); background: var(--card-bg, #fff); box-shadow: var(--shadow-std); font-size: 13px; font-weight: 800; color: var(--black); text-decoration: none; white-space: nowrap; }
.sx-all:hover { background: var(--black); color: #fff; }
.sx-all[hidden] { display: none; }
.sx-nav button { width: 36px; height: 36px; border: 0; border-radius: var(--pill); background: var(--card-bg, #fff);
  box-shadow: var(--shadow-std); color: var(--black); cursor: pointer; display: grid; place-items: center; }
.sx-nav button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sx-nav button:disabled { opacity: .35; cursor: default; box-shadow: none; }
.sx-nav button:focus-visible, .sx-tog:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

/* grid: the Details toggle sits on the headline's row, right-aligned — placed by CSS, not by markup order, so the
   card markup stays byte-identical to the SSR one (and details stay right after the headline for crawlers) */
.sx-card { background: var(--card-bg, #fff); border-radius: var(--radius-sm); box-shadow: var(--shadow-std); padding: 18px 22px 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; align-items: start; }
.sx-card:not(.cur) { display: none; }   /* one period shown at a time; the others' cards are in the HTML (SSR) */
.sx-meta { grid-column: 1; grid-row: 1; }
.sx-tone { grid-column: 2; grid-row: 1; justify-self: end; display: inline-flex; gap: 10px;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.4; }   /* plain glyphs — the colour says it */
.sx-tone .up { color: var(--gain); } .sx-tone .down { color: var(--loss); }
.sx-h { grid-column: 1; grid-row: 2; }
.sx-tog { grid-column: 2; grid-row: 2; justify-self: end; }   /* its own width — the column is as wide as the tone chip */
.sx-more { grid-column: 1 / -1; grid-row: 3; }
.sx-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sx-lvl { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--black); }
.sx-meta time, .sx-chg { font-variant-numeric: tabular-nums; }
.sx-chg { font-weight: 700; }
.sx-chg:empty { display: none; }
.sx-chg.skel { display: inline-block; width: 44px; height: 12px; border-radius: 6px; vertical-align: -1px; }   /* the % move, until the chart is in */
.sx-chg.up { color: var(--gain); } .sx-chg.down { color: var(--loss); }
.sx-h { margin-top: 6px; font-size: 18px; line-height: 1.42; font-weight: 700; letter-spacing: -.2px;
  color: var(--black); text-wrap: balance; }

/* details: always in the DOM (crawlable), collapsed by height — never display:none */
.sx-more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.sx-card.open .sx-more { grid-template-rows: 1fr; }
.sx-more-in { min-height: 0; overflow: hidden; }
.sx-ds { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--card-border-color, rgba(0, 0, 0, .08)); }
.sx-d { display: grid; grid-template-columns: 16px 1fr; gap: 8px; }
.sx-ic { font-size: 10px; line-height: 23px; color: var(--muted); }
.sx-d.up .sx-ic { color: var(--gain); } .sx-d.down .sx-ic { color: var(--loss); }
.sx-dt p { font-size: 14.5px; line-height: 1.6; color: var(--black); }
.sx-dt b { font-weight: 700; }
.sx-dt .sx-why { margin-top: 3px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.sx-foot { margin-top: 14px; }
.sx-ev { border: 0; padding: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--black);
  cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-medium); text-underline-offset: 3px; }
.sx-ev:hover { text-decoration-color: currentColor; }
.sx-ev:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; border-radius: 4px; }
/* the feed shows one period's stories — a removable chip in the feed bar */
.ex-feedbar { scroll-margin-top: 120px; }   /* scrolled to on "based on N stories" — clear the fixed pill nav */
.sx-fchip { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px 0 14px; border: 0; border-radius: var(--pill);
  background: var(--black); color: var(--ivory); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.sx-fchip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.sx-fchip:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }

.sx-tog { margin-top: 2px; min-height: 36px; white-space: nowrap; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; border: 0;
  border-radius: var(--pill); background: var(--ivory); color: var(--black); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.sx-tog:hover { background: #e7e4dd; }
.sx-tog svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.sx-card.open .sx-tog svg { transform: rotate(180deg); }
/* open = the active state, same language as the page's selected controls (.seg button.on / rail .on): black */
.sx-card.open .sx-tog, .sx-card.open .sx-tog:hover { background: var(--black); color: var(--ivory); }

/* wide cards: the points side by side — fills the card while each line stays readable (~65 chars) */
@media (min-width: 980px) { .sx-ds { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 40px; } }
@media (max-width: 720px) {
  .sx { padding: 0 16px 20px; }
  .sx-card { padding: 16px 16px 14px; }
  .sx-h { font-size: 16.5px; }
  .sx-dt p { font-size: 14px; }
  .sx-nav button { width: 44px; height: 44px; } .sx-all { height: 44px; }
  .sx-tog { min-height: 44px; min-width: 44px; padding: 0; justify-content: center; }   /* icon-only: the headline needs the width */
  .sx-tog span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* label stays for screen readers */
  .sx-card { column-gap: 12px; }
}
@media (prefers-reduced-motion: reduce) { .sx-more, .sx-tog svg, .sx-band, .sx-seg { transition: none; } }
