/* Shared mathematical typography for every Lab, research note and pricer. */
:root{--math-ink:#102433;--math-gold:#9b7837;--math-rule:#d1dbe0;--math-surface:#f6f8f9}

/* Display equations use one consistent, high-contrast surface. */
.math-display{
  display:block!important;box-sizing:border-box;min-width:0;max-width:100%;width:100%;
  margin:1rem 0!important;padding:1.15rem clamp(.8rem,2.4vw,1.4rem)!important;
  overflow-x:auto!important;overflow-y:hidden;overscroll-behavior-inline:contain;
  border:1px solid rgba(155,120,55,.38)!important;border-left:4px solid var(--math-gold)!important;
  border-radius:8px!important;background:linear-gradient(135deg,#fbfcfc,var(--math-surface))!important;
  box-shadow:0 5px 16px rgba(6,22,33,.07);color:var(--math-ink)!important;
  font-size:clamp(.98rem,1.35vw,1.13rem)!important;line-height:1.65!important;
  direction:ltr!important;text-align:center;white-space:normal!important;
  scrollbar-color:#b8c4ca transparent;scrollbar-width:thin;-webkit-overflow-scrolling:touch
}
.math-display:focus-visible,.model-equation:focus-visible,.inst-equation:focus-visible{
  outline:3px solid #a18043;outline-offset:3px
}
.math-display .katex-display{margin:0;padding:.18rem 0;text-align:center}
.math-display .katex-display>.katex{display:inline-block;max-width:none;text-align:center;white-space:nowrap}
.math-display .katex{font-size:1.08em;text-indent:0}
.math-display .katex-html,.model-equation .katex-html,.inst-equation .katex-html{direction:ltr}
.math-display::before{display:none!important;content:none!important}
.math-plain{white-space:pre-wrap!important;overflow-wrap:anywhere;line-height:1.8}
td.math-display{display:table-cell!important;width:auto;max-width:none;margin:0!important;padding:.35rem!important;border:0!important;background:transparent!important;box-shadow:none!important;text-align:left;font-size:inherit!important;overflow:visible!important}
td.math-display .katex-display{display:inline;margin:0;padding:0;text-align:left}
td.math-display .katex{font-size:1em}

/* Dynamically generated KaTeX equations and institutional model blocks. */
.model-equation,.inst-equation{
  min-width:0;max-width:100%;direction:ltr;overscroll-behavior-inline:contain;
  scrollbar-color:#738792 transparent;scrollbar-width:thin;-webkit-overflow-scrolling:touch
}
.model-equation .katex-display,.inst-equation .katex-display{margin:.1rem 0;overflow:visible}
.model-equation .katex,.inst-equation .katex{font-size:1.08em}
.model-equation .katex-display>.katex,.inst-equation .katex-display>.katex{max-width:none;white-space:nowrap}

/* Inline notation can scroll locally instead of widening the whole page. */
.math-inline,.formula-inline{
  display:inline-block;max-width:100%;overflow-x:auto;overflow-y:hidden;
  vertical-align:baseline;direction:ltr;white-space:nowrap;overscroll-behavior-inline:contain;
  scrollbar-width:thin;-webkit-overflow-scrolling:touch
}
.math-inline .katex,.formula-inline .katex{font-size:1.04em}

/* Symbol tables keep notation and plain-language definitions aligned. */
.formula-reference,.risk-equations,.complete-risk-formula{
  min-width:0;margin-top:1.5rem;padding:1.2rem;
  border:1px solid rgba(157,176,187,.42);border-radius:10px;
  background:rgba(8,27,40,.32)
}
.formula-reference h3,.risk-equations h3,.complete-risk-formula h5{
  margin:0 0 .8rem;color:#e7edf0;font:600 .75rem/1.45 "DM Mono",monospace;
  letter-spacing:.07em;text-transform:uppercase
}
.formula-reference dl,.risk-equations dl,.formula-parameters{
  display:grid;grid-template-columns:minmax(4.5rem,7.5rem) minmax(0,1fr);
  gap:0;margin:1rem 0 0;border-top:1px solid rgba(157,176,187,.3)
}
.formula-reference dt,.formula-reference dd,.risk-equations dt,.risk-equations dd,.formula-parameters>div{
  min-width:0;padding:.68rem .6rem;border-bottom:1px solid rgba(157,176,187,.22);
  line-height:1.65;overflow-wrap:anywhere
}
.formula-reference dt,.risk-equations dt,.formula-parameters dt{
  color:#f0d79f;font:600 .9rem/1.55 "DM Mono",monospace
}
.formula-reference dd,.risk-equations dd,.formula-parameters dd{
  margin:0;color:#c5d1d8;font-size:.92rem
}
.formula-reference p,.risk-equations>p,.complete-risk-formula>p{
  max-width:78ch;margin:1rem 0 0;color:#b9c8d0;line-height:1.75
}
.risk-symbol-table{
  width:100%;margin-top:1.15rem;border-collapse:collapse;font-size:.88rem
}
.risk-symbol-table caption{
  padding:.7rem 0;color:#e7edf0;font:600 .73rem/1.4 "DM Mono",monospace;
  letter-spacing:.07em;text-align:left;text-transform:uppercase
}
.risk-symbol-table th,.risk-symbol-table td{
  padding:.65rem .7rem;border:1px solid rgba(157,176,187,.26);
  vertical-align:top;text-align:left;line-height:1.6
}
.risk-symbol-table th{color:#f0d79f;font-size:.72rem;letter-spacing:.05em;text-transform:uppercase}
.risk-symbol-table td:first-child{width:7.5rem;color:#f0d79f;font-family:"DM Mono",monospace}

@media(max-width:650px){
  .math-display{margin:.85rem 0!important;padding:.9rem .7rem!important;font-size:.94rem!important;border-left-width:3px!important;border-radius:6px!important}
  .math-display .katex{font-size:1.02em}
  .model-equation .katex,.inst-equation .katex{font-size:.98em}
  .formula-reference,.risk-equations,.complete-risk-formula{padding:.85rem}
  .formula-reference dl,.risk-equations dl,.formula-parameters{grid-template-columns:minmax(3.5rem,5rem) minmax(0,1fr)}
  .formula-reference dt,.risk-equations dt,.formula-parameters dt{font-size:.82rem}
  .formula-reference dd,.risk-equations dd,.formula-parameters dd{font-size:.85rem}
  .risk-symbol-table{display:block;max-width:100%;overflow-x:auto;font-size:.78rem;white-space:normal}
  .risk-symbol-table td:first-child{width:5rem;min-width:5rem}
}
@media(prefers-contrast:more){.math-display{border-color:#71551f!important;border-left-color:#71551f!important;box-shadow:none}.math-display:focus-visible{outline-color:#71551f}}
