@font-face {
  font-family: "Chivo Brand";
  src: url("assets/brand/fonts/Chivo-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* ============================================================
   Compound Strategy Lab — dark fintech playground
   ============================================================ */
:root {
  --bg-0: #0a0e1a;
  --bg-1: #101628;
  --card: rgba(255, 255, 255, 0.045);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #e8ecf6;
  --text-dim: #8b94ad;
  --green: #4ade80;
  --brand-green: #1EE81F;
  --green-deep: #16a34a;
  --orange: #fb923c;
  --violet: #a78bfa;
  --radius: 18px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(74, 222, 128, 0.10), transparent 60%),
    radial-gradient(1000px 500px at 90% 0%, rgba(167, 139, 250, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 40%);
  min-height: 100vh;
  padding: 28px 20px 60px;
}

main { max-width: 1060px; margin: 0 auto; }

/* ---------- shared primary navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 28px;
  width: 100vw;
  min-height: 72px;
  margin: -28px calc(50% - 50vw) 26px;
  padding: 0 max(32px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(139, 148, 173, 0.14);
  background: rgba(10, 14, 26, 0.92);
  backdrop-filter: blur(16px);
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 650;
}
.site-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-right: auto;
  color: var(--brand-green) !important;
  flex: none;
}
.site-nav-brand img { display: block; width: 300px; height: auto; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 160ms ease;
}
.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] { color: var(--brand-green); }

/* ---------- header ---------- */
.site-header { text-align: center; max-width: 1060px; margin: 0 auto 26px; }
.site-header h1 {
  font-size: clamp(1.35rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.42em;
}
.logo {
  width: 0.92em;
  height: 0.92em;
  filter: drop-shadow(0 4px 18px rgba(74, 222, 128, 0.45));
}
.brand-wordmark {
  font-family: "Chivo Brand", Chivo, Helvetica, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--brand-green);
}
.grad-text {
  background: linear-gradient(90deg, #4ade80, #34d399 40%, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { color: var(--text-dim); margin-top: 8px; font-size: 1.02rem; }
.site-footer a { color: var(--violet); font-weight: 700; }
.site-footer .disclaimer {
  font-size: 0.72rem;
  opacity: 0.75;
  max-width: 640px;
  margin: 10px auto 0;
  line-height: 1.5;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

/* ---------- controls ---------- */
.controls { padding: 20px 22px; margin-bottom: 18px; }
.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); font-weight: 600;
}
.field-label b { color: var(--green); font-size: 0.9rem; margin-left: 4px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.adorn { position: absolute; left: 12px; color: var(--text-dim); font-weight: 600; pointer-events: none; }
input[type="number"], select {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 12px 10px 26px;
  outline: none;
  transition: border-color 0.2s;
}
select { padding-left: 12px; cursor: pointer; }
input[type="number"]:focus, select:focus { border-color: var(--green); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--green-deep), var(--green));
  outline: none; cursor: pointer; margin-top: 12px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid var(--green);
  box-shadow: 0 2px 10px rgba(74, 222, 128, 0.5);
  cursor: grab;
}

.presets { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.presets-label { color: var(--text-dim); font-size: 0.82rem; font-weight: 600; margin-right: 4px; }
.chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s;
}
.chip:hover { background: rgba(74, 222, 128, 0.15); border-color: var(--green); transform: translateY(-1px); }

/* ---------- stage ---------- */
.stage-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, #0d1322 0%, #0a1020 70%, #0c1526 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  margin-bottom: 14px;
}
#stage { display: block; width: 100%; height: 520px; }

/* top-right: the bottom-left corner is where the shorter stack's height
   readout sits, and the hint was covering it */
.scene-hint {
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(139, 148, 173, 0.16);
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-align: right;
}

/* ---------- playbar ---------- */
.playbar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 18px; }
.play-btn {
  width: 48px; height: 48px; flex: none;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--green), #22c55e);
  color: #06130a;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(74, 222, 128, 0.45);
  transition: transform 0.15s;
}
.play-btn:hover { transform: scale(1.08); }
.play-btn svg { width: 20px; height: 20px; fill: #06130a; display: block; margin: 0 auto; }
.playbar input[type="range"] { margin-top: 0; }
.time-readout { flex: none; min-width: 110px; text-align: right; font-weight: 700; }
.time-total { color: var(--text-dim); font-weight: 500; font-size: 0.85rem; }

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); font-weight: 700;
}
.stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.78rem; color: var(--text-dim); }
.compound-stat .stat-value { color: var(--green); }
.simple-stat .stat-value { color: var(--orange); }
.diff-stat { border-color: #11cc11; }
.diff-stat .stat-value { color: #11cc11; }
.spark-card { padding-bottom: 12px; }
#sparkline { width: 100%; height: 64px; }

/* ---------- info dots & popovers (shared) ---------- */
.info-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  padding: 0;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid rgba(139, 148, 173, 0.55);
  background: transparent;
  color: var(--text-dim);
  font: italic 700 10px Georgia, serif;
  cursor: pointer;
  vertical-align: middle;
  flex: none;
  transition: all 0.15s;
}
.info-dot:hover { border-color: var(--violet); color: var(--violet); }

.info-popover {
  position: fixed;
  z-index: 1000;
  max-width: 300px;
  background: #141b2e;
  border: 1px solid rgba(167, 139, 250, 0.5);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}
.info-popover b { color: var(--violet); }
.info-popover code {
  display: block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  color: var(--violet);
  background: rgba(167, 139, 250, 0.08);
  border-radius: 6px;
  padding: 5px 8px;
  margin: 7px 0;
  white-space: pre-wrap;
}

/* ---------- footer ---------- */
.site-footer { margin-top: 34px; color: var(--text-dim); }
.compact-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding-top: 10px;
  border-top: 1px solid var(--card-border);
  color: rgba(139, 148, 173, 0.9);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}
.footer-mark {
  width: 16px;
  height: 16px;
  background: url("assets/brand/favicon-48.png?v=9") center / contain no-repeat;
  flex: none;
}
.compact-footer > .footer-mark + span {
  color: var(--brand-green);
  font-family: "Chivo Brand", Chivo, Helvetica, Arial, sans-serif;
  font-weight: 400;
  letter-spacing: 0.14em;
}
.compact-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}
.compact-footer a {
  color: var(--text-dim);
  font-weight: 700;
  text-decoration: none;
}
.compact-footer a:hover,
.compact-footer a:focus-visible { color: var(--text); }

/* ---------- public policy and editorial pages ---------- */
body.policy-page { min-height: 100vh; }
.policy-shell { max-width: 820px; margin: 0 auto; }
.policy-shell > .site-nav {
  margin-left: calc(50% - 50vw);
  margin-right: 0;
}
body.docs-page > .site-nav { margin-top: 0; }
.policy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 42px;
}
.policy-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-weight: 800; }
.policy-brand .logo { width: 27px; height: 27px; }
.policy-brand .brand-wordmark { font-size: 0.78rem; }
.policy-brand small { color: var(--text-dim); font-family: inherit; font-size: 0.68rem; font-weight: 700; }
.policy-back { color: var(--text-dim); font-size: 0.82rem; font-weight: 700; text-decoration: none; }
.policy-back:hover, .policy-back:focus-visible { color: var(--text); }
.policy-content { max-width: 720px; }
.policy-content h1 { font-size: clamp(2rem, 5vw, 2.7rem); margin-bottom: 10px; }
.policy-content .policy-lede { max-width: 660px; color: var(--text-dim); font-size: 1rem; line-height: 1.65; margin-bottom: 34px; }
.policy-content h2 { margin: 30px 0 9px; font-size: 1.08rem; }
.policy-content p, .policy-content li { color: rgba(232, 236, 246, 0.88); font-size: 0.94rem; line-height: 1.7; }
.policy-content p { margin-bottom: 13px; }
.policy-content ul { padding-left: 20px; margin-bottom: 14px; }
.policy-content li { margin-bottom: 7px; }
.policy-note { padding: 12px 14px; border-left: 2px solid var(--violet); background: rgba(167, 139, 250, 0.07); color: var(--text-dim); font-size: 0.86rem; line-height: 1.55; margin: 22px 0; }
.policy-shell > .compact-footer { margin-top: 52px; }

@media (max-width: 640px) {
  .site-nav { gap: 4px 14px; width: 100vw; min-height: 62px; margin: -28px calc(50% - 50vw) 14px; padding: 4px 20px; font-size: 0.72rem; }
  .site-nav-brand { width: 100%; min-height: 34px; }
  .site-nav-brand img { width: 260px; height: auto; }
  .site-nav a { min-height: 36px; }
  .policy-shell > .site-nav { margin-left: calc(50% - 50vw); }
  body.docs-page > .site-nav { margin-top: 0; }
  #stage { height: 400px; }
  .compact-footer { align-items: flex-start; gap: 8px; font-size: 0.58rem; }
  .compact-footer nav { width: 100%; margin-left: 0; gap: 9px 12px; }
  .policy-header { margin-bottom: 30px; }
}

/* ---------- scrollbars (match the dark theme) ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 148, 173, 0.35) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139, 148, 173, 0.28);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(139, 148, 173, 0.5); }
