/* Interactive site-scene on the Leistungen page. Loaded only there. */

.leistungen-scene {
  display: grid;
  gap: var(--space-lg);
  align-items: start;
}
@media (min-width: 960px) {
  .leistungen-scene { grid-template-columns: 1.6fr 1fr; }
}

/* Desktop with real hover support: the legend LIST is replaced by a
   floating tooltip that appears directly over the hovered/focused part of
   the picture (see leistungen-scene.js, which only enables this when the
   pointer device actually supports hover). The detail card stays visible
   below the picture as a persistent "click to keep this open" panel --
   only the redundant button list is visually hidden (still keyboard
   focusable, since touch/keyboard-without-hover users need it). */
.leistungen-scene.has-hover-tooltip {
  grid-template-columns: 1fr;
}
.leistungen-scene.has-hover-tooltip .service-legend {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.leistungen-scene.has-hover-tooltip .leistungen-scene__panel {
  margin: 0;
}

.scene-hover-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin: 0;
  padding: 0.6em 1em;
  text-align: center;
  font-size: 0.92rem;
  color: var(--color-text);
  opacity: 0.75;
}
.leistungen-scene.has-hover-tooltip .scene-hover-hint {
  display: flex;
  animation: ctd-hint-pulse 2.4s ease-in-out 1;
}

@keyframes ctd-hint-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .leistungen-scene.has-hover-tooltip .scene-hover-hint { animation: none; }
}

.leistungen-scene__graphic {
  background: var(--color-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Real illustrated photo as background, with a coordinate-matched
   transparent SVG overlay on top for the hoverable/clickable regions. */
.leistungen-scene__graphic { position: relative; line-height: 0; }
.scene-image { width: 100%; height: auto; display: block; border-radius: calc(var(--radius) - 4px); }
.scene-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Hotspot regions are invisible by default; hover/active reveals a soft
   highlight fill + outline. Window regions get a warmer glass-like tint. */
.hotspot {
  fill: transparent;
  stroke: transparent;
  stroke-width: 3;
  cursor: pointer;
  transition: fill var(--transition-base), stroke var(--transition-base);
}
.hotspot.is-hover {
  fill: var(--color-accent);
  fill-opacity: 0.16;
  stroke: var(--color-accent);
  stroke-opacity: 0.55;
}
.hotspot.is-active {
  fill: var(--color-accent);
  fill-opacity: 0.24;
  stroke: var(--color-accent);
  stroke-opacity: 0.9;
}
.hotspot.window.is-hover,
.hotspot.window.is-active {
  fill: #ffe9c2;
  fill-opacity: 0.45;
  stroke: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  .hotspot { transition: none; }
}

/* Floating tooltip shown on hover/focus of a hotspot (desktop only, see
   leistungen-scene.js for the hover-capability check). */
.scene-tooltip {
  position: absolute;
  z-index: 5;
  width: 240px;
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
  background: var(--color-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px) scale(0.92);
  transition: opacity 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  /* .leistungen-scene__graphic sets line-height:0 to remove the image's
     inline whitespace gap -- reset it here so the tooltip's own text
     doesn't inherit that and collapse on top of itself. */
  line-height: 1.4;
}
.scene-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -16px) scale(1);
  pointer-events: auto;
  cursor: pointer;
}

/* Speech-bubble pointer connecting the card back to the hovered element. */
.scene-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--color-bg);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 3px 0;
}

.scene-tooltip__head {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin-bottom: 0.3em;
}
.scene-tooltip__icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  overflow: hidden;
}
.scene-tooltip__icon svg { width: 16px; height: 16px; }
.scene-tooltip__icon img { width: 100%; height: 100%; object-fit: cover; }
.scene-tooltip__title { font-weight: 700; }
.scene-tooltip__text { display: block; font-size: 0.88rem; opacity: 0.85; }

@media (prefers-reduced-motion: reduce) {
  .scene-tooltip { transition: none; }
}

/* Legend + detail panel */
.service-legend { list-style: none; margin: 0 0 var(--space-sm); padding: 0; display: grid; gap: 0.4rem; }
.service-legend__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.65em 0.9em;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}
.service-legend__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.service-legend__icon svg { width: 18px; height: 18px; }
.service-legend__icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.service-legend__item:hover,
.service-legend__item.is-hover {
  border-color: var(--color-primary);
  transform: translateX(2px);
}
.service-legend__item[aria-pressed="true"] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Persistent click panels -- one per service, pre-rendered server-side
   (icon/image + title + full editor content), only visibility toggles in
   JS. Styled to match the icon-badge card look used on the Philosophie
   page (template-parts/content/service-card.php / usp-item.php) so the
   whole site reads as one system. */
.service-panels { position: relative; min-height: 4.5em; }
.service-panel {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius);
  padding: var(--space-sm) var(--space-md);
}
.service-panel.is-visible { display: block; }
.service-panel[data-service="__default__"] {
  border-left-color: var(--border-color);
  opacity: 0.8;
}
.service-panel__head { display: flex; align-items: center; gap: 0.7em; margin-bottom: 0.5em; }
.service-panel__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  overflow: hidden;
}
.service-panel__icon svg { width: 22px; height: 22px; }
.service-panel__icon img { width: 100%; height: 100%; object-fit: cover; }
.service-panel__title { font-weight: 700; font-size: 1.1rem; }
.service-panel__content > *:last-child { margin-bottom: 0; }
.service-panel__content img { border-radius: calc(var(--radius) - 4px); margin-block: var(--space-xs); }
.service-panel__text { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .service-legend__item { transition: none; }
  .service-legend__item:hover, .service-legend__item.is-hover { transform: none; }
}
