/* TraderTimeTraveler. Colors follow the DataPublisher data-viz palette; light and dark are both set. */
:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --base: #c3c2b7; --border: rgba(11,11,11,.10); --wash: rgba(11,11,11,.04);
  --up: #2a78d6; --down: #e34948; --s1: #6250d6; --s2: #1baf7a; --s3: #eb6834; --accent: #2a78d6;
  --good: #0ca30c; --good-text: #006300; --crit: #d03b3b; --warn-bg: #fff4d6; --err-text: #a52a2a;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --base: #383835; --border: rgba(255,255,255,.10); --wash: rgba(255,255,255,.05);
    --up: #3987e5; --down: #e66767; --s1: #9085e9; --s2: #199e70; --s3: #d95926; --accent: #3987e5;
    --good-text: #0ca30c; --warn-bg: #3a3118; --err-text: #ff9a9a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --base: #383835; --border: rgba(255,255,255,.10); --wash: rgba(255,255,255,.05);
  --up: #3987e5; --down: #e66767; --s1: #9085e9; --s2: #199e70; --s3: #d95926; --accent: #3987e5;
  --good-text: #0ca30c; --warn-bg: #3a3118; --err-text: #ff9a9a;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 24px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 650; }
p { margin: 0 0 10px; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }

.app { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 100vh; }
nav.side { padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; height: 100vh; }
nav.side .brand { font-weight: 700; font-size: 16px; padding: 4px 10px 16px; line-height: 1.2; }
nav.side .brand span { display: block; font-weight: 500; font-size: 12px; color: var(--ink2); }
nav.side a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink2); text-decoration: none; margin-bottom: 2px; }
nav.side a:hover { background: var(--wash); color: var(--ink); }
nav.side a[aria-current="page"] { background: var(--wash); color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
nav.side .soon { display: block; padding: 8px 10px; color: var(--muted); }
main { padding: 22px 28px 60px; max-width: 1280px; width: 100%; }
footer.disclaimer { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--ink2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.tile .label { font-size: 13px; color: var(--ink2); }
.tile .value { font-size: 26px; font-weight: 650; }
.hero { padding: 22px 24px; }
.hero .label { color: var(--ink2); font-size: 14px; }
.hero .figure { font-size: 56px; font-weight: 650; line-height: 1.1; margin: 4px 0; }   /* proportional figures on purpose */
.pos { color: var(--good-text); } .neg { color: var(--err-text); }

button, .btn { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--base); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--wash); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.seg { display: flex; }
.seg button { flex: 1; border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }

label { display: block; font-size: 13px; color: var(--ink2); margin-top: 10px; }
input, select, textarea { font: inherit; width: 100%; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--base); background: var(--surface); color: var(--ink); margin-top: 3px; }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--wash); font-size: 13.5px; }
.calc b { font-weight: 650; }
.err { color: var(--err-text); font-size: 13.5px; margin-top: 8px; }
.notice { background: var(--warn-bg); border-radius: 8px; padding: 9px 12px; margin: 10px 0; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip { padding: 3px 10px; border-radius: 99px; background: var(--wash); font-size: 13px; color: var(--ink2); }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
table.data th:first-child, table.data td:first-child, table.data .l { text-align: left; }
table.data th { color: var(--ink2); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
table.data tr.click { cursor: pointer; } table.data tr.click:hover td { background: var(--wash); }
table.data tr.sel td { background: var(--wash); }
.scroll { max-height: 320px; overflow: auto; border: 1px solid var(--grid); border-radius: 8px; }
details { margin-top: 12px; } summary { cursor: pointer; color: var(--ink2); }

/* charts */
.chartbox { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 6px; }
.readout { font: 13px/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink2); min-height: 36px; padding: 2px 4px 6px; white-space: normal; word-spacing: 4px; }
svg { width: 100%; height: auto; display: block; }
svg text { font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
svg .axis { fill: var(--muted); }
svg .ptitle { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
svg .leg { fill: var(--ink2); }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .base { stroke: var(--base); stroke-width: 1; }
svg .wick.up { stroke: var(--up); stroke-width: 1.5; } svg .wick.down { stroke: var(--down); stroke-width: 1.5; }
svg .body.up { fill: var(--surface); stroke: var(--up); stroke-width: 1.5; }      /* hollow = closed above open */
svg .body.down { fill: var(--down); stroke: var(--down); stroke-width: 1.5; }    /* filled = closed below open */
svg .vol { fill: var(--muted); opacity: .45; }
svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .line.s1 { stroke: var(--s1); } svg .line.s2 { stroke: var(--s2); } svg .line.s3 { stroke: var(--s3); }
svg .line.bb { stroke: var(--ink2); stroke-width: 1.25; stroke-dasharray: 5 4; }   /* dashed neutral: a second cue besides hue */
svg .bbwash { fill: var(--ink2); opacity: .07; stroke: none; }
svg .hist.up { fill: var(--up); opacity: .55; } svg .hist.down { fill: var(--down); opacity: .55; }
svg .wash { fill: var(--s1); opacity: .10; stroke: none; }
svg .ord { stroke-width: 1.5; } svg .ord.entry { stroke: var(--ink); } svg .ord.stop { stroke: var(--crit); } svg .ord.target { stroke: var(--good); }
svg .ordtxt { fill: var(--ink); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
svg .lasttag { fill: var(--ink); } svg .lasttxt { fill: var(--surface); font-weight: 650; }
svg .xhair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
svg .hit { fill: transparent; }
svg .mk { fill: var(--ink); } svg .ring { stroke: var(--surface); stroke-width: 2; }
svg .enddot { fill: var(--s1); } svg .endlab { fill: var(--ink); font-weight: 650; }
svg .rbar.up { fill: var(--up); } svg .rbar.down { fill: var(--down); }

.dealt { text-align: center; padding: 56px 20px; }
.dealt .big { font-size: 20px; font-weight: 650; margin-bottom: 8px; }
.result .headline { font-size: 22px; font-weight: 650; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 14px; }
.kv dt { color: var(--ink2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* chart toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 0 0 10px; }
.toolbar .grp { display: flex; align-items: center; gap: 6px; }
.toolbar .lbl { font-size: 12.5px; color: var(--ink2); }
.toolbar .seg button { padding: 5px 10px; font-size: 13px; white-space: nowrap; }
.toolbar .seg button:disabled { opacity: .35; }
.toolbar .zoom button { padding: 5px 11px; font-size: 15px; line-height: 1; }
.toolbar .note { font-size: 12.5px; color: var(--ink2); }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; padding: 5px 10px; border: 1px solid var(--base); border-radius: 8px; font-size: 13px; color: var(--ink); background: var(--surface); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--wash); }
details.menu .pop { position: absolute; z-index: 5; top: 34px; left: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 10px; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
details.menu .pop label { display: flex; gap: 8px; align-items: center; margin: 6px 0 0; color: var(--ink); font-size: 13.5px; }
details.menu .pop input { width: auto; margin: 0; }
details.menu .pop .grphd { font-size: 12px; color: var(--ink2); margin-top: 8px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  nav.side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 2px; border-right: 0; border-bottom: 1px solid var(--border); }
  nav.side .brand { width: 100%; padding-bottom: 6px; }
  nav.side a, nav.side .soon { margin: 0; }
  main { padding: 16px 16px 50px; }
  .grid2 { grid-template-columns: 1fr; }
  .hero .figure { font-size: 44px; }
}

.learn details { border-top: 1px solid var(--border); padding: 8px 0; }
.learn summary { cursor: pointer; font-weight: 600; }
.learn details p { max-width: 70ch; margin: 8px 0; }
.learn ul { margin: 6px 0 4px 18px; padding: 0; }
.learn a { color: var(--accent); }
.learn h3.grp { font-size: 14px; margin: 16px 0 4px; color: var(--ink2); }
.books { margin: 4px 0 0 18px; padding: 0; }
.books li { margin: 8px 0; max-width: 78ch; }

/* performance report */
.report .card { margin-top: 14px; }
.report h1 { margin-bottom: 6px; }
.repbar { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.repbar label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); }
.repbar label.chk { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 8px; }
.repbar .grow { flex: 1; }
.report ul.notes { margin: 0 0 0 18px; padding: 0; } .report ul.notes li { margin: 6px 0; max-width: 80ch; }
@media print {
  :root, :root[data-theme="dark"] { color-scheme: light;
    --page: #fff; --surface: #fff; --ink: #0b0b0b; --ink2: #3d3c39; --muted: #6b6a65; --grid: #e1e0d9; --base: #c3c2b7; --border: #cfcec6; --wash: #f2f1ec;
    --up: #2a78d6; --down: #e34948; --s1: #6250d6; --s2: #1baf7a; --s3: #eb6834; --accent: #2a78d6; --good-text: #006300; --err-text: #a52a2a; --warn-bg: #fff4d6; }
  nav.side, .noprint, footer.disclaimer { display: none !important; }
  .app { display: block; } main { padding: 0; max-width: none; }
  .card { border-radius: 0; break-inside: avoid; } .tiles { break-inside: avoid; }
  .scroll { overflow: visible !important; max-height: none !important; }
  body { font-size: 12px; }
}
.repbar label.chk { white-space: nowrap; } .repbar label.chk input { width: auto; margin: 0; }

/* home page */
.tagline { font-size: 16px; margin-bottom: 14px; }
.herogrid { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 20px; align-items: center; }
.herogrid .dial { width: 170px; height: 170px; justify-self: end; }
.mood { margin: 10px 0 14px; max-width: 52ch; color: var(--ink2); font-style: italic; }
.story { margin-top: 16px; background: var(--wash); }
.story h2 { font-size: 17px; }
.story p { font: 17px/1.65 Georgia, "Iowan Old Style", "Palatino Linotype", serif; max-width: 68ch; margin: 0 0 14px; }
.story p:first-of-type::first-letter { font-size: 2.6em; float: left; line-height: .9; padding: 4px 8px 0 0; color: var(--s3); font-weight: 700; }
.card + .card, .card + .tiles, .tiles + .card { margin-top: 16px; }
dl.panel { display: grid; grid-template-columns: max-content 1fr; gap: 6px 22px; margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
dl.panel dt { color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; padding-top: 1px; } dl.panel dd { margin: 0; }
details.faq { border-top: 1px solid var(--border); padding: 8px 0; } details.faq summary { cursor: pointer; font-weight: 600; } details.faq p { max-width: 70ch; margin: 8px 0 2px; color: var(--ink2); }
.maxim { margin: 26px 0 0; text-align: center; font: italic 19px/1.4 Georgia, "Iowan Old Style", serif; color: var(--ink); }
.maxim span { display: block; font: 12px/1.4 system-ui, sans-serif; font-style: normal; color: var(--muted); margin-top: 4px; letter-spacing: .04em; }
@media (max-width: 720px) { .herogrid { grid-template-columns: 1fr; } .herogrid .dial { justify-self: start; width: 120px; height: 120px; order: -1; } }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } .btn.primary:hover { filter: brightness(1.08); }
.tiles > .card + .card { margin-top: 0; }
.storygrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; align-items: start; }
.storygrid > .card { margin-top: 0 !important; }
@media (max-width: 980px) { .storygrid { grid-template-columns: 1fr; } }

.trailbox { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--base); }
.trailbox h3 { margin: 0 0 6px; font-size: 14px; }

svg .hintspan { fill: none; stroke: var(--ink2); stroke-width: 1; stroke-dasharray: 3 3; }
svg .hinttxt { font-size: 10.5px; font-weight: 650; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.hinthead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.hinthead h2 { margin: 0; }
.hints { list-style: none; margin: 8px 0 0; padding: 0; }
.hints li { padding: 8px 0; border-top: 1px solid var(--base); }
.hints li:first-child { border-top: 0; }
.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border: 1px solid var(--base); border-radius: 999px; margin-left: 6px; font-weight: 500; }
.quizgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; font-size: 14px; margin: 6px 0; }
.quizgrid label { display: flex; gap: 6px; align-items: center; margin: 0; }
.quizgrid input { width: auto; margin: 0; }

/* Patterns page */
.pat-group { margin: 22px 0 2px; }
.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 10px; }
.pat-card h3 { margin: 0; font-size: 16px; }
.pat-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.pat-svg { display: block; width: 100%; height: auto; max-height: 190px; }
.pat-cap { margin: 4px 0 10px; }
.pat-band { fill: var(--wash); }
.pc.pc-up { fill: var(--up); stroke: var(--up); stroke-width: 1.4; }
.pc.pc-dn { fill: var(--down); stroke: var(--down); stroke-width: 1.4; }
.pc-ghost { fill: none; stroke-width: 1.3; stroke-dasharray: 3 3; opacity: .85; }
.pc-ghost.pc-up { stroke: var(--up); }
.pc-ghost.pc-dn { stroke: var(--down); }
.pat-hope { fill: none; stroke: var(--ink2); stroke-width: 1.6; stroke-dasharray: 4 3; }
