/* ==========================================================================
   backtester.app — public landing page
   Same palette and chrome as the signed-in app, scaled up for marketing.
   ========================================================================== */

body.public { display: block; height: auto; min-height: 100vh; overflow: visible; }

body.marketing {
  font-size: 14px;
  line-height: 1.6;
  background:
    radial-gradient(900px 500px at 50% -14%, rgba(63, 191, 174, 0.1), transparent 62%),
    radial-gradient(700px 420px at 96% 10%, rgba(111, 178, 255, 0.035), transparent 60%),
    var(--bg);
}

.home-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 0 0 6px 0;
  background: var(--teal);
  color: var(--teal-ink);
  font-size: 12px;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* Header ---------------------------------------------------------------- */

body.marketing .topbar {
  height: 64px;
  padding: 0 max(28px, calc((100% - 1180px) / 2 + 28px));
  background: rgba(8, 13, 19, 0.76);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
body.marketing .wordmark { font-size: 17px; }
body.marketing .brand-sub { font-size: 9.5px; letter-spacing: 0.16em; }
body.marketing .topnav { gap: 22px; }
body.marketing .topnav a { font-size: 12px; }
body.marketing .topnav a.btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 7px;
  color: var(--teal-ink);
  font-size: 11.5px;
  font-weight: 600;
}
body.marketing .topnav a.btn:hover { color: var(--teal-ink); text-decoration: none; }

/* Hero ------------------------------------------------------------------ */

.hero {
  position: relative;
  overflow: hidden;
  padding: 68px 0 0;
}
.hero::before {
  content: "";
  position: absolute;
  top: -280px;
  left: 50%;
  width: 1100px;
  height: 680px;
  transform: translateX(-50%);
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(63, 191, 174, 0.13), transparent 72%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(900px 420px at 50% 0%, #000 0%, transparent 78%);
  mask-image: radial-gradient(900px 420px at 50% 0%, #000 0%, transparent 78%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 940px;
  margin: 0 auto;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border: 1px solid rgba(63, 191, 174, 0.26);
  border-radius: 99px;
  background: rgba(63, 191, 174, 0.06);
  color: #9fe9dd;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.hero-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(63, 191, 174, 0.45);
  animation: badge-pulse 2.6s ease-out infinite;
}
@keyframes badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 191, 174, 0.4); }
  60%, 100% { box-shadow: 0 0 0 8px rgba(63, 191, 174, 0); }
}

.hero-title {
  max-width: 920px;
  margin: 26px auto 0;
  color: var(--text);
  font-size: clamp(2.55rem, 5.6vw, 4.1rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.04;
}
.hero-title .accent-line {
  display: block;
  background: linear-gradient(96deg, #eef3f7 0%, #9fe9dd 38%, #3fbfae 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 610px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}
.btn-lg {
  height: 46px;
  padding: 0 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.btn-lg.btn-primary-glow { box-shadow: 0 10px 34px rgba(63, 191, 174, 0.2); }
.btn-lg.btn-primary-glow:hover { box-shadow: 0 14px 40px rgba(63, 191, 174, 0.26); transform: translateY(-1px); }

.hero-note {
  margin-top: 16px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.01em;
}

/* Product preview ------------------------------------------------------- */

.hero-preview-wrap {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 54px auto 0;
}

.app-preview {
  overflow: hidden;
  border: 1px solid rgba(63, 191, 174, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, #0e1721 0%, #0a1118 100%);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

.preview-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.preview-dots { grid-column: 1; justify-self: start; }
.preview-bar-label { grid-column: 2; justify-self: center; }
.preview-tag { grid-column: 3; justify-self: end; }
.preview-dots { display: inline-flex; gap: 6px; }
.preview-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #263341;
}
.preview-bar-label {
  color: var(--faint);
  font-family: var(--num);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.preview-tag {
  padding: 2px 7px;
  border: 1px solid rgba(210, 165, 76, 0.3);
  border-radius: 4px;
  background: var(--warning-wash);
  color: #d9bd80;
  font-family: var(--num);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-body { padding: 22px 24px 20px; }

.preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.preview-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.preview-title span {
  margin-left: 6px;
  color: var(--faint);
  font-family: var(--num);
  font-size: 11px;
  font-weight: 400;
}
.preview-head p { margin-top: 4px; color: var(--faint); font-size: 10.5px; }
.preview-action {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.preview-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.preview-metric {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-deep);
}
.preview-metric span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.preview-metric strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-family: var(--num);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.preview-metric strong.pos { color: var(--positive); }
.preview-metric strong.warn { color: var(--warning); }
.preview-metric em {
  display: block;
  margin-top: 5px;
  color: var(--faint);
  font-size: 9.5px;
  font-style: normal;
  line-height: 1.4;
}

.preview-chart {
  margin-top: 12px;
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-deep);
}
.preview-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.preview-chart-title {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.preview-chart-head span { color: var(--faint); font-size: 9.5px; }
.equity-svg {
  display: block;
  width: 100%;
  height: clamp(150px, 18vw, 230px);
  filter: drop-shadow(0 6px 18px rgba(63, 191, 174, 0.12));
}
.preview-chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--faint);
  font-family: var(--num);
  font-size: 9.5px;
}

.preview-note {
  margin-top: 14px;
  color: var(--faint);
  font-size: 10px;
  text-align: center;
}

/* Sections -------------------------------------------------------------- */

.section { padding: 104px 0 0; }

.section-head {
  max-width: 620px;
  margin: 0 auto 42px;
  text-align: center;
}
.kicker {
  display: inline-block;
  color: var(--teal);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.section-head h2 {
  margin-top: 12px;
  color: var(--text);
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.16;
}
.section-head p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

/* Benefits -------------------------------------------------------------- */

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.benefit {
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.016), transparent 65%), var(--surface);
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}
.benefit:hover {
  transform: translateY(-3px);
  border-color: rgba(63, 191, 174, 0.28);
  background-color: #0e1721;
}
.benefit-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 18px;
  border: 1px solid rgba(63, 191, 174, 0.24);
  border-radius: 10px;
  background: var(--teal-wash);
  color: var(--teal);
}
.benefit-icon svg { width: 20px; height: 20px; }
.benefit h3 { color: var(--text); font-size: 14.5px; font-weight: 600; letter-spacing: -0.015em; }
.benefit p { margin-top: 8px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }

/* Three steps ----------------------------------------------------------- */

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.how-steps li {
  position: relative;
  padding: 0 22px;
  text-align: center;
}
.how-steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 23px;
  left: calc(50% + 31px);
  width: calc(100% - 62px);
  height: 1px;
  background: linear-gradient(90deg, rgba(63, 191, 174, 0.4), rgba(63, 191, 174, 0.08));
}
.step-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border: 1px solid rgba(63, 191, 174, 0.32);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 7px var(--bg);
  color: var(--teal);
  font-family: var(--num);
  font-size: 13px;
}
.how-steps h3 { color: var(--text); font-size: 14px; font-weight: 600; }
.how-steps p { max-width: 260px; margin: 7px auto 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* Details --------------------------------------------------------------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.detail {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 180ms ease;
}
.detail:hover { border-color: var(--line-strong); }
.detail[open] { border-color: rgba(63, 191, 174, 0.22); }
.detail summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  list-style: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  user-select: none;
}
.detail summary::-webkit-details-marker { display: none; }
.detail summary::after {
  content: "+";
  color: var(--teal);
  font-family: var(--num);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}
.detail[open] summary::after { content: "−"; }
.detail summary:hover { color: var(--teal-bright); }
.detail-body {
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.detail-body p + p { margin-top: 9px; }
.detail-body a { color: var(--teal); }
.detail-body a:hover { color: var(--teal-bright); }

/* Closing CTA ----------------------------------------------------------- */

.cta-section { padding: 104px 0 0; }
.cta-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 44px 48px;
  border: 1px solid rgba(63, 191, 174, 0.24);
  border-radius: 16px;
  background:
    radial-gradient(620px 300px at 12% 0%, rgba(63, 191, 174, 0.13), transparent 66%),
    var(--surface);
}
.cta-card h2 {
  color: var(--text);
  font-size: clamp(1.55rem, 2.8vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.cta-card p { max-width: 54ch; margin-top: 9px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.cta-card .btn { flex: 0 0 auto; }
.cta-risk { margin-top: 16px; color: var(--faint); font-size: 10.5px; line-height: 1.55; text-align: center; }

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

.site-footer { margin-top: 104px; border-top: 1px solid var(--line); background: var(--bg-deep); }
.footer-inner {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1.2fr;
  gap: 36px;
  padding-top: 46px;
  padding-bottom: 38px;
}
.footer-brand .wordmark { font-size: 16px; }
.footer-brand p { max-width: 34ch; margin-top: 11px; color: var(--faint); font-size: 11.5px; line-height: 1.65; }
.footer-col h4 {
  margin-bottom: 13px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.footer-col a { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11.5px; }
.footer-col a:hover { color: var(--teal); text-decoration: none; }
.footer-col p { color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.footer-bottom { border-top: 1px solid var(--line); }
.footer-bottom .home-shell { padding-top: 17px; padding-bottom: 22px; }
.footer-bottom p { max-width: 92ch; color: var(--faint); font-size: 10px; line-height: 1.65; }

/* Reveal on scroll (progressive enhancement, home.js) ------------------- */

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 600ms ease, transform 600ms ease; }
.reveal.in { opacity: 1; transform: none; }

/* Responsive ------------------------------------------------------------ */

@media (max-width: 1080px) {
  .benefit-grid { grid-template-columns: minmax(0, 1fr); }
  .benefit { padding: 22px 20px; }
  .footer-inner { grid-template-columns: 1.5fr 1fr 1fr; }
}

@media (max-width: 860px) {
  .preview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .cta-card { flex-direction: column; align-items: flex-start; padding: 32px 28px; }
}

@media (max-width: 780px) {
  body.marketing .topbar {
    height: auto;
    padding: 12px 18px;
    gap: 10px;
  }
  body.marketing .topnav { gap: 14px; }
  body.marketing .topnav a { font-size: 11px; }
  .home-shell { padding: 0 18px; }
  .hero { padding-top: 48px; }
  .hero-title { font-size: clamp(2.3rem, 10vw, 3.2rem); }
  .hero-sub { font-size: 14px; }
  .hero-preview-wrap { margin-top: 38px; }
  .preview-body { padding: 16px; }
  .preview-bar { padding: 0 12px; }
  .preview-head { gap: 10px; }
  .preview-metric { padding: 10px 11px; }
  .preview-metric strong { font-size: 21px; }
  .section { padding-top: 76px; }
  .section-head { margin-bottom: 30px; }
  .how-steps { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .how-steps li { padding: 0 0 0 68px; text-align: left; }
  .how-steps li:not(:last-child)::after {
    top: 52px;
    left: 23px;
    width: 1px;
    height: calc(100% + 30px - 52px);
    background: linear-gradient(180deg, rgba(63, 191, 174, 0.4), rgba(63, 191, 174, 0.08));
  }
  .step-dot { position: absolute; left: 0; top: 0; margin: 0; }
  .how-steps p { margin-left: 0; }
  .cta-section { padding-top: 76px; }
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding-top: 36px; }
  .site-footer { margin-top: 76px; }
}

@media (max-width: 560px) {
  .cta-risk { text-align: left; }
  .nav-secondary { display: none; }
  body.marketing .topbar { justify-content: space-between; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; }
  .preview-bar-label { display: none; }
  .preview-action { display: none; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .hero-title { font-size: 2rem; }
  .hero-badge { padding: 6px 11px; font-size: 9px; letter-spacing: 0.1em; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-badge .dot { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .benefit, .btn-lg.btn-primary-glow:hover { transform: none; }
}
