/* Local connection preview: draw once on selection, then remain solid. */
@media (min-width: 701px) {
  .lineage-page .lineage-controls {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
  }

  .lineage-page [data-lineage-relationship-legend] {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    flex: 0 0 auto;
    order: 0;
    width: max-content;
    gap: 0.75rem;
    max-width: none;
  }

  .lineage-page [data-lineage-relationship-legend] p {
    flex: none;
  }

  .lineage-page .lineage-filter-trigger {
    flex: none;
  }

  .lineage-page .lineage-graph-nav {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    width: max-content;
    max-width: none;
    margin-left: auto;
  }
}

@media (min-width: 701px) and (max-width: 1600px) {
  .lineage-page .lineage-graph-nav__pan-hint {
    display: none;
  }
}

.lineage-page .lineage-relationship-legend i {
  height: 3px;
  width: 1.75rem;
  border-radius: 999px;
  flex: none;
}

.lineage-detail .lineage-relationship-card--rival {
  border-radius: 16px;
}

@media (min-width: 701px) {
  html:has(body.page-lineage) {
    scrollbar-gutter: auto;
  }
}

.lineage-detail__hero {
  padding-top: 0.2rem;
}

@media (min-width: 701px) {
  .lineage-detail {
    overflow: visible;
    padding: 0;
  }

  .lineage-detail [data-lineage-detail-content] {
    border-radius: inherit;
    box-sizing: border-box;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.4rem 1.35rem;
    scroll-padding-top: 1.4rem;
  }

  /* Attached edge tab stays reachable while the dossier content scrolls. */
  html body.page-lineage .lineage-detail .lineage-detail__close {
    background: inherit;
    border: 1px solid;
    border-color: inherit;
    border-radius: 8px !important;
    box-sizing: border-box;
    height: 34px !important;
    width: 34px !important;
    min-height: 34px !important;
    min-width: 34px !important;
    padding: 0;
    /* Match the 34px node info button; include the pane's 1px border. */
    left: calc(-34px - 2px - 1px) !important;
    right: auto !important;
    top: 1.5rem !important;
    transform: none !important;
  }

  html body.page-lineage .lineage-detail .lineage-detail__close .material-symbols-outlined {
    font-size: 20px;
  }

  html body.page-lineage .lineage-detail .lineage-detail__close:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 3px;
  }

}

.lineage-detail__identity {
  align-items: center;
  box-sizing: border-box;
  flex-direction: row;
  width: 100%;
}

.lineage-detail__title-block {
  container-type: inline-size;
  padding-top: 0;
}

/* Size names to the narrow text column, and wrap only between whole words. */
.lineage-detail .lineage-detail__title-block h2 {
  font-size: 2rem;
  font-size: clamp(1.25rem, 15cqi, 2.5rem);
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-wrap: balance;
}

@media (max-width: 520px) {
  .lineage-detail__portrait {
    flex: 0 0 min(6.6rem, 32%);
    width: min(6.6rem, 32%);
  }
}

.lineage-detail .lineage-detail__jp {
  overflow-wrap: anywhere;
}

.lineage-page .lineage-insight-strip__helper {
  color: #fff;
}

.lineage-graph.is-selection-only:not(.is-focusing) .lineage-connection,
.lineage-graph.is-selection-only.is-focusing .lineage-connection:not(.is-related) {
  visibility: hidden;
}

[data-lineage-page] .lineage-graph-nav [data-lineage-all-connections] {
  min-width: 9.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

[data-lineage-page] .lineage-graph-nav [data-lineage-all-connections]::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  flex: none;
}

[data-lineage-page] .lineage-graph-nav [data-lineage-all-connections][aria-pressed="true"] {
  border-color: var(--accent-red);
  color: #fff;
  background: var(--accent-red);
}

[data-lineage-page] .lineage-graph-nav [data-lineage-all-connections][aria-pressed="true"]::before {
  background: currentColor;
}

[data-lineage-page] .lineage-graph-nav [data-lineage-all-connections]:disabled {
  background: var(--modal-shadowbox-surface-strong) !important;
  border-color: var(--modal-shadowbox-stroke) !important;
  color: var(--text-secondary) !important;
  cursor: not-allowed;
  opacity: 0.45;
}

.lineage-mobile-simple-graph.is-focusing .lineage-node:not(.is-related) {
  opacity: 0.06;
}

.lineage-mobile-simple-graph.is-focusing .lineage-node:focus-visible {
  opacity: 1;
}

.lineage-connection {
  fill: none !important;
  stroke: var(--lineage-link-color);
  stroke-width: var(--lineage-connection-width, 2.5px);
  stroke-linecap: round;
  filter: none !important;
  transition: stroke 220ms ease, opacity 220ms ease;
}

.lineage-mobile-simple-graph.is-focusing .lineage-connection:not(.is-related) {
  opacity: 0.045;
  stroke-opacity: 0.28;
}

[data-theme="showa-light"] .lineage-mobile-simple-graph.is-focusing .lineage-connection:not(.is-related),
[data-theme="modern-showa"] .lineage-mobile-simple-graph.is-focusing .lineage-connection:not(.is-related) {
  opacity: 0.035;
  stroke-opacity: 0.22;
}

.lineage-connection.is-lineage-trace {
  animation: lineage-connection-draw 980ms ease-in-out both;
}

@keyframes lineage-connection-draw {
  from { stroke-dasharray: 1; stroke-dashoffset: 1; }
  to { stroke-dasharray: 1; stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lineage-connection {
    animation: none !important;
    transition: none;
  }
}
