/* ex2.css: the Exodus 2.0 design system (documented at /desk/styleguide/).
 *
 * Black, quiet and exact. A blue-black ground, one grotesk set light and large for figures, and
 * one blue that marks the thing to act on and the line of a chart, nothing else. Sections are not
 * cards: they are rows of a specification sheet, a hairline above, the label in a narrow column on
 * the left and the content on the right, with a lot of air between them. Depth comes from small
 * steps of lightness, never from shadows or glow.
 *
 * There are no inline styles anywhere (the CSP forbids them). Motion lives in static/js/motion.js
 * and charts.js and only plays for people who have not asked for less of it; nothing on a page
 * waits for an animation to be visible.
 *
 * Classes
 *   layout     .wrap .main .row .row--between .grid--2 .sheet (a short page) .solo (one centred form)
 *              .bento (two sections side by side) .section-gap .section-gap--small .section-gap-below
 *   masthead   .masthead .brand .brand__mark .wordmark .nav .header-side .header-side__who .skip
 *   footer     .site-footer .site-footer__rule .site-footer__small .site-footer__risk .site-footer__links
 *              .site-footer__legal
 *   sections   .part (a ruled row) .part--hero (the figure a page is about) .part--center .part__side
 *              .part__head .part__sub .part__note .part__main .part__main--split .part__chart
 *              .part__foot .part__link .fold (a section that opens)
 *   documents  .prose .prose--long (legal pages) .prose--columns .doc-head .doc-toc .doc-no .doc-table
 *              .warning
 *   type       .title .lede .small .muted .faint .nowrap .num .visually-hidden .page-head
 *              .page-head__meta .page-head__state .page-foot
 *   figures    .lead-figure .lead-figure__note .figure .figure--sm .gain .loss .flat .readings .reading
 *              .reading__label .reading__value .reading__note
 *   ledgers    .ledger .ledger__note .ledger__total .dl
 *   tables     .table .table--stack (stacked rows on phones; give cells data-label) .table--trades
 *              .table--list .table--log .table__empty .table__total .cell-text .table-scroll
 *   status     .state .state--copying .state--paused .state--warn .state--pending .state--failed .state--muted
 *   actions    .button .button--primary .button--quiet .button--danger .button--small .button--block
 *              .link-button .actions
 *   forms      .form .form--wide .field .field__label .field__help .field__error .check .form-errors
 *   notices    .notices .notice .notice--info .notice--warn .notice--error .notice--ok .notice--quiet .messages
 *   misc       .empty .pager .switch (segmented control; the current one has aria-current)
 *   calendar   .cal .cal__week (role=row) .cal__head .cal__wide .cal__narrow .cal__day .cal__day--weekend
 *              .cal__day--out .cal__day--today .cal__day--gain .cal__day--loss .cal__date .cal__pnl
 *              .cal__full .cal__compact .cal__trades .cal-nav
 *   chart      .chart .chart__svg .chart__grid .chart__axis .chart__area .chart__line .chart__base
 *              .chart__bar .chart__hover .chart__dot .chart__end .chart__tip .chart__fallback
 *   insights   .tiles .tile .ring .duel .bar .spark .legend
 *   landing    .front .front__text .front__title .front__lede .front__actions .front__note .front__visual
 *              .split .facts .reveal
 *   print      .no-print, and the @media print block at the end
 *
 * Legibility rules (checked by coe/tests/test_design.py so they cannot drift):
 *   - every colour that carries text is at least 4.5:1 on --ground and --card, and the tinted wells
 *     carry only colours that are 4.5:1 on them (WCAG AA); field borders are at least 3:1.
 *     --rule and --hair are decoration and stay quiet.
 *   - no text below 0.75rem (12px) outside print.
 *   - all motion stops under prefers-reduced-motion.
 */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/hanken-grotesk-latin-wght.c501f578bf3f.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  /* the ground and two steps of lightness above it */
  --ground: #06080b;
  --card: #0d1117;
  --card-2: #141a22;
  --field: #0a0e13;
  /* type, tinted to the ground's blue */
  --ink: #eaf0f7;
  --muted: #9ba7b6;
  --faint: #7d8899;
  /* hairlines: decoration, never text */
  --rule: #1f2731;
  --hair: #161c24;
  --rule-strong: #2c3644;
  --field-rule: #5d6a7b;
  /* the one colour: actions, the current place, focus, the chart line */
  --signal: #6aa9ff;
  --signal-hover: #8cbcff;
  --signal-ink: #051326;
  --signal-dim: #0c1a2e;
  --signal-ring: #1c3d6b;
  /* results and cautions, and the wells they tint */
  --gain: #45d39b;
  --loss: #ff7b84;
  --warn: #f0bf5f;
  --gain-dim: #0b2018;
  --loss-dim: #2a1015;
  --warn-dim: #261d0b;

  --sans: "Hanken Grotesk", "Segoe UI", Helvetica, Arial, sans-serif;

  --gutter: clamp(20px, 4vw, 48px);
  --max: 1200px;
  --side: 15rem;
  --r: 14px;
  --r-small: 10px;
  --gap: 24px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 160ms;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--ground); overflow-x: clip; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--ground);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: lining-nums;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

a { color: var(--signal); text-decoration: none; transition: color var(--fast) ease-out; }
a:hover { color: var(--signal-hover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, svg:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 4px;
}

img { max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--sans); font-weight: 400; line-height: 1.15; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }
strong { font-weight: 500; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.875em; color: var(--muted); }

.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 40; }

/* ------------------------------------------------------------------ layout */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.main { flex: 1; padding-top: 56px; padding-bottom: 96px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.row--between { justify-content: space-between; }
.grid--2 { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
.sheet { max-width: 34rem; margin: 10vh auto 0; }
.sheet > * + * { margin-top: 16px; }
.sheet > .title + * { margin-top: 20px; }
/* one form on its own: the title, a note and the fields in one narrow column */
.solo { max-width: 25rem; margin: 6vh auto 0; }
.solo > .title { margin-bottom: 32px; }
.solo .part { display: block; border-top: 0; padding: 0; }
.solo .part__side { margin-bottom: 24px; }
.solo .part__side > * + * { margin-top: 6px; }
.solo .button--primary { width: 100%; }
.section-gap { margin-top: 32px; }
.section-gap--small { margin-top: 14px; }
.section-gap-below { margin-bottom: 24px; }

/* two sections side by side on a wide screen, each with its label on top */
.bento { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--rule); }
.bento > .part { border-top: 0; display: block; }
.bento > .part + .part { border-top: 1px solid var(--rule); }
.bento > .part > .part__side { margin-bottom: 24px; }
.bento .dl { grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr); }
@media (min-width: 960px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 64px; }
  .bento--wide-first { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .bento > .part + .part { border-top: 0; }
  .bento > .part:only-child { grid-column: 1 / -1; }
  .prose.prose--columns { columns: 2; column-gap: 56px; max-width: none; }
  .prose--columns p { break-inside: avoid; }
}

/* ------------------------------------------------------------------ masthead */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px 40px;
  min-height: 64px;
  padding: 0 max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter)));
  background: var(--ground);
  border-bottom: 1px solid var(--hair);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand__mark { width: 26px; height: 26px; flex: none; color: var(--signal); }
.wordmark { font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.02em; white-space: nowrap; }
.nav { display: flex; align-self: stretch; gap: 28px; }
.nav a {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.875rem;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 transparent;
  transition: color var(--fast) ease-out, box-shadow var(--fast) ease-out;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--signal); }
.header-side { display: flex; align-items: center; gap: 20px; margin-left: auto; font-size: 0.875rem; white-space: nowrap; }
.header-side form { margin: 0; }
.header-side a:not(.button), .header-side .link-button { color: var(--muted); }
.header-side a:not(.button):hover, .header-side .link-button:hover { color: var(--ink); }
.header-side__who { color: var(--faint); }

/* ------------------------------------------------------------------ footer */
.site-footer { margin-top: auto; color: var(--faint); font-size: 0.8125rem; line-height: 1.55; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
.site-footer__rule {
  border-top: 1px solid var(--hair);
  padding: 32px 0 40px;
  display: grid;
  gap: 20px 64px;
  grid-template-columns: minmax(0, 1fr);
}
.site-footer__small p { margin: 0 0 0.5em; }
.site-footer__small { max-width: 72ch; }
.site-footer__links { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px 24px; }
@media (min-width: 960px) {
  .site-footer__rule { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ------------------------------------------------------------------ sections */
/* A ruled row: the label in a column of its own on the left, the content on the right */
.part {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px 48px;
  border-top: 1px solid var(--rule);
  padding: 40px 0;
}
.page-head + .part, .title + .part, .lede + .part { margin-top: 24px; }
.part__side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; min-width: 0; align-content: flex-start; }
.part__head { font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.012em; }
.part__sub { font-size: 0.9375rem; font-weight: 500; margin: 2.2em 0 0.8em; }
.part__note { flex-basis: 100%; font-size: 0.875rem; line-height: 1.5; color: var(--muted); margin: 0; }
.part__note p { margin: 0 0 0.5em; }
.part__note a + a { margin-left: 16px; }
.part__main { min-width: 0; }
.part__chart { margin-top: 32px; }
.part__foot { margin-top: 16px; }
.part__side .switch, .part__side .cal-nav, .part__side .part__link { margin-left: auto; }
@media (min-width: 960px) {
  .part { grid-template-columns: var(--side) minmax(0, 1fr); }
  .part > .part__side { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; }
  .part > .part__side .switch, .part > .part__side .cal-nav, .part > .part__side .part__link { margin-left: 0; }
  .part__main--split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); column-gap: 56px; align-items: end; }
}
/* in a pair, the label and its controls run along the top of each */
.bento > .part > .part__side { flex-direction: row; align-items: center; flex-wrap: wrap; }
.bento > .part > .part__side .switch, .bento > .part > .part__side .cal-nav, .bento > .part > .part__side .part__link { margin-left: auto; }
/* the figure a page is about: full width, label and controls along the top */
.part--hero { display: block; border-top: 0; padding-top: 8px; }
.part--hero > .part__side { flex-direction: row; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.part--hero > .part__side .switch { margin-left: auto; }
.part--hero .part__head { font-size: 0.9375rem; font-weight: 400; color: var(--muted); }
.part--center { text-align: center; }
.part--center .part__side { justify-content: center; }

/* ------------------------------------------------------------------ type */
.title { font-size: clamp(2rem, 4.6vw, 3rem); font-weight: 300; line-height: 1.08; letter-spacing: -0.035em; margin-bottom: 8px; }
.lede { font-size: 1.1875rem; line-height: 1.45; color: var(--muted); max-width: 52ch; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
/* read by screen readers, not shown */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.num, .figure, .lead-figure, .reading__value, .table td.num, .table th.num { font-variant-numeric: tabular-nums lining-nums; }

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 32px; margin-bottom: 32px; }
.page-head > div:first-child { min-width: 0; flex: 1 1 22rem; }
.page-head .title { margin-bottom: 0; }
.page-head__meta { font-size: 0.875rem; color: var(--muted); margin: 10px 0 0; }
.page-foot { font-size: 0.8125rem; color: var(--faint); margin: 24px 0 0; }

/* ------------------------------------------------------------------ figures */
.lead-figure {
  font-size: clamp(3.25rem, 9vw, 6rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.05em;
  margin: 0;
  white-space: nowrap;
}
.lead-figure__note { color: var(--muted); margin: 14px 0 0; font-size: 0.9375rem; }
.figure { font-size: 2.5rem; font-weight: 300; line-height: 1.1; letter-spacing: -0.04em; }
.figure--sm { font-size: 1.375rem; font-weight: 400; line-height: 1.25; letter-spacing: -0.02em; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.flat { color: var(--muted); }
/* a signed amount inside a sentence must not break after its sign; .small spans are the desk's
   problem sentences, which have to wrap or the member table is wider than a phone */
span:is(.gain, .loss, .flat):not(.small) { white-space: nowrap; }

/* a row of figures with their labels above them, divided by hairlines */
.readings { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); margin: 0; border-top: 1px solid var(--hair); }
.reading { padding: 16px 20px 0 0; min-width: 0; }
.reading + .reading { padding-left: 20px; border-left: 1px solid var(--hair); }
.reading__label { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.reading__value { margin: 4px 0 0; font-size: 1.25rem; font-weight: 400; letter-spacing: -0.02em; white-space: nowrap; }
.reading__note { margin: 2px 0 0; font-size: 0.8125rem; color: var(--faint); }

/* ------------------------------------------------------------------ ledgers */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.ledger tr { border-top: 1px solid var(--hair); }
.ledger tr:first-child { border-top: 0; }
.ledger th, .ledger td { padding: 12px 0; text-align: left; font-weight: 400; vertical-align: baseline; }
.ledger th { width: 34%; }
.bento .ledger th { width: auto; }
.ledger .ledger__note { color: var(--muted); font-size: 0.875rem; padding-left: 16px; }
.ledger .num { text-align: right; white-space: nowrap; padding-left: 16px; }
.ledger__total th, .ledger__total td { font-weight: 500; }
.ledger .ledger__total { border-top: 1px solid var(--rule-strong); }
@media (min-width: 960px) {
  .part__main--split .ledger, .part__main--split .ledger tbody { display: block; }
  .part__main--split .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 10px 0; }
  .part__main--split .ledger th, .part__main--split .ledger td { padding: 0; width: auto; }
  .part__main--split .ledger .num { grid-column: 2; grid-row: 1; padding-left: 0; }
  .part__main--split .ledger .ledger__note { grid-column: 1 / -1; grid-row: 2; padding-left: 0; }
}

.dl { display: grid; grid-template-columns: minmax(120px, 13rem) minmax(0, 1fr); margin: 0; }
.dl dt, .dl dd { padding: 12px 0; border-top: 1px solid var(--hair); }
.dl dt { padding-right: 16px; color: var(--muted); }
.dl dd { margin: 0; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.dl > :nth-child(-n+2) { border-top: 0; }

/* ------------------------------------------------------------------ tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums lining-nums; }
.table th { text-align: left; font-weight: 400; color: var(--muted); font-size: 0.8125rem; padding: 0 20px 10px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; vertical-align: bottom; }
.table td { padding: 14px 20px 14px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; white-space: nowrap; }
@media (min-width: 641px) {
  .table td.num + td:not(.num), .table th.num + th:not(.num) { padding-left: 32px; }
}
.table--trades th:last-child, .table--trades td:last-child { text-align: right; }
.table th a { color: inherit; }
.table td a { color: var(--ink); }
.table td a:hover { color: var(--signal-hover); }
.table__empty { color: var(--faint); padding: 12px 0; }
.table .table__total td { border-top: 1px solid var(--rule-strong); font-weight: 500; font-size: 1.0625rem; }
.table-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 14px 0; border-bottom: 1px solid var(--hair); }
  .table--stack tr:first-child { padding-top: 0; }
  .table--stack tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .table--stack td { border: 0; padding: 1px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; text-align: right; }
  .table--stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; text-align: left; }
  .table--stack td.num { text-align: right; }
  /* a sentence, or a form, in a stacked row: label above it, ranged left */
  .table--stack td.cell-text, .doc-table:not(.doc-table--figures).table--stack td { display: block; text-align: left; padding: 2px 0; }
  .table--stack td.cell-text::before, .doc-table:not(.doc-table--figures).table--stack td::before { display: block; }
  /* a trade is three lines: when and the result, what and its source, the size and prices */
  .table--trades tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
  .table--trades td { display: block; width: auto; text-align: left; }
  .table--trades td[data-label="Closed"], .table--trades td[data-label="Side"] { grid-column: 1 / 3; }
  .table--trades td[data-label="Closed"]::before, .table--trades td[data-label="Side"]::before,
  .table--trades td[data-label="Result"]::before, .table--trades td[data-label="Source"]::before { content: none; }
  .table--trades td[data-label="Result"] { grid-column: 3; grid-row: 1; text-align: right; font-weight: 500; }
  .table--trades td[data-label="Source"] { grid-column: 3; grid-row: 2; text-align: right; color: var(--muted); }
  .table--trades td[data-label="Lots"], .table--trades td[data-label="Open"], .table--trades td[data-label="Close"] { color: var(--muted); font-size: 0.8125rem; text-align: left; }
  .table--trades td[data-label="Lots"]::before, .table--trades td[data-label="Open"]::before, .table--trades td[data-label="Close"]::before { content: attr(data-label) " "; font-size: 0.75rem; color: var(--faint); }
  /* the rest are list rows too: the name and the key figure on one line, the detail under them */
  .table--stack td.cell-text[data-label=""] { display: none; }
  .table--list tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .table--list td, .table--list td.num { display: block; width: auto; text-align: left; padding: 0; }
  .table--list td:first-child { font-weight: 500; }
  .table--list td:first-child::before, .table--list td[data-label=""]::before, .table--list td[data-label="Result"]::before,
  .table--list td[data-label="Return"]::before, .table--list td[data-label="Status"]::before { content: none; }
  .table--list td[data-label=""], .table--list td[data-label="Result"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: 500; }
  .table--list td[data-label="Return"], .table--list td[data-label="Fee"] { grid-column: 2; grid-row: 2; text-align: right; }
  .table--list td[data-label="Status"] { grid-column: 1 / -1; }
  .table--list td[data-label="Opening equity"], .table--list td[data-label="Trades"], .table--list td[data-label="Copied"],
  .table--list td[data-label="Fee"] { color: var(--muted); font-size: 0.8125rem; }
  .table--list td[data-label="Opening equity"]::before, .table--list td[data-label="Trades"]::before, .table--list td[data-label="Copied"]::before,
  .table--list td[data-label="Fee"]::before { content: attr(data-label) " "; font-size: 0.75rem; color: var(--faint); }
  .table--list td[data-label=""] a { display: inline-block; padding: 8px 0 8px 12px; margin: -8px 0; }
  /* a history is a list of sentences: when, then what, with no labels */
  .table--log td, .table--log td.cell-text { display: block; width: auto; text-align: left; padding: 0; }
  .table--log td::before, .table--log td.cell-text::before { content: none; }
  .table--log td[data-label="When"], .table--log td[data-label="Event"], .table--log td[data-label="By"] { color: var(--muted); font-size: 0.8125rem; }
  .ledger, .ledger tbody { display: block; }
  .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 10px 0; }
  .ledger th, .ledger td { padding: 0; width: auto; }
  .ledger .num { grid-column: 2; grid-row: 1; padding-left: 0; }
  .ledger .ledger__note { grid-column: 1 / -1; grid-row: 2; padding-left: 0; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { padding-bottom: 0; }
  .dl dd { padding-top: 2px; border-top: 0; }
  .dl > :nth-child(2) { border-top: 0; }
  .dl > dt:not(:first-child) { border-top: 1px solid var(--hair); }
}

/* ------------------------------------------------------------------ status */
/* a word in its colour after a short signal bar */
.state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
}
.state::before { content: ""; width: 12px; height: 2px; border-radius: 1px; background: currentColor; flex: none; }
.state--copying { color: var(--gain); }
.state--paused, .state--warn { color: var(--warn); }
.state--pending { color: var(--signal); }
.state--failed { color: var(--loss); }
.state--muted { color: var(--muted); }
/* the account state, shown here only on phones, where the header drops it */
.page-head__state { display: none; }

/* ------------------------------------------------------------------ buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  padding: 0 20px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-small);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: background-color var(--fast) ease-out, border-color var(--fast) ease-out, color var(--fast) ease-out, transform 120ms ease-out;
}
.button:hover { background: var(--card-2); color: var(--ink); text-decoration: none; }
.button:active { transform: scale(0.98); }
.button--primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.button--primary:hover { background: var(--signal-hover); border-color: var(--signal-hover); color: var(--signal-ink); }
.button--quiet { border-color: transparent; color: var(--muted); padding-left: 12px; padding-right: 12px; }
.button--quiet:hover { background: transparent; color: var(--ink); }
.button--danger { color: var(--loss); }
.button--danger:hover { color: var(--loss); background: var(--loss-dim); border-color: var(--loss-dim); }
.button--small { min-height: 34px; font-size: 0.8125rem; padding: 0 14px; }
.button--block { display: flex; width: 100%; }
.button[disabled] { opacity: 0.55; cursor: not-allowed; }
.button[hidden] { display: none; }

.link-button { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; color: var(--ink); cursor: pointer; transition: color var(--fast) ease-out; }
.link-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.actions form { margin: 0; }

/* ------------------------------------------------------------------ forms */
.form { max-width: 28rem; }
.form--wide { max-width: 36rem; }
.field { margin-bottom: 20px; }
.field__label, .field > label { display: block; font-size: 0.8125rem; color: var(--muted); margin-bottom: 8px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  min-height: 48px;
  font: inherit;
  letter-spacing: inherit;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--field-rule);
  border-radius: var(--r-small);
  padding: 11px 14px;
  transition: border-color var(--fast) ease-out, box-shadow var(--fast) ease-out;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--signal); box-shadow: 0 0 0 3px var(--signal-ring); outline: none; }
/* Browser autofill painted the sign-in fields pale blue. The text and caret are set back to ours,
   and the browser's own fill is held off by a transition too slow ever to finish. */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  transition: background-color 9999s ease-out 0s;
  filter: none;
}
input::placeholder { color: var(--faint); }
.field__help { margin-top: 8px; font-size: 0.8125rem; line-height: 1.5; color: var(--faint); }
.field__help ul { margin: 2px 0 0; padding-left: 1.1em; }
.field__error, .errorlist { margin: 6px 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--loss); }
.field--invalid input, .field--invalid select { border-color: var(--loss); }
.check { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; line-height: 1.45; }
.check input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--signal); flex: none; }

/* ------------------------------------------------------------------ notices */
/* A tinted well, its tint the kind of notice. No border, no stripe, no icon. */
.notice { background: var(--card); border-radius: var(--r-small); padding: 14px 18px; margin: 0 0 10px; }
.notice--info { background: var(--signal-dim); }
.notice--ok { background: var(--gain-dim); }
.notice--warn { background: var(--warn-dim); }
.notice--error { background: var(--loss-dim); }
.notice--quiet { background: var(--card); color: var(--muted); font-size: 0.875rem; }
.notice strong { font-weight: 500; }
.notice a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.notice p { margin-bottom: 0.4em; }
.notice p:last-child { margin-bottom: 0; }
.notice summary { cursor: pointer; }
.notice[open] summary { margin-bottom: 0.4em; }
.notice .button { margin-top: 6px; }
.notices { margin-top: 32px; }
.notices:empty { display: none; }
.messages { list-style: none; margin: 0 0 24px; padding: 0; }
/* the risk warning: reading size, in ink */
.warning { line-height: 1.6; max-width: 68ch; }

/* ------------------------------------------------------------------ misc */
.empty { color: var(--muted); margin: 0; padding: 4px 0; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 20px; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums lining-nums; }
/* the segmented control: a hairline round the set, the current one lifted a step */
.switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; border: 1px solid var(--rule); font-size: 0.8125rem; }
.switch a { padding: 4px 11px; border-radius: 7px; color: var(--muted); transition: color var(--fast) ease-out, background-color var(--fast) ease-out; }
.switch a:hover { color: var(--ink); text-decoration: none; }
.switch a[aria-current="page"] { background: var(--card-2); color: var(--ink); }

/* ------------------------------------------------------------------ month P/L calendar */
.cal-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 16px; font-size: 0.875rem; }
.cal-nav a { color: var(--muted); }
.cal-nav a:hover { color: var(--ink); }
.cal-nav strong { font-weight: 500; }
.cal-nav a[aria-label="Previous month"]::before { content: "\2039\00a0"; }
.cal-nav a[aria-label="Next month"]::after { content: "\00a0\203a"; }
.cal {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 0.42fr));
  gap: 4px;
  font-variant-numeric: tabular-nums lining-nums;
}
.cal__week { display: contents; }
.cal__head { color: var(--faint); font-size: 0.75rem; padding: 0 8px 6px; }
.cal__narrow { display: none; }
.cal__day { min-height: 72px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; border-radius: 8px; background: var(--card); }
.cal__date { font-size: 0.75rem; color: var(--faint); }
.cal__pnl { font-size: 0.875rem; line-height: 1.25; margin-top: auto; text-align: right; overflow-wrap: normal; white-space: nowrap; }
.cal__compact { display: none; }
.cal__trades { font-size: 0.75rem; color: var(--muted); text-align: right; }
.cal__day--gain { background: var(--gain-dim); }
.cal__day--loss { background: var(--loss-dim); }
.cal__day--gain .cal__date, .cal__day--loss .cal__date { color: var(--muted); }
.cal__day--weekend { background: transparent; }
.cal__day--out { background: transparent; }
.cal__day--out .cal__date { visibility: hidden; }
.cal__day--today { box-shadow: inset 0 0 0 1px var(--signal); }
.cal__day--today .cal__date { color: var(--ink); }
@media (max-width: 640px) {
  .cal { gap: 2px; }
  .cal__day { min-height: 48px; padding: 4px 5px; border-radius: 6px; }
  .cal__pnl { font-size: 0.75rem; }
  .cal__full { display: none; }
  .cal__compact { display: inline; }
  .cal__head { padding: 0 3px 4px; }
  .cal__wide {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .cal__narrow { display: inline; }
  .cal__trades { display: none; }
}

/* ------------------------------------------------------------------ chart */
.chart { position: relative; }
.chart__svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart__grid { stroke: var(--hair); stroke-width: 1; shape-rendering: crispEdges; }
.chart__base { stroke: var(--rule-strong); stroke-width: 1; shape-rendering: crispEdges; }
.chart__axis { fill: var(--faint); font-family: var(--sans); font-size: 12px; font-variant-numeric: tabular-nums lining-nums; }
.chart__line { fill: none; stroke: var(--signal); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart__area { stroke: none; }
.chart__end { fill: var(--signal); stroke: var(--ground); stroke-width: 2; }
.chart__hover { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 3; }
.chart__dot { fill: var(--ground); stroke: var(--signal); stroke-width: 2; }
.chart__tip {
  position: absolute;
  top: 0;
  pointer-events: none;
  background: var(--card-2);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-small);
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
}
.chart__bar { transform-box: fill-box; }
.chart__bar--gain { fill: var(--gain); opacity: 0.6; }
.chart__bar--loss { fill: var(--loss); opacity: 0.6; }
.chart__line--quiet { stroke: var(--faint); stroke-width: 1.25; stroke-dasharray: 3 4; }
.chart__tip-line { display: block; }
.chart__tip[hidden] { display: none; }
.chart__tip strong { display: block; font-size: 0.9375rem; font-weight: 500; color: var(--ink); }
.chart__fallback { margin-top: 12px; }
.js .chart__fallback { display: none; }
.chart svg:focus { outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }

/* a section that opens: the working behind a page, out of the way until someone wants it */
.fold summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; list-style: none; grid-column: 1 / -1; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "+"; font-size: 1.25rem; font-weight: 300; line-height: 1; color: var(--muted); transition: transform 220ms var(--ease); }
.fold[open] summary::after { transform: rotate(45deg); }
.fold summary:hover::after { color: var(--ink); }
.fold { display: block; }
.fold .part__main { margin-top: 24px; }

/* ------------------------------------------------------------------ insights */
/* four readings of the month in a strip, divided by hairlines */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.tile { display: flex; flex-direction: column; min-width: 0; padding: 28px 24px 4px 0; }
.tile:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--hair); }
.tile__head { font-size: 0.8125rem; font-weight: 400; color: var(--muted); margin-bottom: 16px; }
.tile__note { font-size: 0.8125rem; line-height: 1.4; color: var(--faint); margin: auto 0 0; padding-top: 14px; }
.tile__figure { font-size: 2rem; font-weight: 300; line-height: 1.1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums lining-nums; margin: 0 0 12px; }
@media (min-width: 960px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tile + .tile { padding-left: 24px; border-left: 1px solid var(--hair); }
}

.ring { position: relative; width: 96px; height: 96px; }
.ring__svg { display: block; width: 100%; height: 100%; }
.ring__track { fill: none; stroke: var(--card-2); stroke-width: 6; }
.ring__value { fill: none; stroke: var(--signal); stroke-width: 6; stroke-linecap: round; }
.ring__figure { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 1.375rem; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums lining-nums; }

.duel__row { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; margin: 0 0 6px; font-variant-numeric: tabular-nums lining-nums; }
.duel__row span:first-child { color: var(--muted); }
.bar { display: block; margin: 0 0 14px; }
.bar__track { fill: var(--card-2); }
.bar__gain { fill: var(--gain); }
.bar__loss { fill: var(--loss); }
.bar__signal { fill: var(--signal); }
.bar--split { margin: 16px 0 0; }

.spark { display: block; width: 100%; height: 44px; }
.spark__area { fill: var(--loss-dim); stroke: var(--loss); stroke-width: 1.25; stroke-linejoin: round; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 20px; flex-basis: 100%; font-size: 0.875rem; margin: 0; }
.legend__you, .legend__master { display: inline-flex; align-items: center; gap: 8px; }
.legend__you::before, .legend__master::before { content: ""; width: 16px; height: 2px; border-radius: 1px; }
.legend__you::before { background: var(--signal); }
.legend__master::before { background: var(--faint); }

/* ------------------------------------------------------------------ landing */
.home .main { padding-top: 0; }
.front {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 48px 64px;
  min-height: min(760px, calc(100svh - 64px));
  padding: 72px 0 96px;
}
.front__title { font-size: clamp(2.75rem, 7.4vw, 5.5rem); font-weight: 300; line-height: 1.02; letter-spacing: -0.045em; max-width: 11ch; }
.front__lede { margin: 28px 0 0; font-size: clamp(1.0625rem, 1.6vw, 1.3125rem); line-height: 1.45; color: var(--muted); max-width: 34ch; }
.front__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 40px; }
.front__actions .button--primary { min-height: 52px; padding: 0 30px; font-size: 1rem; }
.front__note { margin: 20px 0 0; font-size: 0.875rem; color: var(--faint); }
.front__visual { display: grid; place-items: center; }
@media (min-width: 960px) {
  .front { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

/* the split: what is yours of the profit, as a ring */
.split { position: relative; width: min(100%, 340px); aspect-ratio: 1; }
.split__svg { display: block; width: 100%; height: 100%; }
.split__track { fill: none; stroke: var(--rule); stroke-width: 1.5; }
.split__value { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; }
.split__label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; margin: 0; }
.split__figure { display: block; font-size: clamp(3.5rem, 8vw, 5rem); font-weight: 300; line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums lining-nums; }
.split__word { display: block; margin-top: 10px; font-size: 0.9375rem; color: var(--muted); }

/* the facts a prospect needs, as a specification sheet */
.facts { padding: 96px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px 48px; }
.facts__head { font-size: clamp(1.75rem, 3.4vw, 2.5rem); font-weight: 300; letter-spacing: -0.035em; line-height: 1.1; }
.facts .dl { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); font-size: 1.0625rem; }
.facts .dl dt, .facts .dl dd { padding: 18px 0; }
.facts .warning { font-size: 1.0625rem; color: var(--muted); }
.facts .warning p:first-child { color: var(--ink); }
@media (min-width: 960px) {
  .facts { grid-template-columns: var(--side) minmax(0, 1fr); }
}

/* JS marks sections below the fold, then shows each as it scrolls in (motion.js) */
.reveal--pending { opacity: 0; }

/* on a phone the nav is a bar along the bottom edge, where a thumb is */
@media (max-width: 760px) {
  body:has(.nav) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .masthead { min-height: 56px; }
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    margin: 0;
    gap: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding: 0 4px env(safe-area-inset-bottom);
    background: var(--ground);
    border-top: 1px solid var(--rule);
  }
  .nav a { justify-content: center; text-align: center; min-height: 56px; padding: 4px 2px; font-size: 0.75rem; line-height: 1.15; white-space: normal; }
  .nav a[aria-current="page"] { box-shadow: inset 0 2px 0 var(--signal); }
  .header-side { gap: 16px; }
  .header-side .link-button, .header-side a:not(.button) { padding: 12px 0; }
  .cal-nav a { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .header-side .state, .header-side__who { display: none; }
  .page-head__state { display: inline-flex; }
}
@media (max-width: 640px) {
  .main { padding-top: 32px; padding-bottom: 64px; }
  .part { padding: 32px 0; }
  .lead-figure { font-size: clamp(2.75rem, 13vw, 3.5rem); }
  .tile { padding-top: 22px; padding-right: 12px; }
  .tile:nth-child(even) { padding-left: 16px; }
  .tiles .tile:nth-child(n+3) { border-top: 1px solid var(--hair); }
  .ring { width: 80px; height: 80px; }
  .readings { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .reading { padding-right: 10px; }
  .reading + .reading { padding-left: 10px; }
  .reading__value { font-size: 1.0625rem; }
  .reading__label, .reading__note { font-size: 0.75rem; }
  .form, .form--wide { max-width: none; }
  .front { padding: 40px 0 64px; min-height: 0; gap: 56px; }
  .split { width: min(100%, 260px); }
  .facts { padding: 64px 0; }
  .facts .dl { grid-template-columns: minmax(0, 1fr); font-size: 1rem; }
  .facts .dl dt, .facts .dl dd { padding: 14px 0 0; }
  .facts .dl dd { padding: 2px 0 14px; }
}

/* ------------------------------------------------------------------ prose */
/* .prose: short explanatory text. .prose--long: a document read top to bottom (the legal pages),
   its contents beside the text on a wide screen, numbered sections that can be linked to */
.prose { max-width: 66ch; }
.prose--long p, .prose--long li, .prose--long td { line-height: 1.65; }
.prose--long p { margin: 0 0 0.9em; }
.prose--long section { scroll-margin-top: 88px; }
.prose--long h2 { font-size: 1.1875rem; font-weight: 500; letter-spacing: -0.015em; margin: 2.4em 0 0.6em; }
.prose--long ul, .prose--long ol { margin: 0 0 1em; padding-left: 1.2em; }
.prose--long li + li { margin-top: 0.4em; }
.prose--long strong { font-weight: 500; }
.doc-head { margin-bottom: 32px; }
.doc-head .title { margin: 0 0 8px; }
.doc-no { color: var(--faint); margin-right: 0.4em; font-variant-numeric: lining-nums; }
.doc-toc { font-size: 0.875rem; line-height: 1.4; margin: 0 0 24px; color: var(--muted); }
.doc-toc ol { margin: 0; padding-left: 1.6em; }
.doc-toc li { margin: 0 0 8px; }
.doc-toc a { color: var(--muted); }
.doc-toc a:hover { color: var(--ink); }
.doc-table { margin: 6px 0 1.2em; }
.prose--long .doc-table td { line-height: 1.45; }
.doc-table--figures td:first-child { white-space: nowrap; }
@media (min-width: 960px) {
  .prose--long { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); column-gap: 48px; max-width: none; }
  .prose--long > * { grid-column: 2; max-width: 42rem; }
  .prose--long > .doc-head { grid-column: 1 / -1; max-width: none; }
  .prose--long > .doc-toc { grid-column: 1; grid-row: 2 / span 30; align-self: start; position: sticky; top: 96px; }
}

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal--pending { opacity: 1; }
}

/* ------------------------------------------------------------------ print (statements) */
@media print {
  :root {
    color-scheme: light;
    --ground: #fff; --card: #fff; --card-2: #fff; --field: #fff; --ink: #111; --muted: #444; --faint: #666;
    --rule: #111; --rule-strong: #111; --hair: #bbb; --signal: #111; --gain: #111; --loss: #8a1f17; --warn: #111;
    --gain-dim: #fff; --loss-dim: #fff; --warn-dim: #fff; --signal-dim: #fff;
  }
  /* statement-sized type: at 12pt a due statement with payee details ran onto a second A4 page */
  html { font-size: 12.5px; background: #fff; }
  body { font-size: 9.5pt; letter-spacing: 0; padding-bottom: 0; background: #fff; }
  .nav, .header-side, .no-print, .skip { display: none !important; }
  .masthead { position: static; min-height: 0; padding: 0 0 6px; border-bottom: 1px solid #111; }
  /* one mark per printed page (a statement carries its own), and of the footer only the line that
     says who issued it */
  .masthead .brand__mark, .site-footer__links, .site-footer__small > p:not(.site-footer__legal) { display: none !important; }
  .site-footer { padding: 8px 0 0; font-size: 9pt; color: #444; }
  .site-footer__rule { display: block; padding: 4px 0 0; }
  a { color: inherit; text-decoration: none; }
  .wrap { max-width: none; padding-left: 0; padding-right: 0; }
  .main { padding-top: 10px; padding-bottom: 10px; }
  .title, .lead-figure { color: #111; }
  .table .table__total td { border-bottom: 3px double #111; font-size: inherit; }
  @page { margin: 14mm 14mm 12mm; }
}
