/* Trader in a Box landing page.
   Layout: chart-paper page; a short hero with two actions, then a scroll story where five
   plain-language steps (left) drive one sticky app window (right); the Conductor gets its own section.
   Fonts are self-hosted from ./fonts (SIL Open Font License 1.1, licence files alongside). */

/* ---- fonts (latin subset; other scripts fall back to the system font) ---- */
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/atkinson-hyperlegible-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 500 800;
  font-stretch: 100%;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/spline-sans-mono-var-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #f1f4f8;
  --desk: #dde3ec;
  --ink: #131a26;
  --ink-soft: #4b5668;
  --rule: #cfd7e3;
  --accent: #c27d0e;
  --accent-ink: #8a5806;
  /* Trader in a Box's own colour: its name, wherever it appears in text, and nothing else in text */
  --brand: #8f5a05;

  /* the app's own colours (webapp/static/theme.css): the mock is the real dark UI in both themes */
  --app-bg: #0f1115;
  --app-surface: #171a21;
  --app-border: #2a2e37;
  --app-text: #e8eaed;
  --app-text2: #9aa1ac;
  --app-up: #3fb950;
  --app-down: #f85149;
  --app-order: #d29922;
  --app-agent: #a371f7;
  --app-detector: #58a6ff;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --f-mono: "Spline Sans Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.88rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.7rem, 1.4rem + 1.4vw, 2.5rem);
  --step-4: clamp(2.6rem, 1.7rem + 4.2vw, 5.2rem);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c111a; --desk: #161e2b; --ink: #e6ebf3; --ink-soft: #9ba7b9; --rule: #253043;
    --accent: #e3a83a; --accent-ink: #f0bd5a; --brand: #f2c063; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0c111a; --desk: #161e2b; --ink: #e6ebf3; --ink-soft: #9ba7b9; --rule: #253043;
  --accent: #e3a83a; --accent-ink: #f0bd5a; --brand: #f2c063; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--step-0);
  line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background-image:
    linear-gradient(color-mix(in srgb, var(--rule) 45%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--rule) 45%, transparent) 1px, transparent 1px);
  background-size: 100% 48px, 48px 100%;
}
img { max-width: 100%; }
[hidden]:not([hidden="until-found" i]) { display: none !important; }
.wrap { max-width: 1120px; margin-inline: auto; }
a { color: var(--ink); text-underline-offset: 3px; }
.tib { color: var(--brand); font-family: var(--f-display); font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* SVG colours as classes, not style attributes, so the CSP needs no 'unsafe-inline' */
.f-ink { fill: var(--ink); }
.f-ink-soft { fill: var(--ink-soft); }
.f-paper { fill: var(--paper); }
.f-desk { fill: var(--desk); }
.f-accent { fill: var(--accent); }
.s-ink { stroke: var(--ink); }
.s-paper { stroke: var(--paper); }
.s-rule { stroke: var(--rule); }
.s-accent { stroke: var(--accent); }
.s-detector { stroke: var(--app-detector); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 0.7em 1.25em; border-radius: 999px;
  font: 700 var(--step-0) / 1 var(--f-body); text-decoration: none; border: 1.5px solid var(--ink);
}
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.line { color: var(--ink); background: transparent; }
.btn.solid:hover { background: color-mix(in srgb, var(--ink) 85%, var(--accent)); }
.btn.line:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }

/* ---- header ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 18px; border-bottom: 1px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--brand); text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.top .btn { font-size: var(--step--1); padding: 0.55em 1em; }

/* ---- hero ---- */
.hero { padding-block: clamp(44px, 8vw, 104px) clamp(36px, 5vw, 64px); display: grid; gap: 26px; }
.eyebrow { font-family: var(--f-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); }
h1 { font-family: var(--f-display); font-weight: 800; font-size: var(--step-4); line-height: 0.98; letter-spacing: -0.035em; margin: 0; max-width: 13ch; text-wrap: balance; }
h1 em { font-style: normal; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.07em; text-underline-offset: 0.1em; }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); max-width: 36ch; margin: 0; text-wrap: pretty; }
.lede strong { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.promises { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 6px 0 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: var(--step--1); }
.promises li { display: flex; align-items: center; gap: 8px; }
.promises li::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); flex: none; }

h2 { font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); line-height: 1.08; letter-spacing: -0.025em; margin: 0; text-wrap: balance; }

/* ---- scroll demo ---- */
.demo-intro { padding-block: 36px 0; border-top: 1px solid var(--rule); display: grid; gap: 8px; }
.demo { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(24px, 4vw, 56px); align-items: start; padding-bottom: 10vh; }
.steps { display: grid; padding-block: 16vh 28vh; }
.step { min-height: 58vh; display: grid; align-content: center; gap: 10px; padding-left: 20px; border-left: 2px solid var(--rule); transition: border-color 0.3s, opacity 0.3s; opacity: 0.5; }
.step[aria-current="step"] { border-left-color: var(--accent); opacity: 1; }
.step h3 { font-family: var(--f-display); font-weight: 700; font-size: var(--step-2); line-height: 1.08; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
.step p { margin: 0; max-width: 34ch; color: var(--ink-soft); font-size: var(--step-1); line-height: 1.45; text-wrap: pretty; }

.stage-col { position: sticky; top: max(24px, calc(50vh - 250px)); display: grid; gap: 10px; }
.stage { container-type: inline-size; position: relative; aspect-ratio: 4 / 3.15; width: 100%; max-width: 100%; background: var(--desk); border-radius: 16px; overflow: hidden; border: 1px solid var(--rule); }
.stage-cap { font-size: var(--step--1); color: var(--ink-soft); }

/* app windows */
.win {
  position: absolute; display: flex; flex-direction: column;
  background: var(--app-bg); color: var(--app-text);
  border: 1px solid var(--app-border); border-radius: 10px; overflow: hidden;
  box-shadow: 0 12px 32px -14px rgb(5 8 14 / 0.6);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(9px, 2.1cqi, 13.5px); line-height: 1.4;
  transition: left 0.6s cubic-bezier(.2,.7,.2,1), top 0.6s cubic-bezier(.2,.7,.2,1), width 0.6s cubic-bezier(.2,.7,.2,1), height 0.6s cubic-bezier(.2,.7,.2,1), opacity 0.4s, filter 0.4s;
}
.win-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0.55em 0.9em; background: var(--app-surface); border-bottom: 1px solid var(--app-border); white-space: nowrap; }
.win-head b { font-weight: 600; letter-spacing: 0.02em; }
.chip { font-size: 0.85em; padding: 0.1em 0.65em; border-radius: 99px; border: 1px solid var(--app-border); color: var(--app-text2); }
.chip.wait { color: var(--app-detector); border-color: color-mix(in srgb, var(--app-detector) 50%, transparent); }
.chip.auto { color: var(--app-order); border-color: color-mix(in srgb, var(--app-order) 60%, transparent); }
.win-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.win-body svg { display: block; width: 100%; flex: 1; min-height: 0; }
.msgs { padding: 0.7em 0.9em 0.9em; border-top: 1px solid var(--app-border); }
.msg { margin: 0; padding: 0.45em 0.75em; border-radius: 8px; background: var(--app-surface); }
.msg .who { display: block; font-size: 0.82em; color: var(--app-agent); }

.say { display: none; }
.stage[data-step="1"] .say-1, .stage[data-step="2"] .say-2, .stage[data-step="3"] .say-3,
.stage[data-step="4"] .say-3, .stage[data-step="5"] .say-3 { display: block; }

/* window placement per step: a cascade (1, 5), EURUSD close up (2, 3), GBPJPY close up (4) */
.w-jpy { left: 3%; top: 4%; width: 54%; height: 50%; z-index: 1; }
.w-gbp { left: 21%; top: 14%; width: 56%; height: 56%; z-index: 2; }
.w-eur { left: 39%; top: 27%; width: 58%; height: 69%; z-index: 3; }
.stage[data-step="2"] .w-eur, .stage[data-step="3"] .w-eur { left: 3%; top: 4%; width: 94%; height: 92%; }
.stage[data-step="2"] .w-gbp, .stage[data-step="2"] .w-jpy,
.stage[data-step="3"] .w-gbp, .stage[data-step="3"] .w-jpy { opacity: 0; }
.stage[data-step="4"] .w-gbp { left: 3%; top: 4%; width: 94%; height: 92%; z-index: 4; }
.stage[data-step="4"] .w-eur, .stage[data-step="4"] .w-jpy { opacity: 0; }
.stage[data-step="5"] .win { filter: saturate(0.6) brightness(0.75); }

/* EURUSD chart layers and header chips */
.layer { opacity: 0; transition: opacity 0.45s; }
.stage[data-step="2"] .l-wait, .stage[data-step="3"] .l-fill, .stage[data-step="3"] .l-order { opacity: 1; }
.st { display: none; }
.stage[data-step="1"] .st-1, .stage[data-step="2"] .st-2, .stage[data-step="3"] .st-3,
.stage[data-step="4"] .st-1, .stage[data-step="5"] .st-5 { display: inline-block; }

/* trade card */
.card {
  position: absolute; right: 3%; top: 7%; width: min(56%, 19em);
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px;
  padding: 0.9em 1em; display: grid; gap: 0.6em; box-shadow: 0 16px 40px -16px rgb(0 0 0 / 0.8);
  opacity: 0; transform: translateY(12px); transition: opacity 0.45s, transform 0.45s;
}
.stage[data-step="3"] .card { opacity: 1; transform: none; }
.card h4 { margin: 0; font-size: 1.15em; font-weight: 600; }
.card h4 span { color: var(--app-up); }
.card .why { margin: 0; color: var(--app-text2); }
.card .facts { display: flex; flex-wrap: wrap; gap: 0.35em; }
.card .facts span { border: 1px solid var(--app-border); border-radius: 6px; padding: 0.05em 0.55em; }
.card .btns { display: flex; gap: 0.5em; }
.card .b { font: inherit; padding: 0.4em 1.1em; border-radius: 7px; border: 1px solid var(--app-border); background: transparent; color: var(--app-text); }
.card .b.go { background: #238636; border-color: #2ea043; color: #fff; position: relative; }
.stage[data-step="3"] .card .b.go::after { content: ""; position: absolute; inset: -4px; border-radius: 10px; border: 2px solid var(--app-up); animation: ping 1.6s ease-out infinite; }
@keyframes ping { from { opacity: 0.9; transform: scale(0.96); } to { opacity: 0; transform: scale(1.12); } }

/* AUTO bar (GBPJPY) */
.autobar { display: none; gap: 0.45em; padding: 0.8em 0.9em; border-top: 1px solid var(--app-border); background: #1a1712; }
.stage[data-step="4"] .autobar { display: grid; }
.stage[data-step="4"] .w-gbp .msgs { display: none; }
.autobar .line b { color: var(--app-order); font-weight: 600; margin-right: 0.4em; }
.autobar .limits { display: flex; flex-wrap: wrap; gap: 0.35em; }
.autobar .limits span { border: 1px solid var(--app-border); border-radius: 6px; padding: 0.05em 0.55em; }

/* the Conductor's panel */
.conductor {
  position: absolute; right: 4%; top: 6%; bottom: 6%; width: min(66%, 26em); z-index: 6;
  background: var(--app-bg); color: var(--app-text); border: 1px solid color-mix(in srgb, var(--app-order) 55%, var(--app-border));
  border-radius: 12px; box-shadow: 0 20px 48px -18px rgb(0 0 0 / 0.85);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: clamp(9px, 2.1cqi, 13.5px); line-height: 1.4;
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateX(16px); transition: opacity 0.5s, transform 0.5s; pointer-events: none;
}
.stage[data-step="5"] .conductor { opacity: 1; transform: none; }
.conductor .win-head b { color: var(--app-order); }
.conductor ul { list-style: none; margin: 0; padding: 0.4em 0.9em; display: grid; }
.conductor li { display: flex; align-items: center; gap: 0.6em; padding: 0.45em 0; border-bottom: 1px solid var(--app-border); }
.conductor li:last-child { border-bottom: 0; }
.conductor li b { font-weight: 600; min-width: 4.6em; }
.conductor li span { color: var(--app-text2); }
.dot { width: 0.6em; height: 0.6em; border-radius: 50%; flex: none; background: var(--app-text2); }
.dot.watch { background: var(--app-detector); }
.dot.trade { background: var(--app-up); }
.dot.rest { background: var(--app-order); }
.report { margin: auto 0.9em 0.9em; padding: 0.6em 0.75em; border-radius: 8px; background: var(--app-surface); }
.report .who { display: block; font-size: 0.82em; color: var(--app-order); }

/* ---- the Conductor section ---- */
.conductor-sec { padding-block: 64px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px clamp(28px, 5vw, 72px); align-items: center; }
.conductor-sec .tag { display: inline-block; font-family: var(--f-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink); border: 1px solid var(--ink-soft); border-radius: 99px; padding: 0.15em 0.8em; justify-self: start; }
.conductor-sec .copy { display: grid; gap: 18px; }
.conductor-sec .copy > p { margin: 0; font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); max-width: 34ch; }
.does { margin: 0; display: grid; gap: 16px; }
.does div { display: grid; gap: 2px; padding-left: 16px; border-left: 2px solid var(--accent); }
.does dt { font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); line-height: 1.2; }
.does dd { margin: 0; color: var(--ink-soft); }
.hub { width: 100%; max-width: 520px; justify-self: center; display: block; }
.hub text { font-family: var(--f-mono); }

/* ---- assurance ---- */
.trust { padding-block: 64px; border-top: 1px solid var(--rule); display: grid; gap: 32px; }
.trust dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px clamp(20px, 3vw, 44px); }
.trust dt { font-family: var(--f-display); font-weight: 700; font-size: var(--step-1); line-height: 1.2; margin-bottom: 8px; }
.trust dd { margin: 0; color: var(--ink-soft); }

/* ---- closing call ---- */
.cta { padding-block: 64px; border-top: 1px solid var(--ink); display: grid; gap: 18px; justify-items: start; }
.cta p { margin: 0; color: var(--ink-soft); font-size: var(--step-1); max-width: 40ch; }

.foot { border-top: 1px solid var(--rule); padding-block: 22px 40px; display: grid; gap: 12px; font-size: var(--step--1); color: var(--ink-soft); }
.foot .risk { max-width: 80ch; margin: 0; }
.foot .line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* ---- narrow screens: the stage sticks on top, the steps scroll under it ---- */
@media (max-width: 820px) {
  .demo { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .stage-col { order: -1; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); padding-block: 10px; }
  .stage { aspect-ratio: 4 / 3.3; }
  .stage-cap { display: none; }
  .steps { padding-block: 4vh 36vh; }
  .step { min-height: 44vh; align-content: start; padding-top: 24px; }
  .conductor-sec, .trust dl { grid-template-columns: minmax(0, 1fr); }
  .hub { order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
