/* Flash Finance US — the data library (/data/): pages and the fchart.js charts.
   Loaded only by the data templates, on top of site.css (its tokens: --surface, --border, --text...).
   1 chart colours · 2 chart · 3 page pieces · 4 hub and topic pages · 5 small screens

   Chart colours are the site's chart palette: eight hues in a fixed order, each stepped for the
   light and for the dark surface, checked for colour-blind separation of neighbours and contrast
   against both surfaces (#ffffff and #111a2e). A series keeps its colour whatever is hidden.
   Text is never set in a series colour. */

/* ── 1 chart colours ── */
:root{
  --fc-1:#2a78d6; --fc-2:#eb6834; --fc-3:#1baf7a; --fc-4:#eda100; --fc-5:#e87ba4; --fc-6:#008300; --fc-7:#6250d6; --fc-8:#e34948;
  --fc-grid:#e6eaf1; --fc-axis:#c3ccd9; --fc-ink:var(--text); --fc-muted:var(--muted); --fc-surface:var(--surface);
  --fc-band:rgba(12,21,38,.055);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --fc-1:#3987e5; --fc-2:#d95926; --fc-3:#199e70; --fc-4:#c98500; --fc-5:#d55181; --fc-6:#0ca30c; --fc-7:#9085e9; --fc-8:#e66767;
    --fc-grid:#1d2944; --fc-axis:#33436a; --fc-band:rgba(255,255,255,.07);
  }
}
:root[data-theme="dark"]{
  --fc-1:#3987e5; --fc-2:#d95926; --fc-3:#199e70; --fc-4:#c98500; --fc-5:#d55181; --fc-6:#0ca30c; --fc-7:#9085e9; --fc-8:#e66767;
  --fc-grid:#1d2944; --fc-axis:#33436a; --fc-band:rgba(255,255,255,.07);
}

/* ── 2 chart ── */
.fc{margin:0;position:relative;min-width:0}
.fc-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px;margin-bottom:10px}
.fc-seg{display:inline-flex;background:var(--surface-3);border-radius:10px;padding:3px;gap:2px;max-width:100%;overflow-x:auto;scrollbar-width:none}
.fc-seg::-webkit-scrollbar{display:none}
.fc-seg button{border:0;background:none;padding:6px 11px;border-radius:8px;font:600 .8rem var(--font);color:var(--text-2);cursor:pointer;white-space:nowrap}
.fc-seg button:hover{color:var(--text)}
.fc-seg button.on{background:var(--surface);color:var(--text);box-shadow:var(--shadow)}
.fc-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.fc-more{display:inline-flex;gap:4px}
.fc-sel{appearance:none;-webkit-appearance:none;border:1px solid var(--border);border-radius:8px;background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237c8aa5' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;padding:6px 26px 6px 10px;font:600 .78rem var(--font);color:var(--text-2);cursor:pointer;max-width:230px}
.fc-btn{border:1px solid var(--border);background:var(--surface);border-radius:8px;padding:6px 10px;font:600 .78rem/1.2 var(--font);color:var(--text-2);cursor:pointer;white-space:nowrap}
.fc-btn:hover,.fc-sel:hover{border-color:var(--border-2);color:var(--text)}
.fc-btn[aria-pressed="true"]{background:var(--brand);border-color:var(--brand);color:#fff}
.fc-btn:disabled{opacity:.4;cursor:default}
.fc-legend{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.fc-key{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--border);background:var(--surface);border-radius:999px;padding:4px 11px 4px 9px;font:500 .8rem/1.3 var(--font);color:var(--text-2);cursor:pointer}
.fc-key:hover{border-color:var(--border-2)}
.fc-key b{font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}
.fc-key.off{opacity:.5}
.fc-key.off .fc-sw{background:var(--muted)!important}
.fc-sw{width:14px;height:3px;border-radius:2px;flex:none}
.fc-plot{position:relative;height:var(--fc-h,420px);touch-action:pan-y;cursor:crosshair;-webkit-user-select:none;user-select:none}
.fc-plot:focus{outline:none}
.fc-plot:focus-visible{outline:2px solid var(--brand-2);outline-offset:4px;border-radius:6px}
.fc-plot noscript,.fc-wait{display:flex;align-items:center;justify-content:center;height:100%;color:var(--muted);font-size:.86rem;text-align:center;padding:0 12px}
.fc-svg{display:block;overflow:visible}
.fc-svg text{font:500 11px var(--font);fill:var(--fc-muted);font-variant-numeric:tabular-nums}
.fc-grid,.fc-tick{stroke:var(--fc-grid);stroke-width:1;shape-rendering:crispEdges}
.fc-zero,.fc-axis{stroke:var(--fc-axis);stroke-width:1;shape-rendering:crispEdges}
.fc-line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.fc-area{opacity:.1}
.fc-barp{opacity:.92}
.fc-stk{opacity:.86}
.fc-stkl{fill:none;stroke:var(--fc-surface);stroke-width:1.5}
.fc-tip-t{border-top:1px solid var(--border);margin-top:3px;padding-top:3px}
.fc-tip-t .fc-ln{background:none}
.fc-band{fill:var(--fc-band)}
.fc-dot{stroke:var(--fc-surface);stroke-width:2}
.fc-cross{stroke:var(--text-2);stroke-width:1;opacity:.5;shape-rendering:crispEdges}
.fc-zoom{fill:var(--brand);opacity:.13;pointer-events:none}
.fc-tip{position:absolute;z-index:5;pointer-events:none;background:var(--surface);border:1px solid var(--border-2);border-radius:10px;box-shadow:var(--shadow-md);padding:8px 11px;font-size:.8rem;min-width:140px;max-width:min(320px,80%)}
.fc-tip-d{font-weight:700;color:var(--text-2);margin-bottom:3px;font-size:.74rem;letter-spacing:.02em}
.fc-tip-r{display:flex;align-items:baseline;gap:7px;line-height:1.55}
.fc-tip-r b{font-variant-numeric:tabular-nums;color:var(--text);font-size:.86rem;white-space:nowrap}
.fc-tip-r span{color:var(--muted);font-size:.76rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fc-ln{width:12px;height:3px;border-radius:2px;flex:none;align-self:center}
.fc-reset{position:absolute;right:66px;top:6px;z-index:4;border:1px solid var(--border-2);background:var(--surface);border-radius:8px;padding:4px 10px;font:600 .74rem var(--font);color:var(--text-2);cursor:pointer;box-shadow:var(--shadow)}
.fc-reset:hover{color:var(--brand);border-color:var(--brand)}
.fc-nav{height:44px;margin:8px 58px 0 2px;position:relative;touch-action:none;cursor:grab;border-radius:6px;background:var(--surface-2);overflow:hidden}
.fc-nav:active{cursor:grabbing}
.fc-nsvg{display:block}
.fc-nline{fill:none;stroke:var(--fc-muted);stroke-width:1.2;opacity:.75;vector-effect:non-scaling-stroke}
.fc-nshade{fill:var(--surface-3);opacity:.78}
.fc-nwin{fill:var(--brand);fill-opacity:.07;stroke:var(--brand);stroke-width:1.5}
.fc-nh{fill:var(--brand)}
.fc-note{font-size:.78rem;color:var(--muted);margin:10px 0 0;display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center}
.fc-note i{display:inline-block;width:14px;height:10px;border-radius:2px;background:var(--fc-band);border:1px solid var(--fc-grid);margin-right:6px;vertical-align:-1px}
.fc-curve{margin-top:22px;padding-top:16px;border-top:1px solid var(--border);position:relative}
.fc-ctitle{font-weight:700;font-size:1rem}
.fc-cplot{height:300px;cursor:default}
.fc-cmain{stroke-width:3}
.fc-slider{width:min(360px,46vw);accent-color:var(--brand)}
.fc-curve .fc-key{cursor:default}
.fc.fc-full{position:fixed;inset:0;z-index:2000;background:var(--surface);padding:16px 18px 14px;display:flex;flex-direction:column;margin:0}
.fc.fc-full .fc-plot{flex:1;height:auto;min-height:0}
html.fc-lock,html.fc-lock body{overflow:hidden}

/* ── 3 page pieces ── */
.dh-neu{color:var(--text-2)}
.dh-hero{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:18px 40px;align-items:end;margin:4px 0 18px}
.dh-hero h1{margin-bottom:.3em}
.dh-lead{color:var(--text-2);font-size:1.02rem;max-width:78ch;margin:0}
.dh-now{text-align:right;min-width:230px}
.dh-now .px{font:800 2.5rem/1.05 var(--font);letter-spacing:-.035em;white-space:nowrap}
.dh-now .ch{font:700 1rem/1.4 var(--font);font-variant-numeric:tabular-nums;margin-top:6px}
.dh-now .ch small{font-weight:500;color:var(--muted);font-size:.84rem}
.dh-now>small{display:block;color:var(--muted);margin-top:2px}
.dh-meter{margin:12px 0 0 auto;max-width:260px}
.dh-meter-bar{position:relative;height:6px;border-radius:3px;background:var(--surface-3)}
.dh-meter-bar i{position:absolute;top:-4px;width:4px;height:14px;border-radius:2px;background:var(--brand);transform:translateX(-2px);box-shadow:0 0 0 2px var(--bg)}
.dh-meter-l{display:flex;justify-content:space-between;gap:10px;font-size:.72rem;color:var(--muted);margin-top:6px;font-variant-numeric:tabular-nums}
.dh-meter-l b{font-weight:600;color:var(--text-2)}
.dh-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 16px}
.dh-chips .badge{font-size:.76rem;padding:3px 9px}
.dh-chart{padding:16px 18px 14px}
.dh-chart .card-h{margin-bottom:10px}
.dh-prose h2{font-size:1rem;margin:1.2em 0 .35em}
.dh-prose h2:first-child{margin-top:0}
.dh-prose p{color:var(--text-2);margin:0 0 .6em}
.dh-src{font-size:.84rem;border-top:1px solid var(--border);margin-top:14px;padding-top:12px;color:var(--text-2)}
.dh-src dt{font-size:.68rem;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);margin-top:8px}
.dh-src dt:first-child{margin-top:0}
.dh-src dd{margin:1px 0 0}
.dh-more summary{cursor:pointer;font-weight:600;font-size:.86rem;color:var(--brand);padding:10px 0 2px;list-style:none}
.dh-more summary::-webkit-details-marker{display:none}
.dh-more summary::after{content:" ▾"}
.dh-more[open] summary::after{content:" ▴"}
.tbl td.dh-neu{color:var(--text-2)}
.dh-tile .dh-sub{font-size:.8rem;margin-top:1px;min-height:1.3em}
.dh-tile .dh-meta{font-size:.72rem;color:var(--muted);margin-top:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dh-tile .idx-top>span:first-child{color:var(--text-2)}
svg.spark.dh-n polyline{stroke:var(--fc-1)}
svg.spark.up.dh-inv polyline{stroke:var(--down-2)}
svg.spark.down.dh-inv polyline{stroke:var(--up-2)}

.dh-tbl td{white-space:nowrap}
.dh-tbl td:first-child{white-space:normal;min-width:160px}
.dh-bar{display:inline-block;vertical-align:middle;width:72px;height:6px;border-radius:3px;background:var(--surface-3);margin-right:9px;overflow:hidden}
.dh-bar i{display:block;height:100%;border-radius:3px;background:var(--fc-1)}
.dh-extra{display:none}
.dh-open .dh-extra{display:table-row}
.dh-open li.dh-extra{display:flex}
.dh-all{margin-top:12px}
.dh-feed .when,.dh-cal .when{min-width:96px}
.dh-cal .when{font-weight:600;color:var(--text-2)}
.dh-fsub{font-size:.82rem;margin-top:2px}

/* ── 4 hub and topic pages ── */
.dh-search{position:relative;max-width:640px;margin:14px 0 6px}
.dh-search input{width:100%;height:48px;border:1px solid var(--border-2);border-radius:12px;background:var(--surface);color:var(--text);font:500 1rem var(--font);padding:0 16px 0 44px;box-shadow:var(--shadow)}
.dh-search input:focus{outline:2px solid var(--brand-2);outline-offset:1px;border-color:transparent}
.dh-search svg{position:absolute;left:15px;top:15px;width:18px;height:18px;color:var(--muted);pointer-events:none}
.dh-results{position:absolute;left:0;right:0;top:54px;z-index:20;background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);overflow:hidden;display:none;max-height:min(420px,60vh);overflow-y:auto}
.dh-results.show{display:block}
.dh-results a{display:flex;justify-content:space-between;gap:12px;padding:9px 14px;color:var(--text);font-size:.9rem}
.dh-results a small{color:var(--muted);white-space:nowrap}
.dh-results a.sel,.dh-results a:hover{background:var(--surface-3);text-decoration:none}
.dh-results p{margin:0;padding:12px 14px;color:var(--muted);font-size:.88rem}
.dh-topics{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0}
.dh-sec{margin-top:30px}
.dh-sec .sec-h p{flex:1 0 100%;margin:2px 0 0;color:var(--muted);font-size:.88rem}
.dh-list td:first-child a{font-weight:600}
.dh-list td small{display:block;color:var(--muted);font-size:.76rem}

/* ── 5 small screens ── */
@media (max-width:900px){
  /* phones: heading, then the figure, then the sentences about it */
  .dh-hero{display:flex;flex-direction:column;align-items:stretch;gap:10px}
  .dh-hero>div:first-child{display:contents}
  .dh-hero .eyebrow{order:1;margin-bottom:0}
  .dh-hero h1{order:2;margin:0}
  .dh-hero .dh-now{order:3}
  .dh-hero .dh-lead{order:4}
  .dh-now{text-align:left;min-width:0}
  .dh-now .px{font-size:2.1rem}
  .dh-meter{margin-left:0}
}
@media (max-width:640px){
  .fc-plot{height:min(var(--fc-h,420px),300px)}
  .fc-bar{gap:8px}
  .fc-tools{width:100%;flex-wrap:nowrap}
  .fc-sel{flex:1;min-width:0;max-width:none}
  .fc-btn{padding:6px 8px}
  .fc-nav{margin-right:50px}
  .dh-chart{padding:14px 12px 12px}
}
