/* Armorica Capital — selected-month research working paper. */
:root {
  --ocean: #223340;
  --steel: #496577;
  --blue: var(--steel);
  --gold: #b49a60;
  --paper: #f7f7f3;
  --line: #d9e0e2;
  --muted: #566773;
  --danger: #913e26;
  --success: #27624d;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--paper); color: var(--ocean); font: 15px/1.6 'IBM Plex Sans', sans-serif; }
[hidden] { display: none !important; }
a { color: var(--ocean); text-underline-offset: 4px; }
a:hover { color: var(--steel); }
button, select { min-height: 44px; border: 1px solid #9baab2; border-radius: 2px; padding: 8px 10px; color: var(--ocean); background: #fff; font: inherit; }
button { cursor: pointer; }
button:hover:not(:disabled) { background: #edf1f2; border-color: var(--steel); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, .table-scroll:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.skip { position: absolute; top: -80px; left: 16px; z-index: 10; padding: 12px; background: #fff; }
.skip:focus { top: 10px; }
.site-header { max-width: 1248px; margin: auto; padding: 21px 40px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.site-header > a { flex: 0 1 208px; min-width: 0; }
.site-header img { display: block; width: 100%; max-width: 208px; height: auto; }
.site-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px 18px; font-size: 13px; }
.site-header nav a { font-weight: 500; }
#session-user { color: var(--muted); overflow-wrap: anywhere; }
#session-user:empty { display: none; }
#logout { font-size: 13px; }
main { max-width: 1248px; margin: auto; padding: 35px 40px 56px; }
.intro { margin-bottom: 26px; max-width: 920px; }
.kicker { margin: 0 0 10px; color: var(--steel); font-size: 12px; font-weight: 500; letter-spacing: .025em; }
.kicker span { margin: 0 7px; color: var(--gold); }
h1 { margin: 0 0 13px; font-size: 38px; line-height: 1.2; font-weight: 500; letter-spacing: -.025em; }
h2 { margin: 0; font-size: 24px; line-height: 1.3; font-weight: 500; letter-spacing: -.015em; }
h3 { margin: 24px 0 9px; font-size: 16px; line-height: 1.4; font-weight: 600; }
p { margin: 12px 0; }
.lead { max-width: 780px; margin: 0 0 12px; font-size: 16px; line-height: 1.6; }
.aside, .muted, .rounding-note { color: var(--muted); font-size: 13px; }
.intro .aside { margin-bottom: 4px; }
.rounding-note { margin: 0; }
.session-message { margin: 18px 0; font-size: 14px; }
.session-message:has(#session-status:empty) { display: none; }
.selection { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 24px; padding: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.selection label { display: flex; flex-direction: column; min-width: 0; gap: 5px; color: var(--muted); font-size: 12px; }
.selection select { width: 100%; max-width: 100%; font-size: 14px; }
.month-controls { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.month-controls label { width: 150px; }
.month-controls button { width: 44px; flex: 0 0 44px; padding: 8px; }
.selection > label { flex: 0 1 260px; }
#selection-status { flex: 1 1 240px; min-width: 0; margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 22px; margin: 13px 0 22px; }
.flow a { display: flex; align-items: baseline; gap: 9px; min-width: 0; min-height: 44px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 13px; line-height: 1.5; }
.flow b { color: var(--steel); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.flow a:hover { border-bottom-color: var(--gold); }
.meta { display: flex; flex-wrap: wrap; gap: 5px 24px; padding: 0 0 10px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.meta strong { color: var(--ocean); font-weight: 500; }
#app > .muted { margin: 0 0 25px; }
.step { margin: 0 0 28px; padding: 25px 28px 22px; border: 1px solid var(--line); border-top-color: #9baab2; background: #fff; scroll-margin-top: 24px; min-width: 0; }
.step-heading { display: flex; align-items: baseline; gap: 15px; margin-bottom: 15px; }
.step-number { flex: 0 0 24px; color: var(--steel); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.step p { max-width: 940px; }
.formula { margin: 12px 0; padding: 11px 15px; border-left: 2px solid #c7cfd4; background: #f5f7f7; font-size: 14px; line-height: 1.75; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.formula strong { font-weight: 600; }
.formula small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.pair > div { min-width: 0; }
.pair h3 { margin-top: 12px; }
.table-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; margin: 17px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums lining-nums; }
caption { padding: 10px 12px; text-align: left; color: var(--ocean); font-weight: 600; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { text-align: right; background: #f3f5f5; color: var(--muted); font-size: 12px; font-weight: 500; }
thead th:first-child, tbody th { text-align: left; }
tbody th { min-width: 135px; font-weight: 400; }
tbody td { text-align: right; }
/* Market-input units are labels, rather than numerical observations. */
#step-1 th:last-child, #step-1 td:last-child { text-align: left; }
tr:last-child td, tr:last-child th { border-bottom: 0; }
.wide table { min-width: 820px; }
.wide th, .wide td { min-width: 90px; }
.formula-cell { min-width: 220px; overflow-wrap: anywhere; }
.total-row { font-weight: 600; background: #f3f5f5; }
.check { margin: 14px 0; padding: 5px 0 5px 12px; border-left: 2px solid #a5b6ac; color: var(--muted); font-size: 13px; }
.notice, .check.bad { padding: 11px 14px; border-left: 3px solid var(--danger); background: #fcf3ed; color: #733b29; font-size: 13px; }
.unknown { color: var(--danger); font-size: 12px; font-weight: 500; }
details { min-width: 0; margin: 17px 0; padding: 11px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 500; font-size: 13px; }
.source-list { display: grid; grid-template-columns: minmax(100px, 160px) minmax(0, 1fr); gap: 0 20px; margin: 12px 0; font-size: 12px; line-height: 1.65; }
.source-list dt, .source-list dd { min-width: 0; margin: 0; padding: 7px 0; border-bottom: 1px solid #edf0f1; overflow-wrap: anywhere; }
.source-list dt { font-weight: 500; }
.source-list dd { color: var(--muted); }
.numeric-bars { margin: 18px 0 10px; }
.numeric-bars > div { display: grid; grid-template-columns: 110px minmax(25px, 1fr) 92px; align-items: center; gap: 14px; margin: 10px 0; font-size: 13px; }
.numeric-bars strong { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; background: #edf0f1; }
.bar-fill { display: block; height: 100%; background: var(--steel); }
.numeric-bars > div:nth-child(3) .bar-fill { background: var(--gold); }
footer { display: flex; justify-content: space-between; gap: 16px; max-width: 1248px; margin: auto; padding: 22px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .site-header { padding: 20px 28px; }
  main { padding: 30px 28px 44px; }
  .selection > label { flex-basis: 250px; }
  #selection-status { flex-basis: 100%; margin: 0; }
  .flow { gap: 0 16px; }
  .flow a { font-size: 12px; }
  .step { padding: 23px 22px 20px; }
  h2 { font-size: 22px; }
  footer { padding: 22px 28px; }
}
@media (max-width: 600px) {
  .site-header { padding: 16px; gap: 12px; align-items: flex-start; }
  .site-header > a { flex: 0 1 150px; }
  .site-header nav { flex: 1 1 120px; gap: 6px; font-size: 12px; }
  #session-user { width: 100%; text-align: right; font-size: 11px; }
  #logout { min-height: 36px; padding: 5px 8px; font-size: 12px; }
  main { padding: 25px 16px 32px; }
  h1 { font-size: 30px; line-height: 1.2; }
  .kicker { font-size: 11px; }
  .lead { font-size: 15px; }
  .intro { margin-bottom: 21px; }
  .selection { gap: 12px; padding: 14px 0; }
  .month-controls { width: 100%; }
  .month-controls label { flex: 1; width: auto; }
  .selection > label { flex: 1 1 100%; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; margin-bottom: 20px; }
  .flow a { gap: 6px; font-size: 12px; }
  .meta { gap: 5px 16px; }
  .step { margin-bottom: 21px; padding: 20px 14px 17px; }
  .step-heading { gap: 9px; margin-bottom: 13px; }
  .step-number { flex-basis: 20px; font-size: 12px; }
  h2 { font-size: 20px; }
  h3 { font-size: 15px; margin-top: 21px; }
  .step p { font-size: 14px; }
  .step p.aside, .step p.muted, .step p.check, .step p.notice { font-size: 12px; }
  .pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .formula { padding: 10px 12px; font-size: 13px; }
  th, td { padding: 8px 10px; }
  .table-scroll table { min-width: 430px; }
  .table-scroll.wide table { min-width: 820px; }
  .source-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .source-list dt { padding-bottom: 0; border-bottom: 0; }
  .source-list dd { padding-top: 2px; padding-bottom: 9px; }
  .numeric-bars > div { grid-template-columns: 79px minmax(20px, 1fr) 76px; gap: 8px; font-size: 11px; }
  footer { flex-direction: column; gap: 6px; padding: 20px 16px; }
}
/* Linked historical explanation. Pinned controls keep the decision visible at every stage. */
html { scroll-padding-top: 240px; }
.selection { position: sticky; top: 0; z-index: 20; display: block; padding: 12px 18px 7px; background: #f7f7f3; border: 1px solid var(--line); box-shadow: 0 6px 12px #2233400a; }
.selection-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px 20px; }
.selection-controls > label { flex: 0 1 265px; }
.selection-controls #selection-status { margin-bottom: 8px; }
.timeline-heading, .timeline-endpoints { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.timeline-heading { margin-top: 9px; }
.timeline-heading strong { color: var(--ocean); font-size: 13px; font-weight: 500; }
#timeline { height: 42px; width: 100%; cursor: crosshair; }
#timeline svg { width: 100%; height: 100%; display: block; }
#timeline-scrub { display: block; width: 100%; margin: 0; height: 19px; accent-color: var(--steel); cursor: ew-resize; }
.timeline-endpoints { margin-top: -1px; font-size: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.step { scroll-margin-top: 230px; }
.step > p { max-width: 85ch; }
.chart-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; }
.history-figure { min-width: 0; margin: 16px 0; background: #fff; }
.history-figure figcaption { min-height: 92px; border-top: 1px solid var(--line); padding-top: 12px; }
.history-figure h3 { margin: 0 0 6px; font-size: 15px; font-weight: 500; }
.history-figure figcaption p { font-size: 12px; line-height: 1.5; margin: 0; color: var(--muted); max-width: 75ch; }
.history-chart { position: relative; min-width: 0; height: 300px; width: 100%; }
.history-chart[data-chart="positions"], .history-chart[data-chart="returns"] { height: 530px; }
.history-chart[data-chart^="input-"] { height: 230px; }
.history-chart > .muted { padding: 30px; }
.chart-empty { position: absolute; top: 30%; left: 15%; padding: 10px; background: #fffffff0; font-size: 12px; }
.rank-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin: 20px 0 12px; }
.rank-row { display: grid; grid-template-columns: 155px minmax(0,1fr) 80px; align-items: center; gap: 15px; margin: 15px 0; font-size: 12px; }
.rank-row strong { text-align: right; font-weight: 500; }
.rank-track { position: relative; height: 9px; background: linear-gradient(90deg,#dce5e9,#496577); }
.rank-track:after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid #fff; }
.rank-track i { position: absolute; top: -5px; height: 19px; width: 4px; background: var(--gold); border: 1px solid var(--ocean); transform: translateX(-2px); z-index: 1; }
.contribution { display: inline-block; vertical-align: top; width: calc(50% - 12px); margin-right: 12px; border-top: 1px solid var(--line); }
.contribution h4 { margin: 12px 0; font-size: 13px; font-weight: 500; }
.contribution .numeric-bars > div { grid-template-columns: 90px minmax(20px,1fr) 62px; gap: 10px; font-size: 11px; }
#formula-audit { padding: 18px; background: #edf1f1; }
#formula-audit .step { margin-top: 18px; }
#formula-audit #audit-distance-reference { display: none; }
input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 900px) { .selection-controls #selection-status { flex-basis: 100%; margin: 0; } .chart-grid { gap: 12px; } }
@media (max-width: 600px) {
 html { scroll-padding-top: 285px; }
 .selection { margin: 0 -6px; padding: 9px 10px 6px; }
 .selection-controls { gap: 6px 10px; }
 .selection-controls .month-controls { width: auto; flex: 1 1 100%; }
 .selection-controls > label { flex: 1; }
 .selection-controls > label select { max-width: 100%; }
 .selection-controls #selection-status { display: none; }
 .timeline-heading > span:last-child { display: none; }
 #timeline { height: 29px; }
 .selection label { gap: 1px; font-size: 11px; }
 .selection select, .selection button { min-height: 36px; padding-top: 5px; padding-bottom: 5px; }
 .chart-grid { grid-template-columns: minmax(0,1fr); gap: 0; }
 .history-figure figcaption { min-height: 0; padding-bottom: 10px; }
 .rank-row { grid-template-columns: 115px minmax(0,1fr) 62px; gap: 7px; font-size: 11px; }
 .contribution { width: 100%; margin-right: 0; }
 .step { scroll-margin-top: 270px; }
 .flow { margin-top: 10px; }
 h1 { font-size: 29px; }
}
@media print { .selection { display: none; } .history-figure { break-inside: avoid; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  body { background: #fff; }
  .site-header nav, .flow, .selection, .skip { display: none; }
  main { padding: 24px 0; }
  .step { padding: 18px 0; border: 0; border-top: 1px solid var(--line); }
  .step-heading { break-after: avoid; }
  .table-scroll { overflow: visible; }
  .wide table { min-width: 0; font-size: 10px; }
}
