/* Source-reviewed articles: reading first, interaction as a local illustration. */
.mechanisms-index,.mechanism-article{min-width:0;max-width:100%}
.mechanism-header{padding-bottom:23px;border-bottom:1px solid var(--line)}
.mechanism-header h1{margin:9px 0 14px;font:750 30px/1.4 var(--serif);overflow-wrap:anywhere}
.mechanism-header>p{max-width:850px;margin:12px 0 0;line-height:1.85;color:var(--ink-2)}
.mechanism-directory{display:grid;gap:14px;margin-top:23px;min-width:0}
.mechanism-directory-row{display:grid;grid-template-columns:88px minmax(0,1fr);gap:10px;align-items:start}
.mechanism-directory-label{padding-top:8px;font-size:13px;font-weight:600;color:var(--ink-2);line-height:1.6}
.mechanism-directory ul{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:0;min-width:0}
.mechanism-directory li{min-width:0;max-width:100%}
.mechanism-directory a{display:flex;align-items:center;gap:9px;min-height:38px;padding:6px 11px;border:1px solid var(--line);border-radius:7px;font-size:13px;line-height:1.6;overflow-wrap:anywhere}
.mechanism-directory a{background:var(--paper);color:var(--ink);text-decoration:none}
.mechanism-directory a:hover,.mechanism-directory a:focus-visible{text-decoration:none;background:var(--brand-soft);border-color:var(--brand);color:var(--brand-2)}
.mechanism-directory-count{font:12px/1.6 var(--mono);color:var(--muted)}
.mechanism-group{margin-top:30px;min-width:0}
.mechanism-group>h2{margin:0;padding-bottom:13px;border-bottom:1px solid var(--line);font:700 15px/1.6 var(--sans);color:var(--muted)}
.mechanism-list-item{padding:28px 0;border-bottom:1px solid var(--line)}
.mechanism-topic{padding-top:28px;scroll-margin-top:calc(var(--site-header-height,60px) + 20px)}
.mechanism-topic-alias{display:block;height:0;scroll-margin-top:calc(var(--site-header-height,60px) + 20px)}
.mechanism-topic-header{padding-bottom:14px;border-bottom:1px solid var(--line)}
.mechanism-topic-header h3{margin:0 0 8px;font:750 23px/1.5 var(--serif)}
.mechanism-topic-header h3 a{color:inherit}
.mechanism-topic-header h3 a:hover{color:var(--brand)}
.mechanism-topic-header p{margin:0;line-height:1.8;color:var(--ink-2)}
.mechanism-list-item h4{margin:0 0 12px;font:700 20px/1.5 var(--serif)}
.mechanism-breadcrumb{display:flex;align-items:center;gap:9px;font-size:13px;color:var(--muted)}
.mechanism-breadcrumb a{color:var(--brand)}
.mechanism-list-item>p{max-width:820px;margin:12px 0;line-height:1.8}
.mechanism-layout{display:grid;grid-template-columns:minmax(0,1fr) 185px;gap:46px;align-items:start}
.mechanism-toc{grid-column:2;grid-row:1;position:sticky;top:calc(var(--site-header-height,60px) + 22px);padding-block:27px;max-height:calc(100dvh - var(--site-header-height,60px) - 40px);overflow-y:auto;font-size:13px}
.mechanism-toc h2{font:700 14px/1.5 var(--sans);margin:0 0 12px}
.mechanism-toc ol{list-style:none;padding:0;margin:0;display:grid;gap:5px}
.mechanism-toc a{display:block;padding:5px 0;color:var(--ink-2);line-height:1.6}
.mechanism-toc a:hover{color:var(--brand)}
.mechanism-toc ol ol{margin:0 0 7px 12px;gap:1px;font-size:12px}
.mechanism-toc ol ol a{padding:3px 0;color:var(--muted)}
.mechanism-prose>.mechanism-section>h3{scroll-margin-top:calc(var(--site-header-height,60px) + 20px)}
.mechanism-prose{grid-column:1;grid-row:1;min-width:0;max-width:100%;font-size:16px;line-height:1.9;overflow-wrap:anywhere;color:var(--ink-2)}
.mechanism-prose>.mechanism-section{margin:32px 0 40px;scroll-margin-top:calc(var(--site-header-height,60px) + 20px)}
.mechanism-prose h2{margin:0 0 17px;font:750 23px/1.5 var(--serif);color:var(--ink)}
.mechanism-prose h3{margin:25px 0 10px;font:700 18px/1.6 var(--sans);color:var(--ink)}
.mechanism-prose p{margin:12px 0 18px}
.mechanism-prose ul,.mechanism-prose ol{padding-left:24px;margin:14px 0 20px}
.mechanism-prose li{padding-left:3px;margin-block:5px}
.mechanism-prose a{text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--brand) 35%,transparent);text-underline-offset:3px}
.mechanism-prose code{font: .84em/1.7 var(--mono);background:var(--surface-2);padding:2px 4px;border-radius:4px;overflow-wrap:anywhere}
.mechanism-prose pre{max-width:100%;overflow:auto;padding:17px 19px;background:var(--paper);border:1px solid var(--line);border-radius:9px;font:13px/1.75 var(--mono);tab-size:4;white-space:pre;overflow-wrap:normal}
.mechanism-prose pre code{padding:0;background:none;font:inherit}
.mechanism-prose figure{margin:23px 0}
.mechanism-prose figcaption,.mechanism-source,.mechanism-note{color:var(--muted);font-size:13px;line-height:1.85}
.mechanism-prose table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:14px;line-height:1.8;margin:20px 0}
.mechanism-prose th,.mechanism-prose td{padding:12px 10px;vertical-align:top;text-align:left;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.mechanism-prose th{background:var(--surface-2);color:var(--ink);font-weight:650}
.mechanism-prose blockquote{margin:18px 0;padding:14px 18px;background:var(--surface-2);border:1px solid var(--line);border-radius:8px}
.mechanism-flow{display:flex;gap:12px;flex-wrap:wrap;align-items:stretch;list-style:none!important;padding:0!important}
.mechanism-flow>li{flex:1 1 145px;border:1px solid var(--line);border-radius:8px;padding:12px;margin:0;background:var(--paper)}
.mechanism-flow strong{display:block;margin-bottom:6px;color:var(--ink);font-size:14px}
.mechanism-flow span{display:block;font-size:13px;line-height:1.8}
.mechanism-evolution{list-style:none;padding:0!important}
.mechanism-evolution>li{margin:0;padding:0 0 8px;border-bottom:1px solid var(--line-soft)}
.mechanism-related{display:flex;gap:16px 26px;flex-wrap:wrap;border-top:1px solid var(--line);padding:18px 0 0;font-size:14px}
.mechanism-diagram{min-width:0;max-width:100%}
.mechanism-diagram>.mechanism-view-heading{font-size:14px;font-weight:600;line-height:1.7}
.mechanism-diagram-scroll{max-width:100%;border:1px solid var(--line);border-radius:9px;background:var(--paper);padding:12px}
/* Keep compact diagrams at their natural size; tall diagrams open in the viewer for detail. */
.mechanism-diagram-scroll img{display:block;width:auto;min-width:0;max-width:100%;height:auto;max-height:min(640px,70vh);max-height:min(640px,70svh);margin-inline:auto}
.mechanism-diagram figcaption{margin-top:10px}
.mechanism-wire-diagram{min-width:0;max-width:100%}
.mechanism-wire-diagram>.mechanism-view-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.mechanism-wire-scroll{min-width:0;max-width:100%;border:1px solid var(--line);border-radius:8px;background:var(--paper)}
.mechanism-wire-scroll img{display:block;width:100%;min-width:0;max-width:100%;height:auto}
.mechanism-wire-scroll:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
.mechanism-wire-diagram figcaption{margin-top:8px}
.mechanism-diagram-source{margin-top:8px;font-size:12px;color:var(--muted)}
.mechanism-diagram-source summary{cursor:pointer;width:fit-content;padding:5px 0}
.mechanism-diagram-source pre{font-size:12px}
.mechanism-diagram-scroll:focus-visible,.mechanism-diagram-source summary:focus-visible{outline:2px solid var(--brand);outline-offset:3px}
.mechanism-article :is(a,button,select):focus-visible,.mechanisms-index a:focus-visible{outline:2px solid var(--brand);outline-offset:4px}

.migration-lab{margin:25px 0;padding:21px;background:var(--paper);border:1px solid var(--line);border-radius:12px;min-width:0;max-width:100%;font-size:14px;line-height:1.75}
.migration-lab h3{margin:0 0 10px;font-size:18px}
.migration-static{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:16px 0}
.mechanism-prose .migration-static{list-style:none;padding:0}
.migration-lab[data-initialized="true"] .migration-static{display:none}
.migration-static-step{padding:12px;border:1px solid var(--line);border-radius:7px;min-width:0;background:var(--surface-2)}
.migration-static-step strong{display:block;margin-bottom:5px;font-size:13px;color:var(--ink)}
.migration-static-step p{font-size:12px;margin:0}
.migration-static-step span{display:block;font-size:12px;line-height:1.8}
.migration-controls{display:flex;flex-wrap:wrap;gap:14px 18px;margin:20px 0 12px}
.migration-control{display:flex;flex:1 1 170px;flex-direction:column;gap:7px;min-width:0;font-size:13px}
.migration-control select{width:100%;max-width:100%;min-width:0;min-height:38px;font-size:13px}
.migration-playback{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:14px 0}
.migration-lab button{min-height:38px;padding:7px 13px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink-2);font:500 13px/1.5 var(--sans);cursor:pointer}
.migration-lab button:hover:not(:disabled){background:var(--brand-soft);border-color:var(--brand);color:var(--brand-2)}
.migration-lab button:disabled{color:var(--faint);background:var(--surface-2);cursor:default}
.migration-lab button[aria-pressed="true"]{background:var(--brand-soft);color:var(--brand-2);border-color:var(--brand)}
.migration-lab-status{font-size:13px;color:var(--brand-2);font-weight:600;margin:15px 0 8px}
.migration-step-description{min-height:3.5em;font-size:13px;margin:8px 0 15px!important}
.migration-progress{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;list-style:none!important;padding:0!important;margin:14px 0 18px!important;font-size:12px;color:var(--muted)}
.migration-progress li{min-width:0;padding:8px 4px!important;margin:0!important;border-bottom:2px solid var(--line);text-align:center}
.migration-progress li[aria-current="step"]{border-color:var(--brand);color:var(--brand-2);font-weight:650}
.migration-stream-view{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr) minmax(0,1fr);gap:12px;align-items:stretch;margin:18px 0}
.migration-stream-endpoint{min-width:0;padding:14px 12px;border:1px solid var(--line);border-radius:8px}
.migration-stream-endpoint h4{margin:0 0 7px;font-size:14px;color:var(--ink)}
.migration-stream-endpoint strong{display:block;font-size:12px;font-weight:600;color:var(--brand-2)}
.migration-stream-endpoint p{margin:8px 0 0!important;font-size:12px;line-height:1.8;color:var(--muted)}
.migration-stream-channel{min-width:0;display:flex;flex-direction:column;justify-content:center;gap:7px;text-align:center;padding:10px;background:var(--surface-2);border-radius:8px}
.migration-stream-direction{font:500 27px/1 var(--sans);color:var(--brand)}
.migration-stream-label{font-size:11px;color:var(--muted)}
.migration-stream-channel code{display:block;background:none;font-size:12px!important;line-height:1.8!important;white-space:normal;overflow-wrap:anywhere;color:var(--ink)}
.migration-source-function{font-size:12px;margin:10px 0 20px!important;color:var(--muted);overflow-wrap:anywhere}
.migration-source-function code{font-size:11px!important}
.migration-endpoints{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin:18px 0}
.migration-endpoint{min-width:0}
.mechanism-prose .migration-endpoint{margin:0}
.migration-endpoint h4{margin:0 0 7px;font-size:14px;font-weight:650}
.migration-endpoint-state{display:block;font-size:12px;font-weight:400;color:var(--muted);margin:3px 0 10px}
.migration-page-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px}
.migration-page{display:flex;min-width:0;min-height:39px;flex-direction:column;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:4px;background:var(--surface-2);font:11px/1.4 var(--mono);color:var(--muted);transition:background-color .2s,border-color .2s}
.migration-page[data-state="current"]{background:#e3efeb;border-color:#b8d4c9;color:#285246}
.migration-page[data-state="dirty"]{background:#fff0dc;border-color:#e6c492;color:#82551b}
.migration-page[data-state="fetched"]{background:#e3edf7;border-color:#abc4dd;color:#2d557b}
.migration-page[data-state="missing"]{border-style:dashed;background:transparent}
.migration-page[data-state="retained"]{background:var(--surface-2);color:var(--ink-2)}
.migration-page-mark{font:10px/1.5 var(--sans)}
.migration-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:17px 0;padding:12px 0;border-block:1px solid var(--line-soft);font-size:12px}
.migration-stats>div{min-width:0}
.migration-stats dt{color:var(--muted)}
.migration-stats dd{margin:3px 0 0;font:650 16px/1.5 var(--mono);color:var(--ink)}
.migration-legend{display:flex;flex-wrap:wrap;gap:5px 16px;color:var(--muted);font-size:12px;margin:12px 0}
.migration-model-note{color:var(--muted);font-size:12px;line-height:1.8;margin:12px 0 0!important}
.migration-lab [hidden]{display:none!important}
@media(max-width:960px){
  .mechanism-layout{grid-template-columns:minmax(0,1fr);gap:0}
  .mechanism-toc{grid-column:1;grid-row:1;position:static;max-height:none;padding:20px 0;border-bottom:1px solid var(--line)}
  .mechanism-toc ol{grid-template-columns:repeat(2,minmax(0,1fr));gap:2px 20px}
  .mechanism-toc ol ol{grid-template-columns:minmax(0,1fr);gap:1px}
  .mechanism-toc a{padding:6px 0}
  .mechanism-prose{grid-column:1;grid-row:2}
}
@media(max-width:620px){
  .mechanism-directory{gap:15px;margin-top:19px}
  .mechanism-directory-row{grid-template-columns:minmax(0,1fr);gap:7px}
  .mechanism-directory-label{padding-top:0}
  .mechanism-directory a{min-height:42px;padding:7px 10px}
  .mechanism-diagram-scroll{padding:6px}
  .mechanism-header h1{font-size:25px}
  .mechanism-header>p{font-size:14px}
  .mechanism-prose{font-size:15px;line-height:1.9}
  .mechanism-prose h2{font-size:21px}
  .mechanism-prose h3{font-size:17px}
  .mechanism-prose pre{padding:13px;font-size:12px}
  .mechanism-prose th,.mechanism-prose td{padding:10px 6px;font-size:12px}
  .mechanism-toc{font-size:12px}
  .mechanism-toc ol{gap:0 12px}
  .mechanism-toc>ol{grid-template-columns:minmax(0,1fr)}
  .migration-lab{padding:14px;border-radius:9px}
  .migration-static{grid-template-columns:minmax(0,1fr);gap:7px}
  .migration-static-step{padding:10px 12px}
  .migration-controls{gap:12px;margin-top:16px}
  .migration-control{flex-basis:100%}
  .migration-playback{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .migration-lab button{min-height:42px}
  .migration-endpoints{grid-template-columns:minmax(0,1fr);gap:16px}
  .migration-stream-view{grid-template-columns:minmax(0,1fr);gap:9px}
  .migration-stream-direction{transform:rotate(90deg)}
  .migration-stream-endpoint{padding:11px 13px}
  .migration-stream-endpoint p{margin-top:4px!important}
  .migration-stream-channel{padding:10px 12px;gap:5px}
  .migration-progress{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 10px;font-size:11px}
  .migration-page{min-height:38px}
  .migration-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .migration-step-description{min-height:0}
  .mechanism-related{gap:12px 20px;font-size:13px}
}
@media(prefers-reduced-motion:reduce){.migration-lab *{animation:none!important;transition:none!important}}
@media print{
  .mechanism-wire-scroll{overflow:visible;border:0}.mechanism-wire-scroll img{width:100%;min-width:0}
  .mechanism-toc,.migration-controls,.migration-playback,.mechanism-related{display:none!important}
  .mechanism-layout{display:block}.mechanism-prose{font-size:11pt}.mechanism-prose section{break-inside:auto}
  .migration-lab{break-inside:avoid}.mechanism-prose a{color:inherit}
}
