/* ==========================================================================
   morph.css — "Dieselbe Software. Ihr Unternehmen."
   --------------------------------------------------------------------------
   Der Kern der Seite. Ein Laptop bleibt beim Scrollen stehen, die Anwendung
   darin nimmt fliessend vier Corporate Designs an.

   Aufteilung der Verantwortung:
   · JavaScript schreibt ausschliesslich interpolierte Rohwerte in
     Custom Properties (drei Farben, vier Zahlen, ein Font, ein Fortschritt).
   · CSS leitet daraus alles Übrige ab (weiche Töne, Schein, Rundungen).
   Ergebnis: ein einziger Schreibvorgang pro Frame, kein Layout-Thrashing.

   Der Hebel: das Oberflächen-Kit in app-ui.css liest die Markenfarbe aus
   --accent. Wird --accent innerhalb des Morph-Containers neu gesetzt, folgt
   die gesamte Anwendung – Logo, Navigation, Schaltfläche, Kennzahlen,
   Diagramm – ohne eine einzige zusätzliche Regel.
   ========================================================================== */

.morph {
  /* Startwerte = neutrale Basis. Ohne JavaScript bleibt es dabei, und die
     Oberfläche ist trotzdem vollständig und korrekt gestaltet. */
  --m-accent:    #2E2D29;
  --m-side:      #FFFFFF;
  --m-side-text: #8B897F;
  --m-r:         12px;
  --m-r-sm:      8px;
  --m-dot:       50%;
  --m-track:     -0.01em;
  --m-font:      var(--font-display);
  --m-swap:      1;
  --m-progress:  0%;

  --morph-len: 340vh;
}

.morph__intro { max-width: 50rem; }
.morph__title { margin-top: 1.375rem; }
.morph__text  { margin-top: 1.25rem; max-width: 35rem; }

/* --------------------------------------------------------------------------
   Bühne
   Die Bahn ist hoch, die Bühne bleibt darin stehen. Die Bahnlänge bestimmt,
   wie lange man an einem Corporate Design "verweilt": 340vh ergeben pro
   Wechsel gut eine Bildschirmhöhe – langsam genug, um es zu lesen.
   -------------------------------------------------------------------------- */
.morph__track {
  position: relative;
  height: var(--morph-len);
  margin-top: clamp(1.5rem, 3vw, 3rem);
}
.morph__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  align-items: center;
}
.morph__layout {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: clamp(2rem, 4vw, 4.5rem);
  align-items: center;
}

/* ---- Textspalte ------------------------------------------------------- */
.morph__count { display: flex; align-items: baseline; gap: .5rem; }
.morph__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 6vw, 5.25rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: #E0DED6;
  font-variant-numeric: tabular-nums;
}
.morph__total { font-family: var(--font-display); font-weight: 600; font-size: .9375rem; color: #B5B3A9; }

.morph__sector {
  margin-top: .875rem;
  font-family: var(--m-font);
  font-weight: 800;
  font-size: clamp(1.875rem, 3vw, 2.875rem);
  line-height: 1.1;
  letter-spacing: var(--m-track);
  color: var(--c-bg-ink);
}
.morph__desc { margin-top: 1rem; font-size: var(--fs-sm); line-height: 1.7; color: var(--c-body); text-wrap: pretty; }

/* Der Text kann nicht interpoliert werden – er wird zum Farbmittelpunkt
   der Überblendung kurz weicher und wechselt im Tiefpunkt. Dadurch wirkt
   auch der Inhaltswechsel wie ein Übergang, nicht wie ein Sprung. */
.morph [data-m-text] { opacity: var(--m-swap); }

/* ---- Wählbare Branchenliste ------------------------------------------
   Bewusst Schaltflächen, keine Punkte: mit Tastatur oder bei reduzierter
   Bewegung bleiben alle vier Designs erreichbar. --on ist die Nähe zum
   aktuellen Zustand (0…1) und wird stufenlos mitgeführt.
   -------------------------------------------------------------------------- */
.morph__themes {
  margin-top: 2.25rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}
.morph__theme {
  --on: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 500;
  cursor: pointer;
  color: color-mix(in oklab, var(--c-text) calc(var(--on) * 100%), #9B998F);
  transition: color var(--dur-mid) var(--ease-soft);
}
.morph__theme::before {
  content: "";
  height: 2px;
  width: calc(18px + 26px * var(--on));
  flex: none;
  background: color-mix(in oklab, var(--c-text) calc(var(--on) * 100%), #D6D4CD);
  transition: width var(--dur-mid) var(--ease-soft),
              background-color var(--dur-mid) var(--ease-soft);
}
.morph__theme:hover { color: var(--c-text); }

.morph__progress {
  margin-top: 2.25rem;
  max-width: 17.5rem;
  height: 2px;
  border-radius: var(--r-pill);
  background: #ECEBE5;
  overflow: hidden;
}
.morph__progress-fill {
  display: block;
  height: 100%;
  width: var(--m-progress);
  background: var(--m-accent);
}

/* ---- Gerät ------------------------------------------------------------
   Der Laptop selbst morpht nicht. Konstante Hardware, wechselnde Software –
   genau das ist die Aussage. Nur der Lichtschein darunter nimmt die
   Markenfarbe auf; das genügt als Signal.
   -------------------------------------------------------------------------- */
.morph__device { position: relative; }
.morph__device::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6%;
  width: 78%;
  height: 34%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side,
              color-mix(in oklab, var(--m-accent) 28%, transparent), transparent 72%);
  filter: blur(28px);
  opacity: .8;
  pointer-events: none;
}

/* ---- Die morphende Anwendung ----------------------------------------- */
.morph__app {
  --accent: var(--m-accent);
  --accent-soft: color-mix(in oklab, var(--m-accent) 13%, #FFFFFF);
}
.morph__app .app__side { background: var(--m-side); }
.morph__app .nav-item { color: var(--m-side-text); }
.morph__app .nav-item.is-active { color: #FFFFFF; }
.morph__app .nav-item::before { border-radius: var(--m-dot); }

/* Rundungen: eine Zahl entscheidet über den Charakter der ganzen Oberfläche –
   von kantig (Metallbau) bis weich (Badi). */
.morph__app .app__mark,
.morph__app .app__search,
.morph__app .nav-item,
.morph__app .ui-btn { border-radius: var(--m-r-sm); }
.morph__app .ui-stat,
.morph__app .ui-chart { border-radius: var(--m-r); }
.morph__app .ui-bar { border-radius: calc(var(--m-r-sm) * .35) calc(var(--m-r-sm) * .35) 0 0; }

/* Schrift: Familie wechselt im Tiefpunkt der Überblendung, Laufweite läuft
   stufenlos mit. Dadurch fühlt sich auch der Schriftwechsel weich an. */
.morph__app .app__name,
.morph__app .app__mark,
.morph__app .ui-head__title,
.morph__app .ui-stat__value {
  font-family: var(--m-font);
  letter-spacing: var(--m-track);
}

/* ---- Abschluss des Abschnitts ---------------------------------------- */
.morph__outro {
  max-width: 56rem;
  margin-inline: auto;
  padding: clamp(4.5rem, 9vw, 8.75rem) var(--gutter) 0;
  text-align: center;
}
.morph__quote {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.625rem, 3.2vw, 2.75rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--c-bg-ink);
  text-wrap: balance;
}
.morph__quote em { font-style: normal; color: var(--accent); }

/* --------------------------------------------------------------------------
   Schmale Bildschirme
   Die Textspalte rückt über das Gerät, die Gerätebreite wird aus der
   verfügbaren Höhe berechnet – so bleibt die Bühne immer vollständig
   sichtbar, ohne dass innerhalb der Bühne gescrollt werden muss.
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .morph { --morph-len: 280vh; }
  .morph__layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .morph__desc,
  .morph__themes { display: none; }
  .morph__count { align-items: baseline; }
  .morph__progress { margin-top: 1.25rem; max-width: none; }
  .morph__device {
    width: min(100%, calc((100svh - 15rem) * 1.6));
    margin-inline: auto;
  }
}

/* --------------------------------------------------------------------------
   Reduzierte Bewegung
   Kein Sticky, kein Scroll-Morphing. Die Bühne wird ein normaler Abschnitt,
   die Branchenliste bleibt bedienbar – alle vier Designs sind erreichbar.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .morph__track { height: auto; }
  .morph__stage { position: static; height: auto; padding-block: 2rem; }
  .morph__themes { display: flex; }
  .morph__progress { display: none; }
  .morph [data-m-text] { opacity: 1; }
}
