/* ============================================================================
   Opal Research — dark theme for the live-trading console.
   Brand vocabulary (Fraunces display serif, IBM Plex Mono kickers/data, opal
   gem + iridescent endpaper band, market-green accents, the live-dot ping)
   carried over from the marketing site and inverted onto a warm near-black.
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/Fraunces-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Warm near-black ground, parchment ink reversed out of it. */
  --ground: #131109;
  --surface: #1d1a11;
  --surface-2: #272317;
  --paper: #f4f1e8;
  --paper-soft: #cbc5b2;
  --ink-soft: #b3ac96;
  --ink-faint: #8b8470;
  /* Market green: brightened off the print accent so it reads on dark. */
  --accent: #2bbd6e;
  --accent-strong: #54da92;
  --accent-deep: #0b5d3b;
  --accent-wash: rgba(43, 189, 110, 0.12);
  --live: #2bbd6e;
  --rust: #e0744a;
  --rust-wash: rgba(224, 116, 74, 0.14);
  --hairline: rgba(244, 241, 232, 0.14);
  --hairline-soft: rgba(244, 241, 232, 0.07);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 31px 24px 24px;
  background: var(--ground);
  color: var(--paper);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Quiet engineering grid — faint light hairlines fading toward the fold. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--hairline-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--hairline-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, black, rgba(0, 0, 0, 0.25) 70%, transparent);
  opacity: 0.6;
}

/* Endpaper band: a thin strip of the opal's iridescence across the very top
   of every page, like the marbled top-stain of a fine binding. */
.opal-band {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  z-index: 50;
  background-image: url("opal-band.jpg");
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}

.page { position: relative; z-index: 1; max-width: 1600px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.page-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.page-title { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--paper); }

/* Brand lockup: the opal gem beside a Fraunces wordmark. */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 12px; text-decoration: none; }
.page-header > .brand-lockup { margin-bottom: 0; }
.brand-gem { width: 28px; height: 28px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(43, 189, 110, 0.25)); }
.brand-name { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--paper); letter-spacing: -0.01em; }

.strategy-link { font-family: var(--font-mono); color: var(--accent); font-weight: 500; text-decoration: none; }
.strategy-link:hover { color: var(--accent-strong); text-decoration: underline; }

/* Kicker: mono, tracked-out, with a leading hairline like the print brand. */
.section-kicker { font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.22em; color: var(--ink-faint); margin: 0 0 12px; display: flex; align-items: center; }
.section-kicker::before { content: ""; width: 26px; height: 1px; background: var(--ink-faint); margin-right: 10px; }
.section-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--paper); margin: 0 0 12px; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 18px; }
.hero-grid--list { grid-template-columns: minmax(0, 1.5fr) minmax(380px, 1fr); }
.hero-card, .metric-card, .chart-card, .epoch-log, .toolbar-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 10px; }
.hero-card { padding: 20px; }
.hero-copy { max-width: 720px; color: var(--ink-soft); font-size: 15px; line-height: 1.55; margin: 12px 0 0; }
.toolbar-card { display: flex; align-items: flex-start; gap: 6px; padding: 14px; flex-direction: column; }
.toolbar-main { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-control { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); color: var(--ink-faint); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; }
.filter-control select { appearance: none; border: 1px solid var(--hairline); border-radius: 6px; background: var(--ground); color: var(--paper); padding: 8px 34px 8px 12px; font-family: var(--font-sans); font-size: 13px; text-transform: none; letter-spacing: normal; }
.strategy-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.empty-cell { color: var(--ink-faint); text-align: center; padding: 28px 10px; }
.hero-card--compact { display: flex; align-items: center; }
.strategy-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.hero-title { font-family: var(--font-display); margin: 0; font-size: 25px; font-weight: 600; letter-spacing: -0.01em; color: var(--paper); }
.hero-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hero-meta-grid--status { grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; }
.hero-meta-item { min-width: 0; }
.hero-meta-item--status .status-pill { display: inline-flex; }
.hero-meta-item--refresh { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.hero-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.hero-meta-label, .stat-label { font-family: var(--font-mono); color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.hero-meta-row .hero-meta-label { margin-bottom: 0; }
.hero-meta-value { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--paper); }
.refresh-updated-meta { white-space: nowrap; }
.refresh-toggle { font-family: var(--font-mono); border: 1px solid var(--hairline); background: transparent; color: var(--ink-soft); border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; cursor: pointer; transition: color 160ms ease, border-color 160ms ease; }
.refresh-toggle:hover { color: var(--paper); border-color: var(--ink-faint); }
.capital-grid { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.capital-grid > div { min-width: 0; }
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--paper); white-space: nowrap; }

.status-pill { font-family: var(--font-mono); border-radius: 999px; padding: 7px 14px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; border: 1px solid var(--hairline); display: inline-flex; align-items: center; gap: 8px; }
.status-pill--loading { color: var(--ink-faint); }
.status-pill--active { background: var(--accent-wash); color: var(--accent-strong); border-color: rgba(43, 189, 110, 0.4); }
/* The live-dot ping — the only looping flourish, reserved for live strategies. */
.status-pill--active::before { content: ""; position: relative; width: 7px; height: 7px; border-radius: 999px; background: var(--live); box-shadow: 0 0 0 0 rgba(43, 189, 110, 0.5); animation: livePing 2.2s cubic-bezier(0.22, 1, 0.36, 1) infinite; }
.status-pill--error, .status-pill--stopped { background: var(--rust-wash); color: var(--rust); border-color: rgba(224, 116, 74, 0.4); }

@keyframes livePing {
  0% { box-shadow: 0 0 0 0 rgba(43, 189, 110, 0.5); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(43, 189, 110, 0); }
}

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.metric-card { padding: 16px; background: var(--ground); }
.metric-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--ink-faint); letter-spacing: 0.12em; margin-bottom: 8px; }
.metric-value-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.metric-value { font-family: var(--font-display); font-size: 33px; font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; color: var(--paper); }
.metric-value-detail { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); text-align: right; max-width: 48%; letter-spacing: 0.02em; }
.metric-value-detail--positive { color: var(--live); }
.metric-value-detail--negative { color: var(--rust); }
.metric-subtitle, .metric-detail, .chart-description, .empty-copy, .info-note p { font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.metric-details { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.metric-details--top { margin-top: 0; margin-bottom: 18px; }
.metric-subtitle { margin-top: 16px; }
.info-note { margin-top: 12px; border-top: 1px solid var(--hairline-soft); padding-top: 10px; }
.info-note--section { margin-bottom: 14px; }
.info-note summary { font-family: var(--font-mono); cursor: pointer; color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.info-note summary:hover { color: var(--paper); }

.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chart-card { padding: 14px; }
.chart-card--full { grid-column: 1 / -1; }
.chart-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--paper); margin: 0 0 6px; }
.chart-shell { min-height: 320px; }

.epoch-log { padding: 14px; }
.epoch-log__header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.epoch-log__meta { font-family: var(--font-mono); color: var(--ink-faint); font-size: 12px; letter-spacing: 0.02em; }
.table-shell { max-height: 520px; overflow: auto; border: 1px solid var(--hairline); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-faint); text-transform: uppercase; font-size: 10.5px; font-weight: 500; letter-spacing: 0.1em; padding: 12px 10px; border-bottom: 1px solid var(--hairline); text-align: left; }
tbody td { padding: 10px; border-bottom: 1px solid var(--hairline-soft); white-space: nowrap; vertical-align: top; color: var(--paper-soft); }
tbody tr:hover { background: var(--accent-wash); }
.fill-list { margin: 4px 0 0; padding-left: 18px; color: var(--ink-faint); }
.positive { color: var(--live); }
.negative { color: var(--rust); }
.error-banner { background: var(--rust-wash); color: var(--rust); border: 1px solid rgba(224, 116, 74, 0.4); border-radius: 10px; padding: 14px 16px; }
.hidden { display: none; }

.back-link { font-family: var(--font-mono); display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; border: 1px solid var(--hairline); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 8px 14px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; text-decoration: none; white-space: nowrap; transition: color 160ms ease, border-color 160ms ease; }
.back-link:hover { color: var(--paper); border-color: var(--ink-faint); }

/* ---- Welcome cover ------------------------------------------------------- */
.welcome-body { min-height: 100vh; box-sizing: border-box; display: flex; }
.welcome-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(620px 380px at 50% -8%, rgba(43, 189, 110, 0.14), transparent 70%),
    radial-gradient(540px 320px at 88% 8%, rgba(224, 116, 74, 0.06), transparent 72%);
}
.welcome { position: relative; z-index: 1; margin: auto; max-width: 900px; width: 100%; display: flex; flex-direction: column; gap: 26px; padding: 56px 0; }
.welcome-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 52px 44px; text-align: center; box-shadow: 0 24px 60px -36px rgba(0, 0, 0, 0.8); }
.welcome-gem { width: 88px; height: 88px; object-fit: contain; margin: 0 auto 22px; display: block; filter: drop-shadow(0 6px 26px rgba(43, 189, 110, 0.3)); animation: gemFloat 9s ease-in-out infinite; }
@keyframes gemFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.welcome-kicker { justify-content: center; }
.welcome-title { font-family: var(--font-display); margin: 14px 0 0; font-size: 46px; font-weight: 600; line-height: 1.08; letter-spacing: -0.02em; color: var(--paper); }
.welcome-copy { margin: 18px auto 0; max-width: 580px; color: var(--ink-soft); }
.welcome-actions { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 30px; flex-wrap: wrap; }
.welcome-cta { display: inline-flex; align-items: center; gap: 9px; background: var(--accent-deep); border: 1px solid var(--accent); color: var(--paper); border-radius: 6px; padding: 13px 24px; font-size: 14px; font-weight: 600; text-decoration: none; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 14px 30px -16px rgba(43, 189, 110, 0.55); transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease; }
.welcome-cta:hover { background: var(--accent); transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 18px 36px -16px rgba(43, 189, 110, 0.65); }
.welcome-secondary { font-family: var(--font-mono); color: var(--ink-soft); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; text-decoration: none; }
.welcome-secondary:hover { color: var(--accent-strong); }
.welcome-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.welcome-point { background: var(--surface); border: 1px solid var(--hairline); border-radius: 10px; padding: 20px; transition: transform 200ms ease, border-color 200ms ease; }
.welcome-point:hover { transform: translateY(-3px); border-color: var(--ink-faint); }
.welcome-point p { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }

@media (max-width: 1100px) { .hero-grid, .hero-grid--list, .charts-grid, .hero-meta-grid, .hero-meta-grid--status { grid-template-columns: 1fr; } .metric-value-row { flex-direction: column; align-items: flex-start; } .metric-value-detail { max-width: 100%; text-align: left; } .strategy-title-row { align-items: flex-start; } .hero-meta-row { flex-direction: column; align-items: flex-start; } }
@media (max-width: 768px) { body { padding: 31px 16px 16px; } .page { gap: 20px; } .page-header { flex-direction: column; } .hero-card, .metric-card, .chart-card, .epoch-log, .toolbar-card { padding: 14px; } .toolbar-main { align-items: flex-start; flex-direction: column; } .hero-title { font-size: 21px; } .stat-value, .metric-value { font-size: 27px; } .capital-grid, .strategy-summary-grid { grid-template-columns: 1fr; } .welcome-card { padding: 34px 22px; } .welcome-title { font-size: 32px; } .welcome-points { grid-template-columns: 1fr; } }
