/* Design system shared with the equity research platform
   (equity-research-frontend: globals.css, nav.tsx, shell.tsx, portfolio). */

:root {
  --radius: 1rem;
  --radius-card: 22px;

  --background: #08090c;
  --foreground: #f3f5f8;
  --card: #121419;
  --elevated: #1a1d24;
  --border: #252932;
  --muted: #8b91a0;
  --faint: #5d6370;
  --primary: #6e8bff;
  --accent-bright: #8ea5ff;
  --up: #2fd27c;
  --down: #ff5d63;
  --warn: #f5b84b;

  --ease-rise: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-pill: cubic-bezier(0.3, 1.3, 0.5, 1);

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: dark;
}

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

html {
  font-family: var(--font-sans);
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 24px; }

/* ---------- Header + pill nav ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 30;
  background: color-mix(in srgb, var(--background) 85%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.site-header .container { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }

.wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.025em;
  white-space: nowrap;
  text-decoration: none;
}

.pill-nav {
  position: relative;
  margin-left: auto;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}
.pill-nav__indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--elevated);
  box-shadow: inset 0 0 0 1px var(--border);
  opacity: 0;
  transition: left 450ms var(--ease-pill), width 450ms var(--ease-pill), opacity 200ms;
}
.pill-nav__indicator.is-ready { opacity: 1; }
.pill-nav a {
  position: relative;
  z-index: 1;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--muted);
  transition: color 150ms;
}
.pill-nav a:hover, .pill-nav a[aria-current="true"], .pill-nav a[aria-current="page"] { color: var(--foreground); }

/* ---------- Typography ---------- */

.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.up { color: var(--up); }
.down { color: var(--down); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 19px; font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; }
.section-sub { font-size: 13px; color: var(--muted); }

.link {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color 150ms;
}
.link:hover { color: var(--foreground); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 200ms var(--ease-rise), background 150ms, border-color 150ms, color 150ms;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--foreground); color: var(--background); }
.btn--ghost { background: var(--card); border-color: var(--border); color: var(--foreground); }
.btn--ghost:hover { border-color: #3a3f4b; }

/* ---------- Cards, badges, chips ---------- */

.card {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
}
a.card { display: block; text-decoration: none; transition: border-color 200ms, transform 300ms var(--ease-rise); }
a.card:hover { border-color: #3a3f4b; transform: translateY(-2px); }

.badge {
  display: inline-block;
  white-space: nowrap;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
}
.badge--up { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.badge--warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge--neutral { background: var(--elevated); color: var(--muted); }
.badge--accent { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--accent-bright); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  background: var(--elevated);
  border-radius: 999px;
  padding: 3px 10px;
}

.kv { display: grid; gap: 10px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 600; text-align: right; }

/* Browser-window frame for screenshots */
.frame { display: block; text-decoration: none; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--background); }
.frame__bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--card); }
.frame__dots { display: flex; gap: 6px; }
.frame__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.frame__url { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame img { width: 100%; }
.frame--clip .frame__body { position: relative; max-height: 460px; overflow: hidden; }
.frame--clip .frame__body::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 110px;
  background: linear-gradient(to bottom, transparent, var(--background)); pointer-events: none;
}

/* ---------- Footer ---------- */

.site-footer .container {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding-top: 16px; padding-bottom: 32px;
  font-size: 12px; color: var(--faint);
}
.site-footer a { text-decoration: none; transition: color 150ms; }
.site-footer a:hover { color: var(--muted); }
.site-footer .push { margin-left: auto; }

/* ---------- Motion ---------- */

/* Entrance: content rises into place. Stagger siblings with style="--i: n".
   With JS, elements wait until they scroll into view (.in). */
.rise { animation: rise 0.7s var(--ease-rise) both; animation-delay: calc(var(--i, 0) * 70ms); }
.js .rise:not(.in) { animation: none; opacity: 0.001; }

@keyframes rise {
  from { opacity: 0.001; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Chart lines draw in (paths use pathLength="1"); fills fade in after. */
.anim-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(0.3, 0.7, 0.2, 1) forwards; }
.anim-fade { animation: fade 0.9s 0.35s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise, .js .rise:not(.in), .anim-fade { animation: none; opacity: 1; }
  .anim-draw { animation: none; stroke-dashoffset: 0; }
  .pill-nav__indicator { transition: none; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); background-clip: content-box; }

/* ---------- Phones: nav becomes a floating bottom bar ---------- */

@media (max-width: 767px) {
  .site-header { background: var(--background); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .pill-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    justify-content: space-between;
    padding: 6px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--card) 90%, transparent);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }
  .pill-nav__indicator { top: 6px; bottom: 6px; border-radius: 16px; }
  .pill-nav a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 16px; font-size: 12.5px; }
  .site-footer .container { padding-bottom: 112px; }
}
