/* Drawings on the plain part of the page: the dashboard preview in a laptop
   and a phone, the three scenes of "How it works", and the mini Backtest
   (assets/js/backtest.js). All drawn here and in index.html, no images. */

.plain { background: var(--paper); }

/* ---------- dashboard preview ---------- */

.preview { background: var(--paper-2); padding-block: clamp(3rem, 8vw, 5.5rem) clamp(4rem, 9vw, 6.5rem); }
.preview-text { max-width: 40rem; }
.preview-text p { margin-top: 1rem; color: var(--graphite); }

.devices { position: relative; margin-top: clamp(2rem, 5vw, 3rem); }
.devices figcaption { margin-top: 1.25rem; color: var(--graphite); font-size: .9375rem; }

.laptop { width: min(100%, 50rem); }
.lid {
  container-type: inline-size;
  padding: 1.6% 1.6% 2.2%; border-radius: 1rem 1rem 0 0;
  background: #0C1324; box-shadow: inset 0 0 0 1px #2A3656;
}
.base {
  position: relative; height: .9rem; margin-inline: -3.5%;
  border-radius: 0 0 1rem 1rem; background: linear-gradient(#C7CFDA, #8C97A8);
}
.base::before {
  content: ""; position: absolute; left: 50%; top: 0; width: 14%; height: 40%;
  transform: translateX(-50%); border-radius: 0 0 .5rem .5rem; background: #7A8597;
}

.app {
  display: grid; grid-template-columns: 19% 1fr; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: 4px; background: var(--paper); color: var(--ink);
  font-size: 1.55cqi; line-height: 1.35;
}
.app-side { padding: 1.3em 1.1em; background: var(--paper-2); border-right: 1px solid var(--ruling); }
.app-brand { display: flex; align-items: center; gap: .45em; font-stretch: 125%; font-weight: 800; margin-bottom: 1.4em; }
.app-brand img { width: 1.3em; height: 1.3em; }
.app-group { margin-top: 1.1em; font-size: .85em; color: var(--graphite); }
.app-nav { padding: .35em .6em; margin-top: .25em; border-radius: .35em; }
.app-nav.is-on { background: var(--cobalt-tint); font-weight: 700; }
.app-main { display: grid; align-content: start; gap: 1.1em; padding: 1.3em 1.5em; }
.app-head { display: flex; align-items: center; gap: .9em; }
.app-title { font-stretch: 125%; font-weight: 800; font-size: 1.45em; }
.app-title span { font-stretch: 100%; font-weight: 400; font-size: .7em; color: var(--graphite); }
.pill {
  padding: .15em .7em; border-radius: 1em; font-size: .85em; font-weight: 700;
  background: var(--cobalt-tint); color: var(--ink);
}
.app-actions { display: flex; gap: .5em; margin-left: auto; }
.app-btn { padding: .3em .9em; border: 1.5px solid var(--ink); border-radius: .35em; font-weight: 700; font-size: .9em; }
.app-stop { background: var(--ink); color: var(--paper); }
.app-cols { display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.2em; align-items: start; }

.ladder { width: 100%; height: auto; font-family: var(--font); }
.lad-levels path { stroke: var(--ruling-strong); stroke-dasharray: 4 4; }
.lad-prices text { font-size: 11px; fill: var(--graphite); text-anchor: end; font-variant-numeric: tabular-nums; }
.ladder rect { fill: var(--paper); stroke-width: 1.5; }
.lad-sell rect { stroke: var(--amber); }
.lad-buy rect { stroke: var(--cobalt); }
.lad-sell text, .lad-buy text, .lad-filled, .lad-nowtext { font-size: 11px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.lad-filled { fill: var(--graphite); font-weight: 500; }
.lad-now { stroke: var(--ink); stroke-width: 1.5; }
.lad-dot { fill: var(--ink); }

.app-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .8em 1em; }
.app-stats dt { font-size: .85em; color: var(--graphite); }
.app-stats dd { font-weight: 700; font-size: 1.15em; font-variant-numeric: tabular-nums; }
.app-log { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.app-log th { text-align: left; font-weight: 600; font-size: .85em; color: var(--graphite); padding-bottom: .3em; }
.app-log td { padding: .35em 0; border-top: 1px solid var(--ruling); }
.app-log .is-buy::before, .app-log .is-sell::before {
  content: ""; display: inline-block; width: .6em; height: .6em; margin-right: .4em; border-radius: 50%;
}
.app-log .is-buy::before { background: var(--cobalt); }
.app-log .is-sell::before { box-shadow: inset 0 0 0 .14em var(--amber); }

.phone {
  width: 15rem; padding: .6rem; border-radius: 2.2rem;
  background: #0C1324; box-shadow: inset 0 0 0 1px #2A3656, 0 1.5rem 3rem -1.5rem rgba(12, 19, 36, .55);
}
.phone-screen {
  display: flex; flex-direction: column; gap: .55rem; min-height: 27rem; padding: 1rem .75rem .9rem;
  border-radius: 1.7rem; background: var(--paper); color: var(--ink); font-size: .8125rem; line-height: 1.35;
}
.phone-top { display: flex; justify-content: space-between; padding: 0 .3rem .4rem; font-weight: 800; font-stretch: 125%; }
.phone-top span + span { font-stretch: 100%; font-weight: 500; color: var(--graphite); }
.note {
  display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: start;
  padding: .65rem .7rem; border-radius: .9rem; background: var(--paper-2);
}
.note .key { font-size: 1.35rem; margin: .2rem 0 0; }
.note b { display: block; }
.note time { color: var(--graphite); font-size: .75rem; }
.note-warn { box-shadow: inset 3px 0 0 var(--ink); }
.phone-bot { margin-top: auto; padding: .7rem; border: 1.5px solid var(--ruling-strong); border-radius: .9rem; }
.phone-bot .app-actions { margin: .6rem 0 0; }
.phone-bot .app-btn { flex: 1; text-align: center; font-size: .8125rem; }

/* phones: the phone alone; tablets: laptop, then the phone under it;
   wide screens: the phone stands in front of the laptop's right edge */
@media (max-width: 759px) {
  .laptop { display: none; }
  .devices figcaption { text-align: center; }
}
.phone { margin: 2rem auto 0; }
@media (min-width: 1100px) {
  .laptop { width: min(100% - 8rem, 50rem); }
  .devices { padding-bottom: 1rem; }
  .phone { position: absolute; left: calc(min(100% - 8rem, 50rem) - 3.5rem); bottom: -1.5rem; width: 13.5rem; margin: 0; }
  .phone-screen { min-height: 25rem; }
}

/* ---------- how it works: three drawings, stepping up a level each ---------- */

.stairs { counter-reset: step; display: grid; gap: 2.75rem; }
/* the step number sits under its drawing, next to the title */
.stairs li { display: flex; flex-direction: column; counter-increment: step; }
.stairs li::before {
  content: counter(step); order: 1; margin-bottom: .35rem;
  font-stretch: 125%; font-weight: 800; font-size: 2.25rem; line-height: 1; color: var(--cobalt);
}
.stairs h3 { order: 2; }
.stairs p { order: 3; }
.stairs p { margin-top: .5rem; color: var(--graphite); }
.scene {
  width: 100%; height: auto; margin-bottom: 1rem;
  background: var(--paper-2); border-top: 4px solid var(--ink);
  font-family: var(--font);
}
@media (min-width: 760px) {
  .stairs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; align-items: start; }
  .stairs li:nth-child(1) { margin-top: 4.5rem; }
  .stairs li:nth-child(2) { margin-top: 2.25rem; }
}

.sc-card, .sc-server { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.sc-rule, .sc-slot { stroke: var(--ruling-strong); stroke-width: 1.5; fill: none; }
.sc-slot { stroke-width: 4; stroke-linecap: round; }
.sc-dot { fill: var(--ruling-strong); }
.sc-text { font-size: 14px; font-weight: 700; fill: var(--ink); }
.sc-small, .sc-val { font-size: 12.5px; font-weight: 600; fill: var(--graphite); }
.sc-val { text-anchor: end; font-variant-numeric: tabular-nums; }
.sc-mid { text-anchor: middle; font-size: 11.5px; }
.sc-field { fill: var(--paper-2); stroke: var(--ruling-strong); stroke-width: 1.5; }
.sc-go { fill: var(--ink); }
.sc-shackle { fill: none; stroke: var(--ink); stroke-width: 4.5; }
.sc-lock { fill: var(--cobalt); stroke: var(--ink); stroke-width: 2; }
.sc-hole { fill: var(--paper); }
.sc-route, .sc-arc { fill: none; stroke: var(--graphite); stroke-width: 1.5; stroke-dasharray: 4 4; }
.sc-key circle, .sc-key path { fill: var(--amber-tint); stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.sc-dip { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.sc-bought { fill: var(--cobalt); stroke: var(--paper); stroke-width: 2; }
.sc-sold { fill: var(--paper); stroke: var(--amber); stroke-width: 3; }
.sc-wait { fill: var(--paper); stroke: var(--cobalt); stroke-width: 2.5; }
.sc-track, .sc-fill { stroke-width: 6; stroke-linecap: round; }
.sc-track { stroke: var(--ruling-strong); }
.sc-fill { stroke: var(--cobalt); }
.sc-knob { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.sc-level { stroke: var(--ruling-strong); stroke-width: 1.5; stroke-dasharray: 6 5; }
.sc-price { stroke: var(--ink); stroke-width: 2; }
.sc-now { fill: var(--ink); }
.sc-sun { fill: var(--amber-tint); stroke: var(--amber); stroke-width: 2.5; }
.sc-rays { stroke: var(--amber); stroke-width: 2.5; stroke-linecap: round; }
.sc-moon { fill: var(--cobalt-tint); stroke: var(--cobalt); stroke-width: 2; }
.sc-led { fill: var(--cobalt); }
.sc-led.l2 { fill: var(--amber); }
.sc-ground { stroke: var(--ink); stroke-width: 2.5; }
.sc-cycle { transform-box: view-box; transform-origin: 160px 140px; transform: rotate(-38deg); }

@media (prefers-reduced-motion: no-preference) {
  .is-running .sc-cycle { animation: day-night 24s linear infinite; }
  .is-running .sc-led { animation: blink 2.4s steps(2, jump-none) infinite; }
  .is-running .sc-led.l2 { animation-delay: .8s; }
  .is-running .sc-led.l3 { animation-delay: 1.6s; }
}
@keyframes day-night { from { transform: rotate(-38deg); } to { transform: rotate(322deg); } }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- mini Backtest ---------- */

.bt {
  display: grid; gap: 1.5rem; padding: clamp(1rem, 3vw, 1.75rem);
  border-top: 4px solid var(--ink); background: var(--paper-2);
}
.bt-controls { display: grid; gap: 1.25rem; align-content: start; }
.bt-stories legend { font-weight: 700; font-size: 1rem; margin-bottom: .4rem; }
.bt-stories label { display: flex; gap: .55rem; align-items: center; padding: .2rem 0; font-size: 1rem; cursor: pointer; }
.bt-chart { width: 100%; height: 16.5rem; background: var(--paper); }
.bt-results { display: grid; gap: 1.25rem; }
.bt-facts { display: grid; gap: .75rem 2rem; }
.bt-facts dt { font-size: .9375rem; color: var(--graphite); }
.bt-facts dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.bt-compare { display: grid; gap: 1rem; }
.bt-row { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; align-items: end; }
.bt-row .small { display: block; }
.bt-value { font-stretch: 125%; font-weight: 800; font-size: 1.75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.bt-bar {
  grid-column: 1 / -1; position: relative; height: .75rem;
  background: linear-gradient(var(--ink), var(--ink)) center / 2px 100% no-repeat,
              linear-gradient(var(--ruling-strong), var(--ruling-strong)) center / 100% 1px no-repeat;
}
.bt-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: calc(var(--size, 0) * 50%); background: var(--cobalt);
}
.bt-bar-hold::after { background: var(--graphite); }
.bt-bar.is-loss::after {
  left: auto; right: 50%;
  background: repeating-linear-gradient(135deg, var(--graphite) 0 3px, transparent 3px 6px);
  box-shadow: inset 0 0 0 1.5px var(--graphite);
}
.bt-note { font-weight: 600; }
@media (min-width: 640px) { .bt-facts { grid-template-columns: auto 1fr; } }
@media (min-width: 900px) {
  .bt { grid-template-columns: 14rem minmax(0, 1fr); }
  .bt-results, .bt > .small { grid-column: 2; }
}

.trials { display: grid; gap: 1.5rem 2.5rem; padding-top: 1rem; }
.trials p { margin-top: .5rem; color: var(--graphite); }
@media (min-width: 640px) { .trials { grid-template-columns: 1fr 1fr; } }
