/* Design tokens and components follow the PinTool MM site (pintoolx/market-making frontend). */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url("assets/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  --ink: #0e0f28;
  --accent: #2050f2;
  --pink: #f22085;
  --bg: #e4eaf2;
  --panel: #edf1f7;
  --line: #abb8ce;
  --muted: #4c5870;
  --field-border: #8997ad;
  --good: #1f7a4d;
  --bad: #d0263a;
  --font: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgb(32 80 242 / 0.2); }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { position: relative; min-height: 100dvh; display: flex; flex-direction: column; isolation: isolate; }

/* Brand contour lines, strongest at the edges and fading out behind the content. */
.page::before {
  content: "";
  position: fixed;
  inset: -3%;
  z-index: -1;
  pointer-events: none;
  background: url("assets/hero.svg") center / cover no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 50% 48%, rgb(0 0 0 / 0.35) 30%, #000 100%);
  mask-image: radial-gradient(ellipse 60% 55% at 50% 48%, rgb(0 0 0 / 0.35) 30%, #000 100%);
  animation: contourDrift 14s ease-in-out infinite alternate;
}
@keyframes contourDrift {
  from { transform: translate3d(-1.1%, -0.7%, 0) scale(1.01); }
  to { transform: translate3d(1.1%, 0.7%, 0) scale(1.045); }
}
@media (prefers-reduced-motion: reduce) {
  .page::before { animation: none; }
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 24px max(48px, calc((100% - 1184px) / 2));
}
.logo { display: inline-flex; }
.logo img { display: block; max-width: 100%; height: auto; }
.updated { font-size: 13px; font-weight: 600; color: var(--muted); }

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(1184px + 96px);
  margin: 0 auto;
  padding: 8px 48px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
.muted { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

.page-head { display: flex; flex-direction: column; gap: 12px; }
.page-head > .eyebrow { color: var(--accent); }
.page-head h1 { margin: 0; font-size: clamp(32px, 4vw, 44px); font-weight: 700; line-height: 1.08; letter-spacing: -0.03em; }
.page-head h1 span { display: block; color: var(--accent); }
.page-head p { margin: 4px 0 0; max-width: 62ch; color: var(--muted); }

.panel {
  min-width: 0;
  padding: 24px;
  border-radius: 16px;
  background: var(--panel);
  outline: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.panel h2 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.panel .muted { min-height: 1.6em; margin-bottom: 8px; }

.picker { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; min-width: 0; }
.field.grow { flex: 3 1 320px; }
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.4 var(--font);
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.stat {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--panel);
  outline: 2px solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  min-width: 0;
}
.stat .value { font-size: 20px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat.accent { background: var(--accent); color: #eef3fb; }
.stat.accent .eyebrow { color: #cbd8ff; }

.chip {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #65738a;
  border-radius: 999px;
  background: #d9e2ee;
  font-size: 12px;
  font-weight: 600;
}

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.wide { grid-column: 1 / -1; }
.chart { position: relative; height: 260px; }
.chart.tall { height: 380px; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.ok { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }

/* Same footer as the PinTool MM site: the divider spans only the content column. */
.footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: 20px max(48px, calc((100% - 1184px) / 2));
  font: 500 13px/1.4 var(--font);
  color: var(--ink);
}
.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: max(48px, calc((100% - 1184px) / 2));
  right: max(48px, calc((100% - 1184px) / 2));
  border-top: 1px solid var(--line);
}
.copyright { margin: 0; }
.links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; }
.links a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.links a:hover { color: var(--accent); }
.social { display: inline-flex; }
.social svg { width: 16px; height: 16px; fill: currentColor; }

@media (max-width: 900px) {
  .header, .footer { padding-inline: 16px; }
  .footer::before { left: 16px; right: 16px; }
  main { padding-inline: 16px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .header { padding-block: 16px; }
  .logo img { width: 135px; }
  .panel { padding: 16px; }
  .panel h2 { font-size: 18px; }
  .chart.tall { height: 440px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat .value { font-size: 16px; }
}

.backtest-form { display: flex; flex-wrap: wrap; gap: 16px; margin: 8px 0 16px; }
.backtest-form .field { flex: 0 1 240px; }
#backtest-result { margin-bottom: 16px; }
.stat.positive .value { color: var(--good); }
.stat.negative .value { color: var(--bad); }
.bad-text { color: var(--bad); }

.view { display: flex; flex-direction: column; gap: 24px; }

/* Segmented control, as the role tabs in the PinTool MM header. */
.segmented { display: inline-flex; align-self: flex-start; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 0 var(--ink); }
.segmented a, .segmented button { padding: 6px 14px; border: 0; background: var(--bg); color: var(--ink); font: 600 14px/1.2 var(--font); white-space: nowrap; text-decoration: none; cursor: pointer; }
.segmented > * + * { border-left: 2px solid var(--ink); }
.segmented a:not([aria-current="page"]):hover, .segmented button:not([aria-pressed="true"]):hover { background: #edf1f7; }
.segmented [aria-current="page"], .segmented [aria-pressed="true"] { background: var(--accent); color: #eef3fb; }
.segmented.range a, .segmented.range button { padding: 3px 10px; font-size: 13px; }
/* View switch in the header, as the role tabs in the PinTool MM header. */
.header .tabs { align-self: center; }
@media (max-width: 560px) {
  .header { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .header .tabs { width: 100%; gap: 8px; overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
  .header .tabs a { flex: 1; min-height: 40px; display: grid; place-items: center; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 8px; box-shadow: 0 2px 0 var(--ink); text-align: center; }
  .header .tabs > * + * { border-left: 2px solid var(--ink); }
}

.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

/* Primary button, as in the PinTool MM site. */
.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 18px; border: 0; border-radius: 8px; outline: 2px solid var(--ink);
  background: var(--accent); color: #fff; font: 600 16px/1.2 var(--font); cursor: pointer;
  filter: drop-shadow(0 2px 0 var(--ink)); transition: transform 80ms ease-out, filter 80ms ease-out;
}
.primary:hover { transform: translateY(-2px); filter: drop-shadow(0 4px 0 var(--ink)); }
.primary:active { transition-duration: 0ms; transform: translateY(1px); filter: drop-shadow(0 1px 0 var(--ink)); }

.backtest-cta { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.backtest-cta > div { display: flex; flex-direction: column; gap: 6px; flex: 1 1 320px; }
.backtest-cta .muted { min-height: 0; margin: 0; }

.steps { margin: 8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 15px; }
.steps strong { color: var(--ink); }

[hidden] { display: none !important; }
