/* ---------------------------------------------------------------------------
   Oddsy — documentation
   Same "instrument panel" idiom as oddsy.trade: graphite cards on near-black,
   28px radii, darker header strips split by a hairline, one signal red spent
   only on the primary action and live state. Dark by default, light under
   prefers-color-scheme: light. Tokens are shared verbatim with the landing
   page so the two sites read as one.
--------------------------------------------------------------------------- */

:root {
  /* surfaces, darkest to lightest */
  --bg: #0b0b0b;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #262626;
  --border: #232323;
  --border-strong: #343434;

  /* text */
  --text: #f4f4f4;
  --text-2: #a8a8a8;
  --text-3: #8a8a8a;

  /* signal red, lifted from the mark */
  --brand: #fb1424;
  --brand-2: #c9302f;
  --brand-soft: #ff6b6b;
  --brand-tint: #2a1012;
  --brand-ink: #ffffff;

  --up: #2fd27e;
  --up-tint: #0d2218;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;

  --shadow-card: 0 1px 0 0 rgb(255 255 255 / 0.035) inset,
    0 30px 60px -30px rgb(0 0 0 / 0.75);
  --shadow-brand: 0 10px 30px -12px rgb(232 65 66 / 0.55);

  --ember: radial-gradient(50% 38% at 50% -4%, rgb(232 65 66 / 0.14), transparent 72%),
    radial-gradient(120% 70% at 50% 0%, #161616, transparent 70%);
  --card-bg: linear-gradient(180deg, #171717 0%, #131313 100%);
  --head-bg: rgb(0 0 0 / 0.22);
  --hairline: rgb(255 255 255 / 0.06);

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

  --gutter: 16px;
  --header-h: 64px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfc;
    --surface: #ffffff;
    --surface-2: #f3f3f5;
    --surface-3: #e8e8ec;
    --border: #e3e3e8;
    --border-strong: #d2d2d9;

    --text: #121214;
    --text-2: #4e4e56;
    --text-3: #67676f;

    --brand-soft: #b32c2d;
    --brand-tint: #fdecec;

    --up: #108a52;
    --up-tint: #e6f6ee;

    --shadow-card: 0 1px 0 0 rgb(255 255 255 / 0.9) inset,
      0 18px 40px -28px rgb(16 16 20 / 0.35);
    --ember: radial-gradient(50% 38% at 50% -4%, rgb(232 65 66 / 0.09), transparent 72%),
      radial-gradient(120% 70% at 50% 0%, #f1f1f4, transparent 70%);
    --card-bg: linear-gradient(180deg, #ffffff 0%, #fcfcfd 100%);
    --head-bg: rgb(17 17 20 / 0.03);
    --hairline: rgb(17 17 20 / 0.07);
    color-scheme: light;
  }
}

/* --------------------------------------------------------------- base ---- */

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.015em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--ember);
  pointer-events: none;
  z-index: -1;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.15;
  text-wrap: balance;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  word-break: break-word;
}

::selection {
  background: var(--brand);
  color: var(--brand-ink);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 8px;
}

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

/* ------------------------------------------------------------ helpers ---- */

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.label {
  font-size: 12.5px;
  color: var(--text-3);
}

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--head-bg);
  border-bottom: 1px solid var(--border);
}

.icon-well {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}
.icon-well svg {
  width: 18px;
  height: 18px;
}

.card-body {
  padding: 20px 18px 22px;
}
.card-body > * + * {
  margin-top: 14px;
}
.card-body p {
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.6;
}

.panel {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: border-color 200ms ease;
}
.panel:hover {
  border-color: var(--hairline);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.tag-brand {
  background: var(--brand-tint);
  color: var(--brand-soft);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--brand);
  flex-shrink: 0;
}

/* ------------------------------------------------------------ buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease,
    border-color 180ms ease, box-shadow 220ms ease,
    transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  background: var(--brand-2);
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface-3);
}

.btn-lg {
  height: 50px;
  padding: 0 26px;
  font-size: 15.5px;
}
.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
}

/* ------------------------------------------------------------- header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.brand span {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
}
.brand .brand-sub {
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: -0.01em;
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--border-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* The mobile sidebar toggle. Hidden from the desktop layout, and from any
   browser without JS — the sidebar is simply always open there. */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
}
.nav-toggle svg {
  width: 16px;
  height: 16px;
}

/* ---------------------------------------------------------- docs shell --- */

.docs {
  display: block;
  padding-bottom: 24px;
}

@media (min-width: 1000px) {
  .docs {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
  }
}

/* --------------------------------------------------------------- aside --- */

.docs-nav {
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 1000px) {
  .docs-nav {
    position: sticky;
    top: var(--header-h);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 28px 0 40px;
    border-bottom: 0;
    scrollbar-width: thin;
  }
}

.docs-nav .nav-title {
  margin-bottom: 12px;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-list > li > a {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-2);
  transition: background-color 180ms ease, color 180ms ease;
}
.nav-list > li > a:hover {
  background: var(--surface-2);
  color: var(--text);
}
.nav-list > li > a .n {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}
.nav-list > li > a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 2px 0 0 0 var(--brand);
}
.nav-list > li > a[aria-current="page"] .n {
  color: var(--brand);
}

/* The anchors inside the current page. */
.nav-sub {
  display: grid;
  gap: 1px;
  margin: 4px 0 8px 11px;
  padding-left: 11px;
  border-left: 1px solid var(--border);
}
.nav-sub a {
  display: block;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-3);
  transition: color 180ms ease, background-color 180ms ease;
}
.nav-sub a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-sub a.is-active {
  color: var(--brand-soft);
}

.nav-aside-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.nav-aside-foot a {
  color: var(--text-3);
}
.nav-aside-foot a:hover {
  color: var(--text);
}

/* Mobile: the nav collapses behind the header toggle. Without JS the toggle
   never appears and `hidden` is never set, so the list stays in the page. */
@media (max-width: 999.98px) {
  .js .nav-toggle {
    display: inline-flex;
  }
  .js .docs-nav[hidden] {
    display: none;
  }
  .docs-nav {
    margin-bottom: 8px;
  }
}

/* -------------------------------------------------------------- article -- */

.docs-main {
  min-width: 0;
  padding: 32px 0 56px;
}

.page-head {
  max-width: 62ch;
  margin-bottom: 28px;
}
.page-head h1 {
  margin-top: 10px;
  font-size: clamp(1.9rem, 5.6vw, 2.6rem);
  letter-spacing: -0.045em;
}
.page-head .lede {
  margin-top: 14px;
  color: var(--text-2);
  font-size: clamp(1rem, 2.2vw, 1.0625rem);
  line-height: 1.6;
}

.doc-section {
  padding-top: 8px;
  margin-bottom: 44px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.doc-section > h2 {
  font-size: clamp(1.35rem, 3.6vw, 1.7rem);
  letter-spacing: -0.04em;
}
.doc-section > h2 + p,
.doc-section > p {
  margin-top: 14px;
  max-width: 68ch;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.65;
}
.doc-section > .card,
.doc-section > .split,
.doc-section > .bullets,
.doc-section > .spec,
.doc-section > .steps-wrap,
.doc-section > .note {
  margin-top: 20px;
}
.doc-section h3 {
  margin-top: 28px;
  font-size: 1.0625rem;
  letter-spacing: -0.03em;
}
.doc-section h3 + p {
  margin-top: 10px;
  max-width: 68ch;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.65;
}

.doc-section > h2 > a.anchor {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.6em;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 160ms ease;
}
.doc-section > h2:hover > a.anchor,
.doc-section > h2 > a.anchor:focus-visible {
  opacity: 1;
}

.split {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 860px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

.bullets {
  display: grid;
  gap: 10px;
}
.bullets li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.6;
}
.bullets svg {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  flex-shrink: 0;
  color: var(--brand);
}
.bullets strong {
  color: var(--text);
  font-weight: 500;
}

/* A definition grid: term on the left, the fact on the right. Used wherever a
   number has a name. */
.spec {
  display: grid;
  gap: 0;
  margin: 0;
}
.spec > div {
  display: grid;
  gap: 2px 18px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  grid-template-columns: 1fr;
}
.spec > div:first-child {
  border-top: 0;
}
.spec dt {
  font-size: 13.5px;
  color: var(--text-3);
}
.spec dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.55;
}
@media (min-width: 640px) {
  .spec > div {
    grid-template-columns: 220px minmax(0, 1fr);
    align-items: baseline;
  }
}

/* Numbered flow, as on the landing page. */
.steps {
  display: grid;
  gap: 10px;
  padding: 14px;
  grid-template-columns: 1fr;
}
.steps li {
  padding: 18px;
}
.steps .step-n {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}
.steps h3 {
  margin-top: 10px;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.steps p {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.6;
}
@media (min-width: 640px) {
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1240px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

.flow-note {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: var(--head-bg);
  font-size: 13px;
  color: var(--text-3);
}

/* A standalone caveat. The red rule is the only place it is spent here. */
.note {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}
.note strong {
  color: var(--text);
  font-weight: 500;
}

/* A plain data table that stays readable at phone width. */
.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
caption {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  color: var(--text-3);
  background: var(--head-bg);
  border-bottom: 1px solid var(--border);
}
th,
td {
  padding: 12px 16px;
  text-align: left;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}
thead th {
  border-top: 0;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-3);
}
tbody th {
  font-weight: 400;
  color: var(--text);
}
td {
  color: var(--text-2);
}

.facts {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin-top: 20px;
}
.facts > li {
  padding: 18px 20px;
}
.facts .figure {
  font-size: clamp(1.4rem, 4.2vw, 1.75rem);
  font-weight: 400;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.facts .label {
  margin-top: 6px;
}
@media (min-width: 640px) {
  .facts {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The "start here" grid on the index. */
.tiles {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 20px;
}
@media (min-width: 720px) {
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}
.tiles a.card {
  display: block;
  padding: 20px;
  transition: border-color 200ms ease, transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.tiles a.card:hover {
  border-color: var(--border-strong);
}
.tiles a.card .eyebrow {
  display: block;
}
.tiles a.card h3 {
  margin-top: 10px;
  font-size: 1.0625rem;
}
.tiles a.card p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}
.tiles a.card .go {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--brand-soft);
}
.tiles a.card .go svg {
  width: 15px;
  height: 15px;
}

/* Previous / next, at the foot of every page. */
.pager {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
@media (min-width: 640px) {
  .pager {
    grid-template-columns: 1fr 1fr;
  }
}
.pager a {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  transition: border-color 200ms ease;
}
.pager a:hover {
  border-color: var(--border-strong);
}
.pager a .label {
  display: block;
}
.pager a .t {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: -0.025em;
}
.pager .next {
  text-align: right;
}
.pager .next:only-child {
  grid-column: -2;
}

/* ------------------------------------------------------------- footer ---- */

.site-footer {
  padding: 8px 0 56px;
}
.site-footer .wrap > :first-child {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.footer-brand img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.footer-brand span {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-left: auto;
  font-size: 14px;
  color: var(--text-2);
}
.footer-links a:hover {
  color: var(--text);
}
.footer-note {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--text-3);
  max-width: 70ch;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
