/* Startseiten-Hero "Chaos -> Ordnung".
   Performance: nur transform/opacity animiert, kein WebGL, kein filter/backdrop-filter;
   ausserhalb des Viewports pausieren alle Animationen (Klasse is-visible via hero.js). */

/* ---------- Grundgeruest ---------- */
.hd {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 7.5rem 0 5.5rem;
  background-color: #000000;
  overflow: hidden;
  isolation: isolate;
}

.hd > .container {
  position: relative;
  z-index: 2;
}

.hd-kicker {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 1.5rem;
  padding: .4rem .95rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  font-size: .82rem;
}

.hd-kicker i {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
  animation: hd-blink 2.4s ease-in-out infinite;
}

@keyframes hd-blink {
  50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.05); }
}

.hd .hd-title {
  margin: 0 0 1.25rem;
  color: #ffffff;
  font-size: clamp(2.6rem, 1.4rem + 4vw, 5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -.035em;
}

/* globale span-Regel des Themes ueberschreibt sonst das Gewicht */
.hd .hd-title span {
  font-weight: inherit;
}

.hd-grad {
  background-image: linear-gradient(90deg, #0175ff 0%, #7dabff 30%, #ffcd7d 55%, #7dabff 75%, #0175ff 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hd-shine 9s linear infinite;
}

@keyframes hd-shine {
  to { background-position: 300% 0; }
}

.hd-lead {
  max-width: 40rem;
  margin: 0 0 2rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(1rem, .92rem + .35vw, 1.2rem);
  line-height: 1.6;
}

.hd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.hd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .9rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}

.hd-btn:hover,
.hd-btn:focus-visible {
  color: #ffffff;
  transform: translateY(-2px);
}

.hd-btn--primary {
  background-color: #0175ff;
  box-shadow: 0 14px 34px -12px rgba(1, 117, 255, 0.85);
  color: #ffffff;
}

.hd-btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.hd-btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.hd-trust {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: .85rem;
}

.hd-trust li {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.hd-trust li::before {
  content: '';
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background-color: #0175ff;
}

.hd-in {
  animation: hd-up .9s cubic-bezier(.22, .61, .36, 1) both;
  animation-delay: calc(var(--d, 0) * 120ms + 100ms);
}

@keyframes hd-up {
  from { opacity: 0; transform: translate3d(0, 22px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes hd-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hd-js .hd:not(.is-visible) *,
.hd-js .hd:not(.is-visible) *::before,
.hd-js .hd:not(.is-visible) *::after {
  animation-play-state: paused !important;
}

@media (max-width: 767px) {
  .hd {
    padding: 6.5rem 0 4.5rem;
  }
  .hd-actions .hd-btn {
    flex: 1 1 100%;
  }
}

/* ---------- Hintergrund-Glow: warm im Chaos, blau in Ordnung ---------- */
.hd-e::before,
.hd-e::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -10%;
  z-index: 0;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  transform: translateY(-50%);
  transition: opacity 1s ease;
  pointer-events: none;
}

.hd-e::before {
  background-image: radial-gradient(closest-side, rgba(255, 92, 51, 0.22), rgba(255, 92, 51, 0));
}

.hd-e::after {
  background-image: radial-gradient(closest-side, rgba(1, 117, 255, 0.3), rgba(1, 117, 255, 0));
  opacity: 0;
}

.hd-e.is-order::before { opacity: 0; }
.hd-e.is-order::after { opacity: 1; }

/* ---------- Schalter ---------- */
.hd-e-switch {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  margin: 0 0 1.75rem;
  padding: .5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}

.hd-e-switch:focus-visible {
  outline: 2px solid #0175ff;
  outline-offset: 3px;
}

.hd-e-switch-off { color: #ffb199; transition: color .4s ease; }
.hd-e-switch-on { color: rgba(255, 255, 255, 0.45); transition: color .4s ease; }
.hd-e-switch[aria-checked="true"] .hd-e-switch-off { color: rgba(255, 255, 255, 0.45); }
.hd-e-switch[aria-checked="true"] .hd-e-switch-on { color: #7dabff; }

.hd-e-switch-track {
  position: relative;
  width: 3.2rem;
  height: 1.7rem;
  border-radius: 999px;
  background-color: #3a1f18;
  transition: background-color .4s ease;
}

.hd-e-switch-track i {
  position: absolute;
  top: .2rem;
  left: .2rem;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background-color: #ff8a5c;
  transition: transform .45s cubic-bezier(.3, 1.4, .5, 1), background-color .4s ease;
}

.hd-e-switch[aria-checked="true"] .hd-e-switch-track { background-color: #0b3b7a; }
.hd-e-switch[aria-checked="true"] .hd-e-switch-track i { background-color: #ffffff; transform: translateX(1.5rem); }

/* Mobil sitzt der Schalter direkt ueber dem Klickfeld, am Desktop in der Textspalte */
.hd-e-switch--mob {
  display: none;
}

/* ---------- Klickfeld ---------- */
.hd-e-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  container-type: size;
  cursor: pointer;
}

.hd-e-stage::before {
  content: '';
  position: absolute;
  top: -1rem;
  right: -1rem;
  bottom: -1.75rem;
  left: -1rem;
  border: 1px dashed rgba(255, 138, 92, 0.4);
  border-radius: 1.5rem;
  opacity: .7;
  transition: opacity .4s ease, border-color .5s ease;
  pointer-events: none;
}

.hd-e.is-order .hd-e-stage::before {
  border-color: rgba(125, 171, 255, 0.4);
}

.hd-e-stage:hover::before {
  opacity: 1;
}

.hd-e-cables {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: opacity .6s ease;
}

.hd-e-cables path {
  fill: none;
  stroke: rgba(255, 138, 92, 0.35);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.hd-e.is-order .hd-e-cables {
  opacity: 0;
}

.hd-e-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 31cqw;
  height: 26cqh;
  transform: translate(calc(var(--cx) * 1cqw), calc(var(--cy) * 1cqh)) rotate(var(--cr));
  transition: transform .9s cubic-bezier(.34, 1.3, .5, 1);
  transition-delay: calc(var(--i) * 55ms);
}

.hd-e.is-order .hd-e-item {
  transform: translate(calc(var(--ox) * 1cqw), calc(var(--oy) * 1cqh)) rotate(0deg);
}

.hd-e-jitter {
  position: relative;
  width: 100%;
  height: 100%;
}

.hd-e:not(.is-order) .hd-e-jitter {
  animation: hd-jitter 3.2s ease-in-out infinite;
  animation-delay: calc(var(--i) * -.41s);
}

@keyframes hd-jitter {
  0%, 100% { transform: none; }
  25% { transform: translate(2px, -3px) rotate(1.5deg); }
  50% { transform: translate(-2px, 2px) rotate(-1deg); }
  75% { transform: translate(3px, 1px) rotate(1deg); }
}

.hd-e-face {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  height: 100%;
  padding: 0 1rem;
  border-radius: 1rem;
  font-size: clamp(.72rem, .5rem + .55vw, .95rem);
  font-weight: 600;
  line-height: 1.25;
  transition: opacity .5s ease;
  transition-delay: calc(var(--i) * 55ms + 250ms);
}

.hd-e-face--chaos {
  border: 1px solid rgba(255, 138, 92, 0.45);
  background-color: #1d120e;
  box-shadow: 0 16px 36px -18px rgba(255, 90, 40, 0.6);
  color: #ffc2a8;
}

.hd-e-face--chaos b {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background-color: #ff5c33;
  color: #ffffff;
  font-size: .85rem;
}

.hd-e-face--order {
  gap: .55rem;
  padding: 0 .75rem;
  border: 1px solid rgba(1, 117, 255, 0.45);
  background-color: rgba(14, 18, 26, 0.97);
  box-shadow: 0 16px 36px -18px rgba(1, 117, 255, 0.7);
  color: #ffffff;
  font-size: min(.95rem, 2.35cqw);
  white-space: nowrap;
  overflow: hidden;
  opacity: 0;
}

.hd-e-face--order .mbr-iconfont {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: .6rem;
  background-color: #0175ff;
  color: #ffffff;
  font-size: .9rem;
}

.hd-e.is-order .hd-e-face--order { opacity: 1; }
.hd-e.is-order .hd-e-face--chaos { opacity: 0; }

.hd-e-status {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: grid;
  margin: 0;
  padding: .45rem 1.1rem;
  border-radius: 999px;
  background-color: rgba(255, 92, 51, 0.15);
  color: #ff9b7a;
  font-size: .82rem;
  font-weight: 600;
  transform: translateX(-50%);
  transition: background-color .5s ease, color .5s ease;
}

.hd-e-status span {
  grid-area: 1 / 1;
  text-align: center;
  white-space: nowrap;
  transition: opacity .4s ease;
}

.hd-e-status-order { opacity: 0; }
.hd-e.is-order .hd-e-status { background-color: rgba(34, 197, 94, 0.15); color: #4ade80; }
.hd-e.is-order .hd-e-status-chaos { opacity: 0; }
.hd-e.is-order .hd-e-status-order { opacity: 1; }

/* Hover-Vorschau: die Felder kippen leicht in Richtung des anderen Zustands */
@media (hover: hover) and (pointer: fine) and (min-width: 576px) {
  .hd-e.is-order .hd-e-stage:hover .hd-e-item {
    transform: translate(calc(var(--ox) * 1cqw), calc(var(--oy) * 1cqh)) rotate(calc(var(--cr) * .18));
    transition-duration: .5s;
    transition-delay: calc(var(--i) * 25ms);
  }

  .hd-e:not(.is-order) .hd-e-stage:hover .hd-e-item {
    transform: translate(calc(var(--cx) * 1cqw), calc(var(--cy) * 1cqh)) rotate(calc(var(--cr) * .45));
    transition-duration: .5s;
    transition-delay: calc(var(--i) * 25ms);
  }
}

/* ---------- Klick-Hinweis: in beiden Zustaenden sichtbar ---------- */
.hd-e-ripple {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 9rem;
  height: 9rem;
  margin: -4.5rem 0 0 -4.5rem;
  border: 2px solid rgba(255, 138, 92, 0.75);
  border-radius: 50%;
  opacity: 0;
  animation: hd-ripple-tap 2.8s ease-out 1.2s infinite;
  pointer-events: none;
}

.hd-e.is-order .hd-e-ripple {
  border-color: rgba(125, 171, 255, 0.75);
}

@keyframes hd-ripple-tap {
  0%   { opacity: 0; transform: scale(.2); }
  12%  { opacity: .9; }
  55%  { opacity: 0; transform: scale(1.6); }
  100% { opacity: 0; transform: scale(1.6); }
}

.hd-e-hint {
  position: absolute;
  top: -3.9rem;
  right: 0;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem .95rem .35rem .4rem;
  border-radius: 999px;
  background-color: #ff5c33;
  box-shadow: 0 12px 30px -10px rgba(255, 92, 51, 0.8);
  color: #ffffff;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
  animation: hd-fade .6s ease 1s both;
  transition: background-color .5s ease, box-shadow .5s ease;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hd-e-hint:hover {
  box-shadow: 0 16px 36px -10px rgba(255, 92, 51, 0.95);
}

.hd-e-hint:active .hd-e-hint-icon {
  transform: scale(.88);
}

.hd-e.is-order .hd-e-hint {
  background-color: #0175ff;
  box-shadow: 0 12px 30px -10px rgba(1, 117, 255, 0.85);
}

.hd-e.is-order .hd-e-hint:hover {
  box-shadow: 0 16px 36px -10px rgba(1, 117, 255, 1);
}

.hd-e-hint-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.2);
}

.hd-e-hint-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: hd-ripple-icon 1.6s ease-out infinite;
}

.hd-e-hint-icon .mbr-iconfont {
  font-size: .95rem;
  animation: hd-tap 1.6s ease-in-out infinite;
}

@keyframes hd-tap {
  0%, 100% { transform: none; }
  25% { transform: translateY(2px) scale(.82); }
}

@keyframes hd-ripple-icon {
  0%   { opacity: 0; transform: scale(.8); }
  25%  { opacity: .9; }
  100% { opacity: 0; transform: scale(1.9); }
}

.hd-e-hint-tap,
.hd-e-hint-b,
.hd-e.is-order .hd-e-hint-a { display: none; }
.hd-e.is-order .hd-e-hint-b { display: inline; }

@media (hover: none), (pointer: coarse) {
  .hd-e-hint-click { display: none; }
  .hd-e-hint-tap { display: inline; }
}

/* ---------- Tablet/Mobil ---------- */
@media (max-width: 991px) {
  .hd-e-switch--desk { display: none; }

  .hd-e-visual {
    margin-top: 2.75rem;
    padding-bottom: 4rem;
    text-align: center;
  }

  .hd-e-switch--mob {
    display: inline-flex;
    margin: 0 auto 2rem;
  }

  .hd-e-stage::before {
    top: -.6rem;
    right: -.6rem;
    bottom: -1.25rem;
    left: -.6rem;
  }

  /* Hinweis wandert unter das Feld, damit er den Schalter darueber nicht verdeckt */
  .hd-e-hint {
    top: auto;
    right: auto;
    bottom: -4.4rem;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Mobil: aufgeraeumt in 2 Spalten, damit jede Beschriftung einzeilig lesbar bleibt */
@media (max-width: 575px) {
  .hd-e-stage { aspect-ratio: 4 / 5; }
  .hd-e-item {
    width: 48cqw;
    height: 16cqh;
    transform: translate(calc(var(--cx) * .75cqw), calc(var(--cy) * 1cqh)) rotate(var(--cr));
  }
  .hd-e.is-order .hd-e-item {
    transform: translate(calc(var(--mx) * 1cqw), calc(var(--my) * 1cqh)) rotate(0deg);
  }
  .hd-e-face { gap: .45rem; padding: 0 .65rem; border-radius: .8rem; font-size: .74rem; }
  .hd-e-face--order { font-size: min(.82rem, 3.9cqw); padding: 0 .6rem; }
  .hd-e-face--chaos b { width: 1.2rem; height: 1.2rem; font-size: .7rem; }
  .hd-e-face--order .mbr-iconfont { width: 1.5rem; height: 1.5rem; border-radius: .45rem; font-size: .75rem; }
  .hd-e-switch { font-size: .8rem; gap: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hd *,
  .hd *::before,
  .hd *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
