/* Method-library detail and motion. Load after research.css. */
body.research-ui .research-card-tags {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 5px;
  padding: 0 14px 13px; min-width: 0;
}
body.research-ui .research-card-tags .feed-tag-chip {
  display: inline-flex; align-items: center; margin: 0; max-width: 100%;
  padding: 4px 7px; border: 1px solid #dae4f3; border-radius: 4px;
  color: #526b92; background: #f1f5fc; font: 500 9px/1.4 var(--mono);
  white-space: normal; overflow: visible; overflow-wrap: anywhere;
  text-overflow: clip; transition: color .18s, background .18s, border-color .18s;
}
body.research-ui .research-card-tags .feed-tag-chip:hover {
  color: var(--brand); background: #e6effe; border-color: #aabfe1;
}
body.research-ui .feed-topbar .feed-src { max-width: calc(100% - 36px); }
body.research-ui .research-rail-short { display: none; }
body.research-ui .research-rail-collapse,
body.research-ui .research-rail-expand {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  gap: 4px; border: 1px solid var(--line); border-radius: 5px; min-height: 30px;
  padding: 5px; background: #fff; color: var(--brand); cursor: pointer;
  font: 500 8px/1.2 var(--sans); letter-spacing: 0;
}
body.research-ui .research-rail-collapse { margin-left: auto; }
body.research-ui .research-rail-collapse svg,
body.research-ui .research-rail-expand svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}
body.research-ui .research-rail-collapse:hover,
body.research-ui .research-rail-expand:hover { background: #eaf1fd; border-color: #b7c9e5; }
body.research-ui .feed-grid { overflow-anchor: none; }

/* A short-lived visual copy provides a real exit while the accessible card
   immediately leaves the active results. This layer never handles input. */
body.research-ui .feed-grid.research-motion-layer {
  position: fixed; display: block; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; overflow: hidden; pointer-events: none; z-index: 80;
  contain: strict; grid-template-columns: none;
}
body.research-ui .research-motion-layer .feed-card { pointer-events: none; }

@media (min-width: 1021px) {
  body.research-ui .research-library {
    --research-rail-width: 212px;
    grid-template-columns: var(--research-rail-width) minmax(0, 1fr);
  }
  body.research-ui .research-library.research-feed-ready {
    transition: grid-template-columns .46s cubic-bezier(.2,.8,.2,1), column-gap .46s cubic-bezier(.2,.8,.2,1);
  }
  body.research-ui .research-library.is-rail-collapsed {
    grid-template-columns: 60px minmax(0, 1fr); column-gap: 20px;
  }
  body.research-ui .feed-rail { min-width: 0; }
  body.research-ui .feed-rail-head { align-items: center; gap: 6px; }
  body.research-ui .feed-rail-head-text { min-width: 0; }
  body.research-ui .feed-rail.is-collapsed { padding-right: 12px; }
  body.research-ui .feed-rail.is-collapsed .feed-rail-head {
    justify-content: center; padding: 10px 0 17px;
  }
  body.research-ui .feed-rail.is-collapsed .feed-rail-head-text,
  body.research-ui .feed-rail.is-collapsed .feed-rail-editlink,
  body.research-ui .feed-rail.is-collapsed .feed-rail-dot,
  body.research-ui .feed-rail.is-collapsed .feed-rail-cat-name,
  body.research-ui .feed-rail.is-collapsed .feed-rail-cat-count,
  body.research-ui .feed-rail.is-collapsed .feed-rail-toggle,
  body.research-ui .feed-rail.is-collapsed .feed-rail-subs { display: none !important; }
  body.research-ui .feed-rail.is-collapsed .research-rail-expand {
    flex-direction: column; gap: 3px; width: 44px; padding: 6px 2px;
    font-size: 8px; min-height: 42px;
  }
  body.research-ui .feed-rail.is-collapsed .feed-rail-cats { gap: 5px; overflow-x: hidden; }
  body.research-ui .feed-rail.is-collapsed .feed-rail-row { justify-content: center; }
  body.research-ui .feed-rail.is-collapsed .feed-rail-cat {
    width: 44px; min-height: 42px; padding: 0; gap: 0; justify-content: center;
    margin: 0 auto; border: 1px solid transparent; border-radius: 6px;
  }
  body.research-ui .feed-rail.is-collapsed .feed-rail-cat.active { border-color: #c2d3ee; }
  body.research-ui .feed-rail.is-collapsed .research-rail-short {
    display: block; font: 500 11px/1 var(--mono); color: inherit;
  }
  body.research-ui .research-library.is-rail-collapsed .research-field-toggle {
    display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
    padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 5px;
    background: #fff; color: var(--brand); font: 500 11px var(--sans);
  }
  body.research-ui .research-library.is-rail-collapsed .research-field-toggle svg {
    width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4;
  }
}
@media (min-width: 1021px) and (max-width: 1200px) {
  body.research-ui .research-library { --research-rail-width: 190px; }
}
@media (max-width: 640px) {
  body.research-ui .research-card-tags { padding: 0 17px 14px; gap: 6px; }
  body.research-ui .research-card-tags .feed-tag-chip { padding: 5px 8px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  body.research-ui .research-library.research-feed-ready { transition: none; }
  body.research-ui .research-card-tags .feed-tag-chip { transition: none; }
}
