/* why.css — the "why is it moving" page: /asset/{t}/why (one stock) and ?vs= (compare, up to 3 shown of ≤ 6).
   Design + rules: docs/pseo/why-page.md. Summary card look = mdx-summary.css (.sx-*); layout here (prefix cm-).
   Size classes on <body>: n1–n3 = stocks IN the comparison (fixed for the page → chart/rail never jump on a toggle),
   cv1–cv3 = stocks SHOWN (column count only). */
:root { --nav-h: 88px; --ink: #2B2620; }
body { min-height: 100vh; background: #fff; }
body::before { content: ''; position: fixed; top: calc(-1 * var(--nav-shift, 0px)); transition: top .22s ease; left: 0; right: 0; height: var(--nav-h); z-index: 15; background: rgba(255,255,255,.82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); pointer-events: none; }
.cm { max-width: var(--ex-page); margin-inline: auto; padding: 0 40px 80px; }

/* hero — compare: the title (one line, …); one stock shown: that stock's compact header (~80px) */
.cm-hero { padding: calc(var(--nav-h) + 18px) 4px 18px; }
.cm-hero h1 { font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -.5px; color: var(--ink); margin: 6px 0 4px; }
.cm-hero:not(.one) h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-hero p { font-size: 14px; color: #5F574B; font-weight: 600; }
.cm-back { font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: none; }
.cm-hero.one { padding-bottom: 14px; }
.cm-hero.one h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }   /* not shown — kept for SEO / screen readers */
.cm-bar { display: flex; align-items: center; gap: 14px; min-height: 80px; box-sizing: border-box; padding: 12px 20px; margin-top: 8px; border-radius: var(--radius-sm, 18px); background: #fff; box-shadow: var(--shadow-std); }
.cm-bar > .rl-ic { width: 48px !important; height: 48px !important; flex: none; }
.cm-bar > .cm-mdx { background: #fff; border-radius: 50%; } .cm-bar > .cm-mdx img { width: 70%; height: 70%; object-fit: contain; margin: 15%; }
.cm-bar .idm { display: contents; }
.cm-bar .nm { font-size: 24px; font-weight: 800; letter-spacing: -.3px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cm-bar .tk { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.cm-bar .as-tk { font-size: 12px; padding: 3px 8px; } .cm-bar .ccy { font-size: 11px; font-weight: 700; color: #5F574B; letter-spacing: .4px; }
.cm-bar .cm-follow { flex: none; }
.cm-bar .q { margin-left: auto; display: flex; align-items: baseline; gap: 10px; flex: none; font-variant-numeric: tabular-nums; }
.cm-bar .px { font-size: 26px; font-weight: 800; color: var(--ink); }
.cm-bar .chg { font-size: 15px; font-weight: 800; } .cm-bar .chg.up { color: #0f8f43; } .cm-bar .chg.down { color: #cc2f2f; }
.cm-bar .rg { font-size: 11.5px; font-weight: 700; color: #5F574B; }

/* the sticky card: chips + range · chart · one rail row per stock */
.cm-card { position: sticky; top: calc(var(--nav-h) - var(--nav-shift, 0px)); transition: top .22s ease; z-index: 20; padding: 10px 18px 8px; border-radius: var(--radius-sm, 18px);
  background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow-std); }
.cm-head { display: flex; align-items: center; gap: 8px; min-height: 44px; box-sizing: border-box; padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,.06); }
.cm-chips { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.cm-chips::-webkit-scrollbar { display: none; }
.cm-chips.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.cm-chips.fade-l { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px); mask-image: linear-gradient(to right, transparent, #000 36px); }
.cm-chips.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.cm-chips > * { flex: none; }
.cm-chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 5px; border-radius: 999px; background: var(--c);
  border: 1.5px solid var(--c); font: inherit; font-size: 13.5px; font-weight: 700; color: #fff; cursor: pointer; white-space: nowrap; }
.cm-chip .rl-ic { width: 26px; height: 26px; flex: none; }
.cm-chip .pc { font-variant-numeric: tabular-nums; font-weight: 800; }
.cm-cand { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 1.5px dashed var(--c); background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.cm-cand .rl-ic { width: 26px; height: 26px; opacity: .75; }
.cm-cand:hover .rl-ic { opacity: 1; }
.cm-cand i { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%; background: var(--c); color: #fff; font: 800 11px/15px system-ui; font-style: normal; text-align: center; }
.cm-cand.thin::after { content: '•'; position: absolute; left: -2px; top: -6px; color: #c08a00; font-size: 16px; }
.cm-range { flex: none; margin-left: auto; }
.cm-add { flex: none; height: 36px; padding: 0 12px; border-radius: 999px; border: 1.5px dashed rgba(0,0,0,.3); background: #fff; font: inherit; font-size: 13px; font-weight: 700; color: #5F574B; cursor: pointer; white-space: nowrap; }
.cm-add:hover { border-color: var(--ink); color: var(--ink); }
.cm-pick { position: absolute; left: 18px; top: 52px; z-index: 40; width: min(760px, calc(100% - 36px)); background: #fff; border-radius: 16px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 10px; }
.cm-pick-in { width: 100%; box-sizing: border-box; height: 40px; border: 1.5px solid rgba(0,0,0,.15); border-radius: 12px; padding: 0 12px; font: inherit; font-size: 14px; outline: none; }
.cm-pick-in:focus { border-color: var(--ink); }
.cm-pick-res { margin-top: 10px; max-height: 420px; overflow-y: auto; }
.cm-pick-it { display: flex; align-items: baseline; gap: 10px; border: 0; background: none; text-align: left; padding: 9px 10px; border-radius: 10px; font: inherit; cursor: pointer; }
.cm-pick-it:hover, .cm-pick-it:focus-visible { background: #F2F0EB; }
.cm-pick-it b { font-size: 13.5px; color: var(--ink); flex: none; } .cm-pick-it span { font-size: 13px; color: #5F574B; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-pick-msg { padding: 10px; font-size: 13px; color: #8a8174; }
.cm-hint { position: absolute; z-index: 30; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 700; padding: 7px 10px; border-radius: 10px; box-shadow: var(--shadow-std); }
#cmSvg { width: 100%; height: 190px; display: block; overflow: visible; margin-top: 4px; }
.n2 #cmSvg, .n3 #cmSvg { height: 160px; }
.cm-line { fill: none; stroke-width: 2.2; transition: opacity .2s; }
.cm-zero { stroke: rgba(0,0,0,.25); stroke-dasharray: 3 4; }
.cm-win { fill: rgba(0,0,0,.055); }
.cm-rails { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.cm-rrow { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: center; border-radius: 999px; padding: 2px 4px 2px 2px; background: var(--tint); transition: opacity .2s; }
.cm-rrow.off { opacity: .3; }
.cm-rrow .rl-ic { width: 22px; height: 22px; }
.cm-rrow .sx-rail { height: 26px; margin: 0; }
.cm-rrow .sx-seg { top: 1px; height: 24px; background: rgba(255,255,255,.75); }
.cm-rrow .sx-seg.on { background: var(--c); color: #fff; }
.n3 .cm-rrow .rl-ic { width: 18px; height: 18px; } .n3 .cm-rrow .sx-rail { height: 22px; } .n3 .cm-rrow .sx-seg { height: 20px; font-size: 10.5px; } .n3 .cm-rails { gap: 3px; }
.cm-nocov { position: absolute; left: 0; top: 1px; bottom: 1px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; border: 1px dashed rgba(0,0,0,.18); border-radius: 999px; font-size: 10.5px; font-weight: 700; color: #8a8174; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.cm-norail { display: flex; align-items: center; height: 100%; padding-left: 8px; font-size: 11.5px; font-weight: 700; color: #8a8174; }
.cm-dots { display: none; }

/* the long read — desktop: a time staircase (cards placed by layoutTL(): same time slot = same top; a newer slot is
   never below an older one; a column gets a gap only when another column's previous card is longer) */
.cm-tl { position: relative; margin-top: 26px; }
.cm-tl::before { content: ''; position: absolute; left: 50px; top: 0; bottom: 0; width: 2px; background: rgba(0,0,0,.08); border-radius: 2px; }
.cm-tick { position: absolute; left: 0; width: 46px; text-align: right; font-size: 11.5px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.cm-tick::after { content: ''; position: absolute; right: -10px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.cm-tick.on { color: #fff; } .cm-tick.on span { background: var(--ink); border-radius: 6px; padding: 1px 4px; }
.cm-tl .sx-card { position: absolute; display: grid; border-top: 3px solid var(--c); transition: top .25s ease; }
.cm-start { position: absolute; box-sizing: border-box; border: 1.5px dashed rgba(0,0,0,.18); border-radius: 14px; padding: 12px 14px; font-size: 13px; font-weight: 700; color: #5F574B; background: #fff; }
.cm-start small { font-weight: 600; color: #8a8174; }
.cm-start.m { position: static; }

/* summary cards here: collapsed to headline + first point; "expand all" opens every card of every stock */
.sx-card.cm-c { padding: 12px 14px; }
.sx-card.cm-c .sx-h { font-size: 15.5px; }
.sx-card.cm-c .sx-more { grid-template-rows: 1fr; }
.sx-card.cm-c .sx-ds { display: flex !important; flex-direction: column; gap: 10px; margin-top: 10px; padding-top: 10px; }
.sx-card.cm-c .sx-dt p { font-size: 13.5px; }
.sx-card.cm-c:not(.open) .sx-d:nth-child(n+2), .sx-card.cm-c:not(.open) .sx-why, .sx-card.cm-c:not(.open) .sx-foot, .sx-card.cm-c:not(.open) .cm-kids, .sx-card.cm-c:not(.open) .cm-evl { display: none; }
.sx-card.cm-c .sx-tog { display: none; }
.cv2 .sx-card.cm-c .sx-chg.up, .cv2 .sx-card.cm-c .sx-chg.down, .cv3 .sx-card.cm-c .sx-chg.up, .cv3 .sx-card.cm-c .sx-chg.down { color: var(--ink); }   /* compare: % in ink + ▲▼ (line colours are identities, not up/down) */
.cm-more { margin-top: 8px; border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; font-weight: 800; color: var(--ink); cursor: pointer; text-align: left; }
.cm-kids { margin-top: 10px; padding-top: 10px; border-top: 1px dashed rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 6px; }
.cm-kids b { font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: #8a8174; }
.cm-kids div { font-size: 13px; line-height: 1.45; } .cm-kids time { font-weight: 800; margin-right: 6px; }
.cm-evl { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cm-evl li { font-size: 13px; line-height: 1.4; } .cm-evl a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(0,0,0,.2); text-underline-offset: 2px; }
.cm-evl a:hover { text-decoration-color: currentColor; }
/* skeleton (SSR, while why.js loads): the real card's boxes, filled with .skel — same heights as the live card */
.cm-sk-px { width: 150px; height: 30px; border-radius: 8px; }
.cm-sk-chip { width: 132px; height: 36px; border-radius: 999px; } .cm-sk-cand { width: 36px; height: 36px; border-radius: 50%; }
.cm-sk-range { width: 236px; height: 42px; border-radius: 999px; margin-left: auto; flex: none; }
.cm-sk-chart { height: 190px; margin-top: 4px; padding: 8px 48px 18px 4px; box-sizing: border-box; display: flex; }
.cm-sk-chart .skel { flex: 1; border-radius: 10px; opacity: .55; }
.n2 .cm-sk-chart, .n3 .cm-sk-chart { height: 160px; }
.cm-sk-row { background: #F2F0EB; } .cm-sk-row .rl-ic { border-radius: 50%; }
.cm-sk-row .sx-rail { display: flex; align-items: center; padding: 0 4px; } .cm-sk-row .sx-rail .skel { width: 100%; height: 70%; border-radius: 999px; opacity: .6; }
/* the server-rendered read (crawlers, no-JS) — the client replaces it */
.cm-ssr { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.cm-ssr .sx-card { display: grid; }
.cm-ssr-s { display: flex; flex-direction: column; gap: 12px; } .cm-ssr-s h2 { font-size: 15px; font-weight: 800; color: var(--ink); margin: 14px 4px 0; } .cm-ssr .sx-chg.skel { display: none; }

/* mobile: one column at a time, swipe between the shown stocks; chips still toggle; the rail shows the shown stocks */
@media (max-width: 720px) {
  :root { --nav-h: 80px; }
  .cm { padding: 0 12px 60px; }
  .cm-hero h1 { font-size: 24px; }
  .cm-bar { gap: 10px; padding: 10px 12px; min-height: 64px; } .cm-bar > .rl-ic { width: 38px !important; height: 38px !important; }
  .cm-bar .idm { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .cm-bar .nm { font-size: 17px; } .cm-bar .cm-follow { display: none; }
  .cm-bar .q { flex-direction: column; align-items: flex-end; gap: 0; } .cm-bar .px { font-size: 19px; } .cm-bar .chg { font-size: 13px; } .cm-bar .rg { display: none; }
  .cm-card { padding: 8px 10px 6px; }
  .cm-sk-range { width: 40px; height: 40px; border-radius: 50%; } .cm-sk-chip { width: 110px; height: 32px; } .cm-sk-cand { width: 32px; height: 32px; }
  .cm-sk-chart, .n2 .cm-sk-chart, .n3 .cm-sk-chart { height: 120px; } .cm-sk-px { width: 90px; height: 24px; }
  #cmSvg, .n2 #cmSvg, .n3 #cmSvg { height: 120px; }
  .cm-rrow:not(.cur) { opacity: .45; }
  .cm-dots { display: flex; justify-content: center; gap: 8px; padding-top: 6px; min-height: 14px; box-sizing: border-box; }   /* 1 stock → no dots, same height */
  .cm-dot { width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; background: var(--c); opacity: .35; }
  .cm-dot.cur { width: 22px; border-radius: 4px; opacity: 1; }
  .cm-chip { height: 32px; font-size: 12.5px; padding: 0 10px 0 4px; } .cm-chip .rl-ic { width: 24px; height: 24px; }
  .cm-cand { width: 32px; height: 32px; } .cm-add { height: 32px; }
  .cm-pick { left: 10px; width: calc(100% - 20px); top: 48px; }
  .cm-chips { touch-action: pan-x; overscroll-behavior-x: contain; }
  .cm-tl { display: none; }
  .cm-swipe { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin-top: 18px; scrollbar-width: none; align-items: flex-start; }
  .cm-swipe::-webkit-scrollbar { display: none; }
  .cm-col { flex: 0 0 100%; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
  .cm-col .cm-mh { font-size: 13px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--ink); padding: 12px 2px 0; }
  .cm-col .sx-card { display: grid; border-top: 3px solid var(--c); }
}
@media (min-width: 721px) { .cm-swipe { display: none; } }
