/* ============================================================
   MG WEB & SYSTEMS · „Hier entsteht etwas Neues"
   Eigenständige Baustellenseite – nur HTML + diese Datei.
   Läuft auf jedem Webhosting, kein Build, kein Node.
   ============================================================ */
:root {
  --bg: #0e1013;
  --panel: #191d24;
  --panel-2: #1f242d;
  --inset: #0a0c0e;
  --line: #262b33;
  --line-strong: #39404c;
  --ink: #f0ece3;
  --ink-dim: #b9b5aa;
  --ink-mute: #8f8d86;
  --accent: #0085ca;
  --accent-text: #3aa5de;
  --ok: #4cd17d;
  --warn: #ffcf5c;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-mech: cubic-bezier(0.6, 0.05, 0.25, 1);
  --ease-settle: cubic-bezier(0.34, 1.35, 0.44, 1);
  color-scheme: dark;
}

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

/* Nichts darf die Seite seitlich scrollbar machen. Betrifft vor allem die
   Sprechblase des rollenden Bots, der bis an den Bildrand fährt.
   `clip` statt `hidden`: hidden erzeugt einen Scrollcontainer und würde das
   position:fixed von Absperrband und Kranbahn aushebeln. */
html {
  overflow-x: clip;
}

* {
  margin: 0;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgb(240 236 227 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(240 236 227 / 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

/* Absperrband oben.
   z-index 0, also HINTER dem Seiteninhalt (.page liegt auf 2): Beim Scrollen
   schob sich das Band sonst quer durch die Überschrift und zerschnitt sie.
   Jetzt läuft der Text darüber hinweg – das Band bleibt sichtbar, wo nichts
   ist, und stört nicht, wo etwas ist. Dasselbe gilt für die Kranbahn. */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: 6px;
  background: repeating-linear-gradient(45deg, rgb(0 133 202 / 0.6) 0 10px, transparent 10px 20px);
  z-index: 0;
  animation: tape 26s linear infinite;
}

@keyframes tape {
  to {
    background-position: 56.6px 0;
  }
}

/* ---------- Kran ---------- */
.rail {
  position: fixed;
  top: 34px;
  left: 4%;
  right: 4%;
  border-top: 2px dashed var(--line-strong);
  z-index: 0;
  pointer-events: none;
}

.trolley {
  position: absolute;
  top: -7px;
  left: 12%;
  width: 40px;
  animation: trolley 22s var(--ease-mech) infinite;
}

.trolley__body {
  display: block;
  height: 12px;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
}

.trolley__cable {
  position: absolute;
  left: 50%;
  top: 12px;
  width: 2px;
  height: 46px;
  background: var(--ink-mute);
  animation: cable 22s var(--ease-mech) infinite;
}

.trolley__load {
  position: absolute;
  left: 50%;
  translate: -50%;
  top: 58px;
  width: 38px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
  animation: load 22s var(--ease-mech) infinite;
}

@keyframes trolley {
  0%, 8% { left: 12%; }
  38%, 58% { left: calc(50% - 20px); }
  88%, 100% { left: 12%; }
}

@keyframes cable {
  0%, 30% { height: 46px; }
  44%, 54% { height: 88px; }
  66%, 100% { height: 46px; }
}

@keyframes load {
  0%, 30% { top: 58px; opacity: 1; }
  44% { top: 100px; opacity: 1; }
  50%, 100% { top: 100px; opacity: 0; }
}

/* ---------- Seite ---------- */
.page {
  position: relative;
  z-index: 2;
  width: min(100% - 2.5rem, 60rem);
  margin-inline: auto;
  padding-block: clamp(4.5rem, 12vh, 7rem) clamp(2.5rem, 6vh, 4rem);
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 1.5rem;
}

/* Marke */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  animation: rise 0.7s var(--ease-out) both;
}

.brand__mark {
  width: 46px;
  height: 30px;
  flex: none;
}

.brand__l1,
.brand__l2 {
  fill: var(--ink);
}

.brand__l3 {
  fill: var(--accent);
}

.brand__l1 { animation: slabIn 0.6s var(--ease-settle) 0.1s both; }
.brand__l2 { animation: slabIn 0.6s var(--ease-settle) 0.25s both; }
.brand__l3 { animation: slabIn 0.6s var(--ease-settle) 0.4s both; }

@keyframes slabIn {
  from { opacity: 0; transform: translateY(-10px); }
}

.brand__words {
  display: grid;
  gap: 0.22rem;
  text-align: left;
  line-height: 1;
}

.brand__words b {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.brand__words i {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.56rem;
  letter-spacing: 0.3em;
  color: var(--ink-mute);
}

/* Status-Chip */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  color: var(--warn);
  border: 1px solid rgb(255 207 92 / 0.4);
  border-radius: 999px;
  padding: 0.42rem 1rem;
  animation: rise 0.7s var(--ease-out) 0.15s both;
}

.tag__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.6s ease-in-out infinite;
}

/* Titel */
.title {
  font-size: clamp(2.5rem, 1rem + 8vw, 5.5rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.025em;
  display: grid;
  gap: 0.05em;
}

.title__line {
  display: block;
  overflow: hidden;
  animation: rise 0.9s var(--ease-out) both;
}

.title__line:nth-child(1) { animation-delay: 0.25s; }
.title__line:nth-child(2) { animation-delay: 0.4s; }

.title__line--accent {
  color: var(--accent-text);
}

.lead {
  color: var(--ink-dim);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  max-width: 48ch;
  animation: rise 0.9s var(--ease-out) 0.55s both;
}

/* Chips */
.chips {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  max-width: 44rem;
}

.chips li {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.34rem 0.85rem;
  animation: rise 0.6s var(--ease-out) both;
  animation-delay: calc(0.7s + var(--i) * 0.07s);
}

/* ---------- Terminal ---------- */
.term {
  width: min(100%, 34rem);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  background: var(--inset);
  text-align: left;
  animation: rise 0.8s var(--ease-out) 1s both;
}

.term__bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0.9rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line-strong);
}

.term__dots {
  display: inline-flex;
  gap: 5px;
}

.term__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.term__dots i:first-child {
  background: rgb(0 133 202 / 0.75);
}

.term__title {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

.term__body {
  font-family: var(--mono);
  padding: 0.9rem 1.2rem 1rem;
  font-size: 0.78rem;
  line-height: 1.95;
}

.term__body p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.p {
  color: var(--accent-text);
  font-weight: 600;
}

.out {
  color: var(--ink-dim);
  opacity: 0;
  animation: fade 0.3s ease-out forwards;
  animation-delay: calc(1.5s + var(--l) * 0.5s);
}

.ok {
  color: var(--ok);
  opacity: 0;
  animation: fade 0.3s ease-out 3s forwards;
}

.cursorline {
  opacity: 0;
  animation: fade 0.3s ease-out 3.4s forwards;
}

.cursor {
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- Baustelle ---------- */
.site {
  position: relative;
  width: min(100%, 46rem);
  height: 190px;
  margin-top: 0.5rem;
  animation: fade 0.8s ease-out 1.2s both;
}

.site__ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  border-top: 1px dashed var(--line-strong);
}

/* Gerüst rund um den Stack */
.scaffold {
  position: absolute;
  left: 50%;
  bottom: 22px;
  translate: -50%;
  width: 196px;
  height: 116px;
  border-left: 3px solid var(--line-strong);
  border-right: 3px solid var(--line-strong);
}

.scaffold span {
  position: absolute;
  left: -3px;
  right: -3px;
  height: 3px;
  background: var(--line-strong);
}

.scaffold span:nth-child(1) { top: 0; }
.scaffold span:nth-child(2) { top: 34%; }
.scaffold span:nth-child(3) { top: 68%; }
.scaffold span:nth-child(4) { bottom: 0; }

/* Leiter am linken Pfosten */
.scaffold::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 6px;
  bottom: 6px;
  width: 16px;
  background:
    linear-gradient(var(--line) 0 0) left / 2px 100% no-repeat,
    linear-gradient(var(--line) 0 0) right / 2px 100% no-repeat,
    repeating-linear-gradient(transparent 0 9px, var(--line) 9px 11px);
}

/* Der Stack, der gebaut wird */
.stack {
  z-index: 2;
  position: absolute;
  left: 50%;
  bottom: 26px;
  translate: -50%;
  display: grid;
  gap: 6px;
  justify-items: start;
}

.stack__slab {
  width: 96px;
  height: 17px;
  border-radius: 3px;
  background: var(--ink);
}

.stack__slab--1 { animation: build 22s var(--ease-settle) infinite; }
.stack__slab--2 { margin-left: 15px; animation: build 22s var(--ease-settle) 0.5s infinite; }
.stack__slab--3 {
  margin-left: 30px;
  background: var(--accent);
  animation: buildTop 22s var(--ease-settle) infinite;
}

@keyframes build {
  0%, 6% { opacity: 0; transform: translateY(-26px); }
  14%, 92% { opacity: 1; transform: translateY(0); }
  98%, 100% { opacity: 0; transform: translateY(-26px); }
}

/* Die oberste Ebene kommt erst, wenn der Kran sie absetzt */
@keyframes buildTop {
  0%, 46% { opacity: 0; transform: translateY(-30px); }
  54%, 92% { opacity: 1; transform: translateY(0); }
  98%, 100% { opacity: 0; transform: translateY(-30px); }
}

/* Funken */
.sparks {
  position: absolute;
  left: calc(50% - 78px);
  bottom: 78px;
}

.sparks i {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent-text);
  opacity: 0;
  animation: spark 1.6s ease-out infinite;
}

.sparks i:nth-child(1) { animation-delay: 0s; --dx: -14px; --dy: -18px; }
.sparks i:nth-child(2) { animation-delay: 0.2s; --dx: 10px; --dy: -22px; }
.sparks i:nth-child(3) { animation-delay: 0.45s; --dx: -6px; --dy: -26px; }
.sparks i:nth-child(4) { animation-delay: 0.7s; --dx: 16px; --dy: -14px; }
.sparks i:nth-child(5) { animation-delay: 0.95s; --dx: -18px; --dy: -10px; }

@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  70% { opacity: 0.8; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

/* Bots · anklickbar ohne JavaScript
   ---------------------------------
   Die Seite muss auch dann laufen, wenn die Anwendung steht – und die
   Content-Security-Policy erlaubt keine Inline-Skripte. Der Klick läuft
   deshalb über eine versteckte Checkbox im umgebenden <label>:
   Hover zeigt den Spruch, Klick das Easter Egg. */
.crewhit {
  position: absolute;
  z-index: 2;
  bottom: 20px;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Nicht display:none – sonst ginge der :checked-Zustand verloren.
   tabindex="-1" im HTML hält die Deko aus der Tabreihenfolge. */
.crewhit input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.bot {
  display: block;
  width: 74px;
  height: 86px;
}

.b-base,
.b-body { fill: var(--panel-2); stroke: var(--line-strong); stroke-width: 1.5; }
.b-wheel { fill: var(--inset); stroke: var(--line-strong); }
.b-stripe { fill: var(--accent); }
.b-plate,
.b-visor,
.b-neck { fill: var(--inset); }
.b-glyph { fill: none; stroke: var(--accent); stroke-width: 2; }
.b-check { fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.b-arm { stroke: var(--panel-2); stroke-width: 7; stroke-linecap: round; fill: none; }
.b-hand { fill: var(--line-strong); }
.b-eye { fill: var(--accent); }
.b-ant { stroke: var(--line-strong); stroke-width: 2.5; }
.b-tip { fill: var(--ok); }
.b-tool { fill: var(--ink-mute); }
.b-carry { fill: var(--accent); }

.crewhit--work { left: calc(50% - 132px); }

.bot--work {
  animation: nudge 0.5s ease-in-out infinite alternate;
}

.bot--work .b-armwork {
  transform-origin: 87px 74px;
  animation: screw 0.5s ease-in-out infinite alternate;
}

.crewhit--check { right: calc(50% - 132px); }

.bot--check {
  transform: scaleX(-1);
}

/* Der Bot ist gespiegelt, damit er zur Baustelle schaut – dabei kippt der
   Haken auf seinem Display mit und liest sich verkehrt herum (wie ein Pfeil
   in die falsche Richtung). Deshalb hier einmal zurückdrehen, um seine
   eigene Mitte (x = 59). */
.bot--check .b-check {
  transform: scaleX(-1);
  transform-origin: 59px 94px;
}

.bot--check .b-eye--scan {
  animation: scan 5.5s ease-in-out infinite;
}

/* Bot, der quer durchs Bild rollt und dabei zweimal anhält.
   Die Fahrt sitzt auf der Klickfläche, nicht auf dem Bot: sonst würden sich
   Fahrt und Wackler beim Klick um dieselbe transform-Eigenschaft streiten. */
.crewhit--roll {
  left: 0;
  bottom: 2px;
  z-index: 3;
  animation: roll 26s ease-in-out infinite;
}

.bot--roll {
  width: 54px;
  height: 63px;
}

/* ---------- Spruch & Easter Egg ---------- */
.say,
.egg {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  translate: -50% 5px;
  width: max-content;
  /* Die beiden festen Bots stehen nur ~190 px auseinander. Breitere Blasen
     würden sich überdecken, sobald beide angetippt sind. */
  max-width: 10.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  line-height: 1.5;
  color: var(--ink-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out), translate 0.25s var(--ease-out);
}

.crewhit:hover .say {
  opacity: 1;
  translate: -50% 0;
}

/* Steht nach der Hover-Regel und ist spezifischer – beim Klick hovert man ja
   zwangsläufig, das Egg muss also gewinnen. */
.crewhit input:checked ~ .say {
  opacity: 0;
}

.crewhit input:checked ~ .egg {
  opacity: 1;
  translate: -50% 0;
  color: var(--accent-text);
  border-color: var(--accent);
}

/* Fallendes Werkzeug – rutscht seitlich aus der Hand, nicht durch den Bot.
   Der Prüf-Bot ist gespiegelt, seine Werkzeughand liegt also links. */
.drop {
  position: absolute;
  left: 50%;
  bottom: 44px;
  width: 16px;
  height: 16px;
  translate: -50%;
  opacity: 0;
  pointer-events: none;
}

.crewhit--work .drop { left: 84%; }
.crewhit--check .drop { left: 16%; }
.crewhit--roll .drop { left: 50%; bottom: 32px; }

.drop svg {
  display: block;
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .crewhit input:checked ~ .drop {
    animation: toolfall 1.5s var(--ease-mech);
  }

  .crewhit input:checked ~ .bot .b-eye {
    animation: eggblink 1.5s steps(1);
  }
}

@keyframes toolfall {
  0% { opacity: 0; translate: -50% -4px; rotate: 0deg; }
  12% { opacity: 1; }
  80% { opacity: 1; }
  /* Endet knapp über dem Boden der Szene */
  100% { opacity: 0; translate: -50% 34px; rotate: 210deg; }
}

@keyframes eggblink {
  0%, 100% { fill: var(--accent); }
  10%, 30% { fill: var(--warn); }
  20%, 40% { fill: var(--accent); }
}

@keyframes roll {
  0% { transform: translateX(-90px); }
  26%, 38% { transform: translateX(28vw); }
  64%, 74% { transform: translateX(58vw); }
  100% { transform: translateX(105vw); }
}

@keyframes nudge { to { transform: translateY(-1.5px); } }
@keyframes screw { to { rotate: -16deg; } }
@keyframes scan {
  0%, 55%, 100% { transform: translateX(0); }
  65%, 90% { transform: translateX(18px); }
}

/* ---------- Fortschritt ---------- */
.progress {
  width: min(100%, 34rem);
  display: grid;
  gap: 0.5rem;
  animation: rise 0.8s var(--ease-out) 1.4s both;
}

.progress__head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
}

.progress__pct { color: var(--accent-text); }

.progress__track {
  height: 6px;
  border-radius: 3px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress__fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-text));
  animation: fill 22s var(--ease-mech) infinite;
}

@keyframes fill {
  0% { width: 4%; }
  20% { width: 32%; }
  45% { width: 54%; }
  70% { width: 78%; }
  92%, 100% { width: 92%; }
}

/* ---------- Footer ---------- */
.foot {
  display: grid;
  gap: 0.6rem;
  justify-items: center;
  margin-top: 0.5rem;
  animation: fade 0.8s ease-out 1.6s both;
}

.foot__contact {
  color: var(--ink-mute);
  font-size: 0.95rem;
  text-align: center;
  text-wrap: balance;
}

.foot__contact a {
  color: var(--accent-text);
  white-space: nowrap;
}

.foot__sep {
  padding-inline: 0.35rem;
  opacity: 0.5;
}

.foot__region {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.foot__made {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
}

.heart {
  width: 16px;
  height: 15px;
}

.foot__made:hover .heart {
  animation: beat 0.9s var(--ease-settle) infinite;
}

/* ---------- Keyframes allgemein ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
}

@keyframes fade {
  to { opacity: 1; }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@keyframes blink {
  50% { opacity: 0; }
}

@keyframes beat {
  0%, 100% { scale: 1; }
  28% { scale: 1.22; }
  45% { scale: 1.05; }
  62% { scale: 1.16; }
}

/* ---------- Mobil ---------- */
@media (max-width: 700px) {
  .site { height: 160px; }
  .bot { width: 58px; height: 68px; }
  .crewhit--work { left: 2%; }
  .crewhit--check { right: 2%; }
  .crewhit--roll { display: none; }

  /* Sprechblasen mobil NICHT über dem Bot zentrieren: Die Bots stehen hier
     2 % vom Rand, eine zentrierte Blase ragte dadurch aus dem Bild (links
     abgeschnitten, rechts entstand eine Querscrollleiste). Stattdessen an der
     jeweiligen Aussenkante ausrichten und nach innen wachsen lassen. */
  /* Höchstens knapp die halbe Breite je Seite, damit sich zwei geöffnete
     Blasen nicht überdecken. Bezugsgröße ist NICHT der Viewport, sondern der
     Seitencontainer: Der ist 2.5rem schmaler, und die Bots sitzen darin
     nochmal 2 % vom Rand – deshalb die Abzüge. */
  .say,
  .egg {
    max-width: calc(46vw - 20px);
    font-size: 0.58rem;
  }

  .crewhit--work .say,
  .crewhit--work .egg {
    left: 0;
    right: auto;
    translate: 0 5px;
  }

  .crewhit--check .say,
  .crewhit--check .egg {
    left: auto;
    right: 0;
    translate: 0 5px;
  }

  .crewhit--work input:checked ~ .egg,
  .crewhit--work:hover .say,
  .crewhit--check input:checked ~ .egg,
  .crewhit--check:hover .say {
    translate: 0 0;
  }
  .scaffold { display: none; }
  .stack__slab { width: 78px; height: 14px; }
  .term__body { font-size: 0.7rem; }
  .rail { top: 26px; }
}

/* ---------- Reduced Motion: alles ruhig, nichts verschwindet ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .out,
  .ok,
  .cursorline,
  .stack__slab {
    opacity: 1 !important;
    transform: none !important;
  }

  .progress__fill { width: 62%; }
  .trolley__load { opacity: 0; }
}
