/* ============================================================
   MVRVZ — on-chain valuation dashboard
   Typography: IBM Plex Sans + IBM Plex Mono
   Aesthetic: editorial terminal · monochrome · single amber accent
   ============================================================ */

:root {
  color-scheme: dark light;

  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --max-width: 1120px;
  --header-height: 52px;

  --radius: 4px;
  --radius-lg: 6px;

  /* Bitcoin-leaning amber, slightly muted for data UIs */
  --accent: #e0962b;
  --accent-soft: rgba(224, 150, 43, 0.14);

  --ok: #4cb782;
  --pending: #e0962b;
}

html[data-theme="dark"] {
  --bg:            #0a0a0a;
  --bg-elev:       #0e0e0e;
  --surface:       #121212;
  --surface-2:     #171717;
  --text:          #ededed;
  --text-2:        #b8b8b8;
  --muted:         #7a7a7a;
  --soft:          #555555;
  --border:        #222222;
  --border-2:      #2c2c2c;
  --grid:          rgba(255, 255, 255, 0.025);
  --chart-bg:      #0a0a0a;
}

html[data-theme="light"] {
  --bg:            #fafaf9;
  --bg-elev:       #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f4f4f2;
  --text:          #0f0f0f;
  --text-2:        #3a3a3a;
  --muted:         #6b6b6b;
  --soft:          #9a9a9a;
  --border:        #e8e6e2;
  --border-2:      #d8d5d0;
  --grid:          rgba(0, 0, 0, 0.03);
  --chart-bg:      #ffffff;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "ss02", "cv11";
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.site-header-inner {
  width: min(var(--max-width), calc(100% - 28px));
  min-height: var(--header-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.brand-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.top-nav a {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 120ms ease;
}

.top-nav a:hover {
  color: var(--text);
}

.header-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  position: relative;
}

.status-dot--ok {
  background: var(--ok);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 25%, transparent);
}

.status-dot--pending {
  background: var(--pending);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pending) 25%, transparent);
  animation: status-pulse 1.8s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.theme-toggle {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 120ms ease, border-color 120ms ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-2);
}

.theme-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-theme="dark"]  .theme-icon-sun  { display: block; }
html[data-theme="dark"]  .theme-icon-moon { display: none; }
html[data-theme="light"] .theme-icon-sun  { display: none; }
html[data-theme="light"] .theme-icon-moon { display: block; }

/* ============================================================
   PAGE LAYOUT
   ============================================================ */

.page {
  width: min(var(--max-width), calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

/* ---------- intro ---------- */

.intro {
  padding: 8px 0 26px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  max-width: 640px;
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--text);
}

.intro-copy {
  margin: 12px 0 0;
  max-width: 560px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.55;
}

/* ============================================================
   CHART CARDS
   ============================================================ */

.chart-list {
  display: grid;
  gap: 20px;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.chart-card-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.chart-card-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.chart-index {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--soft);
  padding-top: 2px;
}

.chart-card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text);
}

.chart-card-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* chart container */

.chart-shell {
  position: relative;
  background: var(--chart-bg);
}

.chart {
  width: 100%;
  height: 460px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  pointer-events: none;
}

.chart-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: status-pulse 1.4s ease-in-out infinite;
}

.chart.is-ready + .chart-loading {
  display: none;
}

.chart-description {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.chart-description p {
  margin: 0;
  max-width: 72ch;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ============================================================
   DEFINITIONS
   ============================================================ */

.notes {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.notes h2 {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.notes-list {
  margin: 0;
  padding: 0;
}

.notes-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 24px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.notes-row:last-child {
  border-bottom: 1px solid var(--border);
}

.notes-row dt {
  font-weight: 500;
  color: var(--text);
  font-size: 13.5px;
}

.notes-row dd {
  margin: 0;
  color: var(--text-2);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.site-footer-inner {
  width: min(var(--max-width), calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.footer-sep {
  color: var(--soft);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .chart {
    height: 400px;
  }
}

@media (max-width: 720px) {
  .site-header-inner,
  .page,
  .site-footer-inner {
    width: min(var(--max-width), calc(100% - 22px));
  }

  .top-nav {
    display: none;
  }

  .status-pill-text {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page {
    padding: 22px 0 28px;
  }

  .intro {
    padding: 4px 0 20px;
    margin-bottom: 20px;
  }

  .eyebrow {
    margin-bottom: 10px;
  }

  .intro-copy {
    font-size: 14px;
  }

  .chart-list {
    gap: 14px;
  }

  .chart-card-header {
    padding: 14px 14px 12px;
  }

  .chart-card-header h2 {
    font-size: 15px;
  }

  .chart-card-header p {
    font-size: 12.5px;
  }

  .chart {
    height: 340px;
  }

  .chart-description {
    padding: 12px 14px 14px;
  }

  .chart-description p {
    font-size: 13px;
  }

  .notes {
    margin-top: 24px;
    padding-top: 20px;
  }

  .notes-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }

  .notes-row dt {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
  }
}

@media (max-width: 480px) {
  .site-header-inner,
  .page,
  .site-footer-inner {
    width: min(var(--max-width), calc(100% - 16px));
  }

  .site-header-inner {
    gap: 10px;
  }

  .brand-text {
    font-size: 12.5px;
  }

  .status-pill {
    padding: 4px 7px 4px 7px;
    font-size: 10.5px;
  }

  .status-pill-text {
    max-width: 90px;
  }

  .theme-toggle {
    width: 28px;
    height: 28px;
  }

  h1 {
    font-size: 22px;
  }

  .chart {
    height: 300px;
  }

  .site-footer-inner {
    padding: 14px 0 20px;
    font-size: 11px;
  }
}

/* ============================================================
   ECHARTS TOOLTIP (injected markup)
   ============================================================ */

.tooltip-date {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 12px;
}

.tooltip-marker {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tooltip-name {
  color: var(--text-2);
  margin-right: auto;
}

.tooltip-row strong {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

/* ============================================================
   MOTION — subtle page-in
   ============================================================ */

@media (prefers-reduced-motion: no-preference) {
  .intro {
    animation: fade-up 420ms ease-out both;
  }
  .chart-card {
    animation: fade-up 480ms ease-out both;
  }
  .chart-card:nth-child(1) { animation-delay: 40ms; }
  .chart-card:nth-child(2) { animation-delay: 90ms; }
  .chart-card:nth-child(3) { animation-delay: 140ms; }

  @keyframes fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}