/* ==========================================================================
   Leistungen – abstrakter Grundriss mit verschiebbaren Wänden
   Statischer Grundzustand (ohne JS / reduzierte Bewegung): Grundriss +
   Leistungstexte darunter. `.is-live` aktiviert den gepinnten Modus.
   ========================================================================== */

.services {
  --st: 0;
  --plan-ink: rgb(24 24 23 / 0.62);
  --plan-ink-soft: rgb(24 24 23 / 0.16);
  position: relative;
  overflow-x: clip;
  background: color-mix(in srgb, var(--c-dark) calc(var(--st) * 100%), var(--c-stone));
  color: var(--c-ink);
  padding-block: var(--space-section-tight) clamp(4rem, 3rem + 4vw, 7rem);
}
.services .kicker { color: var(--c-muted-on-stone); }

.services__title {
  margin-top: 1.75rem;
  max-width: 12em;
}
.services__lead {
  margin-top: clamp(1.75rem, 1.2rem + 1.5vw, 2.5rem);
  max-width: 43.75rem;
  color: var(--c-muted-on-stone);
}
.services__intro .marker { margin-top: clamp(3.5rem, 2.5rem + 3vw, 5.5rem); }

/* ---------- Bühne ---------- */

.plan-pin { margin-top: clamp(2rem, 1.25rem + 2vw, 3.5rem); }

.plan-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.plan {
  --x: 42; --yl: 58; --yr: 38;
  position: relative;
  width: min(90vw, 100vw - 2 * var(--gutter));
  height: min(75svh, 58vw);
  min-height: 420px;
  border: 1px solid var(--plan-ink);
  overflow: clip;
  overflow-clip-margin: 24px;
}

/* Achsen-Markierungen außen */
.plan__axis { position: absolute; pointer-events: none; }
.plan__axis--top {
  left: 0; right: 0; top: -14px; height: 8px;
  background:
    linear-gradient(var(--plan-ink), var(--plan-ink)) left top / 1px 100% no-repeat,
    linear-gradient(var(--plan-ink), var(--plan-ink)) right top / 1px 100% no-repeat,
    linear-gradient(var(--plan-ink-soft), var(--plan-ink-soft)) left 50% / 100% 1px no-repeat;
}
.plan__axis--left {
  top: 0; bottom: 0; left: -14px; width: 8px;
  background:
    linear-gradient(var(--plan-ink), var(--plan-ink)) left top / 100% 1px no-repeat,
    linear-gradient(var(--plan-ink), var(--plan-ink)) left bottom / 100% 1px no-repeat,
    linear-gradient(var(--plan-ink-soft), var(--plan-ink-soft)) 50% top / 1px 100% no-repeat;
}

/* Wände */
.wall {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}
.wall__line {
  position: absolute;
  display: block;
  overflow: hidden;
  background: var(--plan-ink);
  will-change: transform;
}
.wall--v { transform: translateX(calc(var(--x) * 1%)); }
.wall--v .wall__line { left: 0; top: 0; bottom: 0; width: 1px; }
.wall--hl { transform: translateY(calc(var(--yl) * 1%)); }
.wall--hl .wall__line {
  left: 0; top: 0; width: 100%; height: 1px;
  transform-origin: left center;
  transform: scaleX(calc(var(--x) / 100));
}
.wall--hr { transform: translateY(calc(var(--yr) * 1%)); }
.wall--hr .wall__line {
  right: 0; top: 0; width: 100%; height: 1px;
  transform-origin: right center;
  transform: scaleX(calc((100 - var(--x)) / 100));
}

/* Lichtimpuls, der entlang der aktiven Kante läuft */
.wall__pulse {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(90deg, rgb(197 154 118 / 0) 0%, var(--c-champagne) 40%, var(--c-glow) 55%, rgb(230 199 168 / 0) 100%);
  background-size: 45% 100%;
  background-repeat: no-repeat;
  background-position: -60% 0;
}
.wall--v .wall__pulse {
  background-image: linear-gradient(180deg, rgb(197 154 118 / 0) 0%, var(--c-champagne) 40%, var(--c-glow) 55%, rgb(230 199 168 / 0) 100%);
  background-size: 100% 45%;
  background-position: 0 -60%;
}
.wall.is-pulsing .wall__line { width: 2px; margin-left: -0.5px; }
.wall--hl.is-pulsing .wall__line,
.wall--hr.is-pulsing .wall__line { width: 100%; height: 2px; margin: -0.5px 0 0; }
.wall.is-pulsing .wall__pulse { animation: wall-pulse-h 1.6s var(--ease-in-out) forwards; }
.wall--v.is-pulsing .wall__pulse { animation-name: wall-pulse-v; }
@keyframes wall-pulse-h {
  0% { opacity: 0; background-position: -60% 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; background-position: 160% 0; }
}
@keyframes wall-pulse-v {
  0% { opacity: 0; background-position: 0 -60%; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; background-position: 0 160%; }
}

/* Raumbeschriftungen */
.room-tag {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: clamp(0.9rem, 1.4vw, 1.4rem);
  will-change: transform;
}
.room-tag[data-room-tag="2"] { transform: translateX(calc(var(--x) * 1%)); }
.room-tag[data-room-tag="3"] { transform: translateY(calc(var(--yl) * 1%)); }
.room-tag[data-room-tag="4"] { transform: translate(calc(var(--x) * 1%), calc(var(--yr) * 1%)); }
.room-tag__num {
  font-size: 0.6875rem;
  font-weight: 500;
  font-stretch: 115%;
  letter-spacing: 0.18em;
  color: var(--c-bronze-on-light);
  padding-top: 0.2em;
}
.room-tag__title {
  max-width: 13rem;
  font-size: clamp(0.9375rem, 0.8rem + 0.4vw, 1.125rem);
  font-weight: 450;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

/* Raum-Visuals (nur im Live-Modus sichtbar) */
.room-visual {
  position: absolute;
  display: none;
  pointer-events: none;
  color: var(--c-ink);
}
.room-visual svg { width: 100%; height: 100%; overflow: visible; }
.room-visual text {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  font-stretch: 115%;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  fill: var(--c-muted-on-stone);
  text-anchor: middle;
}

.room-visual--1 { left: 38%; top: 16%; width: 31%; height: 58%; }
.room-visual--2 { left: 64%; top: 16%; width: 33%; height: 54%; }
.room-visual--3 { left: 38%; top: 30%; width: 31%; height: 60%; }
.room-visual--4 { left: 64%; top: 32%; width: 33%; height: 58%; }

.dim path { fill: none; stroke: var(--plan-ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.found { fill: none; stroke: var(--c-bronze); stroke-width: 1; vector-effect: non-scaling-stroke; }
.found--inner { stroke: var(--plan-ink); stroke-dasharray: 3 5; }
.found-dot { fill: var(--c-bronze); }

.route { fill: none; stroke: var(--c-ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.route-nodes circle { fill: var(--c-stone); stroke: var(--c-ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.route-nodes .route-end { fill: var(--c-bronze); stroke: var(--c-bronze); }

.flow path { fill: none; stroke: var(--plan-ink-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.flow-dots circle { fill: var(--c-ink); }
.target { fill: var(--c-bronze); }
.target-ring { fill: none; stroke: var(--c-bronze); stroke-width: 1; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; }

/* Wireframe, das sich am Raster ausrichtet */
.wire {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--plan-ink);
  background: rgb(245 243 238 / 0.55);
}
.wire__grid {
  position: absolute;
  inset: 0 6%;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4%;
}
.wire__grid i { background: rgb(154 114 84 / 0.08); border-inline: 1px solid rgb(154 114 84 / 0.18); }
.wire__el {
  position: absolute;
  display: block;
  will-change: transform;
}
.wire__el--nav { left: 6%; right: 6%; top: 7%; height: 1px; background: var(--c-ink); }
.wire__el--h1 { left: 6%; top: 17%; width: 55%; height: 7%; background: var(--c-ink); }
.wire__el--h1b { left: 6%; top: 27%; width: 38%; height: 7%; background: var(--c-ink); }
.wire__el--text { left: 6%; top: 42%; width: 38%; height: 14%; background: repeating-linear-gradient(to bottom, var(--plan-ink) 0 1px, transparent 1px 22%); }
.wire__el--img { left: 52%; top: 42%; width: 42%; height: 46%; border: 1px solid var(--plan-ink); background: linear-gradient(to top right, transparent calc(50% - 0.5px), var(--plan-ink-soft) 50%, transparent calc(50% + 0.5px)); }
.wire__el--btn { left: 6%; top: 66%; width: 24%; height: 9%; border-radius: 999px; background: var(--c-copper); }
.wire__space {
  position: absolute;
  display: block;
  border: 1px solid var(--c-bronze);
  border-top: 0;
  height: 6px;
  opacity: 0;
}
.wire__space--a { left: 6%; top: 36.5%; width: 38%; }
.wire__space--b { left: 44%; top: 50%; width: 8%; }

/* Finale */
.plan__finale {
  display: none;
}

/* ---------- Leistungstexte ---------- */

.plan-copy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3rem clamp(2rem, 4vw, 5rem);
  width: var(--shell);
}

.room-copy__label {
  font-size: 0.6875rem;
  font-weight: 500;
  font-stretch: 115%;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-bronze-on-light);
}
.room-copy__title {
  margin-top: 0.9rem;
  font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem);
  font-weight: 450;
  font-stretch: 94%;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.room-copy__text {
  margin-top: 1rem;
  max-width: 26rem;
  color: var(--c-muted-on-stone);
  text-wrap: pretty;
}

/* technische Beschriftungen statt Bulletpoints */
.specs {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.55rem;
}
.specs li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.6875rem;
  font-weight: 500;
  font-stretch: 112%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-ink);
}
.specs li::before {
  content: "";
  flex: none;
  width: 1.25rem;
  height: 5px;
  border-left: 1px solid var(--c-bronze);
  background: linear-gradient(var(--c-bronze), var(--c-bronze)) left 50% / 100% 1px no-repeat;
}

/* ---------- Static-Modus: Finale unter dem Grundriss ---------- */
.plan-pin:not(.is-live) .plan__finale {
  display: block;
}

/* ==========================================================================
   Live-Modus (JS, Bewegung erlaubt)
   ========================================================================== */

.plan-pin.is-live .plan-stage {
  height: 100svh;
  justify-content: center;
  padding-top: calc(var(--header-top) + var(--header-h) * 0.5);
  gap: 0;
}
.plan-pin.is-live .room-visual { display: block; }
.plan-pin.is-live .plan__finale {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 50%; top: 50%;
  width: min(34rem, 80%);
  padding: clamp(1.75rem, 3vw, 2.75rem);
  transform: translate(-50%, -50%);
  background: var(--c-dark);
  color: var(--c-ivory);
  box-shadow: 0 24px 60px -32px rgb(17 17 16 / 0.55);
  text-align: center;
  visibility: hidden;
}

/* Schließen */
.plan__finale-close {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  border: 0;
  background: transparent;
  color: rgb(245 243 238 / 0.7);
  transition: color 0.25s ease;
}
.plan__finale-close svg { width: 1rem; height: 1rem; }
@media (hover: hover) and (pointer: fine) {
  .plan__finale-close:hover { color: var(--c-champagne); }
}
.plan__finale.is-dismissed { display: none !important; }
.plan__finale-title {
  font-size: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
  font-weight: 450;
  font-stretch: 92%;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.plan__finale-title span { display: block; }
.plan__finale-text {
  margin-top: 1rem;
  max-width: 28rem;
  color: rgb(245 243 238 / 0.72);
  text-wrap: balance;
}
.plan__finale .text-link { color: var(--c-ivory); }
.plan__finale .text-link:hover { color: var(--c-champagne); }
.plan__finale-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.75rem;
  margin-top: 1.75rem;
}
.plan-pin:not(.is-live) .plan__finale {
  margin: 3.5rem auto 0;
  max-width: 34rem;
  text-align: center;
}
.plan-pin:not(.is-live) .plan__finale-actions { justify-content: center; }
.plan-pin:not(.is-live) .plan__finale-close { display: none; }

/* Desktop: Texte liegen im jeweils aktiven Raum */
@media (min-width: 861px) {
  .plan-pin.is-live .plan-copy {
    position: absolute;
    left: 50%;
    top: calc(50% + (var(--header-top) + var(--header-h) * 0.5) / 2);
    width: min(90vw, 100vw - 2 * var(--gutter));
    height: min(75svh, 58vw);
    min-height: 420px;
    transform: translate(-50%, -50%);
    display: block;
    pointer-events: none;
  }
  .plan-pin.is-live .room-copy {
    position: absolute;
    width: 30%;
    max-width: 26rem;
    visibility: hidden;
  }
  .plan-pin.is-live .room-copy[data-copy="1"] { left: 3%; top: 13%; }
  .plan-pin.is-live .room-copy[data-copy="2"] { left: 31%; top: 13%; }
  .plan-pin.is-live .room-copy[data-copy="3"] { left: 3%; top: 31%; }
  .plan-pin.is-live .room-copy[data-copy="4"] { left: 31%; top: 31%; }
}

@media (min-width: 861px) and (max-height: 760px) {
  .plan-pin.is-live .room-copy__text { font-size: 0.9375rem; }
  .plan-pin.is-live .specs { margin-top: 1rem; }
}

/* Mobile */
@media (max-width: 860px) {
  .plan { height: 62vw; min-height: 260px; width: var(--shell); }
  .plan-copy { grid-template-columns: 1fr; }
  .room-tag { flex-direction: column; padding: 0.6rem; gap: 0.2rem; }
  .room-tag__title { font-size: 0.75rem; max-width: 26vw; hyphens: manual; -webkit-hyphens: manual; }

  .plan-pin.is-live .plan-stage {
    justify-content: flex-start;
    padding-top: calc(var(--header-top) + var(--header-h) + 1.25rem);
    gap: 1.5rem;
  }
  .plan-pin.is-live .plan { height: 46svh; min-height: 0; }
  .plan-pin.is-live .plan-copy { display: grid; grid-template-columns: 1fr; gap: 0; }
  .plan-pin.is-live .room-copy { grid-area: 1 / 1; visibility: hidden; }
  .plan-pin.is-live .room-copy__title { margin-top: 0.5rem; font-size: 1.375rem; }
  .plan-pin.is-live .room-copy__text { margin-top: 0.6rem; font-size: 0.9375rem; }
  .plan-pin.is-live .specs { margin-top: 0.9rem; gap: 0.4rem; }
  .plan-pin.is-live .specs li { font-size: 0.625rem; }
  .plan-pin.is-live .plan__axis { display: none; }

  .room-visual--1 { left: 5%; top: 22%; width: 62%; height: 52%; }
  .room-visual--2 { left: 33%; top: 22%; width: 62%; height: 50%; }
  .room-visual--3 { left: 5%; top: 40%; width: 62%; height: 52%; }
  .room-visual--4 { left: 33%; top: 40%; width: 62%; height: 52%; }
  .plan-pin.is-live .plan__finale { width: 94%; padding: 1.25rem; }
  .plan-pin.is-live .plan__finale-title { font-size: 1.375rem; }
  .plan-pin.is-live .plan__finale-text { font-size: 0.875rem; margin-top: 0.6rem; }
  .plan-pin.is-live .plan__finale-actions { margin-top: 1rem; gap: 0.5rem 1rem; }
  .plan-pin.is-live .plan__finale .btn { padding: 0.75rem 1.1rem; min-height: 2.75rem; }
}

/* Statischer Modus: Finale unterhalb des Grundrisses */
.plan-pin:not(.is-live) .plan {
  overflow: visible;
  margin-bottom: clamp(17rem, 14rem + 6vw, 20rem);
}
.plan-pin:not(.is-live) .plan__finale {
  padding: clamp(1.75rem, 3vw, 2.75rem);
  background: var(--c-dark);
  color: var(--c-ivory);
  position: absolute;
  left: 50%;
  top: calc(100% + 3.5rem);
  width: min(34rem, 100%);
  margin: 0;
  transform: translateX(-50%);
}
.plan-pin:not(.is-live) .plan__finale-actions { justify-content: center; }
