/*
  Wayfinder - the signature element. Deliberately the one component that
  goes dark (Bone Ink chrome): everywhere else on the site is a light,
  paper-toned reading surface; this is styled like the radiology
  lightbox/viewer instrument it's modeled on, so the contrast reads as
  intentional - stepping into a diagnostic tool and back - rather than
  inconsistent. See the design-token sign-off's self-critique log.
*/

.wayfinder {
  background: var(--color-bone-ink);
  color: var(--color-field-white);
  padding: clamp(1rem, 3vw, 1.75rem);
  border-radius: 2px;
}

.wayfinder__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(243, 245, 246, 0.15);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.wayfinder__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  color: rgba(243, 245, 246, 0.55);
}

.wayfinder__tabs {
  display: flex;
  gap: 0.35rem;
}
.wayfinder__tabs button {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.03em;
  color: rgba(243, 245, 246, 0.6);
  background: transparent;
  border: 1px solid rgba(243, 245, 246, 0.25);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}
.wayfinder__tabs button[aria-selected='true'] {
  color: var(--color-bone-ink);
  background: var(--color-field-white);
  border-color: var(--color-field-white);
}
.wayfinder__tabs button:focus-visible {
  outline: 2px solid var(--color-oxblood);
  outline-offset: 2px;
}

.wayfinder__viewer {
  position: relative;
  display: flex;
  justify-content: center;
}

.wayfinder__stage {
  width: 100%;
  max-width: 22rem;
  padding: 1rem 0;
  display: flex;
  justify-content: center;
}
/*
  Height-capped, not just width-capped: the spine viewBox is ~4.4:1
  (tall) - at a pure width-driven max-width, the full C1-S1 stack
  rendered far taller than one screen (reported: "too large... scrolling
  way too down"). max-height + width:auto lets the browser use the
  viewBox's intrinsic aspect ratio to shrink proportionally against
  whichever bound is tighter, the same way object-fit:contain works for
  an <img> - width:100% alone only ever looks at the horizontal bound.
  Harmless for the cranial tab (~0.77:1, landscape) since its natural
  height at max-width never gets close to this cap.
*/
.wayfinder__stage svg {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(65vh, 40rem);
  display: block;
  overflow: visible;
}

.wf-baseline {
  stroke: rgba(243, 245, 246, 0.15);
  stroke-width: 1;
}

/*
  Static, non-interactive background silhouette behind the cranial
  hotspots - see WayfinderLayout::cranialOutlinePath()'s docblock for why
  this was added (individually-correct lobe shapes still read as
  scattered pieces, not "a brain", without an overall unifying outline).
  Deliberately low fill-opacity and a soft neutral stroke so it never
  competes with the actual axis-colored hotspots drawn on top of it.
*/
.wf-brain-outline {
  fill: var(--color-navy-mid);
  fill-opacity: 0.12;
  stroke: rgba(243, 245, 246, 0.22);
  stroke-width: 1.25;
}

.wf-hotspot rect,
.wf-hotspot ellipse,
.wf-hotspot path {
  fill: var(--axis-color, var(--color-oxblood));
  fill-opacity: 0.45;
  stroke: rgba(243, 245, 246, 0.18);
  stroke-width: 0.75;
  transition: fill-opacity 0.15s ease, stroke 0.15s ease, stroke-width 0.15s ease;
}
.wf-hotspot {
  cursor: pointer;
}
.wf-hotspot:hover rect,
.wf-hotspot:hover ellipse,
.wf-hotspot:hover path,
.wf-hotspot:focus-visible rect,
.wf-hotspot:focus-visible ellipse,
.wf-hotspot:focus-visible path,
.wf-hotspot.is-active rect,
.wf-hotspot.is-active ellipse,
.wf-hotspot.is-active path {
  fill-opacity: 1;
  stroke: var(--color-field-white);
  stroke-width: 1.5;
}
.wf-hotspot:focus-visible rect,
.wf-hotspot:focus-visible ellipse,
.wf-hotspot:focus-visible path {
  stroke: var(--color-oxblood);
  stroke-width: 2;
}

/* tooltip - JS positions it with inline top/left against .wayfinder__viewer */
.wayfinder__tooltip {
  position: absolute;
  z-index: 5;
  max-width: 16rem;
  background: var(--color-field-white);
  color: var(--color-bone-ink);
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--color-brass);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.wayfinder__tooltip[hidden] {
  display: none;
}
.wf-tooltip__mono {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  color: var(--color-brass);
  margin-bottom: 0.25rem;
}
.wf-tooltip__title {
  font-weight: 600;
  font-size: var(--fs-body-s);
  margin-bottom: 0.4rem;
}
.wf-tooltip__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  color: var(--color-ink-soft);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.wf-tooltip__list li::before {
  content: '\2192\0020';
  color: var(--color-soft-tissue);
}

/* dialog */
.wayfinder__dialog {
  border: none;
  padding: 1.25rem 1.5rem 1.5rem;
  max-width: 28rem;
  width: min(90vw, 28rem);
  background: var(--color-field-white);
  color: var(--color-bone-ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.wayfinder__dialog::backdrop {
  background: rgba(20, 26, 33, 0.55);
}
.wayfinder__dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wf-dialog__mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  color: var(--color-navy-mid);
}
.wf-dialog__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-soft-tissue);
  padding: 0.25rem 0.4rem;
}
.wayfinder__dialog h3 {
  font-family: var(--font-display);
  font-size: var(--fs-l);
  margin: 0.5rem 0 0.85rem;
}
.wayfinder__dialog h4 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-soft-tissue);
  margin: 1rem 0 0.4rem;
}
.wayfinder__dialog ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.wayfinder__dialog a {
  color: var(--color-navy-mid);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .wf-hotspot rect,
  .wf-hotspot ellipse,
  .wf-hotspot path {
    transition-duration: 0.001ms !important;
  }
}

@media (min-width: 640px) {
  .wayfinder__stage {
    max-width: 26rem;
  }
}
