/* Website-Showcase · Phase 2 · 3D-Komposition mit autonomem Schweben
   Alle Regeln sind auf .website-showcase begrenzt. Maße innerhalb der Bühne
   in cqw (1 % der Bühnenbreite), damit die Komposition proportional skaliert.

   Ebenen je Fenster (getrennte transforms, keine Konflikte):
     li.ws-item    Position und Stapelung    (statisch)
     .ws-float     Schweben zweiachsig       (zwei CSS-Animationen: translate = x, transform = y)
     .ws-window    statische 3D-Basis        (translateZ + Neigung, unverändert) */

@font-face {
  font-family: "Onest";
  src: url("../assets/onest.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

.website-showcase {
  --ws-frame: #230849;
  --ws-bar-bg: #2D0B65;
  --ws-edge: 183 138 255;
  --ws-dot-1: #ff5f57;
  --ws-dot-2: #febc2e;
  --ws-dot-3: #28c840;
  --ws-shadow: 20 6 48;

  container: showcase / inline-size;
  box-sizing: border-box;
  width: 100%;
  padding-inline: clamp(16px, 4vw, 48px);
  overflow-x: clip;
  font-family: "Onest", system-ui, sans-serif;
  color: #fff;
}

.website-showcase *,
.website-showcase *::before,
.website-showcase *::after {
  box-sizing: border-box;
}

/* Bühne: Desktop ca. 2.25 : 1, max. 1000 px */
.ws-stage {
  container: ws-stage / inline-size;
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin-inline: auto;
  aspect-ratio: 2.25;
}

.ws-scene {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  perspective: 110cqw;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
}

/* Ebene 1: Position. Schwebeweg je Achse als Gesamtweg (hin und her),
   Ausgangslage ist die Mitte: ±halber Weg */
.ws-item {
  --float-x: 10px;
  --float-y: 5px;

  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  margin: 0;
  transform-style: preserve-3d;
}

/* Ebene 2: Schweben */
.ws-float {
  transform-style: preserve-3d;
}

/* Ebene 3: statische 3D-Basis, tiefvioletter Rahmen */
.ws-window {
  --bar: 2.6cqw;
  --r: max(6px, 0.9cqw);
  --frame: 2px;

  position: relative;
  padding: 0 var(--frame) var(--frame);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--ws-frame);
  transform-origin: 50% 50%;
  transform:
    translateZ(var(--z, 0))
    rotateY(var(--ry, 0deg))
    rotateX(var(--rx, 0deg))
    rotateZ(var(--rz, 0deg));
  box-shadow:
    0 0 1.1cqw rgb(var(--ws-edge) / var(--glow-a)),
    0 1.6cqw 4cqw -0.8cqw rgb(var(--ws-shadow) / 0.5),
    0 0.4cqw 1.2cqw rgb(var(--ws-shadow) / 0.28);
}

/* schmale hellviolette Lichtkante auf dem Rahmen */
.ws-window::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(var(--ws-edge) / var(--edge-a));
  pointer-events: none;
}

/* hintere Fenster: zurückhaltender beleuchtet */
.ws-item--left,
.ws-item--right {
  --edge-a: 0.3;
  --glow-a: 0.2;
  --hl-a: 0.18;
  --bar-hi: #2D0B65;
  --bar-lo: #270959;
  z-index: 1;
}

.ws-item--left {
  --x: 3cqw; --y: 7cqw; --w: 46cqw;
  --z: -10cqw; --ry: 14deg; --rx: 3deg; --rz: -1.5deg;
  --float-x: 36px; --float-y: 16px;
  --dur-x: 4.4s; --delay-x: -1.1s;
  --dur-y: 5.6s; --delay-y: -4.3s;
}

.ws-item--right {
  --x: 51cqw; --y: 13cqw; --w: 46cqw;
  --z: -10cqw; --ry: -14deg; --rx: 3deg; --rz: 1.5deg;
  --float-x: 32px; --float-y: 18px;
  --dur-x: 5s;   --delay-x: -4.2s;
  --dur-y: 4.8s; --delay-y: -0.9s;
}

/* vorderes Fenster: klarer beleuchtet, etwas ruhiger */
.ws-item--front {
  --x: 29cqw; --y: 4cqw; --w: 42cqw;
  --z: 0cqw; --ry: -3deg; --rx: 2deg; --rz: 0deg;
  --float-x: 30px; --float-y: 14px;
  --dur-x: 4s;   --delay-x: -2.4s;
  --dur-y: 5.2s; --delay-y: -0.8s;
  --edge-a: 0.5;
  --glow-a: 0.34;
  --hl-a: 0.32;
  --bar-hi: #3A1384;
  --bar-lo: #2D0B65;
  z-index: 2;
}

.ws-item--front .ws-window {
  box-shadow:
    0 0 1.3cqw rgb(var(--ws-edge) / var(--glow-a)),
    0 2.6cqw 6cqw -1cqw rgb(var(--ws-shadow) / 0.6),
    0 0.8cqw 1.8cqw rgb(var(--ws-shadow) / 0.32);
}

/* Browserkopf */
.ws-bar {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--bar);
  margin-inline: calc(var(--frame) * -1);
  padding-inline: calc(var(--bar) * 0.42);
  background: linear-gradient(180deg, var(--bar-hi), var(--bar-lo));
  border-bottom: 1px solid rgb(0 0 0 / 0.3);
  box-shadow: inset 0 1px 0 rgb(var(--ws-edge) / var(--hl-a));
}

.ws-dots {
  display: flex;
  gap: calc(var(--bar) * 0.2);
}

.ws-dots i {
  display: block;
  width: calc(var(--bar) * 0.28);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ws-dot-1);
  opacity: 0.85;
}

.ws-dots i:nth-child(2) { background: var(--ws-dot-2); }
.ws-dots i:nth-child(3) { background: var(--ws-dot-3); }

.ws-address {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 38%;
  height: calc(var(--bar) * 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgb(var(--ws-edge) / 0.1);
  color: rgb(255 255 255 / 0.66);
  font-size: max(7.5px, calc(var(--bar) * 0.36));
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
}

/* Screenshot vollständig, unverändert, Seitenverhältnis aus width/height */
.ws-screen {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: 50% 0;
  border-radius: 0 0 calc(var(--r) - var(--frame)) calc(var(--r) - var(--frame));
}

/* Bewegung: nur aktiv, wenn showcase.js data-ws-motion="on" setzt.
   Ohne data-ws-running (offscreen, Tab verborgen) pausiert die Animation.
   x und y laufen als getrennte Animationen (translate / transform) mit
   eigenen Perioden: sinusartige Pendel je Achse, zusammen eine ruhige,
   nie exakt wiederholte Bahn. Jede Achse für sich ist ein nahtloser Loop. */
@keyframes ws-float-x {
  0%, 100% { translate: calc(var(--float-x) * -0.5) 0; }
  50% { translate: calc(var(--float-x) * 0.5) 0; }
}

@keyframes ws-float-y {
  0%, 100% { transform: translate3d(0, calc(var(--float-y) * 0.5), 0); }
  50% { transform: translate3d(0, calc(var(--float-y) * -0.5), 0); }
}

.website-showcase[data-ws-motion="on"] .ws-float {
  animation:
    ws-float-x var(--dur-x) cubic-bezier(0.37, 0, 0.63, 1) var(--delay-x) infinite both,
    ws-float-y var(--dur-y) cubic-bezier(0.37, 0, 0.63, 1) var(--delay-y) infinite both;
  animation-play-state: paused;
}

.website-showcase[data-ws-motion="on"][data-ws-running] .ws-float {
  animation-play-state: running;
}

/* Mobile: flache, leicht versetzte Anordnung (Bühne 100 : 66).
   Seiten 58cqw breit, bündig bei 0 / 100cqw, durch die Tiefe projiziert
   etwa so breit wie das vordere Fenster (52cqw). */
@container showcase (max-width: 640px) {
  .ws-stage {
    aspect-ratio: 100 / 66;
  }

  .ws-window {
    --bar: 4.6cqw;
    --r: max(5px, 1.8cqw);
  }

  .ws-item--left {
    --x: 0cqw; --y: 11cqw; --w: 58cqw;
    --float-x: 26px; --float-y: 14px;
  }

  .ws-item--right {
    --x: 42cqw; --y: 25cqw; --w: 58cqw;
    --float-x: 24px; --float-y: 16px;
  }

  .ws-item--front {
    --x: 24cqw; --y: 7cqw; --w: 52cqw;
    --float-x: 22px; --float-y: 12px;
  }
}

/* reduzierte Bewegung: kein Schweben (auch ohne JS) */
@media (prefers-reduced-motion: reduce) {
  .website-showcase *,
  .website-showcase *::before,
  .website-showcase *::after {
    animation: none !important;
    transition: none !important;
  }
}
