/* Adjusted Close — shared stylesheet.
   Identity: prose is the note, every figure is a ledger column. */

:root {
  --paper:      #F4F6F7;
  --surface:    #FFFFFF;
  --surface-2:  #EDF1F2;
  --ink:        #12171C;
  --ink-soft:   #33414B;
  --muted:      #5A6873;
  --faint:      #8B98A1;
  --rule:       #DBE2E5;
  --rule-soft:  #E8EDEF;
  --accent:     #12655F;
  --accent-bg:  #E2EDEB;
  --risk:       #A34A2C;
  --risk-bg:    #F5E7E1;

  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 68ch;
  --step--1: 0.8125rem;
  --step-0:  1.0625rem;
  --step-1:  1.1875rem;
  --step-2:  1.5rem;
  --step-3:  2rem;
  --step-4:  2.75rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #101417;
    --surface:   #171C20;
    --surface-2: #1E252A;
    --ink:       #E6EAEC;
    --ink-soft:  #C3CCD1;
    --muted:     #8794A0;
    --faint:     #6B7883;
    --rule:      #293238;
    --rule-soft: #212930;
    --accent:    #4FA79D;
    --accent-bg: #14302E;
    --risk:      #D4805F;
    --risk-bg:   #33211A;
  }
}

:root[data-theme="dark"] {
  --paper:     #101417;
  --surface:   #171C20;
  --surface-2: #1E252A;
  --ink:       #E6EAEC;
  --ink-soft:  #C3CCD1;
  --muted:     #8794A0;
  --faint:     #6B7883;
  --rule:      #293238;
  --rule-soft: #212930;
  --accent:    #4FA79D;
  --accent-bg: #14302E;
  --risk:      #D4805F;
  --risk-bg:   #33211A;
}

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.62;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2.5rem) 5rem;
}

/* ---------- site header ---------- */

.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 3rem;
}

.wordmark {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.wordmark:hover { color: var(--accent); }

.wordmark svg {
  width: 1.55em;
  height: 1.55em;
  vertical-align: -0.42em;
  margin-right: 0.5em;
  overflow: visible;
}

.wm-line  { fill: none; stroke: currentColor; stroke-width: 7; stroke-linecap: square; }
.wm-ghost { fill: none; stroke: var(--faint); stroke-width: 5; }
.wm-dot   { fill: var(--accent); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- type ---------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

h1 {
  font-size: var(--step-4);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.018em;
  text-wrap: balance;
  margin: 0 0 1rem;
  max-width: 22ch;
}

h1.wide { max-width: none; }

.lede {
  font-size: var(--step-2);
  line-height: 1.42;
  color: var(--ink-soft);
  font-style: italic;
  max-width: var(--measure);
  margin: 0 0 2rem;
  text-wrap: pretty;
}

h2 {
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 3.5rem 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 2.5rem 0 0.85rem;
}

h4 {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 2rem 0 0.6rem;
}

p, ul, ol { max-width: var(--measure); }
p { margin: 0 0 1.15rem; }

strong { font-weight: 600; }
em { font-style: italic; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

code {
  font-family: var(--mono);
  font-size: 0.8125em;
  background: var(--surface-2);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

pre {
  font-family: var(--mono);
  font-size: var(--step--1);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  max-width: var(--measure);
  line-height: 1.5;
}

pre code { background: none; border: none; padding: 0; font-size: 1em; }

blockquote {
  margin: 1.75rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--accent-bg);
  border-left: 3px solid var(--accent);
  max-width: var(--measure);
}

blockquote > :last-child { margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
  max-width: none;
}

ul, ol { padding-left: 1.35rem; margin: 0 0 1.3rem; }
li { margin-bottom: 0.55rem; }
li > ul, li > ol { margin-top: 0.55rem; }

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 1.75rem 0 2rem;
  border: 1px solid var(--rule);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--step--1);
}

thead th {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}

tbody td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  color: var(--ink-soft);
}

tbody tr:last-child td { border-bottom: none; }

/* numeric columns: every table in this study is figures after col 1 */
tbody td + td, thead th + th {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tbody td + td { color: var(--ink); }
tbody td:first-child { font-weight: 600; color: var(--ink); white-space: nowrap; }

tbody td strong { color: var(--ink); }

/* ---------- monitor dashboard ---------- */

.asof {
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--muted);
  margin: 0 0 2rem;
}

.asof .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.5rem;
  vertical-align: 0.05em;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin: 2rem 0 2.5rem;
}

.card {
  background: var(--surface);
  padding: 1.1rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.card-pair {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-pair .base { color: var(--faint); font-weight: 400; }

.pill {
  font-family: var(--mono);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.22em 0.5em;
  border: 1px solid currentColor;
  border-radius: 2px;
  white-space: nowrap;
}

.pill.clears { color: var(--accent); }
.pill.short  { color: var(--risk); }

/* card sparkline: 21d vol history + flip-point rule, inline SVG from build.py */

.spark svg {
  display: block;
  width: 100%;
  height: 52px;
  overflow: visible;
}

.spark-line { stroke: var(--ink-soft); stroke-width: 1.2px; }
.spark-flip { stroke: var(--risk); stroke-width: 1px; opacity: 0.8; }
.spark-dot  { stroke-width: 5px; }
.spark-dot.pos { stroke: var(--accent); }
.spark-dot.neg { stroke: var(--risk); }

.spark-cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 0.4rem;
}

/* standalone chart figures, also inline SVG */

.figure {
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: 1.1rem 1.3rem 0.9rem;
  margin: 1.75rem 0 2rem;
}

.figure svg { display: block; width: 100%; height: auto; }

.fig-cap {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
  max-width: none;
}

.chart-axis { stroke: var(--rule); }
.chart-grid { stroke: var(--rule-soft); }
.chart-bar-pos { fill: var(--accent); }
.chart-bar-neg { fill: var(--risk); }

.chart-title {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

/* research-note figure series: naive expectation, frictionless mechanism,
   actual fund — and their end-of-line value labels */

.fig-naive  { stroke: var(--faint); stroke-width: 1.1px; fill: none; stroke-dasharray: 4 3; }
.fig-mech   { stroke: var(--accent); stroke-width: 1.2px; fill: none; }
.fig-actual { stroke: var(--ink); stroke-width: 1.6px; fill: none; }

.figlab {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  fill: var(--ink);
}

.figlab-naive  { fill: var(--faint); }
.figlab-mech   { fill: var(--accent); }
.figlab-actual { fill: var(--ink); }

.chart-label, .chart-val {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-label { fill: var(--muted); }
.chart-val   { fill: var(--ink); font-weight: 600; }

.card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.card dt { color: var(--muted); font-family: var(--serif); font-size: var(--step--1); }
.card dd { margin: 0; text-align: right; color: var(--ink); }
.card dd.pos { color: var(--accent); font-weight: 600; }
.card dd.neg { color: var(--risk); font-weight: 600; }

.note {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  padding: 1.15rem 1.3rem;
  margin: 2rem 0;
  max-width: var(--measure);
}

.note.warn { border-top-color: var(--risk); }
.note > :last-child { margin-bottom: 0; }

.note-label {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.55rem;
}

.note.warn .note-label { color: var(--risk); }

/* ---------- index-page pieces ---------- */

.work {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin: 2rem 0 2.5rem;
}

@media (min-width: 700px) { .work { grid-template-columns: 1fr 1fr; } }

.work-item {
  background: var(--surface);
  padding: 1.5rem 1.6rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}

.work-item:hover { background: var(--surface-2); }

.work-kind {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.work-item h3 { margin: 0; font-size: var(--step-1); line-height: 1.3; }
.work-item p { margin: 0; font-size: var(--step--1); color: var(--muted); line-height: 1.55; max-width: none; }

.work-stat {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: auto;
  padding-top: 0.5rem;
}

.work-stat small {
  display: block;
  font-family: var(--serif);
  font-size: var(--step--1);
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 0.15rem;
}

.services {
  border: 1px solid var(--rule);
  background: var(--surface);
  margin: 2rem 0 1.25rem;
}

.svc {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 1.5rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--rule-soft);
  align-items: baseline;
}

.svc:last-child { border-bottom: none; }

.svc-name { font-weight: 600; }
.svc-price {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  font-size: var(--step--1);
}
.svc-desc {
  grid-column: 1 / -1;
  font-size: var(--step--1);
  color: var(--muted);
  max-width: 60ch;
}

.contact {
  border-top: 2px solid var(--ink);
  padding-top: 1.75rem;
  margin-top: 3.5rem;
}

.contact-mail {
  font-family: var(--mono);
  font-size: var(--step-1);
  font-weight: 500;
  word-break: break-all;
}

/* ---------- footer ---------- */

.site-foot {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}

.site-foot p { margin: 0; max-width: 62ch; }

.site-foot .disclaimer { font-style: italic; }

:where(a, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
