/* BottiAi multi-page layer. Builds on the tokens in bottiai-onepage.css. */

/* Header actions */
.top-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.alarm-link {
  display: inline-flex;
  height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.alarm-link:hover, .alarm-link.active { border-color: var(--line-strong); color: var(--ink); }

/* Breadcrumbs */
.crumbs { padding-top: 14px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 0; color: var(--muted); font-size: 13px; }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: "/"; margin: 0 8px; color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs [aria-current] { color: var(--ink-2); }

/* Hero */
.page-hero { padding-block: 30px 34px; }
.eyebrow {
  margin-bottom: 10px;
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.eyebrow a { color: inherit; }
.page-hero h1, .page-lage h1 {
  max-width: 22ch;
  font-family: var(--display);
  font-size: clamp(32px, 4.6vw, 54px);
  font-weight: 680;
  letter-spacing: -0.034em;
  line-height: 1.06;
}
.page-hero h1 { max-width: 26ch; }
.hero-sub { color: var(--muted); font-weight: 560; }
.lead { max-width: 70ch; margin-top: 14px; color: var(--ink-2); font-size: 17px; }
.lead a, .table-note a, .provenance a, .today-line a, .fine-print a, .section-head p a, .method-grid a { color: var(--brand-ink); text-underline-offset: 3px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 880px;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.kpis div { padding: 14px 18px; }
.kpis div + div { border-left: 1px solid var(--line); }
.kpis dt { color: var(--muted); font-size: 13px; }
.kpis dd { font-family: var(--display); font-size: 26px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpis dd small { color: var(--muted); font-size: 14px; font-weight: 550; }

.today-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 18px; color: var(--ink-2); font-size: 15px; }
.today-line .status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.today-line .status-dot.is-on { background: var(--signal-mark); box-shadow: 0 0 0 4px var(--signal-band); }

/* Buttons */
.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 620;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn-primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn-primary:hover { border-color: var(--brand-ink); background: var(--brand-ink); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn-small { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.is-on { border-color: var(--signal-mark); background: var(--signal-band); color: var(--ink); }

.lage-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.lage .lage-actions { margin-bottom: 4px; }

/* Provenance */
.provenance { max-width: 80ch; margin-top: 16px; color: var(--muted); font-size: 14px; }
.badge-live, .badge-retro {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}
.badge-live { background: var(--signal); color: var(--signal-ink); }
.badge-late { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: var(--history); color: var(--history-ink); font-size: 12px; font-weight: 700; vertical-align: 1px; }
.badge-retro { background: var(--surface-2); color: var(--ink-2); }

/* Static level bars on day pages */
progress.level {
  width: 100%;
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: var(--surface-2);
}
progress.level::-webkit-progress-bar { border-radius: 999px; background: var(--surface-2); }
progress.level-score::-webkit-progress-value { border-radius: 999px; background: var(--model); }
progress.level-breadth::-webkit-progress-value { border-radius: 999px; background: var(--breadth); }
progress.level-breadth.is-stress::-webkit-progress-value { background: var(--stress); }
progress.level-score::-moz-progress-bar { border-radius: 999px; background: var(--model); }
progress.level-breadth::-moz-progress-bar { border-radius: 999px; background: var(--breadth); }

/* Analog days */
.analog-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.analog-panel, .analog-side { padding: 6px 0 14px; }
.analog-panel .fine-print, .analog-panel .table-note { padding-inline: 18px; }
.analog-side { padding: 16px 18px; }
.analog-side h3 { margin-bottom: 8px; font-size: 15px; font-weight: 650; }
.analog-list li + li { border-top: 1px solid var(--line); }
.analog-list a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0 12px;
  padding: 9px 0;
  color: inherit;
  text-decoration: none;
}
.analog-list a:hover b { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.analog-list b { font-weight: 650; font-variant-numeric: tabular-nums; }
.analog-list span { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.analog-list em { grid-row: 1; grid-column: 2; justify-self: end; font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; }
.analog-list em small { color: var(--muted); font-size: 12px; font-weight: 500; }
.text-link { display: inline-block; margin-top: 10px; color: var(--brand-ink); font-size: 14px; font-weight: 600; text-underline-offset: 3px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-wrap > .data-table { min-width: 560px; }
.data-table th, .data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table thead th { color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.3; vertical-align: bottom; }
.data-table thead th small, .data-table tbody th small { color: var(--muted); font-weight: 500; }
.data-table tbody th { font-weight: 600; }
.data-table .num { text-align: right; white-space: nowrap; }
.data-table .strong { font-weight: 700; }
.data-table a { color: var(--brand-ink); text-underline-offset: 3px; }
.data-table tr.is-current td, .data-table tr.is-current th { background: var(--brand-wash); }
.data-table tr.is-signal td:first-child, .data-table tr.is-signal th:first-child { box-shadow: inset 3px 0 0 var(--signal-mark); }
.data-table tbody tr:hover td, .data-table tbody tr:hover th { background: var(--surface-2); }
.panel > .table-wrap { margin: 0; border: 0; }
.table-note { margin-top: 12px; color: var(--ink-2); font-size: 14px; }
.tag-signal { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--signal); color: var(--signal-ink); font-size: 11.5px; font-weight: 700; }

/* Charts */
.chart-figure { margin: 0; }
.chart-box { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.chart-top { height: 300px; }
.chart-bottom { height: 150px; border-top: 1px solid var(--line); }
.chart-box[data-chart="fund"] .chart-top { height: 380px; }
.chart-fallback { padding: 18px; color: var(--muted); font-size: 14px; }
.chart-box.ready .chart-fallback { display: none; }
.chart-figure figcaption { margin-top: 8px; color: var(--muted); font-size: 13px; }
.chart-legend { position: absolute; z-index: 3; top: 10px; left: 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; pointer-events: none; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 3px; border-radius: 2px; }
.chart-legend .k-spy { background: var(--brand); }
.chart-legend .k-sma { background: var(--muted); }
.chart-legend .k-breadth { background: var(--breadth); }
.chart-legend .k-score { background: var(--model); }
.chart-legend .k-signal { width: 8px; height: 8px; border-radius: 50%; background: var(--signal-mark); }

/* Pager */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.pager a {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.pager a:hover { border-color: var(--line-strong); }
.pager small { color: var(--muted); font-size: 12px; }
.pager span { font-weight: 620; }
.pager-next { margin-left: auto; text-align: right; }

/* Signal study */
.study-teaser { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px; margin-top: 18px; padding: 16px 18px; }
.study-teaser p { max-width: 72ch; color: var(--ink-2); }
.rugs { margin-top: 18px; padding: 16px 18px 10px; }
.rugs h3 { font-size: 15px; font-weight: 650; }
.rug-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 10px; color: var(--muted); font-size: 12px; }
.rug-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rug-legend .tick { width: 3px; height: 12px; border-radius: 1px; }
.rug-legend .tick.pos { background: var(--pos); }
.rug-legend .tick.neg { background: var(--neg); }
.rug-legend .tick.median { width: 4px; background: var(--ink); }
.rug-legend .tick.base { width: 0; border-left: 2px dashed var(--muted); }
.rug-row { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 6px 0; }
.rug-label { font-size: 13px; font-weight: 600; }
.rug { width: 100%; height: 40px; border-radius: 6px; background: var(--surface-2); }
.rug line { vector-effect: non-scaling-stroke; }
.rug-tick { stroke-width: 2; opacity: 0.8; }
.rug-tick.pos { stroke: var(--pos); }
.rug-tick.neg { stroke: var(--neg); }
.rug-zero { stroke: var(--line-strong); stroke-width: 1; }
.rug-median { stroke: var(--ink); stroke-width: 3; }
.rug-base { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 4 3; }
.rug-range { display: flex; grid-column: 2; justify-content: space-between; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.method-grid.limits { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Archive */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.year-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; color: inherit; text-decoration: none; transition: border-color 120ms ease, transform 120ms ease; }
.year-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.year-head { display: flex; align-items: baseline; justify-content: space-between; }
.year-head b { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.year-head em { font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; }
.year-card .spark { width: 100%; height: 44px; margin: 6px 0; }
.year-meta { color: var(--muted); font-size: 13px; }

.heatmap-wrap { padding: 16px 18px 12px; overflow-x: auto; }
.heatmap { display: block; width: 100%; min-width: 640px; height: auto; }
.heatmap text { fill: var(--muted); font-family: var(--sans); font-size: 10px; }
.heatmap rect { stroke: transparent; stroke-width: 1.5; }
.heatmap a:hover rect, .heatmap a:focus rect { stroke: var(--ink); }
.heatmap .h0, .heatmap-legend .h0 { fill: var(--surface-2); background: var(--surface-2); }
.heatmap .h1, .heatmap-legend .h1 { fill: color-mix(in srgb, var(--breadth) 18%, var(--surface)); background: color-mix(in srgb, var(--breadth) 18%, var(--surface)); }
.heatmap .h2, .heatmap-legend .h2 { fill: color-mix(in srgb, var(--breadth) 38%, var(--surface)); background: color-mix(in srgb, var(--breadth) 38%, var(--surface)); }
.heatmap .h3, .heatmap-legend .h3 { fill: color-mix(in srgb, var(--stress) 22%, var(--surface)); background: color-mix(in srgb, var(--stress) 22%, var(--surface)); }
.heatmap .h4, .heatmap-legend .h4 { fill: color-mix(in srgb, var(--stress) 48%, var(--surface)); background: color-mix(in srgb, var(--stress) 48%, var(--surface)); }
.heatmap .h5, .heatmap-legend .h5 { fill: color-mix(in srgb, var(--stress) 82%, var(--surface)); background: color-mix(in srgb, var(--stress) 82%, var(--surface)); }
.heatmap rect.sig { stroke: var(--signal-mark); stroke-width: 2.5; }
.heatmap-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.heatmap-legend i { width: 12px; height: 12px; border-radius: 3px; }
.heatmap-legend i.sig { margin-left: 12px; border: 2.5px solid var(--signal-mark); background: transparent; }

/* ETFs */
.fund-link { display: flex; flex-direction: column; color: inherit !important; text-decoration: none; }
.fund-link b { color: var(--brand-ink); font-weight: 700; }
.fund-link span { color: var(--muted); font-size: 13px; font-weight: 500; }
.fund-link:hover b { text-decoration: underline; text-underline-offset: 3px; }
.score-pill { display: inline-block; min-width: 38px; padding: 1px 8px; border-radius: 999px; background: var(--brand-wash); color: var(--brand-ink); font-weight: 650; text-align: center; }
.detail-link { margin: 10px 16px 14px; }

/* Alerts */
.alert-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border-top: 0; padding-top: 0; }
.alert-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.alert-card header h2 { font-size: 20px; font-weight: 680; letter-spacing: -0.01em; }
.alert-card header p { margin-top: 4px; color: var(--muted); font-size: 14.5px; }
.alert-card .btn { align-self: flex-start; }
#push-card { grid-row: span 2; }
.topic-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; }
.topic { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.topic:hover { border-color: var(--line-strong); }
.topic input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); }
.topic span { display: flex; flex-direction: column; }
.topic small { color: var(--muted); font-size: 13px; }
.alert-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.push-state { min-height: 1.4em; color: var(--ink-2); font-size: 14px; font-weight: 550; }
.push-state.is-on { color: var(--pos); }
.push-state.is-error { color: var(--neg); }
.feed-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.feed-row div { display: flex; grid-column: 1 / -1; flex-direction: column; }
.feed-row small { color: var(--muted); font-size: 13px; }
.feed-row code, .snippet code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.feed-row code { overflow: hidden; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); text-overflow: ellipsis; white-space: nowrap; }
.badge-preview { max-width: 100%; height: auto; }

/* Embed */
.embed-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 16px; align-items: start; border-top: 0; padding-top: 0; }
.embed-preview { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.embed-preview h2 { font-size: 18px; font-weight: 660; }
.badge-stage { display: grid; place-items: center; padding: 26px 14px; border-radius: 12px; }
.badge-stage.light { background: #f5f5f0; }
.badge-stage.dark { background: #0b0e14; }
.badge-stage img { max-width: 100%; height: auto; }
.embed-codes { display: flex; flex-direction: column; gap: 12px; }
.snippet { padding: 14px 16px; }
.snippet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.snippet h3 { font-size: 14.5px; font-weight: 650; }
.snippet pre { margin: 0; padding: 12px; overflow-x: auto; border-radius: 10px; background: var(--surface-2); white-space: pre-wrap; word-break: break-all; }

/* Protocol */
.protocol-table td small { color: var(--muted); }
.hash { color: var(--muted); font-size: 12px; }

/* Articles */
.article { padding-bottom: 40px; }
.article-hero { padding-bottom: 20px; }
.prose { max-width: 72ch; color: var(--ink-2); font-size: 17px; line-height: 1.7; }
.prose > * + * { margin-top: 16px; }
.prose h2 { margin-top: 36px; color: var(--ink); font-family: var(--display); font-size: 24px; font-weight: 670; letter-spacing: -0.02em; line-height: 1.2; }
.prose ul, .prose ol { padding-left: 22px; }
.prose ul { list-style: disc; }
.prose ol.numbered { list-style: decimal; }
.prose li + li { margin-top: 6px; }
.prose strong { color: var(--ink); }
.prose a { color: var(--brand-ink); text-underline-offset: 3px; }
.prose .table-wrap { font-size: 15px; }
.article-more { margin-top: 48px; }
.article-more h2 { margin-bottom: 12px; font-size: 18px; font-weight: 660; }
.card-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.card-list.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 20px; }
.link-card { display: flex; height: 100%; flex-direction: column; gap: 6px; padding: 18px; color: inherit; text-decoration: none; transition: border-color 120ms ease, transform 120ms ease; }
.link-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.link-card strong { font-size: 17px; font-weight: 660; }
.link-card span { color: var(--muted); font-size: 14.5px; }

/* Call to action */
.cta-band { margin-top: 20px; border-top: 1px solid var(--line); background: var(--surface); }
.cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; padding-block: 40px; }
.cta-inner h2 { font-family: var(--display); font-size: clamp(26px, 3vw, 34px); font-weight: 680; letter-spacing: -0.028em; }
.cta-inner p:last-child { max-width: 62ch; margin-top: 8px; color: var(--muted); }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Footer */
.site-footer .footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 24px;
  padding-block: 34px 22px;
}
.footer-grid nav { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.footer-grid nav strong { margin-bottom: 4px; color: var(--ink); font-size: 13px; font-weight: 650; }
.footer-grid nav a { color: var(--muted); text-decoration: none; }
.footer-grid nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-block: 16px 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* Toast */
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 22px;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 20, 32, 0.25);
  transform: translateX(-50%);
}

.status-hero { min-height: 50vh; }
.page-lage .history-note a { color: var(--history-ink); font-weight: 650; }

@media (max-width: 1040px) {
  .analog-grid, .alert-layout, .embed-layout { grid-template-columns: minmax(0, 1fr); }
  #push-card { grid-row: auto; }
  .method-grid.limits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .footer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-grid .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .alarm-link span { display: none; }
  .alarm-link { width: 38px; justify-content: center; padding: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis div:nth-child(3) { border-left: 0; }
  .kpis div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .chart-top { height: 260px; }
  .chart-bottom { height: 130px; }
}

@media (max-width: 640px) {
  .page-hero { padding-block: 20px 26px; }
  .lead { font-size: 16px; }
  .kpis dd { font-size: 22px; }
  .kpis div { padding: 12px 14px; }
  .method-grid.limits, .card-list, .card-list.wide { grid-template-columns: minmax(0, 1fr); }
  .lage-actions .btn { flex: 1 1 auto; }
  .data-table th, .data-table td { padding: 9px 10px; }
  .rug-row { grid-template-columns: minmax(0, 1fr); }
  .rug-range { grid-column: 1; }
  .site-footer .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cta-inner { padding-block: 30px; }
  .cta-actions, .cta-actions .btn { width: 100%; }
  .prose { font-size: 16px; }
  .pager span { font-size: 14px; }
}
