.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  background: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 1;
}

.skip-link:focus { top: 0.5rem; }

.post-preview {
  padding: 1.4rem 0 1.7rem;
  border-bottom: 1px solid var(--border);
}

.post-meta, .back-link, .read-post {
  font-family: var(--font-mono);
  font-size: var(--caption-size);
}

.post-meta { color: var(--text-secondary); }
.post-meta span { margin: 0 0.3rem; }
.post-preview h2 { font-size: 1.35rem; line-height: 1.45; margin: 0.55rem 0; }
.post-preview h2 a { color: var(--text-primary); text-decoration: none; }
.post-preview h2 a:hover, .post-preview h2 a:focus-visible { color: var(--accent); text-decoration: none; }
.post-preview > p:not(.post-meta) { font-size: var(--small-size); margin-bottom: 1rem; }

.article-header, .article-body, .article-end { width: 100%; }
.article-header { margin: 0 0 2.1rem; }
.back-link { display: inline-block; }
.article-header h1 { font-size: 2.15rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.035em; margin: 1.1rem 0 0.85rem; }
.article-body { line-height: 1.75; }
.article-block { position: relative; margin-bottom: 1.15rem; }
.article-body h2 { font-size: 1.4rem; font-weight: 600; line-height: 1.4; margin: 2.5rem 0 1rem; scroll-margin-top: 1.5rem; }
.article-list { list-style: none; margin: 0 0 1.2rem; }
.article-list > li { position: relative; padding-left: 1.3rem; margin-bottom: 0.9rem; }
.article-list > li::before { content: "•"; position: absolute; left: 0.15rem; color: var(--text-secondary); }
.article-figure { margin: 1.6rem 0 1.8rem; }
.article-figure img { width: 100%; height: auto; }
.article-figure figcaption { margin-top: 0.65rem; font-family: var(--font-body); font-size: 0.73rem; font-style: italic; line-height: 1.55; color: var(--text-secondary); text-align: left; }
.trajectory-widget [hidden] { display: none; }
.trajectory-frame { border: 1px solid var(--figure-border, #b9c0c8); border-radius: 0.6rem; overflow: hidden; font-family: system-ui, sans-serif; color: var(--figure-ink, #17253f); }
.trajectory-controls { background: var(--figure-surface, #fbf0eb); }
.trajectory-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trajectory-controls button { display: flex; align-items: center; justify-content: center; gap: 0.45em; font: 600 0.78rem/1.4 system-ui, sans-serif; padding: 0.75rem 0.65rem; border: 0; border-right: 1px solid var(--figure-divider, #d9ccc6); border-bottom: 1px solid var(--figure-divider, #d9ccc6); border-radius: 0; background: transparent; color: var(--figure-ink, #17253f); cursor: pointer; transition: color 150ms ease, background-color 150ms ease; }
.trajectory-controls button > span { min-width: 0; }
.trajectory-controls button:last-child { border-right: 0; }
.trajectory-controls button:hover, .trajectory-tabs [aria-selected="true"] { color: var(--figure-accent-text, #833426); background: var(--figure-selected, #f6e4de); }
.trajectory-tabs [aria-selected="true"] { box-shadow: inset 0 -2px var(--figure-accent, #b64b37); }
.trajectory-widget :is(button, [role="tabpanel"]):focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.trajectory-description { min-height: 7.5em; padding: 0.85rem 1rem; background: var(--figure-surface, #fbf0eb); font-size: 0.78rem; line-height: 1.6; color: var(--figure-muted, #65717d); }
.trajectory-description h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.3rem; color: var(--figure-ink, #17253f); }
.trajectory-panel img { display: block; aspect-ratio: 1280 / 730; object-fit: contain; background: var(--figure-chrome, #f3f4f5); border-top: 1px solid var(--figure-divider, #d9ccc6); }
.trajectory-error { color: var(--accent); font-size: 0.78rem; }
@media (max-width: 600px) {
  .trajectory-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trajectory-controls button:nth-child(2n) { border-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .trajectory-controls button { transition: none; }
}
.research-diagram, .collaboration-diagram { margin-inline: auto; }
.research-diagram { width: 85%; }
.collaboration-diagram { width: 90%; }
.diagram-heading { display: flex; align-items: center; justify-content: center; gap: 0.4em; }
.diagram-icon { display: block; flex: 0 0 auto; width: 1.65em; height: 1.65em; }
.diagram-heading > span { min-width: 0; }
.research-diagram {
  container-type: inline-size;
  font-family: system-ui, sans-serif;
  line-height: 1.4;
  text-align: center;
  color: var(--figure-ink, #17253f);
  scroll-margin-top: 2rem;
}
.research-stages, .research-labels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4%;
}
.research-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem;
  border: 1px solid var(--figure-border, #b9c0c8);
  border-radius: 0.6rem;
  background: var(--figure-surface, #fbf0eb);
}
.research-stage strong { font-size: clamp(0.78rem, 2.5cqi, 0.98rem); font-weight: 600; }
.research-stage > span { font-size: clamp(0.72rem, 2.1cqi, 0.86rem); color: var(--figure-muted, #737f8a); }
.research-stage-cua { border-color: var(--figure-accent, #b64b37); background: var(--figure-selected, #f6e4de); }
.research-stage-cua strong { color: var(--figure-accent-text, #833426); }
.research-stage-cua > span { color: var(--figure-accent, #ab4433); }
@container (max-width: 420px) {
  .research-stage .diagram-heading { flex-direction: column; }
}
.research-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  height: 1.35rem;
  border-left: 1px dashed var(--figure-border, #99a6b1);
}
.research-axis {
  position: relative;
  margin: 1.35rem 10% 1rem;
  height: 2px;
  background: var(--figure-accent, #ab4433);
}
.research-axis::before, .research-axis::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border: solid var(--figure-accent, #ab4433);
  border-width: 0 2px 2px 0;
}
.research-axis::before { left: 0; transform: translateY(-50%) rotate(135deg); }
.research-axis::after { right: 0; transform: translateY(-50%) rotate(-45deg); }
.research-labels { font-size: clamp(0.7rem, 2.1cqi, 0.86rem); color: var(--figure-muted, #737f8a); }
.research-labels strong { color: var(--figure-ink, #17253f); font-weight: 600; }
.collaboration-diagram {
  font-family: system-ui, sans-serif;
  color: var(--figure-ink, #17253f);
  line-height: 1.4;
  scroll-margin-top: 2rem;
}
.collaboration-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.collaboration-panel {
  container-type: inline-size;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--figure-border, #b9c0c8);
  border-radius: 0.6rem;
  background: var(--figure-surface, #fbf0eb);
  text-align: center;
}
.collaboration-panel-shared { border-color: var(--figure-accent, #b64b37); background: var(--figure-selected, #f6e4de); }
.collaboration-panel h3 { font-size: 0.98rem; font-weight: 600; }
.collaboration-subtitle { font-size: 0.78rem; color: var(--figure-muted, #65717d); margin-top: 0.3rem; }
.collaboration-panel-shared h3, .collaboration-panel-shared .collaboration-subtitle { color: var(--figure-accent-text, #833426); }
.collaboration-actors {
  display: grid;
  grid-template-columns: 1fr 1.6rem 1fr;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.83rem;
  font-weight: 600;
}
.collaboration-actors > span:first-child, .collaboration-actors > span:last-child {
  padding: 0.2rem 0.25rem;
  border: 1px solid var(--figure-border, #c9cbd0);
  border-radius: 0.3rem;
  background: var(--figure-white, #fff);
}
.collaboration-connectors { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; color: var(--figure-muted, #737f8a); font-size: 1.2rem; padding: 0.1rem 0; }
.collaboration-panel-shared .collaboration-connectors { color: var(--figure-accent, #ab4433); }
.collaboration-views { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.collaboration-views-shared { grid-template-columns: 1fr; }
.collaboration-interface {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--figure-border, #b9c0c8);
  border-radius: 0.35rem;
  overflow: hidden;
  background: var(--figure-white, #fff);
}
.interface-chrome {
  align-self: stretch;
  text-align: left;
  padding: 0.15rem 0.5rem;
  height: 1.35rem;
  background: var(--figure-chrome, #f3f4f5);
  border-bottom: 1px solid var(--figure-divider, #d9dde1);
  color: var(--figure-muted, #87939e);
  font-size: 0.55rem;
  line-height: 1rem;
  letter-spacing: 0.12rem;
}
.interface-code { font-family: var(--font-mono); font-size: 0.7rem; }
.collaboration-interface strong { margin: 0.3rem 0.3rem 0.2rem; font-size: 0.83rem; font-weight: 600; }
.collaboration-interface > span:last-child { padding: 0 0.45rem 0.3rem; color: var(--figure-muted, #65717d); font-size: min(0.72rem, calc(4cqi - 0.04rem)); }
.collaboration-interface > span.interface-description-nowrap { white-space: nowrap; }
.collaboration-panel-shared .collaboration-interface { border-color: var(--figure-accent, #b64b37); }
.collaboration-panel-shared .interface-chrome { background: var(--figure-surface, #fcf1ec); border-color: var(--figure-border, #e6c2b8); color: var(--figure-accent, #ab4433); }
.collaboration-takeaway { margin-top: 0.4rem; color: var(--figure-muted, #65717d); font-size: 0.76rem; }
.collaboration-panel-shared .collaboration-takeaway { color: var(--figure-accent-text, #833426); }
@media (max-width: 600px) {
  .collaboration-comparison { grid-template-columns: 1fr; }
}
.article-body sup { font-size: 0.7em; line-height: 0; }
.footnote-ref { padding: 0.15rem; scroll-margin-top: 5rem; }
.sidenote {
  position: absolute;
  left: calc(100% + 32px);
  top: 0.25rem;
  width: 229px;
  padding-left: 0.8rem;
  border-left: 1px solid var(--border);
  font-size: 0.73rem;
  line-height: 1.65;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  scroll-margin-top: 2rem;
}
.note-number { font-family: var(--font-mono); font-size: 0.75em; vertical-align: super; margin-right: 0.1rem; }
.sidenote:target,
:is(.article-block, .article-list > li):has(.footnote-ref:is(:hover, :focus-visible)) > .sidenote {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--figure-surface, #fcf6f4);
}
.footnote-ref:target { background: var(--note-highlight, #f9e3dc); outline: 2px solid var(--note-highlight, #f9e3dc); }
.article-end { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.article-footnotes { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.article-footnotes h2 { font-size: 1.35rem; font-weight: 600; margin-bottom: 1rem; }
.article-footnotes .sidenote { position: static; width: auto; margin: 0 0 1rem; font-size: var(--small-size); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Reserve room outside the centered article for the right-margin notes. */
@media (max-width: 1359px) {
  .sidenote { position: static; width: auto; margin: 0.8rem 0 0.3rem 1rem; padding: 0.1rem 0 0.1rem 0.8rem; font-size: 0.8rem; }
}

@media (max-width: 600px) {
  .article-header h1 { font-size: 1.9rem; }
  .article-container .site-nav { align-items: flex-start; }
  .article-body h2 { font-size: 1.35rem; }
  .post-meta { font-size: 0.72rem; }
}

@media print {
  .site-nav, .back-link, .site-footer { display: none; }
  .article-container { max-width: none; }
  .article-header, .article-body, .article-end { width: 100%; }
  .sidenote { position: static; width: auto; margin: 0.75rem 0; }
}
