/* Financial Time Series Analysis — working-paper style on pure white.
   Serif (STIX Two Text) for everything that reads like an article: titles, figure and table
   captions, tables, notes. Sans (Inter) for the controls. Formulas: MathJax (LaTeX fonts).
   Colours of the charts: blue = observed, red / orange = fitted models, grey = references. */

:root {
  --surface: #ffffff;
  --ink: #191919;
  --ink-2: #5e5e5e;
  --rule: #e7e7e7;
  --axis: #c2c2c2;
  --accent: #1757ac;
  --serif: "STIX Two Text", "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; background: var(--surface); color: var(--ink); font: 15px/1.5 var(--sans); }
a { color: var(--accent); }
a:hover { color: #0e3d7e; }
.wrap { max-width: 1280px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: underline; text-align: left;
}

/* ---------------------------------------------------------------- masthead and sections */

.masthead { border-bottom: 1px solid var(--rule); }
.masthead-row {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 8px 24px; padding-top: 28px; padding-bottom: 16px;
}
.masthead h1 { font: 600 30px/1.15 var(--serif); margin: 0; }
.byline { margin: 4px 0 0; color: var(--ink-2); font: italic 16px/1.4 var(--serif); }
.site-links { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; }

.sections { display: flex; gap: 0 32px; overflow-x: auto; scrollbar-width: none; }
.sections button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 0 10px;
  font: inherit; font-size: 15px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.sections button .num { font-family: var(--serif); font-weight: 600; margin-right: 8px; }
.sections button[aria-current="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.sections button:hover { color: var(--ink); }

.loading { margin-top: 40px; color: var(--ink-2); }

/* ---------------------------------------------------------------- access code */

.login { max-width: 420px; margin: 48px auto; padding: 0 24px; display: grid; gap: 12px; }
.login h2 { font: 600 22px/1.3 var(--serif); margin: 0; }
.login p { margin: 0; color: var(--ink-2); font-size: 14px; }
.login input[type="password"] { font: inherit; padding: 9px 10px; border: 1px solid var(--axis); border-radius: 4px; }
.login button {
  justify-self: start; font: inherit; padding: 8px 20px; border: 1px solid var(--ink);
  border-radius: 4px; background: var(--ink); color: #fff; cursor: pointer;
}
.login button:disabled { opacity: 0.6; cursor: wait; }
.login-msg { min-height: 1.5em; }
.login-msg.error { color: #b42318 !important; }


/* ---------------------------------------------------------------- layout and controls */

.layout {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 32px;
  padding-top: 24px; padding-bottom: 40px;
}
.controls { flex: 1 1 232px; max-width: 260px; font-size: 14px; display: flex; flex-direction: column; gap: 18px; }
main { flex: 999 1 560px; min-width: 0; }

.ctl-title {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 6px;
}
.controls select, .controls input[type="search"], .controls input[type="date"] {
  width: 100%; min-width: 0; font: inherit; font-size: 14px; padding: 7px 8px;
  border: 1px solid var(--axis); border-radius: 4px; background: #fff; color: var(--ink);
}
.controls input[type="search"] { margin-bottom: 6px; }
.asset-meta { margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.asset-note { color: var(--ink-2); font-size: 12px; font-style: italic; }

/* segmented controls built on radio buttons */
.seg { display: flex; gap: 6px; margin-bottom: 6px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; text-align: center; font-size: 13px; padding: 7px 4px; border: 1px solid var(--axis);
  border-radius: 4px; background: #fff; color: var(--ink);
}
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg input:disabled + span { color: #b0b0b0; border-color: var(--rule); }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button {
  font: inherit; font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--axis); background: #fff; color: var(--ink);
}
.pills button[aria-pressed="true"], .pills button[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.dates label { display: grid; gap: 2px; }
.controls .dates input[type="date"] { font-size: 12px; padding: 5px 4px; }
.pair { display: flex; gap: 10px; }
.pair > div { flex: 1; min-width: 0; }
.share { border-top: 1px solid var(--rule); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- main column */

.subtabs { margin-bottom: 20px; }
.subtabs button { font-size: 13px; padding: 6px 13px; }

.summary { font-family: var(--serif); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 12px 0 14px; margin-bottom: 26px; }
.summary .line { margin: 0 0 10px; font-size: 17px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi .k { font: 500 11px/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.kpi .v { font-size: 23px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.kpi .u { font-size: 14px; color: var(--ink-2); }

.panel { display: none; }
.panel.active { display: block; }

.fig { margin: 0 0 22px; }
.fig figcaption { font: 17px/1.35 var(--serif); margin-bottom: 2px; }
.chart { width: 100%; height: 420px; }
.chart.short { height: 300px; }
.chart.tall { height: 600px; }

.note, .prose { font: 15px/1.55 var(--serif); color: #444; max-width: 780px; margin: 4px 0 26px; }
.note::before { content: "Note. "; font-style: italic; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin: 0 16px 10px 0; }
.inline input[type="number"], .row input[type="number"] { width: 84px; padding: 4px 6px; font: inherit; }
.inline select, .row select { padding: 4px 6px; font: inherit; }
.row { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; margin: 8px 0 4px; }
.row label { display: inline-flex; align-items: center; gap: 6px; }
h2.sub { font: 600 22px/1.3 var(--serif); margin: 4px 0 10px; }

.pager { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--rule); padding-top: 14px; margin-top: 8px; font-size: 14px; }
.pager button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.pager button:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- tables (booktabs style) */

.table-wrap { overflow-x: auto; margin: 6px 0 4px; }
table.data { border-collapse: collapse; font: 16px/1.4 var(--serif); font-variant-numeric: tabular-nums; min-width: 460px; }
table.data caption { text-align: left; font-size: 17px; padding-bottom: 8px; caption-side: top; }
table.data thead tr { border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); }
table.data tbody tr:last-child { border-bottom: 1.5px solid var(--ink); }
table.data th, table.data td { padding: 6px 14px; text-align: right; }
table.data td { white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data thead th { font-weight: 600; }
table.data tbody th { font-weight: 400; }
.reject { font-weight: 600; }
.alert { font: 15px/1.5 var(--serif); color: var(--ink); max-width: 780px; margin: 0 0 16px; padding: 8px 14px;
  border-left: 3px solid #e07b00; background: #fff7ec; }
.alert button { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
table.data th.l, table.data td.l { text-align: left; }

/* ---------------------------------------------------------------- asset pickers */

.pick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 18px;
  font-size: 13px; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--rule); border-radius: 4px; padding: 10px 12px; margin-bottom: 12px;
}
.pick fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.pick legend { font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); padding: 0; margin-bottom: 3px; }
.pick label { display: block; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 4px; vertical-align: -1px; }

.foot { border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 12px; padding: 16px 0 28px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 860px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .masthead h1 { font-size: 24px; }
  .layout { gap: 16px; padding-top: 16px; }
  .controls { max-width: none; flex-basis: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; }
  .controls section:first-child, .controls section:nth-child(3) { grid-column: 1 / -1; }
  .share { grid-column: 1 / -1; flex-direction: row; gap: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { height: 340px; }
  .row label { width: 100%; }
  .row select { flex: 1; min-width: 0; }
  .chart.tall { height: 520px; }
}

/* ---------------------------------------------------------------- print: the open analysis as a handout */

@media print {
  @page { margin: 16mm 14mm; }
  body { font-size: 11pt; }
  .site-links, .sections, .controls, .subtabs, .pager, .pick, .inline, .row, .foot, .loading { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .layout { display: block; padding: 0; }
  .masthead { border: 0; }
  .masthead-row { padding: 0 0 6pt; }
  .fig, table.data, .kpis, .note { break-inside: avoid; }
  .chart { height: 360px; }
  .chart.short { height: 260px; }
  .chart.tall { height: 520px; }
  a { color: inherit; text-decoration: none; }
}
