/* ------------------------------------------------------------------
   Trading Signal Performance — site styles
   Visual language follows omarchy.org: flat square panels, 1px hairlines,
   monospace-led type, a pixel/dither motif instead of soft gradients.
   Palette is the neutral "matte black" end of that range with one amber
   accent; green/red are reserved for gains/losses.
------------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg: #0d0d0d;
  --panel: #131313;
  --panel-2: #181818;
  --line: #262626;
  --line-strong: #3a3a3a;

  --fg: #d4d4d4;
  --fg-strong: #f2f2f2;
  --fg-dim: #8c8c8c;
  --fg-mute: #5e5e5e;

  --accent: #e68e0d;
  --accent-ink: #120a00;
  --pos: #5fbb7f;
  --neg: #e5645c;
  --warn: #e68e0d;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;

  --gutter: clamp(1rem, 3vw, 2rem);
  --maxw: 1240px;
}

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

html {
  background: var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  top: -1000px;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--fg-strong);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
}

.brand-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  white-space: nowrap;
  transition: color 120ms ease;
}

.site-nav a:hover {
  color: var(--fg-strong);
}

.site-nav .nav-cta {
  margin-left: 0.5rem;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.site-nav .nav-cta:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Sections ---------------------------------------------- */

.section {
  scroll-margin-top: 3.5rem;
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
  border-bottom: 1px solid var(--line);
}

.section-header {
  margin-bottom: 2rem;
}

.section-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.625rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: var(--fg-strong);
  margin: 0 0 0.75rem 0;
}

.section-sub {
  color: var(--fg-dim);
  margin: 0;
  max-width: 76ch;
}

/* The backtest section carries the full model assumptions; keep it
   readable but visually secondary to the data below it. */
#backtest .section-sub {
  max-width: 82ch;
}

/* ---------- Hero -------------------------------------------------- */

#overview {
  padding-bottom: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: stretch;
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hero-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(2.25rem, 5.4vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
  color: var(--fg-strong);
  margin: 0 0 1.5rem 0;
  overflow-wrap: break-word;
}

.hero-lead {
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--fg-dim);
  max-width: 54ch;
  margin: 0 0 2rem 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--line-strong);
  color: var(--fg-strong);
  background: transparent;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.btn:hover {
  border-color: var(--fg-dim);
  background: var(--panel-2);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: #f5a02a;
  border-color: #f5a02a;
}

.hero-art {
  position: relative;
  min-height: 260px;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.hero-art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.px-hi {
  fill: var(--accent);
}

.px-mid {
  fill: #8a5508;
}

.px-lo {
  fill: #2c2c2c;
}

/* Status bar: periods / cuts / costs, in the manner of a terminal bar. */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-bottom: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--panel);
}

.pill {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.65rem 1rem;
  color: var(--fg);
  border-right: 1px solid var(--line);
  flex: 1 1 auto;
}

.pill:last-child {
  border-right: 0;
}

.pill b {
  font-weight: 500;
  color: var(--accent);
}

/* ---------- KPI row ----------------------------------------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 0 0 clamp(2.5rem, 6vw, 4.5rem) 0;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 1.5rem 1.25rem 1.25rem;
  background: var(--bg);
}

.kpi-value {
  order: -1;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--fg-strong);
}

.kpi-label {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--fg-dim);
}

#overview .container > .kpi-grid {
  margin-top: 0;
}

/* ---------- Panels & controls ------------------------------------- */

.card {
  padding: clamp(1rem, 2vw, 1.5rem);
  background: var(--panel);
  border: 1px solid var(--line);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
  max-width: 100%;
}

label {
  font-size: 0.8125rem;
  color: var(--fg-dim);
}

select {
  appearance: none;
  min-width: 11rem;
  max-width: 100%;
  text-overflow: ellipsis;
  padding: 0.55rem 2.5rem 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background-color: var(--bg);
  color: var(--fg-strong);
  font-family: var(--mono);
  font-size: 0.8125rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4.5l4 4 4-4' stroke='%238c8c8c' stroke-width='1.5' fill='none' stroke-linecap='square'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
}

select:hover {
  border-color: var(--fg-dim);
}

select:focus-visible {
  border-color: var(--accent);
}

/* ---------- Tables ------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--bg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  padding: 0.7rem 1rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.table th:first-child,
.table td:first-child {
  text-align: left;
}

.table thead th {
  background: var(--panel-2);
  color: var(--fg-dim);
  font-weight: 500;
  font-size: 0.75rem;
  border-bottom: 1px solid var(--line-strong);
}

.table tbody td {
  color: var(--fg);
}

.table tbody td:first-child {
  color: var(--fg-strong);
  font-weight: 700;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: var(--panel);
}

.table tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--panel-2);
  padding: 0.1rem 0.35rem;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  color: var(--fg-strong);
  background: var(--panel-2);
  padding: 0.1rem 0.35rem;
}

.bt-subtitle {
  margin: 2.25rem 0 0.9rem;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}

.hint {
  color: var(--fg-dim);
  font-size: 0.875rem;
  line-height: 1.6;
  max-width: 100ch;
  margin: 1.25rem 0 0;
}

.bt-frame {
  width: 100%;
  height: 900px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: block;
}

/* ---------- Findings ---------------------------------------------- */

#findings .card {
  max-width: calc(88ch + 4rem);
}

.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  max-width: 88ch;
}

.list li {
  position: relative;
  padding: 1rem 0 1rem 1.75rem;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
}

.list li:first-child {
  padding-top: 0;
}

.list li:first-child:before {
  top: 0.55rem;
}

.list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list li:before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.55rem;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent);
}

.list li strong {
  color: var(--fg-strong);
}

/* ---------- Colour semantics -------------------------------------- */

.text-success,
.table tbody td.text-success {
  color: var(--pos);
}

.text-warning,
.table tbody td.text-warning {
  color: var(--warn);
}

.text-danger,
.table tbody td.text-danger {
  color: var(--neg);
}

/* ---------- Footer ------------------------------------------------ */

.site-footer {
  padding: clamp(2.5rem, 5vw, 3.5rem) 0 1.75rem;
  background: var(--bg);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem 3rem;
  padding-bottom: 2.5rem;
}

.footer-brand {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
}

.footer-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fg-strong);
}

.footer-sub {
  color: var(--fg-dim);
  font-size: 0.9375rem;
  margin-top: 0.5rem;
  max-width: 44ch;
}

.footer-col-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--fg-strong);
  margin-bottom: 0.75rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-links a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.9375rem;
}

.footer-links a:hover {
  color: var(--fg-strong);
}

.footer-meta {
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.footer-meta p {
  margin: 0 0 0.35rem;
  max-width: 100ch;
}

/* ---------- Small screens ----------------------------------------- */

@media (max-width: 960px) {
  .site-nav a:not(.nav-cta) {
    display: none;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-art {
    min-height: 150px;
    order: 2;
  }
  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .pill {
    flex-basis: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .pill:last-child {
    border-bottom: 0;
  }
  .table {
    min-width: 720px;
  }
  select {
    min-width: 9.5rem;
  }
}

/* ---------- Trade timeline ---------------------------------------- */

.tl-slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tl-slider-row output {
  min-width: 4.5em;
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}

input[type="range"] {
  appearance: none;
  width: min(320px, 60vw);
  height: 2rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--line-strong);
}

input[type="range"]::-moz-range-track {
  height: 1px;
  background: var(--line-strong);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 0.75rem;
  height: 1.25rem;
  margin-top: -0.6rem;
  border: 0;
  border-radius: 0;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 0.75rem;
  height: 1.25rem;
  border: 0;
  border-radius: 0;
  background: var(--accent);
}

input[type="range"]:hover::-webkit-slider-thumb { background: #f5a02a; }
input[type="range"]:hover::-moz-range-thumb { background: #f5a02a; }

#timeline svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

#timeline text {
  font-family: var(--mono);
  fill: var(--fg);
}

.tl-caption {
  max-width: 100ch;
}

.tl-caption b {
  font-weight: 600;
  color: var(--fg-strong);
}

/* vertical timeline for narrow screens */
.tl-v {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0 0 0 1.25rem;
  list-style: none;
  border-left: 1px solid var(--line-strong);
}

.tl-v li {
  position: relative;
  display: grid;
  gap: 2px;
}

.tl-v li:before {
  content: "";
  position: absolute;
  left: calc(-1.25rem - 5.5px);
  top: 0.45rem;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--fg-strong);
}

.tl-v li.go:before { background: var(--fg-strong); }
.tl-v li.out:before { background: var(--bg); }
.tl-v li.hold:before { background: var(--accent); border-color: var(--accent); }

.tl-v time {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
}

.tl-v b {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-strong);
}

.tl-v span {
  font-size: 0.875rem;
  color: var(--fg-dim);
}

@media (max-width: 420px) {
  .header-inner {
    gap: 0.75rem;
  }
  .brand {
    gap: 0.5rem;
  }
  .site-nav .nav-cta {
    margin-left: 0;
  }
}

@media (max-width: 340px) {
  .header-inner {
    gap: 0.5rem;
  }
  .brand-title {
    font-size: 0.6875rem;
  }
}

/* ---------- Contact ---------------------------------------------- */

.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  max-width: calc(88ch + 4rem);
}

.contact-label {
  font-size: 0.8125rem;
  color: var(--fg-dim);
}

.hero-note {
  max-width: 54ch;
  margin: -1rem 0 2rem;
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.55;
  color: var(--fg-strong);
}

.hero-note b {
  font-weight: 700;
  color: var(--accent);
}
