/* Reproducibility Atlas — paper & ink, single screen */
:root {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #1c1d1f;
  --ink-2: #45474a;
  --muted: #7d7a74;
  --faint: #a8a49c;
  --rule: #e8e8e6;
  --rule-2: #d2d2cf;
  --band: rgba(28, 29, 31, .075);
  --accent: #b4432a;
  --accent-soft: rgba(180, 67, 42, .1);
  --good: #2f7a5a;
  --warn: #8a5a1a;
  --stage: #ffffff;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  --pad: 22px;
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.45; }
button, select, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:is(a, button, select, input, summary, [tabindex]):focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ---------- Frame: fills the viewport ---------- */
.app { height: 100vh; height: 100dvh; min-height: 640px; display: grid; grid-template-rows: auto auto minmax(0, 1fr); padding: 0 var(--pad); max-width: 1680px; margin: 0 auto; }

.masthead { display: flex; align-items: center; gap: 20px; padding: 12px 0 11px; border-bottom: 1px solid var(--ink); }
.wordmark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; font-family: var(--serif); font-size: 1.12rem; white-space: nowrap; }
.seal { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.tagline { flex: 1; font-family: var(--serif); font-style: italic; color: var(--muted); font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-nav { display: flex; align-items: center; gap: 18px; }
.link { border: 0; background: none; padding: 0; cursor: pointer; font-size: .8rem; color: var(--muted); transition: color .2s; }
.link:hover { color: var(--ink); }
.theme-toggle { display: none !important; width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; padding: 0; }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle circle { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.theme-toggle path { fill: var(--muted); }

/* ---------- Controls ---------- */
.controls { display: grid; grid-template-columns: 1.25fr .8fr 1.25fr 1.15fr .85fr 2.6fr; gap: 0; border-bottom: 1px solid var(--rule); }
.field { display: grid; align-content: start; gap: 3px; min-width: 0; padding: 10px 16px 11px; border-left: 1px solid var(--rule); }
.field:first-child { padding-left: 0; border-left: 0; }
.field > span, .field label > span { font-size: .64rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.field select {
  appearance: none; -webkit-appearance: none; width: 100%; border: 0; border-radius: 0; background-color: transparent;
  font-size: .95rem; color: var(--ink); padding: 2px 18px 2px 0; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23b4432a' stroke-width='1.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; background-size: 9px;
}
.field select:hover:not(:disabled) { color: var(--accent); }
.field select:disabled { opacity: .45; cursor: default; }
.field-disorder select { font-family: var(--serif); font-size: 1.12rem; }
.n-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; }
.n-select { font-size: 1.12rem !important; font-variant-numeric: tabular-nums; color: var(--accent) !important; }
.n-scale { min-width: 0; padding-top: 4px; }
.n-ticks { display: flex; justify-content: space-between; margin: 1px 6px 0; }
.n-ticks button { border: 0; background: none; padding: 0; width: 0; display: flex; justify-content: center; font-size: .6rem; color: var(--faint); cursor: pointer; font-variant-numeric: tabular-nums; }
.n-ticks button:hover { color: var(--ink); }
.n-ticks button.active { color: var(--accent); font-weight: 600; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; --fill: 0%; display: block; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: linear-gradient(var(--ink), var(--ink)) 0 / var(--fill) 100% no-repeat, var(--rule-2); }
input[type=range]::-moz-range-track { height: 1px; background: var(--rule-2); }
input[type=range]::-moz-range-progress { height: 1px; background: var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -6px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--accent); }
input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--accent); }
input[type=range]:disabled { opacity: .4; }

/* ---------- Board ---------- */
.board {
  min-height: 0; display: grid; padding: 14px 0 14px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(260px, 310px);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1.25fr);
  grid-template-areas: "a b c notes" "brain brain brain compare";
  gap: 0;
}
.cell { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 0 22px 14px; }
.cell-a { grid-area: a; padding-left: 0; }
.cell-b { grid-area: b; border-left: 1px solid var(--rule); }
.cell-c { grid-area: c; border-left: 1px solid var(--rule); }
.outcome-card.static { cursor: default; }
.outcome-card.static .mark { border-color: var(--ink-2); background: var(--ink-2); }
.outcome-card.static .outcome-name { color: var(--ink); }
.outcome-card.static strong { color: var(--ink); }
.inline-check { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: .66rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); cursor: pointer; }
.inline-check input { margin: 0; accent-color: var(--accent); }
.cell-notes { grid-area: notes; border-left: 1px solid var(--rule); padding-right: 0; }
.cell-brain { grid-area: brain; padding: 14px 22px 0 0; border-top: 1px solid var(--rule); }
.cell-compare { grid-area: compare; padding: 14px 0 0 22px; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.cell-title { font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cell-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.context-tag { font-size: .7rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Outcome panels */
.outcome-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: baseline; width: 100%; text-align: left; padding: 0 0 4px; border: 0; background: none; cursor: pointer; color: var(--ink); }
.outcome-name { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.outcome-name em { margin-left: auto; font-family: var(--serif); font-size: .95rem; letter-spacing: 0; text-transform: none; color: var(--faint); }
.mark { width: 7px; height: 7px; border-radius: 50%; border: 1.2px solid var(--rule-2); transition: all .2s; }
.outcome-card.active .mark { border-color: var(--accent); background: var(--accent); }
.outcome-card.active .outcome-name { color: var(--ink); }
.outcome-card strong { font-weight: 300; font-size: clamp(1.9rem, 2.8vw, 2.6rem); line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; }
.outcome-card:not(.active) strong { color: var(--ink-2); }
.outcome-description { font-size: .76rem; color: var(--muted); }
.outcome-description.limited-support { color: var(--warn); }
.chart-box { flex: 1; min-height: 90px; position: relative; }
.chart-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.panel-foot { font-size: .74rem; color: var(--ink-2); min-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-foot b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Chart */
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-grid.zero-line { stroke: var(--rule-2); }
.chart-axis { stroke: var(--ink); stroke-width: 1; }
.chart-label { fill: var(--muted); font-size: 10px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.chart-axis-label { fill: var(--faint); font-size: 10px; font-family: var(--serif); font-style: italic; }
.chart-empty { fill: var(--muted); font-size: 13px; text-anchor: middle; font-family: var(--serif); font-style: italic; }
.curve-band { fill: var(--band); pointer-events: none; }
.curve-line { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.curve-line.animate { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s cubic-bezier(.4, .1, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ref-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 3; }
.ref-label { fill: var(--muted); font-size: 9.5px; font-family: var(--sans); }
.selected-guide { stroke: var(--accent); stroke-width: 1; opacity: .55; }
.curve-dot { fill: var(--ink); stroke: var(--paper); stroke-width: 1.2; pointer-events: none; }
.curve-dot.active { fill: var(--paper); stroke: var(--accent); stroke-width: 1.6; }
.curve-core { fill: var(--accent); pointer-events: none; }
.curve-point { cursor: pointer; }
.curve-hitarea { fill: transparent; }
.curve-point:hover .curve-hitarea { fill: var(--ink); fill-opacity: .025; }
.curve-point:focus-visible { outline: none; }
.curve-point:focus-visible .curve-hitarea { stroke: var(--accent); stroke-width: 1; }
.tooltip { position: fixed; z-index: 50; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 12px)); transition: opacity .12s; padding: 6px 9px; background: var(--ink); color: var(--paper); font-size: .72rem; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tooltip.show { opacity: 1; }
.tooltip b { font-weight: 500; font-size: .84rem; }
.tooltip span { opacity: .7; }

/* Better designs */
.cell-notes .cell-title { margin-bottom: 6px; }
.recommendation-option { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; padding: 8px 0; border-top: 1px solid var(--rule); }
.recommendation-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: .74rem; color: var(--muted); }
.recommendation-gain { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.recommendation-gain.positive { color: var(--good); }
.recommendation-value { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 0; min-width: 0; }
.recommendation-value strong { font-weight: 300; font-size: 1.65rem; line-height: 1.1; letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.recommendation-value span { font-family: var(--serif); font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.companion { font-size: .7rem; color: var(--faint); }
.recommendation-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.recommendation-support { margin-top: 3px; font-size: .68rem; color: var(--warn); }
.text-button { border: 0; background: none; padding: 0; cursor: pointer; font-size: .78rem; font-weight: 500; color: var(--accent); border-bottom: 1px solid transparent; }
.text-button:not(:disabled)::after { content: " →"; }
.text-button:hover:not(:disabled) { border-bottom-color: var(--accent); }
.text-button:disabled { color: var(--faint); cursor: default; }

/* Brain */
.brain-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.segmented { display: inline-flex; gap: 14px; }
.segment { border: 0; background: none; padding: 2px 0; font-size: .78rem; color: var(--muted); cursor: pointer; border-bottom: 1px solid transparent; }
.segment:hover:not(:disabled) { color: var(--ink); }
.segment.active { color: var(--ink); border-bottom-color: var(--accent); }
.segment:disabled { opacity: .4; cursor: default; }
.mini-select select { appearance: none; -webkit-appearance: none; border: 0; border-bottom: 1px solid var(--rule-2); background: transparent; font-size: .76rem; color: var(--ink); padding: 1px 2px; cursor: pointer; border-radius: 0; }
.brain-stage { position: relative; flex: 1; min-height: 160px; background: var(--stage); border: 1px solid var(--rule); }
.plotly-brain { position: absolute; inset: 0; overflow: hidden; }
.brain-empty { display: grid; place-items: center; height: 100%; padding: 20px; text-align: center; color: #7d7a74; font-family: var(--serif); font-style: italic; }
.brain-empty.loading { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .4; } }
.brain-head-text { display: flex; align-items: baseline; gap: 14px; min-width: 0; flex: 1 1 260px; }
.brain-caption { margin: 0; min-width: 0; font-size: .72rem; color: #45474a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brain-note { color: #7d7a74; }
.brain-note:not(:empty)::before { content: " · "; color: #a8a49c; }

/* Compare */
.tabs { display: inline-flex; gap: 14px; }
.tab { border: 0; background: none; padding: 2px 0; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); cursor: pointer; border-bottom: 1px solid transparent; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink-2); border-bottom-color: var(--accent); }
.pane { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.small-caption { font-size: .7rem; color: var(--muted); margin-bottom: 4px; }
.ranking-list { display: grid; }
.rank-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) 48px; grid-template-rows: auto auto; column-gap: 6px; row-gap: 3px; align-items: center; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--rule); background: none; padding: 6px 0; font-size: .78rem; color: var(--ink-2); cursor: pointer; }
.rank-item:hover, .rank-item.active { color: var(--ink); }
.rank-pos { grid-row: 1; font-size: .66rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.rank-item.active .rank-pos { color: var(--accent); }
.rank-name { grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; }
.rank-track { grid-column: 2 / 4; grid-row: 2; position: relative; height: 2px; background: var(--rule); }
.rank-track.signed::before { content: ""; position: absolute; left: 50%; top: -3px; height: 8px; width: 1px; background: var(--rule-2); }
.rank-bar { position: absolute; height: 100%; background: var(--ink-2); transform-origin: left; animation: grow .7s cubic-bezier(.3, .7, .2, 1); }
.rank-item.active .rank-bar { background: var(--accent); }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes grow-in { from { opacity: 0; transform: translateY(3px); } }

.load-landscape { margin-top: 10px; }
.land-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 36px; align-items: center; gap: 8px; width: 100%; padding: 5px 0; border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left; cursor: pointer; font-size: .76rem; color: var(--ink-2); }
.land-row:hover { color: var(--ink); }
.land-row.active { color: var(--accent); }
.land-row.missing { cursor: default; color: var(--faint); }
.land-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.land-track { position: relative; height: 12px; }
.land-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--rule); }
.land-whisker { position: absolute; top: 50%; height: 1px; background: var(--ink-2); opacity: .45; }
.land-dot { position: absolute; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--ink); }
.land-row.active .land-dot { background: var(--paper); border: 1.5px solid var(--accent); }
.land-row.active .land-whisker { background: var(--accent); opacity: .8; }
.land-value { text-align: right; font-variant-numeric: tabular-nums; font-size: .72rem; }
.land-row.missing .land-value { font-size: .62rem; }
.land-axis { display: grid; grid-template-columns: 128px minmax(0, 1fr) 36px; gap: 8px; margin-top: 3px; font-size: .62rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.land-axis div { display: flex; justify-content: space-between; }

/* ---------- Sheet (details & methods) ---------- */
.sheet { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 30px 34px; border: 1px solid var(--rule-2); background: var(--paper); color: var(--ink); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .35); }
.sheet::backdrop { background: rgba(20, 20, 18, .28); backdrop-filter: blur(2px); }
.sheet-close { position: sticky; top: 0; float: right; margin: -14px -16px 0 0; }
.sheet-close button { border: 0; background: none; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; }
.sheet section + section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--rule); }
.sheet h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin-bottom: 12px; }
.sheet-line { font-size: .84rem; color: var(--muted); margin-bottom: 12px; }
.detail-list { margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; }
.detail-list div { display: grid; gap: 1px; font-size: .86rem; }
dt { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--ink); }
summary { cursor: pointer; font-family: var(--serif); font-size: 1.3rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
.feature-scroll { max-height: 320px; overflow: auto; margin-top: 10px; }
.feature-scroll table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.feature-scroll :is(th, td) { padding: 6px 0; border-bottom: 1px solid var(--rule); text-align: left; }
.feature-scroll th { position: sticky; top: 0; background: var(--paper); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.feature-scroll :is(th, td):last-child { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: .74rem; }
.method-list { margin: 0; display: grid; gap: 14px; }
.method-list dt { font-family: var(--serif); font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--ink); }
.method-list dd { font-size: .84rem; line-height: 1.6; color: var(--ink-2); font-variant-numeric: normal; }
.cite { margin-top: 18px; font-size: .78rem; color: var(--muted); }
.cite em { font-family: var(--serif); font-size: .9rem; color: var(--ink-2); }

/* ---------- Smaller screens: stack and scroll ---------- */
@media (max-width: 1100px), (max-height: 620px) {
  .app { height: auto; min-height: 0; }
  .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field:nth-child(4) { padding-left: 0; border-left: 0; }
  .field-n { grid-column: 2 / -1; }
  .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 340px 340px auto 460px 420px; grid-template-areas: "a b" "c c" "notes notes" "brain brain" "compare compare"; }
  .cell-c { border-left: 0; border-top: 1px solid var(--rule); padding-top: 14px; }
  .cell-notes { border-left: 0; border-top: 1px solid var(--rule); padding: 14px 0; flex-direction: row; flex-wrap: wrap; gap: 0 22px; }
  .cell-notes .cell-title { width: 100%; }
  .cell-notes .recommendation-option { flex: 1 1 220px; }
  .cell-brain { padding-right: 0; }
  .cell-compare { border-left: 0; padding-left: 0; }
}
@media (max-width: 680px) {
  :root { --pad: 16px; }
  .tagline { display: none; }
  body { overflow-x: hidden; }
  .main-nav { gap: 12px; }
  .masthead { justify-content: space-between; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { padding: 8px 10px 9px; }
  .field:nth-child(odd) { padding-left: 0; border-left: 0; }
  .field:nth-child(4) { padding-left: 10px; border-left: 1px solid var(--rule); }
  .field-n { grid-column: 1 / -1; padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .n-ticks button:nth-child(even) { visibility: hidden; }
  .n-ticks button.active { visibility: visible; }
  .board { grid-template-columns: minmax(0, 1fr); grid-template-rows: 300px 300px 300px auto 380px 440px; grid-template-areas: "a" "b" "c" "notes" "brain" "compare"; }
  .cell-a, .cell-b, .cell-c { padding: 0 0 14px; border-left: 0; }
  .cell-c { padding-top: 14px; border-top: 1px solid var(--rule); }
  .cell-b { padding-top: 14px; border-top: 1px solid var(--rule); }
  .sheet { padding: 24px 20px; }
  .detail-list { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .curve-line.animate { stroke-dashoffset: 0; }
}
