/* ==========================================================================
   Self-hosted faces. Previously these came from fonts.googleapis.com, which
   put two extra DNS+TLS handshakes and a render-blocking stylesheet ahead of
   the first glyph — PageSpeed measured that chain as most of a 1,180ms saving
   on mobile. Archivo is a variable font, so one file per subset covers 400-600.
   ========================================================================== */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/dev-assets/fonts/archivo-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: 'Archivo';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/dev-assets/fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/dev-assets/fonts/ibm-plex-mono-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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/dev-assets/fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/dev-assets/fonts/ibm-plex-mono-500-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: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/dev-assets/fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ==========================================================================
   svojon /dev — trading systems work
   A ledger: every claim on the left, its evidence on the right.
   Deliberately distinct from the fabrication brand (Cinzel/green) while
   staying recognisably the same hand: dark ground, data set in mono.
   ========================================================================== */

:root {
  /* Ground: a plotting surface, blue-slate rather than neutral black */
  --bg:          #0f171c;
  --bg-surface:  #141f26;
  --bg-raised:   #1a262e;
  --bg-nav:      rgba(15, 23, 28, 0.94);

  --rule:        #1e2c34;
  --rule-mid:    #2a3a44;
  --rule-hi:     #3a4e5a;

  /* Amber: instrument readout. The only accent that carries emphasis. */
  --amber:       #e8a33d;
  --amber-hi:    #f5bc64;
  --amber-dim:   rgba(232, 163, 61, 0.08);
  --amber-line:  rgba(232, 163, 61, 0.26);

  /* Rose: used ONLY where the content is a genuine mismatch. */
  --rose:        #c9636b;
  --rose-dim:    rgba(201, 99, 107, 0.09);

  --text:        #c5d2d8;
  --text-mid:    #93a7b1;
  --text-muted:  #6b8391;
  --text-ghost:  #2a3a44;

  --f-sans: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gut: 40px;
  --measure: 62ch;
  --ease: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.6;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--amber); color: var(--bg); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 1px;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--rule-mid); }
::-webkit-scrollbar-thumb:hover { background: var(--rule-hi); }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--amber); color: var(--bg);
  padding: 12px 20px; font-weight: 600; z-index: 999;
}
.skip:focus { left: 0; }

/* ── shell ───────────────────────────────────────────────────────────── */

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gut);
}

/* ── nav ─────────────────────────────────────────────────────────────── */

.dnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.dnav-in {
  max-width: 1180px; margin: 0 auto;
  padding: 0 var(--gut);
  height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}

.mark {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--text-mid);
  text-decoration: none;
  white-space: nowrap;
}
.mark b { color: var(--text); font-weight: 500; }
.mark span { color: var(--amber); }
.mark:hover b { color: var(--amber-hi); }

.dnav-links { display: flex; align-items: center; gap: 4px; list-style: none; }

.dnav-links a {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid transparent;
  transition: color var(--ease), border-color var(--ease);
}
.dnav-links a:hover { color: var(--text); border-color: var(--rule-mid); }
.dnav-links a.on { color: var(--amber); border-color: var(--amber-line); }

/* ── hero ────────────────────────────────────────────────────────────── */

.hero { padding: 92px 0 76px; border-bottom: 1px solid var(--rule); }

.field {
  position: relative;
  width: 100%;
  height: 208px;
  margin-bottom: 52px;
  border: 1px solid var(--rule);
  background: var(--bg-surface);
  overflow: hidden;
}
.field canvas { display: block; width: 100%; height: 100%; }

.field-note {
  position: absolute; right: 12px; bottom: 10px;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(15, 23, 28, 0.82);
  padding: 3px 8px;
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
  gap: 20px 64px;
  align-items: start;
}

h1.lede {
  font-size: clamp(2.1rem, 4.6vw, 3.7rem);
  line-height: 1.03;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: #e4edf1;
  max-width: 15ch;
  text-wrap: balance;
}

.hero-sub {
  font-size: 1.09rem;
  line-height: 1.62;
  color: var(--text-mid);
  max-width: var(--measure);
}
.hero-sub + .hero-sub { margin-top: 18px; }
.hero-sub b { color: var(--text); font-weight: 500; }

.hero-meta {
  margin-top: 40px;
  display: flex; flex-wrap: wrap; gap: 10px 28px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.hero-meta i { font-style: normal; color: var(--amber); }

/* ── generic section ─────────────────────────────────────────────────── */

.band { padding: 76px 0; border-bottom: 1px solid var(--rule); }
.band:last-of-type { border-bottom: 0; }

h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.95rem);
  line-height: 1.18;
  letter-spacing: -0.018em;
  font-weight: 600;
  color: #e4edf1;
  max-width: 24ch;
}

h3 {
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  color: #dce7ec;
  margin-bottom: 14px;
}

p { max-width: var(--measure); }
p + p { margin-top: 16px; }

.band > .wrap > h2 { margin-bottom: 30px; }

.muted { color: var(--text-muted); }

a.inline {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid var(--amber-line);
  transition: border-color var(--ease);
}
a.inline:hover { border-bottom-color: var(--amber); }

/* ── ledger: claim left, evidence right ──────────────────────────────── */

.ledger { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; }
.ledger + .ledger { margin-top: 60px; padding-top: 60px; border-top: 1px solid var(--rule); }

.claim p { max-width: 54ch; color: var(--text-mid); }

/* Evidence that is an image wants the whole column, not half of it. */
.ledger.stacked { grid-template-columns: 1fr; gap: 30px; }
.ledger.stacked .claim p { max-width: var(--measure); }
/* A caption under a full-width image reads as orphaned at body measure. */
.ledger.stacked .shot-cap { max-width: 88ch; }
.claim p strong { color: var(--text); font-weight: 500; }

.evidence { min-width: 0; }

/* ── stat ────────────────────────────────────────────────────────────── */

.stat { border-left: 2px solid var(--amber); padding: 4px 0 4px 20px; }
.stat + .stat { margin-top: 26px; }

.stat-n {
  font-family: var(--f-sans);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.05;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: -0.022em;
  font-variant-numeric: tabular-nums;
}
.stat-n small { font-size: 0.5em; color: var(--text-muted); letter-spacing: 0; }

.stat-l {
  margin-top: 8px;
  font-size: 0.87rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 40ch;
}

/* ── data table ──────────────────────────────────────────────────────── */

.tbl-scroll { overflow-x: auto; border: 1px solid var(--rule); background: var(--bg-surface); }

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--f-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.tbl caption {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--rule);
  white-space: normal;
}
table.tbl th {
  text-align: left;
  font-weight: 500;
  color: var(--text-mid);
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule-mid);
}
table.tbl td {
  padding: 9px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--rule);
}
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl td.num { text-align: right; }
table.tbl .ok { color: var(--amber); }
table.tbl .bad { color: var(--rose); }
table.tbl tr.flag td { background: var(--rose-dim); }

/* ── code ────────────────────────────────────────────────────────────── */

figure.code { border: 1px solid var(--rule); background: var(--bg-surface); }

figure.code figcaption {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
}

figure.code pre {
  overflow-x: auto;
  padding: 16px;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  line-height: 1.72;
  color: var(--text);
  tab-size: 2;
}
figure.code pre .c { color: var(--text-ghost); }
figure.code pre .k { color: var(--amber); }
figure.code pre .s { color: var(--text-muted); }

/* ── screenshot slot: degrades cleanly when the file is absent ───────── */

.shot {
  position: relative;
  display: block;
  border: 1px solid var(--rule);
  background: var(--bg-surface);
  min-height: 190px;
}
.shot img { display: block; width: 100%; height: auto; }

.shot-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 190px;
  padding: 24px;
  text-align: center;
  background-image: repeating-linear-gradient(
    135deg, transparent 0 9px, rgba(42, 58, 68, 0.34) 9px 10px
  );
}
.shot-empty b {
  font-family: var(--f-mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-mid);
}
.shot-empty span {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.shot + figcaption, .shot-cap {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 52ch;
}

/* ── work index rows ─────────────────────────────────────────────────── */

.work { border-top: 1px solid var(--rule); }

a.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 40px;
  padding: 34px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--ease);
}
a.row:hover { border-bottom-color: var(--rule-hi); }

.row-t {
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: #e4edf1;
  transition: color var(--ease);
}
a.row:hover .row-t { color: var(--amber-hi); }

.row-d { margin-top: 8px; color: var(--text-muted); font-size: 0.95rem; max-width: 56ch; }

.row-fig { text-align: right; }
.row-fig b {
  display: block;
  font-family: var(--f-sans);
  font-size: 1.42rem;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: -0.018em;
  font-variant-numeric: tabular-nums;
}
.row-fig span {
  display: block;
  margin-top: 5px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── capability list ─────────────────────────────────────────────────── */

.caps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px 56px; }
.caps h3 { margin-bottom: 10px; }
.caps p { color: var(--text-muted); font-size: 0.95rem; max-width: 46ch; }

/* ── proof strip ─────────────────────────────────────────────────────── */

.links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.links a {
  font-family: var(--f-mono);
  font-size: 0.8rem;
  color: var(--text-mid);
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid var(--rule-mid);
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}
.links a:hover { color: var(--amber); border-color: var(--amber-line); background: var(--amber-dim); }

/* ── cta ─────────────────────────────────────────────────────────────── */

.cta { background: var(--bg-surface); border-top: 1px solid var(--rule); padding: 72px 0; }
.cta h2 { margin-bottom: 20px; }
.cta p { color: var(--text-mid); }

.btns { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

.btn {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 0.84rem;
  text-decoration: none;
  padding: 13px 26px;
  border: 1px solid var(--amber);
  color: var(--bg);
  background: var(--amber);
  transition: background var(--ease), border-color var(--ease);
}
.btn:hover { background: var(--amber-hi); border-color: var(--amber-hi); }

.btn.ghost { background: transparent; color: var(--text); border-color: var(--rule-hi); }
.btn.ghost:hover { background: transparent; color: var(--amber); border-color: var(--amber); }

/* ── case-study head ─────────────────────────────────────────────────── */

.case-head { padding: 68px 0 56px; border-bottom: 1px solid var(--rule); }

.case-head h1 {
  font-size: clamp(1.9rem, 4.4vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.026em;
  font-weight: 600;
  color: #e4edf1;
  max-width: 20ch;
  margin-bottom: 24px;
}

.case-head .hero-sub { font-size: 1.06rem; }
.case-head .hero-grid h1 { margin-bottom: 0; text-wrap: balance; }

.facts {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.facts div { background: var(--bg); padding: 16px 18px; }
.facts dt {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.facts dd { font-size: 0.92rem; color: var(--text); line-height: 1.45; }

/* ── back link ───────────────────────────────────────────────────────── */

.back {
  display: inline-block;
  margin-top: 52px;
  font-family: var(--f-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.back:hover { color: var(--amber); border-bottom-color: var(--amber-line); }

/* ── footer ──────────────────────────────────────────────────────────── */

footer.dfoot { border-top: 1px solid var(--rule); padding: 34px 0; }
.dfoot-in {
  max-width: 1180px; margin: 0 auto; padding: 0 var(--gut);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  font-family: var(--f-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}
.dfoot-in a { color: var(--text-muted); text-decoration: none; }
.dfoot-in a:hover { color: var(--amber); }
.dfoot-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* ── responsive ──────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  :root { --gut: 24px; }
  .ledger { grid-template-columns: 1fr; gap: 34px; }
  .ledger + .ledger { margin-top: 44px; padding-top: 44px; }
  .caps { grid-template-columns: 1fr; gap: 28px; }
  .hero { padding: 60px 0 54px; }
  .band { padding: 56px 0; }
  .field { height: 150px; margin-bottom: 38px; }
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  h1.lede { max-width: 18ch; }
  a.row { grid-template-columns: 1fr; gap: 18px; padding: 28px 0; }
  .row-fig { text-align: left; }
  .row-fig b { font-size: 1.5rem; }
  .dnav-in { height: 56px; }
  .case-head { padding: 48px 0 42px; }
}

@media (max-width: 480px) {
  .dnav-links a { padding: 6px 9px; font-size: 0.74rem; }
  h1.lede { font-size: 2rem; }
  .btns { flex-direction: column; align-items: stretch; }
  .btn { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
