/* Design tokens from the Fynd swap: brown surface,
   cream text, one glass surface (10% cream, 24px blur, 8px corners), Geist type. Dark is the
   design's home; light follows the system setting with Fynd's light values. Series colours are
   Fynd's protocol palette (src/lib/route/protocolColors.ts), validated against both surfaces. */
:root {
  color-scheme: dark;
  --bg: #271611; --ink: #f5f1e4; --muted: rgba(245, 241, 228, 0.68); --faint: #84796f;
  --line: rgba(245, 241, 228, 0.08); --stroke: rgba(245, 241, 228, 0.1); --stroke-hover: rgba(245, 241, 228, 0.2);
  --card: rgba(245, 241, 228, 0.1); --card-hover: rgba(245, 241, 228, 0.16);
  --panel: #3c2c26; /* surface-secondary: the glass step as a solid, for Plotly */
  --raised: rgba(60, 44, 38, 0.97); --shadow: 0 8px 32px rgba(39, 22, 17, 0.6);
  --accent: #e95234; --warn: #ffc400; --up: #6ad678; --down: #ff6a4a;
  --s1: #3987e5; --s2: #bd3061; --s3: #199e70; --s4: #c98500; --s5: #9085e9; --s6: #c37b9f;
  --surface-glass: rgba(39, 22, 17, 0.85);
  --overlay: rgba(14, 5, 2, 0.88); --sheet: rgba(60, 44, 38, 0.9);
  --hero: url("assets/bg/dark-3.webp"); --hero-opacity: 0.8;
  --sans: "Geist", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e5ddd1; --ink: #2b120a; --muted: rgba(43, 18, 10, 0.7); --faint: #67564f;
  --line: rgba(39, 22, 17, 0.1); --stroke: rgba(39, 22, 17, 0.12); --stroke-hover: rgba(39, 22, 17, 0.24);
  --card: rgba(39, 22, 17, 0.08); --card-hover: rgba(39, 22, 17, 0.14);
  --panel: #d6cdc2;
  --raised: rgba(255, 253, 248, 0.98); --shadow: 0 8px 32px rgba(39, 22, 17, 0.12);
  --accent: #a8280f; --warn: #8f6200; --up: #1c6129; --down: #c02f16;
  --surface-glass: rgba(255, 253, 248, 0.85);
  --overlay: rgba(90, 70, 50, 0.45); --sheet: rgba(255, 253, 248, 0.9);
  --hero: url("assets/bg/light-3.webp"); --hero-opacity: 0.5;
}
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--stroke-hover) transparent; }
html { background: var(--bg); }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--hero) center top / cover no-repeat; opacity: var(--hero-opacity); }
body { margin: 0; background: transparent; color: var(--ink); font: 450 14px/20px var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-variant-numeric: tabular-nums; }
a { color: var(--ink); text-decoration: underline dotted var(--stroke-hover); text-underline-offset: 3px; }
a:hover { color: var(--muted); }
code { font-family: var(--mono); font-size: 12px; background: var(--card); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
header { padding: 0 24px; max-width: 1280px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; margin-top: 8px; }
.brand { display: inline-flex; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand .logo { height: 24px; width: auto; }
.actions { display: flex; align-items: center; gap: 8px; }
/* The live swap header's controls: .btn-gradient (Connect) and a 40px glass icon button (theme). */
.btn-primary { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid #8f2410; background: linear-gradient(0deg, #f86a48 0%, #e95234 18%, #da4227 78%, #c2311b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32); color: #f5f1e4; text-decoration: none; white-space: nowrap;
  font: 500 14px/20px var(--sans); transition: filter .15s ease; }
.btn-primary:hover { filter: brightness(1.06); color: #f5f1e4; }
.btn-primary:focus-visible { outline: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 0 0 1px var(--accent); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: var(--card); color: var(--ink); cursor: pointer; transition: background-color .2s; }
.icon-btn:hover { background: var(--card-hover); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent); }
.icon-btn svg { width: 18px; height: 18px; opacity: .7; transition: opacity .2s; }
.icon-btn:hover svg { opacity: 1; }
.theme-toggle .moon, :root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }
.hero { padding: 40px 0 32px; }
h1 { font-size: 48px; line-height: 52px; font-weight: 500; letter-spacing: -0.03em;
  margin: 0 0 16px; max-width: 900px; text-wrap: balance; }
.sub { color: var(--muted); margin: 0; max-width: 720px; font-size: 16px; line-height: 24px; text-wrap: pretty; }
/* Tabs: Fynd's SegmentedTabs, a glass pill under the selected tab. Scrolls sideways when narrow. */
nav { position: sticky; top: 0; z-index: 10; max-width: 1280px; margin: 0 auto 16px; padding: 0 24px; }
/* Glass only once the bar sticks: a full-width blurred strip fades in behind it. */
nav::before { content: ""; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; opacity: 0; pointer-events: none;
  background: var(--surface-glass); box-shadow: inset 0 -1px 0 var(--stroke); transition: opacity .2s ease-out; }
nav.stuck::before { opacity: 1; }
#nav-top { height: 1px; margin-bottom: -1px; }
nav .track { position: relative; display: flex; gap: 32px; align-items: stretch; height: 48px; overflow-x: auto; scrollbar-width: none;
  box-shadow: inset 0 -1px 0 var(--stroke); }
nav .track::-webkit-scrollbar { display: none; }
@media (max-width: 640px) {
  nav .track { gap: 24px; --fl: 0px; --fr: 0px;
    mask-image: linear-gradient(90deg, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fl), #000 calc(100% - var(--fr)), transparent); }
}
nav .tab { flex: 0 0 auto; height: auto; background: none; border: 0; padding: 0; border-radius: 0; cursor: pointer;
  -webkit-user-select: none; user-select: none;
  font: 500 16px/24px var(--sans); color: var(--muted); white-space: nowrap; transition: color .2s, background-color .2s ease-out; }
nav .tab:hover { color: var(--ink); }
nav .tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
nav .tab.on { color: var(--ink); }
/* One underline that slides to the selected tab. */
nav .ink { position: absolute; left: 0; bottom: 0; width: 0; height: 2px; border-radius: 2px; background: var(--ink);
  transition: transform .25s ease-out, width .25s ease-out; }
@media (prefers-reduced-motion: reduce) { nav .ink { transition: none; } }
main { max-width: 1280px; margin: 0 auto; padding: 0 24px 64px; }
section { display: none; } section.on { display: block; }
/* A view draws hidden at full width (so Plotly sizes it), with a skeleton in its place. */
main section.on.loading { visibility: hidden; height: 0; overflow: hidden; }
.skeleton i { position: relative; display: block; overflow: hidden; border-radius: 8px; background: var(--card); }
.skeleton .kpis i { height: 82px; }
.skeleton .grid i { height: 420px; }
.skeleton i::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--card), transparent); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton i::after { animation: none; } }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(560px, 1fr)); gap: 8px; margin-bottom: 16px; }
.grid > * { min-width: 0; }
.card:has(table) { overflow-x: auto; }
/* Cards and tiles: Fynd's glass surface. */
/* Fynd's glass: every translucent surface blurs the art behind it. */
.card, .kpi, .empty, .controls button.resetzoom, .controls > button, .pick-btn, .icon-btn, .seg .pill, nav::before, .tip, .hovertip, .pick-list, .sheet { backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
/* A card is a column: title and note on top, the chart at the bottom, so charts in a row line up. */
.card { display: flex; flex-direction: column; background: var(--card); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.card > .chart { margin-top: auto; flex: none; }
.card > h3.hint { align-self: flex-start; cursor: help; text-decoration: underline dashed var(--faint);
  text-decoration-thickness: 1.5px; text-underline-offset: 5px; margin-bottom: 12px; }
.card > h3.hint:hover, .card > h3.hint:focus-visible { outline: none; text-decoration-color: var(--ink); }
/* Fynd's .tooltip-panel. */
.tip { position: fixed; z-index: 50; max-width: 360px; padding: 8px 10px; pointer-events: none;
  border: 1px solid var(--stroke-hover); border-radius: 8px; background: var(--raised); box-shadow: var(--shadow);
  color: var(--muted); font-size: 13px; line-height: 1.375; }
.tip b { color: var(--ink); font-weight: 500; }
/* Phones: the description opens as Fynd's bottom sheet (ResponsiveDialog). */
.sheet-overlay { position: fixed; inset: 0; z-index: 60; background: var(--overlay);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.sheet { position: fixed; inset: auto 0 0; z-index: 61; max-height: 80vh; overflow-y: auto; outline: none;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--stroke); border-bottom: 0;
  border-radius: 12px 12px 0 0; background: var(--sheet);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55); animation: sheet-up .2s ease-out; }
.sheet .sheet-close { position: absolute; top: 12px; right: 12px; }
.sheet h4 { padding-right: 40px; }
.sheet .handle { display: flex; justify-content: center; padding: 12px 0; cursor: grab; touch-action: none; }
.sheet .handle::before { content: ""; width: 40px; height: 4px; border-radius: 9999px; background: var(--stroke-hover); }
.sheet h4 { margin: 0 0 8px; color: var(--ink); font: 500 18px/24px var(--sans); }
.sheet .body { color: var(--muted); font-size: 14px; line-height: 20px; }
.sheet .body b { color: var(--ink); font-weight: 500; }
.pick-list .row, .sheet .body .row { display: block; width: 100%; border: 0; background: none; text-align: left;
  color: var(--muted); font: 450 16px/24px var(--sans); cursor: pointer; }
.sheet .body .row { padding: 12px 8px; border-radius: 8px; }
.sheet .body .row[aria-selected="true"] { color: var(--ink); font-weight: 500; background: var(--card); }
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.legend-html { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; }
.legend-html button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 450 12px/16px var(--sans); transition: opacity .2s, color .2s; }
.legend-html button:hover { color: var(--ink); }
.legend-html button.off { opacity: .4; }
.legend-html .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.grid > .card { margin-bottom: 0; }
.card h3 { margin: 0 0 4px; font-size: 18px; line-height: 24px; font-weight: 500; letter-spacing: -0.3125px; }
.note { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 20px; }
section > p.note { max-width: 960px; margin-bottom: 16px; }
section > p.intro { font-size: 14px; line-height: 22px; }
section > .intro-full { max-width: 960px; margin: -8px 0 16px; }
.note .more { padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink); font: inherit; font-weight: 500;
  text-decoration: underline dashed var(--faint); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.note .more:hover { text-decoration-color: var(--ink); }
.note b { color: var(--ink); font-weight: 500; }
.chart { height: 300px; }
.chart.tall { height: 560px; }
.card.hoverable { position: relative; }
/* Tooltip: Fynd's .tooltip-panel. */
.hovertip { position: absolute; pointer-events: none; z-index: 5; display: none; min-width: 240px; max-width: 320px;
  background: var(--raised); color: var(--ink);
  border: 1px solid var(--stroke-hover); border-radius: 8px; box-shadow: var(--shadow);
  padding: 8px 10px; font-size: 12px; line-height: 18px; }
.hovertip .h { font-weight: 500; margin-bottom: 4px; }
.hovertip .row { display: flex; justify-content: space-between; gap: 12px; }
.hovertip .row span:first-child { color: var(--muted); }
.hovertip .up { color: var(--up); } .hovertip .down { color: var(--down); }
.js-plotly-plot line.spikeline:not([stroke-dasharray]) { display: none; }
.crossline { position: absolute; pointer-events: none; display: none; border-left: 1px dashed var(--faint); z-index: 4; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 16px; }
.kpi { background: var(--card); border-radius: 8px; padding: 14px 16px; }
.kpi .v { font-size: 28px; line-height: 36px; font-weight: 500; letter-spacing: -0.03em; }
.kpi .l { color: var(--muted); font-size: 12px; line-height: 16px; margin-top: 2px; }
/* Controls: Fynd's glass selectors (ChainSelector), chevron dim until hover. */
.controls { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; margin: 0 0 16px;
  color: var(--muted); font-size: 14px; line-height: 20px; font-weight: 500; }
.controls button.resetzoom, .controls > button, .pick-btn { font: 500 14px/20px var(--sans); color: var(--ink); background-color: var(--card);
  border: 0; border-radius: 8px; height: 36px; padding: 0 12px; cursor: pointer; transition: background-color .2s; }
.controls button.resetzoom, .controls > button:hover, .pick-btn:hover { background-color: var(--card-hover); }
.controls button.resetzoom, .controls > button:focus-visible, .pick-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
/* Dropdowns: Fynd's filter dropdown (liquidity MultiSelect): one glass button with the label, the
   value and a caret, and a raised glass list. The hidden native select keeps the value. */
.pick { position: relative; display: inline-flex; }
.pick > select { display: none; }
.pick-btn { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 12px; }
.pick-btn .k { color: var(--muted); }
.pick-btn svg { width: 20px; height: 20px; opacity: .5; transition: opacity .2s; }
.pick-btn:hover svg, .pick-btn[aria-expanded="true"] svg { opacity: 1; }
.pick-list { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: max(100%, 180px); padding: 4px;
  border: 1px solid var(--stroke); border-radius: 8px; background: var(--raised); box-shadow: var(--shadow); }
.pick-list .row { padding: 6px; border-radius: 4px; white-space: nowrap; }
.pick-list .row:hover, .pick-list .row:focus-visible { outline: none; color: var(--ink); background: var(--card); }
.pick-list .row[aria-selected="true"] { color: var(--ink); font-weight: 500; }
/* Sub-row: the view tabs of the open section. */
.subnav[hidden] { display: none; }
.seg { position: relative; display: flex; height: 40px; align-items: center; }
.seg .pill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 8px; background: var(--card);
  transition: transform .2s ease-out, width .2s ease-out; }
.seg .opt { position: relative; height: 100%; padding: 0 12px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--muted); font: 500 16px/24px var(--sans); transition: color .2s; }
.seg .opt:hover, .seg .opt.on { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .seg .pill { transition: none; } }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 20px; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 500; }
tr:last-child td { border-bottom: 0; }
th:nth-child(-n+3), td:nth-child(-n+3) { text-align: left; }
td.mono { font-family: var(--mono); font-size: 12px; }
.prose { max-width: 760px; color: var(--muted); font-size: 16px; line-height: 26px; }
.prose h3 { margin: 32px 0 8px; color: var(--ink); font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -0.3125px; }
.prose h3:first-child { margin-top: 8px; }
.prose b { color: var(--ink); font-weight: 500; }
.prose li { margin-bottom: 8px; }
.prose code { font-size: 14px; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; background: var(--card); border-radius: 8px; }
@media (max-width: 640px) {
  header, nav, main { padding-left: 16px; padding-right: 16px; }
  /* Phones: two tiles a row, filters on one swipeable row, more width for the charts. */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px; }
  .kpi:last-child:nth-child(odd) { grid-column: span 2; }
  .kpi .v { font-size: 22px; line-height: 28px; }
  .card { padding: 12px; }
  .controls { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .controls::-webkit-scrollbar { display: none; }
  .controls > * { flex: none; }
  .hero { padding-top: 24px; }
  h1 { font-size: 32px; line-height: 36px; }
  .sub { font-size: 14px; line-height: 20px; }
  .grid { grid-template-columns: 1fr; }
  .chart { height: 300px; }
}
.findings { margin-bottom: 16px; }
.controls .full-only { display: contents; } .controls .full-only[hidden] { display: none; }
.findings .lead { margin: 8px 0 4px; line-height: 1.5; }
.findings ul { margin: 8px 0 0; padding-left: 18px; } .findings li { margin: 4px 0; }
/* Tabs and sub-tabs are links in the Astro site. */
nav a.tab, .seg a.opt { text-decoration: none; display: inline-flex; align-items: center; }
/* Wide tables that stack on phones: one block per row, each value under its column's label. */
@media (max-width: 640px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr:first-child { display: none; }
  table.stack tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 2px 0; white-space: normal; }
  table.stack td::before { content: attr(data-label); color: var(--muted); text-align: left; }
  table.stack td:first-child { font-weight: 500; }
  table.stack td:first-child::before { content: none; }
}
