/* ============================================================
   Atlas — clean fintech design system
   Light-first · indigo accent · JetBrains Mono numbers
   Dark via [data-theme="dark"]
   ============================================================ */

:root {
  --bg: #f7f7f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f3f5;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --ink: #111827;
  --ink-soft: #4b5563;
  --muted: #9ca3af;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --up: #059669;
  --up-soft: rgba(5, 150, 105, 0.10);
  --down: #e11d48;
  --down-soft: rgba(225, 29, 72, 0.10);
  --warn: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-lift: 0 12px 32px rgba(17, 24, 39, 0.10);
  --max: 1120px;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d0e12;
  --bg-soft: #131419;
  --panel: #16171d;
  --panel-2: #1d1f27;
  --line: #262833;
  --line-strong: #343747;
  --ink: #f3f4f6;
  --ink-soft: #a6adbb;
  --muted: #6b7280;
  --accent: #818cf8;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --up: #34d399;
  --up-soft: rgba(52, 211, 153, 0.14);
  --down: #fb7185;
  --down-soft: rgba(251, 113, 133, 0.14);
  --warn: #fbbf24;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ── reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15.5px;
  transition: background 0.25s ease, color 0.25s ease;
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button, input { font: inherit; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: var(--accent-soft); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }

.container { width: min(100% - 2rem, var(--max)); margin-inline: auto; }

/* ── header ──────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.05rem; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.8rem;
  box-shadow: 0 2px 8px var(--accent-soft);
}
.brand-mark span { transform: translateY(-0.5px); }
.nav { display: flex; align-items: center; gap: 1.4rem; }
.nav-link { font-size: 0.9rem; font-weight: 500; color: var(--ink-soft); padding: 4px 2px; }
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--ink); }
.nav-ai {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--accent); color: #fff !important;
  padding: 5px 13px; border-radius: 999px; font-weight: 600;
  box-shadow: 0 2px 10px var(--accent-soft);
  transition: filter .15s ease, box-shadow .15s ease;
}
.nav-ai:hover { filter: brightness(1.08); box-shadow: 0 3px 14px var(--accent-soft); }
.nav-ai.active { background: var(--accent); color: #fff !important; box-shadow: 0 3px 14px var(--accent-soft); }

.theme-toggle {
  border: 1px solid var(--line-strong); background: var(--panel);
  color: var(--ink-soft); border-radius: 8px; width: 34px; height: 34px;
  cursor: pointer; display: grid; place-items: center; font-size: 0.95rem;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── hero ────────────────────────────────────────────────── */
.hero { padding: 4.5rem 0 2.5rem; max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); font-weight: 600;
  margin-bottom: 1.1rem;
}
.eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.hero-title { font-size: 2.9rem; font-weight: 800; letter-spacing: -0.035em; margin-bottom: 1rem; }
.lede { font-size: 1.06rem; color: var(--ink-soft); max-width: 620px; }

/* ── sections ────────────────────────────────────────────── */
.strategies-section { padding: 2rem 0 3.5rem; }
.section-head { margin-bottom: 1.6rem; }
.section-head h2 { font-size: 1.45rem; font-weight: 750; }
.section-head p { color: var(--muted); font-size: 0.92rem; margin-top: 0.25rem; }

/* ── strategy cards ──────────────────────────────────────── */
.strategy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1.25rem; }
.strategy-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.45rem; cursor: pointer;
  display: flex; flex-direction: column; gap: 1rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.strategy-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
}
.card-top { display: flex; align-items: center; justify-content: space-between; }
.card-type {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.card-ann { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--up); }
.card-ann small { font-family: var(--font-body); font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.card-title { font-size: 1.18rem; font-weight: 700; margin-bottom: 0.2rem; }
.card-tagline { color: var(--ink-soft); font-size: 0.88rem; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
.stat { background: var(--panel-2); border-radius: 9px; padding: 0.6rem 0.75rem; }
.stat label { display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.15rem; }
.stat b { font-family: var(--font-mono); font-size: 0.92rem; font-weight: 600; }
.stat b.up { color: var(--up); }
.stat b.down { color: var(--down); }

.card-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.badge {
  font-size: 0.68rem; font-weight: 600; padding: 0.22rem 0.55rem; border-radius: 999px;
  font-family: var(--font-mono);
}
.badge-1s { color: var(--up); background: var(--up-soft); }

/* ── detail view ─────────────────────────────────────────── */
.detail-view { padding: 2.25rem 0 4.5rem; }
.back-link {
  display: inline-block; margin-bottom: 1.5rem; font-size: 0.88rem; font-weight: 500;
  color: var(--ink-soft);
}
.back-link:hover { color: var(--accent); }
.detail-topline { margin-bottom: 1.4rem; }
.detail-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin: 0.3rem 0; }
.detail-tagline { color: var(--ink-soft); }

.detail-metrics-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin-bottom: 1.2rem; }
.metric-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.metric-card .k {
  display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 600; margin-bottom: 0.35rem;
}
.metric-card .v { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; }
.metric-card .v.pos { color: var(--up); }
.metric-card .v.neg { color: var(--down); }
.metric-card .s { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }

.v1s-note {
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
  background: var(--up-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--up) 30%, transparent);
  border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.86rem; margin-bottom: 1.2rem;
}
.v1s-note::before { content: "✓"; color: var(--up); font-weight: 800; }
.v1s-note strong { color: var(--up); font-family: var(--font-mono); }

.detail-about-block {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.3rem; margin-bottom: 1.4rem;
}
.detail-about { color: var(--ink-soft); font-size: 0.9rem; }

/* ── trade logic section ───────────────────────────────── */
.trade-logic {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.4rem; margin-bottom: 1.4rem;
}
.tl-title {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 0.78rem; color: var(--accent); margin: 0 0 0.9rem; display: flex; align-items: center; gap: 0.5rem;
}
.tl-title::before { content: "▸"; color: var(--accent); }
.tl-sub {
  font-size: 0.92rem; font-weight: 700; color: var(--ink); margin: 1.1rem 0 0.45rem;
  font-family: var(--font-mono);
}
.trade-logic p { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55; margin: 0 0 0.5rem; }
.trade-logic .tl-list { margin: 0 0 0.6rem; padding-left: 1.15rem; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.55; }
.trade-logic .tl-list li { margin-bottom: 0.35rem; }
.trade-logic .tl-list li::marker { color: var(--accent); }
.trade-logic strong { color: var(--ink); font-weight: 700; }

/* ── chart card ──────────────────────────────────────────── */
.chart-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.4rem; margin-bottom: 1.4rem;
}
.chart-card h3 { font-size: 1.02rem; font-weight: 700; margin-bottom: 1rem; }
.chart-wrap { position: relative; }
.equity-chart { width: 100%; height: 300px; }
.chart-tooltip {
  position: absolute; background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 0.4rem 0.65rem; font-family: var(--font-mono);
  font-size: 0.75rem; pointer-events: none; box-shadow: var(--shadow);
  z-index: 5; white-space: nowrap;
}
.chart-note { margin-top: 0.7rem; font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); }

/* ── trades table ────────────────────────────────────────── */
.trades-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.trades-toolbar h3 { margin: 0; margin-right: 0.5rem; }
.chip {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-soft);
  font-size: 0.74rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 999px;
  cursor: pointer; transition: all 0.15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.download { border-color: var(--line-strong); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.chip.download:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 860px; }
thead th {
  text-align: left; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600; padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap;
}
tbody td {
  padding: 0.62rem 0.9rem; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.8rem; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
.tag-side { font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 5px; font-size: 0.72rem; }
.tag-side.CE { color: var(--up); background: var(--up-soft); }
.tag-side.PE { color: var(--down); background: var(--down-soft); }
.reason-tag { font-size: 0.68rem; padding: 0.12rem 0.45rem; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--ink-soft); }
.reason-tag.OPEN { color: #f59e0b; border-color: #f59e0b; }
.pnl.pos { color: var(--up); font-weight: 600; }
.pnl.neg { color: var(--down); font-weight: 600; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-top: 1rem; }
.pagination span { font-size: 0.78rem; color: var(--muted); font-family: var(--font-mono); }
.pagination button {
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  font-size: 0.8rem; font-weight: 600; padding: 0.35rem 0.9rem; border-radius: 8px; cursor: pointer;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── footer ──────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); padding: 1.6rem 0; margin-top: 2rem; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner span { font-size: 0.8rem; color: var(--muted); }
.footer-meta { font-size: 0.72rem !important; }

/* ── skeleton ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line) 50%, var(--panel-2) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .detail-metrics-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .hero { padding: 3rem 0 1.75rem; }
  .hero-title { font-size: 2.1rem; }
  .lede { font-size: 0.96rem; }
  .container { width: min(100% - 1.5rem, var(--max)); }
  .strategy-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .detail-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-title { font-size: 1.55rem; }
  .card-ann { font-size: 1.1rem; }
  .header-inner { height: 54px; }
  .nav-link { font-size: 0.82rem; }
  .chart-card { padding: 1rem; }
  .metric-card { padding: 0.85rem 0.9rem; }
  .metric-card .v { font-size: 1.05rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
}

/* ── slippage selector + compounding block ─────────────── */
.slip-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 0.9rem 0 1.1rem; }
.slip-row label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.slip-row select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.45rem 0.9rem; font-family: var(--font-mono); font-size: 0.9rem;
}
.slip-note { font-size: 0.72rem; color: var(--muted); }
.compounding-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.8rem; margin-bottom: 0.9rem; }
.compounding-stats .stat b.pos { color: var(--up, #16a34a); }
.compounding-stats .stat b.neg { color: var(--down, #dc2626); }
.compounding-stats .stat b.down { color: var(--down, #dc2626); }

/* ── compounding scenario matrix ───────────────────────── */
.comp-matrix { width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.8rem; }
.comp-matrix th, .comp-matrix td { padding: 0.5rem 0.6rem; text-align: right; border-bottom: 1px solid var(--border, rgba(0,0,0,0.08)); }
.comp-matrix th { font-family: var(--mono, "IBM Plex Mono", monospace); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #666); }
.comp-matrix td:first-child, .comp-matrix th:first-child { text-align: left; }
.comp-matrix td b { display: block; font-size: 0.85rem; }
.comp-matrix td span { font-size: 0.68rem; opacity: 0.75; }
.comp-matrix tbody tr { cursor: pointer; transition: background 0.15s; }
.comp-matrix tbody tr:hover { background: rgba(0, 82, 255, 0.06); }
.comp-matrix tbody tr.sel { background: rgba(0, 82, 255, 0.12); outline: 1px solid rgba(0, 82, 255, 0.35); }
.comp-matrix td.pos b { color: var(--pos, #0a7d3c); }
.comp-matrix td.neg b { color: var(--neg, #c5221f); }
.comp-matrix td.down b { color: var(--muted, #999); }
.comp-matrix td.ruined b { color: #c5221f; }
.comp-matrix td.ruined { background: rgba(197, 34, 31, 0.07); }

/* ── Backtest Now range panel ─────────────────────────── */
.bt-now { margin-left: auto; font-size: 0.8rem; font-weight: 700; padding: 0.45rem 0.85rem; border-radius: 8px; border: 1px solid var(--accent, #4f46e5); background: transparent; color: var(--accent, #4f46e5); cursor: pointer; transition: all .15s; }
.bt-now:hover { background: var(--accent, #4f46e5); color: #fff; }
.bt-now.active { background: var(--accent, #4f46e5); color: #fff; }
.bt-panel { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 1rem; padding: 0.7rem 0.9rem; border: 1px dashed var(--line, #e5e7eb); border-radius: 10px; background: var(--panel2, rgba(127,127,127,.04)); }
.bt-panel[hidden] { display: none; }
.bt-preset-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.bt-preset { font-size: 0.78rem; font-weight: 600; padding: 0.3rem 0.7rem; border-radius: 7px; border: 1px solid var(--line, #e5e7eb); background: transparent; color: var(--text, #111); cursor: pointer; }
.bt-preset:hover { border-color: var(--accent, #4f46e5); color: var(--accent, #4f46e5); }
.bt-preset.sel { background: var(--accent, #4f46e5); border-color: var(--accent, #4f46e5); color: #fff; }
.bt-preset:disabled { opacity: .4; cursor: default; }
.bt-panel input[type="date"] { font-size: 0.8rem; padding: 0.3rem 0.5rem; border-radius: 7px; border: 1px solid var(--line, #e5e7eb); background: var(--panel, #fff); color: var(--text, #111); }
.bt-arrow { color: var(--muted); }
.bt-panel .btn { font-size: 0.8rem; font-weight: 700; padding: 0.35rem 0.9rem; border-radius: 7px; border: 1px solid var(--accent, #4f46e5); background: var(--accent, #4f46e5); color: #fff; cursor: pointer; }
.bt-panel .btn.bt-reset { background: transparent; color: var(--muted, #666); border-color: var(--line, #e5e7eb); }
.bt-note { font-size: 0.75rem; color: var(--muted, #666); margin-left: 0.25rem; }
/* ── strategy tiles ─────────────────────────────────────── */
#strategyGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.strategy-tile {
  display: flex; flex-direction: column; gap: 0.65rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 1.15rem 1.2rem 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  will-change: transform;
}
.strategy-tile:hover {
  cursor: pointer;
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
  transform: translateY(-4px);
}
.strategy-tile:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}



.tile-title { font-size: 1.03rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.tile-tagline {
  font-size: 0.8rem; color: var(--ink-soft); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.3em;
}
.tile-spark { margin: 0.1rem 0 0.25rem; }
.tile-spark svg { display: block; width: 100%; height: 56px; }
.tile-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.8rem;
  margin-top: auto;
}
.tm label {
  display: block; font-family: var(--font-mono); font-size: 0.58rem;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  margin-bottom: 0.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tm b { font-size: 0.9rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.tm b.pos { color: var(--up); }
.tm b.neg { color: var(--down); }
.tile-foot {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 0.65rem; margin-top: 0.35rem;
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted);
}
.tile-foot .badge { margin-left: auto; }
