/* 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;
}

.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;
  }

  /* Close sits inside the panel, top-right, like every other panel and
     modal on the site (44px, the shared modal icon-button size), lined up
     with the portrait top and the content's right padding. It is outside
     the scroller, so it stays put while the dossier content scrolls. (It
     used to float outside the panel's left edge, over the graph.) */
  html body.page-lineage .lineage-detail .lineage-detail__close {
    background: inherit;
    border: 1px solid;
    border-color: inherit;
    border-radius: var(--button-radius, 8px) !important;
    box-sizing: border-box;
    height: var(--modal-icon-button-size, 44px) !important;
    width: var(--modal-icon-button-size, 44px) !important;
    min-height: var(--modal-icon-button-size, 44px) !important;
    min-width: var(--modal-icon-button-size, 44px) !important;
    padding: 0;
    left: auto !important;
    right: 1.35rem !important;
    top: 1.4rem !important;
    transform: none !important;
  }

  /* Keep the name clear of the close button. Padding on the heading (not
     the title block) so the name's container-query size is unchanged. */
  .lineage-detail .lineage-detail__title-block h2 {
    padding-right: calc(var(--modal-icon-button-size, 44px) + var(--space-2-5, 10px));
  }

  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;
}

.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;
  }
}

/* Selected and related wrestlers: one neutral style for every node.
   The connector colours carry the meaning (trainer, dojo, influence...), so
   the node outlines no longer use the promotion colour (it still shows in
   the promotion label) or red, which read as one more connector colour.
   Selected: a bright paper outline plus a soft paper halo. Related: a faint
   paper outline. */
html[data-theme] .lineage-page .lineage-node.is-related .lineage-node-halo--outer,
html[data-theme] .lineage-page .lineage-node:focus-visible .lineage-node-halo--outer {
  stroke: rgba(var(--text-primary-rgb), 1);
  stroke-opacity: 0.1;
  stroke-width: 6;
}

html[data-theme] .lineage-page .lineage-node.is-related .lineage-node-halo--inner {
  stroke-opacity: 0;
}

html[data-theme] .lineage-page .lineage-node.is-related .lineage-node-card {
  stroke: rgba(var(--text-primary-rgb), 0.34);
}

html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-halo--outer {
  stroke-opacity: 0.2;
  stroke-width: 8;
}

html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-halo--inner {
  stroke: rgba(var(--text-primary-rgb), 1);
  stroke-opacity: 0.5;
  stroke-width: 1.5;
}

html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-card {
  stroke: rgba(var(--text-primary-rgb), 0.92);
  stroke-width: 1.5;
}

/* Info button: the same two-ring pulse, dialled back (softer, smaller,
   slower). */
html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-info-button__pulse {
  stroke-width: 1.5;
}

html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-info-button__pulse--one {
  animation: lineageInfoButtonPulseSoft 3s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-info-button__pulse--two {
  animation: lineageInfoButtonPulseSoft 3s cubic-bezier(0.16, 1, 0.3, 1) 1.5s infinite;
}

@keyframes lineageInfoButtonPulseSoft {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }

  20% {
    opacity: 0.5;
  }

  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-info-button__pulse--one,
  html[data-theme] .lineage-page .lineage-node.is-active .lineage-node-info-button__pulse--two {
    animation: none;
  }
}

/* Performance: no drop shadow on the cards of hovered, focused or connected
   wrestlers. On the near-black graph it was barely visible, but as an SVG
   filter it was redrawn for every connected card (49 for Antonio Inoki) on
   every frame while the connections draw in. The Rikidozan experiment's red
   glow keeps its own, more specific filter. */
html[data-theme] .lineage-page .lineage-node .lineage-node-card {
  filter: none;
}
