/* The Payoff Curve — Greeks Lab
   Shares design tokens with the rest of the site. Do not fork colors. */

:root {
  --bg: #0a0e13;
  --surface: #10161e;
  --surface-hover: #141c26;
  --ink: #e8ecef;
  --muted: #8a94a6;
  --faint: #77839a; /* min color for text on --bg/--surface: ≥4.5:1 (WCAG AA) */
  --line: rgba(232, 236, 239, 0.09);
  --accent: #3fb68b;
  --accent-dim: rgba(63, 182, 139, 0.12);
  --red: #d97a7a;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; }

input, select, button {
  font-family: var(--sans);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  padding: 11px 14px;
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

button {
  background: var(--accent);
  color: #06130d;
  border: none;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #4cc79b; }

.payoff-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

.wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  padding: 56px 0 56px;
}

/* ---------- Top nav ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.backlink {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease;
}
.backlink:hover { color: var(--accent); }
.subnav { display: flex; gap: 18px; }
.subnav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  text-decoration: none;
  transition: color 0.18s ease;
}
.subnav a:hover, .subnav a[aria-current="page"] { color: var(--accent); }

/* ---------- Header ---------- */
header.tool-head { margin-bottom: 40px; }

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.08;
  margin-bottom: 12px;
}

.tagline { color: var(--muted); font-size: 15px; max-width: 62ch; }

.hero-rule {
  margin-top: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 56px, var(--line) 56px, var(--line) 100%);
  border: none;
}

/* ---------- Sections ---------- */
.section { margin-bottom: 44px; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head .idx {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.1em;
}
.section-head h2 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Cards ---------- */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px 24px;
  color: var(--ink);
}
.card + .card { margin-top: 12px; }

.card--primary {
  border-color: rgba(63, 182, 139, 0.35);
  background: linear-gradient(135deg, var(--accent-dim) 0%, var(--surface) 55%);
}

/* ---------- Fields ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field .hint { color: var(--faint); font-size: 11.5px; margin-top: 4px; }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------- Type toggle ---------- */
.side-toggle { display: flex; gap: 8px; max-width: 320px; }
.side-toggle button {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  padding: 11px 0;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.side-toggle button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ---------- Greek stat strip ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  min-width: 0;
}
.stat-k {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}
.stat-v {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
}
.stat-v.pos { color: var(--accent); }
.stat-v.neg { color: var(--red); }

.out-rate-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 10px;
}
.asof {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 12px;
}
.asof .dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: 1px;
}

/* ---------- Charts + explainers ---------- */
.chart-box { margin-top: 4px; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 10px;
}
.greek-explain {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 12px;
  max-width: 70ch;
}
.greek-explain strong { color: var(--ink); }

/* ---------- Footer ---------- */
footer {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.disclaimer {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 20px;
  max-width: 72ch;
}
.colophon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--faint);
  text-transform: uppercase;
}
.colophon a { color: var(--faint); text-decoration: none; }
.colophon a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .field-row { flex-wrap: wrap; }
  .field-row .field { flex: 1 1 45%; }
}
@media (max-width: 480px) {
  .wrap { padding-top: 40px; }
  .card { padding: 20px 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .side-toggle { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .backlink, .subnav a, .side-toggle button { transition: none; }
}
