:root {
  --ink: #17211b;
  --muted: #647067;
  --paper: #f6f7f2;
  --surface: #ffffff;
  --line: #dce1da;
  --accent: #176b45;
  --accent-dark: #0d4c30;
  --link: #0d4c30;
  --positive: #176b45;
  --negative: #a43b32;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7ece6;
    --muted: #93a197;
    --paper: #12160f;
    --surface: #1a201a;
    --line: #2c342b;
    --accent: #3fbb84;
    --accent-dark: #2c9468;
    --link: #7fe3ab;
    --positive: #4ecf95;
    --negative: #f0897c;
  }
}
:root[data-theme="dark"] {
  --ink: #e7ece6;
  --muted: #93a197;
  --paper: #12160f;
  --surface: #1a201a;
  --line: #2c342b;
  --accent: #3fbb84;
  --accent-dark: #2c9468;
  --link: #7fe3ab;
  --positive: #4ecf95;
  --negative: #f0897c;
}
* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; }
a { color: var(--link); }
a:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid #f0a92e; outline-offset: 2px; }
.site-header, main, footer { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 1.15rem; font-weight: 850; letter-spacing: -.025em; text-decoration: none; white-space: nowrap; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
nav { display: flex; gap: 14px; }
.nav-link { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); font-size: .92rem; font-weight: 650; text-decoration: none; }
.nav-link:hover { color: var(--accent); }
.nav-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
main { min-height: 70vh; padding: 48px 0 72px; }
footer { padding: 24px 0 40px; color: var(--muted); border-top: 1px solid var(--line); }
h1, h2 { line-height: 1.15; letter-spacing: -.025em; }
h1 { max-width: 850px; font-size: clamp(2.2rem, 6vw, 4.8rem); margin: 8px 0 20px; }
h2 { margin-top: 0; font-size: clamp(1.35rem, 3vw, 2rem); }
section { margin-top: 56px; }
.hero { max-width: 820px; margin-top: 24px; }
.hero p:not(.eyebrow), .lede { color: var(--muted); font-size: 1.2rem; max-width: 800px; }
.eyebrow { color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.panel, .disclaimer, .explorer-result { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
form { display: grid; grid-template-columns: auto minmax(150px, 1fr) auto minmax(210px, 2fr) auto; align-items: center; gap: 12px; }
select, button, .button-link { min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
button, .button-link { color: white; background: var(--accent); border-color: var(--accent); cursor: pointer; font-weight: 700; text-decoration: none; }
button:hover, .button-link:hover { background: var(--accent-dark); }
#explorer-result:not(:empty) { margin-top: 18px; }
.card-grid, .stat-grid, .case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card { display: grid; gap: 12px; padding: 18px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 8px 24px rgb(23 107 69 / .08); }
.card span, .card small, .source { color: var(--muted); }
.asset-card-heading { display: flex; align-items: center; gap: 12px; }
.asset-card-heading > span { display: grid; line-height: 1.25; }
.asset-card-heading strong { color: var(--ink); }
.asset-card-heading small { margin-top: 2px; }
.study-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); }
.study-list a { padding: 15px; background: var(--surface); text-decoration: none; }
.breadcrumbs { color: var(--muted); font-size: .9rem; }
.page-heading { margin-top: 34px; }
.page-heading h1 { font-size: clamp(2rem, 5vw, 4rem); }
.page-title-row { display: flex; align-items: flex-start; gap: 20px; }
.page-title-row .eyebrow { margin-top: 3px; }
.page-title-row h1 { margin-top: 8px; }
.disclaimer { border-left: 4px solid #f0a92e; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.horizon-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.horizon-buttons button { min-height: 36px; padding: 5px 10px; background: var(--surface); color: var(--accent); border-color: var(--line); font-weight: 700; }
.horizon-buttons button:hover { background: var(--paper); }
.horizon-buttons button.active { background: var(--accent); color: white; border-color: var(--accent); }
.stat-grid > div { min-height: 100px; padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-grid span { display: block; color: var(--muted); font-size: .85rem; }
.stat-grid strong { display: block; margin-top: 8px; font-size: 1.25rem; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.table-scroll th a { color: inherit; text-decoration: none; }
.table-scroll th a:hover { text-decoration: underline; }
th.sortable-col { cursor: pointer; user-select: none; }
th.sortable-col:hover { background: var(--paper); }
th.sortable-col:focus-visible { outline: 3px solid #f0a92e; outline-offset: -2px; }
th.sortable-col::after { content: "\2195"; display: inline-block; margin-left: 6px; opacity: .35; font-weight: 400; }
th.sortable-col[aria-sort="ascending"]::after { content: "\2191"; opacity: 1; }
th.sortable-col[aria-sort="descending"]::after { content: "\2193"; opacity: 1; }
.positive { color: var(--positive); font-weight: 700; }
.negative { color: var(--negative); font-weight: 700; }
.load-more { margin-top: 14px; }
.case-grid > div { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.prose { max-width: 780px; }
.prose h2 { margin-top: 42px; }
.error-page { text-align: center; padding: 80px 0; }

.cross-asset-list { display: grid; gap: 10px; }
.cross-asset-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cross-asset-label { font-weight: 700; min-width: 220px; }
.cross-asset-links { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.cross-asset-links a { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: .85rem; font-weight: 700; }
.compare-link { font-size: .85rem; white-space: nowrap; font-weight: 700; }

.recent-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.recent-direction { font-weight: 800; width: 1.2em; text-align: center; flex-shrink: 0; }
.recent-direction.positive { color: var(--positive); }
.recent-direction.negative { color: var(--negative); }
.recent-date { margin-left: auto; color: var(--muted); font-size: .85rem; white-space: nowrap; }

.crypto-icon { display: inline-block; flex: 0 0 auto; width: 32px; height: 32px; object-fit: contain; border-radius: 50%; vertical-align: middle; }
.crypto-icon--xs { width: 18px; height: 18px; }
.crypto-icon--sm { width: 26px; height: 26px; }
.crypto-icon--lg { width: 44px; height: 44px; }
.crypto-icon--xl { width: clamp(54px, 8vw, 78px); height: clamp(54px, 8vw, 78px); margin-top: 4px; }
.asset-link { display: inline-flex; align-items: center; gap: 9px; }

.histogram-block { margin-top: 18px; }
.histogram-block h3 { font-size: 1rem; margin: 0 0 10px; }
.histogram-svg { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.histogram-table { width: 100%; min-width: 360px; margin-top: 10px; }

.bar-chart { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }

.occurrence-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 18px; }
.occurrence-filters select { min-height: 40px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.muted { color: var(--muted); }
.muted.small { font-size: .85rem; margin-top: 6px; }

#theme-toggle { background: none; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; min-height: 36px; padding: 4px 10px; font-weight: 400; }
#theme-toggle:hover { background: var(--surface); }

@media (max-width: 760px) {
  .site-header { align-items: flex-start; gap: 12px; }
  .site-header nav { display: grid; grid-template-columns: repeat(2, auto); gap: 7px 12px; }
  .nav-link { font-size: .84rem; }
  .brand span { display: none; }
  .brand img { width: 40px; height: 40px; }
  main { padding-top: 26px; }
  form { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .cross-asset-label { min-width: 0; }
  .page-title-row { gap: 13px; }
  .recent-item { align-items: flex-start; flex-wrap: wrap; }
  .recent-date { width: 100%; margin-left: 66px; }
}
