/* @scilence/library — scilence tokens only */

.s-library-host {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-3);
  padding: var(--s-space-4);
}

.s-library-host__layout {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-3);
}

.s-library-host__title {
  font: var(--s-font-size-2);
  margin: 0;
  color: var(--s-color-fg-primary);
}

.s-library-host__browse-tabs {
  display: flex;
  gap: var(--s-space-2);
}

.s-library-host__browse-tab[aria-pressed="true"] {
  background: var(--s-color-accent-subtle);
}

.s-library-host__origin-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-space-2);
}

.s-library-host__chip.is-active {
  border-color: var(--s-color-accent-active);
}

.s-library-host__table {
  width: 100%;
  border-collapse: collapse;
  font: var(--s-font-size-0);
}

.s-library-host__table th,
.s-library-host__table td {
  padding: var(--s-space-2);
  border-bottom: 1px solid var(--s-color-border-subtle);
  text-align: left;
}

.s-library-host__drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(28rem, 90vw);
  height: 100%;
  background: var(--s-color-bg-panel);
  border-left: 1px solid var(--s-color-border-subtle);
  box-shadow: none;
  z-index: 40;
  overflow: auto;
  padding: var(--s-space-4);
}

.s-library-filter-panel__search-input {
  width: 100%;
  padding: var(--s-space-2);
}

.s-library-cohort-algebra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-space-2);
}

.s-library-cohort-algebra__op[aria-pressed="true"] {
  font-weight: var(--s-font-weight-medium);
}

.s-library-cross-ref-panel__list {
  margin: 0;
  padding-left: var(--s-space-4);
}

.s-library-bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--s-space-2);
}

.s-library-host__xref-badge {
  display: inline-flex;
  min-width: 1.25rem;
  justify-content: center;
  padding: 0 var(--s-space-1);
  border-radius: var(--s-radius-pill);
  background: var(--s-color-bg-subtle);
  font-size: 0.75rem;
}

/* ── library destination (pages/library.js) — cross-library search ────────
   Revived 2026-05-27 by library-destination-demo-revival. Scilence tokens
   only; reuses sidebar search styling vocabulary so the affordance feels
   native rather than bolted on. */

.library-page__search {
  position: relative;
  margin: 0 0 var(--s-space-3);
  max-width: 32rem;
}

.library-page__search-input-wrap {
  display: block;
  position: relative;
}

.library-page__search-input {
  width: 100%;
  padding: var(--s-space-2) var(--s-space-3);
  font: var(--s-font-size-0);
  background: var(--s-color-bg-panel);
  color: var(--s-color-fg-primary);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-input);
  outline: none;
}

.library-page__search-input:focus {
  border-color: var(--s-color-accent-active);
  background: var(--s-color-bg-subtle);
}

.library-page__search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 22rem;
  overflow-y: auto;
  z-index: 20;
  background: var(--s-color-bg-panel);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-input);
  box-shadow: none;
}

.library-page__search-result {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  padding: var(--s-space-2) var(--s-space-3);
  text-align: left;
  background: transparent;
  color: var(--s-color-fg-primary);
  border: 0;
  border-bottom: 1px solid var(--s-color-border-subtle);
  cursor: pointer;
  font: var(--s-font-size-0);
}

.library-page__search-result:last-child {
  border-bottom: 0;
}

.library-page__search-result:hover,
.library-page__search-result[data-active="true"] {
  background: var(--s-color-accent-subtle);
}

.library-page__search-result-name {
  font-weight: var(--s-font-weight-medium);
}

.library-page__search-result-meta {
  font-size: 0.75rem;
  color: var(--s-color-fg-muted);
}

.library-page__search-empty {
  padding: var(--s-space-2) var(--s-space-3);
  color: var(--s-color-fg-muted);
  font: var(--s-font-size-0);
}

/* Focus pulse — when arriving via cross-library search with ?focus=<id>,
   the matched row briefly rings and scrolls into view. */
.library-page__focus-pulse {
  outline: 2px solid var(--s-color-accent-active);
  outline-offset: 2px;
  border-radius: var(--s-radius-input);
  animation: library-page-focus-pulse 2.4s ease-out forwards;
}

@keyframes library-page-focus-pulse {
  0%   { outline-color: var(--s-color-accent-active); }
  60%  { outline-color: transparent; }
  100% { outline-color: transparent; }
}

/* ── library facet rail — Registry / Collections / Datasets section stubs
   (surface-chrome-port-library-entity-browser, 2026-06-09). Mounted
   inside the SurfaceChrome.leftRail host beneath the chip rail; tokens
   only, matches the rail's mono-caps register. */

.library-molecules-filter-rail__sections {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-3);
  padding: var(--s-space-3);
  border-top: 1px solid var(--s-color-border-subtle);
}

.library-molecules-filter-rail__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-1);
}

.library-molecules-filter-rail__section-label {
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-medium);
  color: var(--s-color-fg-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.library-molecules-filter-rail__section-hint {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
  line-height: var(--s-font-line-height-normal);
}

/* ── library entity-card right drawer (SurfaceChrome.rightDrawer) ────
   Per-entity property panel; tokens only. */

.library-entity-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-3);
}

.library-entity-card__empty,
.library-entity-card__coming-soon {
  padding: var(--s-space-3);
  color: var(--s-color-fg-muted);
  font: var(--s-font-size-0);
  line-height: var(--s-font-line-height-normal);
  background: var(--s-color-bg-subtle);
  border: 1px dashed var(--s-color-border-subtle);
  border-radius: var(--s-radius-input);
}

.library-entity-card__title {
  font-size: var(--s-font-size-2);
  font-weight: var(--s-font-weight-medium);
  color: var(--s-color-fg-primary);
  margin: 0;
}

.library-entity-card__subtitle {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-muted);
  margin: 0;
}

.library-entity-card__section {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-2);
}

.library-entity-card__section-label {
  font-size: var(--s-font-size-0);
  font-weight: var(--s-font-weight-medium);
  color: var(--s-color-fg-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.library-entity-card__props {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: var(--s-space-2) var(--s-space-3);
}

.library-entity-card__prop-label {
  color: var(--s-color-fg-muted);
  font-size: var(--s-font-size-0);
}

.library-entity-card__prop-value {
  color: var(--s-color-fg-primary);
  font-size: var(--s-font-size-0);
  word-break: break-word;
}

.library-entity-card__structure {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--s-color-bg-panel);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-input);
  padding: var(--s-space-2);
  min-height: 8rem;
}

.library-entity-card__structure img,
.library-entity-card__structure svg {
  max-width: 100%;
  height: auto;
}

.library-entity-card__where-used {
  display: flex;
  flex-direction: column;
  gap: var(--s-space-1);
}

.library-entity-card__where-used-item {
  font-size: var(--s-font-size-0);
  color: var(--s-color-fg-primary);
}

.library-entity-card__drag {
  align-self: flex-start;
  padding: var(--s-space-1) var(--s-space-3);
  background: var(--s-color-bg-subtle);
  color: var(--s-color-fg-primary);
  border: 1px solid var(--s-color-border-subtle);
  border-radius: var(--s-radius-input);
  cursor: grab;
  font: var(--s-font-size-0);
}

.library-entity-card__drag:active {
  cursor: grabbing;
}
