/* Canonical Design 3 research primitives, shared by Research and Lab. */
:root{--research-bg:#111;--research-surface:#191919;--research-ink:var(--text-primary);--research-muted:var(--text-meta);--research-line:#393939;--dyor-orange:#E85002;--dyor-orange-muted:color-mix(in srgb,var(--dyor-orange) 22%,transparent);--dyor-orange-hover:#E85002;--dyor-orange-surface:color-mix(in srgb,var(--dyor-orange) 8%,#111);--dyor-orange-line:color-mix(in srgb,var(--dyor-orange) 35%,transparent);--research-accent:var(--dyor-orange);--research-focus:#E85002;--research-radius:3px;--research-gap:16px;--research-width:1440px;--research-target:44px}
.chart-lane{min-width:0}
.chart-head{display:flex;justify-content:space-between;gap:16px;margin-bottom:12px;font:11px/1.4 monospace;color:#b5b4ae}
.chart-head strong{font-size:15px;color:#eee;white-space:nowrap}
.chart-head em{font-size:11px;font-style:normal;margin-left:8px;color:#aaa}
svg[data-chart]{width:100%;display:block;overflow:visible;touch-action:pan-y;cursor:crosshair}
svg text{font:11px monospace;fill:#bbb}
svg .line{fill:none;stroke-width:2;vector-effect:non-scaling-stroke}
svg .grid{stroke:#353535;stroke-width:1}
svg .cursor{stroke:#ccc;stroke-dasharray:3 4;opacity:.65}
.chart-caption{font:10px/1.5 monospace;color:#989893;margin-top:10px}
.signal-dot{display:inline-block;width:5px;height:5px;background:#E85002;margin-right:7px}

#buddy-sheet{position:fixed;inset:auto 0 0;margin:0 auto;width:min(100%,620px);max-width:100%;height:auto;max-height:70dvh;border:1px solid #555;border-top:2px solid var(--dyor-orange);border-radius:18px 18px 0 0;background:#191919;color:#eee;padding:0;overflow:hidden;box-shadow:0 -20px 70px #0007}
#buddy-sheet[open]{display:flex;flex-direction:column;animation:sheet-in .18s ease-out}
#buddy-sheet::backdrop{background:#0005}
.buddy-head{padding:18px 18px 12px;display:flex;align-items:flex-start;gap:12px;border-bottom:1px solid #333;flex-shrink:0}
.buddy-head>div{flex:1;min-width:0}
.buddy-head .eyebrow{font-size:8px;letter-spacing:1px}
.buddy-head h2{font-size:19px;margin-top:5px;line-height:1.25}
.buddy-head button{font-size:12px;min-height:44px;flex-shrink:0}
.buddy-content{padding:16px 18px max(22px,env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}
.buddy-answer{font-size:17px;line-height:1.5;letter-spacing:-.2px}
.buddy-findings{margin-top:14px}
.buddy-findings p{font-size:13px;line-height:1.65;margin:12px 0;padding-left:12px;border-left:2px solid #777}
.inline-citation{padding:3px 7px;margin:2px;min-height:30px;font:11px monospace;color:#E85002;border-color:#72503f;background:#251e19}
.buddy-limits{font-size:12px;border-top:1px solid #444;margin-top:16px;padding-top:12px;color:#bbb}
.buddy-limits p{margin:8px 0}
.buddy-followups{display:flex;gap:7px;overflow-x:auto;padding:16px 0}
.buddy-followups button{flex-shrink:0;max-width:220px;min-height:44px;font-size:11px}
.buddy-sources summary{font-size:13px;padding:10px 0}
.buddy-sources button{width:100%;text-align:left;margin:4px 0;padding:12px;font-size:11px;overflow-wrap:anywhere}
.buddy-sources button span{display:block;color:#aaa;margin-top:4px}
.buddy-footnote{font-size:10px;color:#aaa;margin-top:16px}
.buddy-loading{min-height:170px;padding:12px 0;color:#bbb}
.skeleton{height:14px;background:#333;margin-top:22px;width:95%;animation:pulse 1s infinite alternate}
.skeleton.short{width:65%}
.inline-citation{min-height:36px;min-width:36px}
.buddy-footnote{line-height:1.5}
:where(.research-context,.research-sheet,.research-lenses,.chart-lane,#buddy-sheet,.research-primary-nav) :is(button,select,input,a){min-height:var(--research-target);font:inherit;touch-action:manipulation}
:where(.research-context,.research-sheet,.research-lenses,.chart-lane,#buddy-sheet) :is(button,select,input){border:1px solid var(--research-line);border-radius:var(--research-radius);background:var(--research-surface);color:var(--research-ink);padding:10px 12px}
:where(.research-context,.research-sheet,.research-lenses,.chart-lane,#buddy-sheet) :is(button,a,select,input,summary,[tabindex]):focus-visible{outline:2px solid var(--research-focus);outline-offset:3px}
:where(.research-context,.research-sheet,.research-lenses,.chart-lane,#buddy-sheet) button:hover{border-color:var(--research-muted)}
.research-lenses button[aria-pressed=true]{border-bottom:3px solid var(--research-accent);color:var(--research-ink)}
:where(.research-sheet,#buddy-sheet) button:disabled{opacity:.55;cursor:not-allowed}
.research-context{position:relative;z-index:1;display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:14px 0;background:var(--research-bg);border-block:1px solid var(--research-line);margin-bottom:16px}
.research-context-summary{display:flex;flex-wrap:wrap;gap:4px 12px;font:12px/1.4 monospace;min-width:0}
.research-context-summary small{color:var(--research-muted)}
.research-context-actions,.research-lenses{display:flex;gap:6px;flex-wrap:wrap}
.research-context-actions a{display:inline-flex;align-items:center;padding:8px;color:var(--research-ink)}
.research-sheet{position:fixed;inset:0;margin:auto;width:min(620px,calc(100% - 32px));max-width:100%;max-height:85dvh;overflow:auto;background:var(--research-surface);color:var(--research-ink);border:1px solid var(--research-line);border-top:2px solid var(--research-accent);border-radius:var(--research-radius);padding:24px;box-shadow:0 10px 70px #0009}
.research-sheet::backdrop{background:#0009}
.research-sheet :is(.d3-inspector,.inspector){display:block;position:static;width:auto;max-height:none;padding:0;border:0;margin:0;overflow:visible;background:transparent}
.research-sheet :is(p,dd,code){overflow-wrap:anywhere}
.research-sheet :is(h2,h3){font-size:22px;line-height:1.3;margin:12px 0}
.research-sheet dl{display:grid;grid-template-columns:100px minmax(0,1fr);gap:10px;font:12px/1.5 monospace;margin:16px 0}
.research-sheet dd{margin:0}.research-sheet dt{color:var(--research-muted)}
.research-sheet .d3-actions{display:flex;gap:8px;flex-wrap:wrap}.research-sheet details{border-top:1px solid var(--research-line);padding-top:12px;margin-top:16px}
.research-sheet summary,.chart-data summary{min-height:44px;padding:12px 0;cursor:pointer}
.buddy-source{display:grid;gap:8px;border-bottom:1px solid var(--research-line);padding:12px 0}.buddy-source a{color:var(--research-focus)}
.chart-table-scroll{max-height:300px;overflow:auto}.chart-data table{width:100%;border-collapse:collapse;font:12px/1.5 monospace}.chart-data :is(th,td){text-align:left;padding:6px;border-bottom:1px solid var(--research-line)}
.chart-data caption{text-align:left;color:var(--research-muted);padding:8px 0}.chart-data{margin-bottom:12px}
.selected-marker{stroke:var(--research-accent);stroke-width:3;stroke-dasharray:2 3;pointer-events:none}
[data-chart-focus]{margin:0 0 12px}.research-focused{position:fixed;inset:0;z-index:1000;overflow:auto;background:var(--research-bg);padding:20px max(16px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom))}.research-focused svg[data-chart]{height:65dvh;min-height:240px}
.research-primary-nav{display:none}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
@media(max-width:768px){.research-context{top:0;display:block;padding:8px 0}.research-context-summary small{display:none}.research-context-actions{flex-wrap:nowrap;justify-content:space-between}.research-context-actions :is(button,a){font-size:12px;padding:8px;min-height:44px}.research-sheet{inset:auto 0 0;width:100%;max-height:80dvh;padding:20px 18px max(22px,env(safe-area-inset-bottom));border-radius:16px 16px 0 0}.research-primary-nav{display:flex;position:fixed;inset:auto 0 0;background:var(--research-bg);border-top:1px solid var(--research-line);z-index:40;padding-bottom:env(safe-area-inset-bottom)}.research-primary-nav a{flex:1;display:grid;place-items:center;color:var(--research-ink);font-size:12px}.research-primary-nav a[aria-current=page]{border-top:3px solid var(--research-accent)}body:has(.research-primary-nav){padding-bottom:calc(52px + env(safe-area-inset-bottom))}.research-context{top:0}.research-focused{padding-bottom:env(safe-area-inset-bottom)}:where(.research-sheet,#buddy-sheet,.research-context,.research-lenses) :is(input,select){font-size:16px}}
@media(prefers-reduced-motion:no-preference){.research-sheet[open]{animation:research-sheet-in .15s ease-out}@keyframes research-sheet-in{from{opacity:.5;transform:translateY(12px)}to{opacity:1;transform:none}}}
@media(prefers-reduced-motion:reduce){#buddy-sheet[open],.research-sheet[open]{animation:none}.research-focused{scroll-behavior:auto}}

:where(.research-instrument,#visual,.research-sheet) [hidden]{display:none!important}

.selected-point{fill:var(--dyor-orange);stroke:#111;stroke-width:2;vector-effect:non-scaling-stroke}
.evidence-object-head{display:flex;justify-content:space-between;align-items:start;gap:18px}.evidence-object-head h2{margin:0;font-size:22px}.evidence-object-head button{width:auto;flex:none;min-height:44px;padding:8px 12px}
.evidence-lead{font-size:clamp(19px,3vw,26px);line-height:1.4;margin:24px 0 10px}.evidence-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:24px 0}.evidence-facts div{min-width:0}.evidence-facts dt{font-size:12px;color:var(--research-muted)}.evidence-facts dd{margin:4px 0;overflow-wrap:anywhere}.evidence-corroboration{border-block:1px solid var(--research-line);padding:16px 0}.evidence-actions{display:flex;flex-wrap:wrap;gap:10px;padding:20px 0;align-items:center}.evidence-actions button,.evidence-actions a{font:inherit;padding:10px;min-height:44px}.evidence-method{border-top:1px solid var(--research-line);padding:18px 0;overflow-wrap:anywhere}.evidence-method pre{white-space:pre-wrap;overflow-wrap:anywhere}.research-sheet .research-primary{background:var(--dyor-orange);color:#111;border-color:var(--dyor-orange)}.research-action-status{font-size:13px;color:var(--research-muted)}.line-end-label{font-size:12px;font-weight:700}.research-sheet article{min-width:0}

.research-buddy-avatar{display:block;width:56px;height:56px;object-fit:contain;flex:none}.buddy-reveal{padding:14px 0;border-bottom:1px solid var(--research-line);animation:buddy-answer-in .4s ease both}.buddy-reveal:nth-child(2){animation-delay:.12s}.buddy-reveal:nth-child(3){animation-delay:.24s}.buddy-reveal:nth-child(4){animation-delay:.36s}.buddy-reveal h3{font:600 17px/1.3 Arial;margin:0 0 12px}.buddy-reveal p{font:14px/1.65 Arial;margin:10px 0}.buddy-followups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.buddy-followups button{white-space:normal;text-align:left}.buddy-source{overflow-wrap:anywhere}@keyframes buddy-answer-in{from{transform:translateY(5px)}to{transform:none}}@media(prefers-reduced-motion:reduce){.buddy-reveal{animation:none}}

html body .research-context [data-context-ask]{background:var(--dyor-orange);color:#111;border-color:var(--dyor-orange)}

.research-context-summary{flex:1 1 260px}.research-context-actions{flex:0 1 auto;gap:10px;align-items:center;flex-wrap:wrap}.research-context-actions :is(a,button){flex:0 0 auto;min-width:64px;text-align:center;white-space:nowrap}
#buddy-sheet .buddy-content{padding-bottom:max(32px,env(safe-area-inset-bottom))}
#buddy-sheet .buddy-content details{border:0;border-top:1px solid #393939;background:transparent;margin:14px 0 0;padding:14px 0}
#buddy-sheet .buddy-content summary{cursor:pointer;font-weight:600;min-height:44px}
#buddy-sheet .buddy-content section{padding-block:14px}
svg[data-chart] .line{animation:evidence-arrives .45s ease-out}
@keyframes evidence-arrives{from{opacity:.25}to{opacity:1}}
@media(min-width:769px){#buddy-sheet{inset:auto 24px 24px auto;margin:0;width:520px;max-height:80dvh;border-radius:16px}}
@media(max-width:768px){.research-context-actions{flex-wrap:wrap;justify-content:flex-start;gap:8px}.research-context-actions :is(a,button){min-height:44px}}
@media(prefers-reduced-motion:reduce){svg[data-chart] .line{animation:none}}

.research-focused [data-network]{height:75dvh}.research-focused .graph-wrap{max-width:none}

html body #buddy-sheet .buddy-answer{display:block!important}html body #buddy-sheet .inline-citation{display:inline-flex!important;align-items:center;justify-content:center;width:auto!important;min-width:36px;max-width:none;min-height:36px;padding:3px 7px!important;margin:3px!important}html body #buddy-sheet .research-buddy-avatar{display:block!important;border:0!important;box-shadow:none!important;background:none!important}
/* One expanded Buddy workspace: welcome, questions and retained evidence share the same shell. */
html body #buddy-sheet{height:min(820px,90dvh);max-height:90dvh}
html body #buddy-sheet .buddy-content{flex:1;min-height:0;padding:20px 24px;overflow:auto}
html body #buddy-sheet .research-buddy-compose{flex:none;margin:0;padding:16px 24px max(18px,env(safe-area-inset-bottom));background:#202020!important;border-top:1px solid #444}
#buddy-sheet .research-buddy-compose label{display:block;font:600 13px Arial;margin-bottom:8px;color:#eee}
#buddy-sheet .research-buddy-compose>div{display:flex;align-items:center;gap:10px}
html body #buddy-sheet .research-buddy-compose textarea{flex:1;min-width:0;width:100%;resize:vertical;max-height:140px;min-height:64px;background:#111!important;border:1px solid #555;border-radius:12px;color:#eee!important;font:16px/1.5 Arial;padding:12px}
#buddy-sheet .research-buddy-compose button{flex:none;width:44px;min-height:44px;background:#E85002;color:#111;border:0;border-radius:50%;font-size:26px}
#buddy-sheet .research-buddy-compose small{display:block;margin-top:8px;font:11px/1.5 Arial;color:#bbb}
html body #buddy-sheet .research-buddy-welcome{text-align:center;padding:4px 0 16px}
#buddy-sheet .research-buddy-welcome>img{display:block;width:150px;height:150px;object-fit:contain;margin:0 auto 12px}
#buddy-sheet .research-buddy-welcome h3{font:600 25px/1.2 Arial;margin:12px 0}
#buddy-sheet .research-buddy-welcome p{font:15px/1.6 Arial;color:#ccc}
#buddy-sheet .research-buddy-starters{display:grid;gap:10px;margin-top:22px}
html body #buddy-sheet .research-buddy-starters button{padding:14px;text-align:left;white-space:normal;font:600 15px/1.5 Arial;border:1px solid #444;border-radius:10px;background:#252525;color:#eee}
html body #dyor-buddy{display:none!important}
html body .buddy-character{background:transparent!important;border:0!important;box-shadow:none!important}
html body .buddy-character img{display:block!important}
html body .buddy-character::before,html body .buddy-character::after,html body .buddy-character-signal{display:none!important}
@media(max-width:600px){html body #buddy-sheet{height:90dvh;max-height:90dvh}html body #buddy-sheet .buddy-content{padding:16px}html body #buddy-sheet .research-buddy-compose{padding-inline:16px}#buddy-sheet .research-buddy-welcome>img{width:100px;height:100px}#buddy-sheet .research-buddy-welcome h3{font-size:22px}}

html body #buddy-sheet .research-buddy-compose button{background:#E85002!important;color:#111!important;border:0!important;border-radius:50%!important;width:44px!important;height:44px!important;padding:0!important}

.research-freshness { margin: 1.25rem 0; padding: 1rem; border: 1px solid #555; border-radius: .5rem; overflow-wrap: anywhere; font-size: .9rem; }
.research-freshness p { max-width: 75ch; }
.research-freshness a { text-decoration: underline; }

/* Canonical semantic tokens and control geometry. */
:root{--text-primary:#f2eee9;--text-body:#d0ccc7;--text-meta:#b7b1aa;--text-muted:#aaa49d;--text-disabled:#88837e;--accent:var(--dyor-orange);--text-historical:#d6b394;--control-height:44px;--control-padding:14px;--control-gap:8px;--control-radius:6px;--type-body:15px;--type-meta:12px;--line-body:1.6}
:where(.d3-route,.lab-shell,.research-context,.site-header,.refreshed-home) :is(button,.solid-link,.d3-primary,.site-action){box-sizing:border-box;min-height:var(--control-height);line-height:1.4;gap:var(--control-gap);border-radius:var(--control-radius)}
:where(.d3-actions,.home-actions,.workspace-actions) :is(a,button){display:inline-flex;align-items:center;justify-content:center;gap:var(--control-gap);white-space:normal;text-align:center}
:where(.d3-route,.refreshed-home) :is(.d3-primary,.solid-link){background:var(--accent);color:#111!important;border:1px solid var(--accent);padding:12px 18px}
:where(button,a,input,select,textarea,summary):focus-visible{outline:2px solid var(--accent);outline-offset:4px}
.research-arrow{color:inherit!important;flex:none}
.saved-review-marker{padding:16px 18px;border:1px solid var(--research-line);border-left:3px solid var(--accent);border-radius:var(--control-radius);background:var(--research-surface);margin:16px 0;color:var(--text-body)}
.saved-review-marker strong{display:block;color:var(--text-primary)}
.saved-review-marker p{font-size:var(--type-meta);line-height:var(--line-body);margin:6px 0;overflow-wrap:anywhere}
