/* Chaein Research — editorial research-firm styles.
   Type: Newsreader (serif: statements, titles, notes) + IBM Plex Sans (interface, figures).
   Colour: ink on white paper, cool hairline rules, teal kept for the logo and one highlight. */

:root {
  color-scheme: light;
  --paper: #FFFFFF;
  --ink: #0E1A2B;
  --slate: #4F5A68;
  --mute: #6B7580;
  --rule: #DADFE5;
  --wash: #F3F5F7;
  --teal: #2F8F83;
  /* chart series (validated colour-blind safe on white) */
  --s1: #1f5fa8;
  --s2: #0e9483;
  --s3: #c9702a;
  --serif: "Newsreader", "Iowan Old Style", Charter, Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1120px;
  --label: 200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0B1524;
    --ink: #E9EDF1;
    --slate: #B3BDC9;
    --mute: #8B97A6;
    --rule: #23344E;
    --wash: #102038;
    --teal: #3FB3A4;
    --s1: #3f86de;
    --s2: #0fa08c;
    --s3: #d27a2e;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 var(--sans); }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--mute) 70%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) { a { transition: text-decoration-color 120ms; } }

.page { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .page { padding: 0 32px; } }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead .page { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; position: relative; }
.brand img { height: 36px; width: auto; }
.nav { display: flex; gap: 28px; font-size: 15px; }
.nav a { text-decoration: none; color: var(--slate); }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--ink); }
.nav-toggle { display: none; background: none; border: 0; color: var(--ink); font: 500 15px var(--sans); padding: 8px 0; cursor: pointer; }
@media (max-width: 760px) {
  .brand img { height: 30px; }
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 5; flex-direction: column; gap: 0;
         background: var(--paper); border-bottom: 1px solid var(--rule); padding: 4px 16px 12px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 0; border-top: 1px solid var(--rule); }
  .nav a[aria-current="page"] { box-shadow: none; font-weight: 600; }
}

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; font-weight: 500; }
.statement { font: 400 clamp(28px, 4.2vw, 46px)/1.18 var(--serif); letter-spacing: -0.01em; max-width: 21em; margin: 0; }
.title { font: 500 clamp(32px, 4.5vw, 48px)/1.12 var(--serif); letter-spacing: -0.01em; margin: 0 0 16px; }
.standfirst { font: 400 clamp(18px, 2vw, 21px)/1.5 var(--serif); color: var(--slate); max-width: 34em; margin: 0; }
p { margin: 0 0 14px; max-width: 40em; }
.quiet { color: var(--mute); font-size: 14px; }

/* ---------- editorial rows: label column + content ---------- */
.intro { padding: 72px 0 56px; }
.row { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 16px 40px; padding: 36px 0 40px; border-top: 1px solid var(--rule); }
.row > h2 { font: 600 15px/1.5 var(--sans); color: var(--ink); padding-top: 2px; }
.row > h2 .sub { display: block; font-weight: 400; color: var(--mute); }
@media (max-width: 760px) {
  .intro { padding: 44px 0 36px; }
  .row { grid-template-columns: minmax(0, 1fr); padding: 28px 0 32px; }
}

/* record strip on the home page */
.record-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 4px; }
.record-head .figure { font: 500 40px/1 var(--sans); letter-spacing: -0.01em; }
.record-head .delta { font: 500 17px var(--sans); color: var(--slate); }
.spark { width: 100%; height: 120px; margin: 14px 0 10px; }
.spark path { fill: none; stroke: var(--s1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .base { stroke: var(--rule); stroke-width: 1; }
.spark .start, .spark .end { fill: var(--s1); stroke: var(--paper); stroke-width: 2; }
/* ---------- home: firm-level hero with the brand mark as the image ---------- */
/* the hero owns the whole first screen (viewport minus the 73px masthead) */
.firm-hero { position: relative; overflow: hidden; min-height: calc(100vh - 73px); min-height: calc(100svh - 73px); display: flex; align-items: center; border-bottom: 1px solid var(--rule); }
.firm-hero .page { position: relative; z-index: 1; width: 100%; padding-top: 72px; padding-bottom: 80px; }
.firm-copy { max-width: 40rem; }
.firm-statement { font: 400 clamp(46px, 5.6vw, 86px)/1 var(--serif); letter-spacing: -0.03em; margin: 0 0 18px; white-space: nowrap; }
.firm-kicker { font: 400 clamp(26px, 2.5vw, 36px)/1.25 var(--serif); color: var(--ink); margin: 0 0 30px; }
.firm-sub { font: 400 clamp(16px, 1.3vw, 18px)/1.65 var(--sans); color: var(--slate); max-width: 30em; margin: 0 0 32px; }
@media (max-width: 480px) { .firm-statement { white-space: normal; } }
.firm-links { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; font-weight: 500; font-size: 16px; }
.firm-links a { text-decoration-color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.firm-hero .page { z-index: 2; }
/* hero art: faint random paths with one teal path that holds up, fading out under the text */
.firm-art { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; width: 64%; pointer-events: none; }
.firm-art svg { display: block; width: 100%; height: 100%; }
.firm-art .noise { fill: none; stroke: var(--mute); stroke-width: 0.75; opacity: 0.24; }
.firm-art .signal { fill: none; stroke: var(--teal); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
@media (prefers-reduced-motion: no-preference) {
  .firm-art.animate .signal { animation: signal-in 2.4s 0.4s cubic-bezier(.3, .1, .2, 1) forwards; }
  @keyframes signal-in { to { stroke-dashoffset: 0; } }
}
@media (max-width: 1100px) { .firm-art { width: 72%; } .firm-copy { max-width: 34rem; } }
@media (max-width: 760px) {
  .firm-hero { min-height: 0; display: block; }
  .firm-art { top: 0; bottom: auto; height: 230px; width: 100%; -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent 100%); mask-image: linear-gradient(to bottom, #000 60%, transparent 100%); }
  .firm-hero .page { padding-top: 210px; padding-bottom: 48px; }
}

/* pillars: what the house does */
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pillars > div { padding: 56px 40px 64px 0; }
.pillars > div + div { padding-left: 40px; border-left: 1px solid var(--rule); }
.pillars h2 { font: 400 clamp(32px, 3.2vw, 44px)/1.1 var(--serif); letter-spacing: -0.015em; margin: 0 0 14px; color: var(--ink); }
.pillars h2::before { content: ""; display: block; width: 28px; height: 2px; background: var(--teal); margin-bottom: 22px; }
.pillars p { color: var(--slate); font-size: 16px; margin: 0; max-width: 22em; }
@media (max-width: 820px) {
  .pillars { grid-template-columns: minmax(0, 1fr); }
  .pillars > div, .pillars > div + div { padding: 32px 0; border-left: 0; }
  .pillars > div + div { border-top: 1px solid var(--rule); }
}

/* strategies: only what trades real money */
.strategies { padding-top: 72px; padding-bottom: 80px; }
.strategies-title { font: 400 clamp(30px, 3vw, 40px)/1.15 var(--serif); margin: 0 0 24px; }
.strategy-list { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--ink); }
.strategy-list li { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 8px 32px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--rule); }
.s-name { font: 400 30px/1.1 var(--serif); }
.s-desc { color: var(--slate); font-size: 16px; }
.s-status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.s-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
@media (max-width: 760px) { .strategy-list li { grid-template-columns: minmax(0, 1fr); } }
.record-strip { margin-top: 48px; }
.note-line { border-left: 2px solid var(--teal); padding-left: 12px; color: var(--slate); font-size: 14px; max-width: 46em; }

/* study ledger */
.ledger { width: 100%; border-collapse: collapse; font-size: 15px; }
.ledger th, .ledger td { text-align: left; padding: 11px 16px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger thead th { font-weight: 600; font-size: 13px; color: var(--mute); padding-top: 0; }
.ledger td:first-child { font-variant-numeric: tabular-nums; color: var(--mute); white-space: nowrap; width: 6.5em; }
.ledger td:last-child { white-space: nowrap; padding-right: 0; }
.ledger .kept { color: var(--ink); font-weight: 600; }
.ledger .rejected { color: var(--slate); }
.ledger-foot { margin-top: 14px; color: var(--slate); font-size: 15px; }
@media (max-width: 560px) {
  .ledger thead { display: none; }
  .ledger tr { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .ledger td { border: 0; padding: 0; }
  .ledger td:nth-child(2) { grid-column: 1 / -1; }
  .ledger td:last-child { grid-column: 1 / -1; }
}

/* research notes as a journal index */
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); gap: 4px 16px; padding: 14px 0 16px; border-bottom: 1px solid var(--rule); }
.notes li:first-child { padding-top: 0; }
.notes .no { font-variant-numeric: tabular-nums; color: var(--mute); font-size: 14px; padding-top: 4px; }
.notes h3 { font: 500 21px/1.3 var(--serif); margin-bottom: 4px; }
.notes h3 a { text-decoration: none; }
.notes h3 a:hover { text-decoration: underline; }
.notes p { color: var(--slate); font-size: 15px; margin: 0; }
.notes .status { font-size: 13px; color: var(--mute); margin-top: 4px; }

/* engines */
.engines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 48px; }
@media (max-width: 900px) { .engines { grid-template-columns: minmax(0, 1fr); } }
.engine.prose-width { max-width: 40em; }
.engine h3 { font: 500 24px/1.25 var(--serif); }
.engine .state { font-size: 14px; color: var(--mute); margin: 2px 0 10px; }
.engine p { color: var(--slate); }
.engine dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 14px; border-top: 1px solid var(--rule); padding-top: 12px; }
.engine dt { color: var(--mute); }
.engine dd { margin: 0; }

.about { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 32px; align-items: start; }
.about img { width: 140px; height: auto; }
@media (max-width: 760px) { .about { grid-template-columns: minmax(0, 1fr); } .about img { width: 96px; } }

/* ---------- long-form (method page, research notes) ---------- */
.prose { max-width: 40em; }
.prose p, .prose li { font: 400 19px/1.65 var(--serif); color: var(--ink); }
.prose h2 { font: 600 17px/1.4 var(--sans); margin: 40px 0 10px; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose table { border-collapse: collapse; width: 100%; font: 400 15px/1.5 var(--sans); margin: 18px 0 24px; }
.prose th, .prose td { text-align: left; border-bottom: 1px solid var(--rule); padding: 8px 12px 8px 0; font-variant-numeric: tabular-nums; }
.prose th { font-weight: 600; font-size: 13px; color: var(--mute); }
.byline { font-size: 14px; color: var(--mute); margin: 18px 0 0; }

/* ---------- footer ---------- */
.foot { background: var(--wash); border-top: 1px solid var(--rule); margin-top: 48px; padding: 36px 0 52px; font-size: 14px; color: var(--slate); }
@media (prefers-color-scheme: dark) { .foot { background: #102037; } }
.foot .page { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 16px 40px; }
.foot p { max-width: 52em; margin: 0 0 10px; }
.foot .fine { color: var(--mute); font-size: 13px; }
.home .foot { margin-top: 0; }
@media (max-width: 760px) { .foot .page { grid-template-columns: minmax(0, 1fr); } }

/* ---------- performance page ---------- */
.perf-layout { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); gap: 16px 40px; border-top: 1px solid var(--rule); padding-top: 32px; }
.perf-main, .panel { min-width: 0; }
.panel { position: sticky; top: 24px; align-self: start; display: grid; gap: 22px; font-size: 14px; }
.panel fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.panel legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; color: var(--ink); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-block; padding: 4px 9px; border: 1px solid var(--rule); border-radius: 3px; color: var(--slate); font-variant-numeric: tabular-nums; }
.seg input:checked + span { border-color: var(--ink); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--slate); padding: 3px 0; cursor: pointer; }
.check input { margin: 0; accent-color: var(--ink); }
.check .tag { margin-left: auto; }
.tag { font-size: 12px; color: var(--mute); }
.panel-note { color: var(--mute); margin: 0; }
@media (max-width: 900px) {
  .perf-layout { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; display: flex; flex-wrap: wrap; gap: 16px 28px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
}

.key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--key, var(--ink)); vertical-align: middle; margin-right: 8px; flex: none; }
.key.dashed { border-top-style: dashed; }

.hero-stat .label { display: block; font-weight: 600; font-size: 14px; }
.hero-stat .row-figure { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero-stat .value { font: 500 56px/1.1 var(--sans); letter-spacing: -0.015em; }
.hero-stat .delta { font: 500 19px var(--sans); color: var(--slate); }
.hero-stat .sub { display: block; font-size: 14px; color: var(--slate); margin-top: 2px; }
@media (max-width: 480px) { .hero-stat .value { font-size: 46px; } }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; margin: 24px 0 8px; }
@media (max-width: 620px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; } }
.tile { border-top: 1px solid var(--rule); padding: 10px 0 16px; display: flex; flex-direction: column; }
.tile .label { font-size: 13px; color: var(--mute); }
.tile .value { font: 500 22px/1.3 var(--sans); }
.tile .note { font-size: 12px; color: var(--mute); }

.chart-block { border-top: 1px solid var(--rule); padding-top: 16px; margin: 8px 0 32px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; color: var(--slate); margin-bottom: 10px; }
.legend .item { display: inline-flex; align-items: center; }
.legend .tri { font-size: 10px; margin-right: 6px; color: var(--slate); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.chart svg:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .grid.base { stroke: var(--mute); stroke-opacity: 0.5; }
.chart .axis { stroke: var(--mute); stroke-opacity: 0.6; stroke-width: 1; }
.chart .tick { fill: var(--mute); font-size: 12px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series.paper { stroke-dasharray: 6 4; }
.chart .dep-line { stroke: var(--rule); stroke-width: 1; }
.chart .dep-mark { fill: var(--slate); }
.chart .cross { stroke: var(--mute); stroke-width: 1; }
.chart .dot { stroke: var(--paper); stroke-width: 2; }
.chart .start-dot { fill: var(--s1); }
.prelaunch .record-head { margin-bottom: 12px; }
.prelaunch .chart { margin-bottom: 24px; }
.tip { position: absolute; pointer-events: none; background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(14, 26, 43, 0.10); min-width: 150px; z-index: 2; }
.tip-date { color: var(--mute); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; }
.tip-row b { font-size: 15px; font-weight: 600; min-width: 44px; font-variant-numeric: tabular-nums; }
.tip-row span:last-child { color: var(--slate); }
.tip-note { margin-top: 4px; font-size: 12px; color: var(--slate); }

.section-title { font: 600 17px/1.4 var(--sans); margin: 8px 0 12px; }
.table-wrap { overflow-x: auto; margin-bottom: 24px; }
.stats { border-collapse: collapse; width: 100%; font-size: 14px; }
.stats th, .stats td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats th:first-child, .stats td:first-child { text-align: left; }
.stats thead th { font-size: 13px; color: var(--mute); font-weight: 600; }
.stats tbody th { font-weight: 600; }
.stats tbody th .tag { margin-left: 8px; font-weight: 400; }
details.data-view { margin-bottom: 32px; }
details.data-view summary { cursor: pointer; font-size: 14px; color: var(--slate); margin-bottom: 10px; }
.read-list { padding-left: 1.2em; max-width: 44em; color: var(--slate); }
.read-list li { margin-bottom: 8px; }
.read-list b { color: var(--ink); font-weight: 600; }
