@import url("./tokens.css");

/* ── Nexa ──────────────────────────────────────────────────────────────────
   Dateien aus Nexa_ZCG.zip als WOFF2 nach /assets/fonts/ legen.
   Solange sie fehlen, greift die Fallback-Kette in --font-nexa.
   Rollen laut FONTS.md: Body = Book · Quellen/Fussnoten = leichtester Schnitt ·
   Hervorhebung = Bold. Nexa_ZCG.zip enthaelt kein Thin, daher Light.
   Alle Schnitte auf Latin subsettet (je ~13 KB statt ~43 KB).               */

@font-face {
  font-family: "Nexa";
  src: url("../fonts/Nexa-Light.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("../fonts/Nexa-Book.woff2") format("woff2");
  font-weight: 350;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("../fonts/Nexa-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("../fonts/Nexa-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("../fonts/Nexa-Heavy.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ── Basis ───────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-nexa);
  font-weight: 350;
  background: var(--zcg-violet);
  color: var(--zcg-page);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

:where(a) {
  color: inherit;
  text-underline-offset: 2px;
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--zcg-lavender);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

/* ── Buehne: der Roboter ist die Seite ───────────────────────────────────── */

.stage {
  position: relative;
  min-height: 100dvh;
  width: 100%;
  overflow: hidden;
  background:
    radial-gradient(
      64% 42% at 50% 40%,
      var(--zcg-violet-700) 0%,
      rgba(42, 19, 86, 0) 74%
    ),
    var(--zcg-violet);
}

/* Schichtung von unten nach oben:
   Bühnenhintergrund → Headline → Szene (transparent) → Verlauf → Formular.
   Dadurch schiebt sich der Kopf des Roboters vor die Headline, während das
   Formular immer vor dem Roboter bleibt und bedienbar ist. */
.scene {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* Ladeschirm ueber der ganzen Seite: violette Flaeche, ZCG mittig. Blendet weg,
   sobald die Szene steht oder das Standbild uebernimmt. */

.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background:
    radial-gradient(
      70% 45% at 50% 45%,
      var(--zcg-violet-700) 0%,
      rgba(42, 19, 86, 0) 75%
    ),
    var(--zcg-violet);
  opacity: 1;
  transition: opacity 900ms ease;
  /* Sicherheitsnetz: Sollte das Skript gar nicht laufen, gibt der Ladeschirm die
     Seite trotzdem frei, statt sie dauerhaft zu verdecken. */
  animation: boot-release 1s ease 18s forwards;
}

@keyframes boot-release {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.boot span {
  font-weight: 700;
  font-size: clamp(2rem, 11vw, 3.25rem);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  color: var(--zcg-page);
  animation: brand-breathe 2.4s ease-in-out infinite;
}

@keyframes brand-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.boot.is-gone {
  opacity: 0;
  pointer-events: none;
}

.scene__poster {
  position: absolute;
  inset: 0;
  transform: translateY(2.2%);
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  opacity: 0;
  transition: opacity 600ms ease;
}

.stage.is-static .scene__poster {
  opacity: 1;
}

.scene__spline {
  position: absolute;
  inset: 0;
  transform: translateY(2.2%);
  opacity: 0;
  transition: opacity 800ms ease;
}

.stage.is-live .scene__spline {
  opacity: 1;
}

.scene__spline spline-viewer,
.scene__spline canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Nur noch unten: Die Headline liegt jetzt hinter dem Roboter und braucht keinen
   Schleier mehr, das Formular über dem dunklen Torso dagegen schon. */
.scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(
      0deg,
      rgba(28, 10, 58, 0.92) 0%,
      rgba(28, 10, 58, 0.72) 20%,
      rgba(28, 10, 58, 0.24) 40%,
      rgba(28, 10, 58, 0) 58%
    );
}

/* ── Inhalt ueber dem Roboter ────────────────────────────────────────────── */

.overlay {
  position: relative;
  min-height: 100dvh;
  display: grid;
  /* Kopf oben, Formular etwa auf Bauchhoehe, Fuss unten. */
  grid-template-rows: auto minmax(24px, 1.9fr) auto minmax(12px, 0.35fr) auto;
  padding: max(22px, env(safe-area-inset-top)) 20px
    max(18px, env(safe-area-inset-bottom));
  gap: 0;
}

.head {
  grid-row: 1;
  position: relative;
  z-index: 1;
  /* Ein paar Pixel tiefer, damit der Kopf die Unterlaengen der letzten Zeile
     gerade eben ueberschneidet — mehr wuerde das Wort unlesbar machen. */
  padding-top: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

/* Platzhalter-Wortmarke — durch das offizielle Logo-SVG ersetzen. */
.brand {
  flex: none;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-decoration: none;
  color: var(--zcg-page);
}

h1 {
  margin: 0;
  /* Breit genug fuer drei Zeilen: bei vier Zeilen reicht die Headline so weit
     nach unten, dass der Kopf des Roboters sie zu stark verdeckt. */
  max-width: 15ch;
  font-weight: 900;
  font-size: clamp(2.15rem, 9.8vw, 3.25rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: var(--zcg-page);
  text-shadow: 0 2px 24px rgba(28, 10, 58, 0.55);
}

/* ── Formular ────────────────────────────────────────────────────────────── */

.panel {
  grid-row: 3;
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field input[type="email"] {
  font-family: inherit;
  font-weight: 350;
  font-size: 16px; /* verhindert iOS-Auto-Zoom */
  color: var(--zcg-page);
  background: rgba(245, 244, 242, 0.1);
  border: 1px solid rgba(245, 244, 242, 0.3);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  min-height: 54px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(6px);
  transition: border-color 150ms ease, background-color 150ms ease;
}

.field input::placeholder {
  color: rgba(245, 244, 242, 0.5);
}

.field input:focus {
  outline: none;
  border-color: var(--zcg-lavender);
  background: rgba(245, 244, 242, 0.16);
  box-shadow: 0 0 0 3px rgba(123, 94, 167, 0.35);
}

.field.has-error input {
  border-color: var(--zcg-signal);
}

.field__error,
.form-error {
  margin: 0;
  text-align: center;
  font-weight: 350;
  font-size: 13px;
  color: #E9A8B3; /* --zcg-signal aufgehellt, damit es auf Violett lesbar bleibt */
}

.field__error:empty,
.form-error:empty {
  display: none;
}

.submit {
  font-family: inherit;
  font-weight: 700;
  font-size: 16px;
  color: var(--zcg-violet);
  background: var(--zcg-page);
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 20px;
  min-height: 54px;
  width: 100%;
  cursor: pointer;
  transition: background-color 150ms ease, opacity 150ms ease;
}

.submit:hover:not(:disabled) {
  background: var(--zcg-lav-l);
}

.submit:disabled {
  opacity: 0.65;
  cursor: progress;
}

.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  font-weight: 200;
  font-size: 11.5px;
  line-height: 1.45;
  color: rgba(245, 244, 242, 0.84);
  cursor: pointer;
}

.consent input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 1px 0 0;
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid rgba(245, 244, 242, 0.42);
  border-radius: var(--radius-sm);
  background: rgba(245, 244, 242, 0.08);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.consent input[type="checkbox"]::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  transition: transform 120ms ease;
}

.consent input[type="checkbox"]:checked {
  background: var(--zcg-lavender);
  border-color: var(--zcg-lavender);
}

.consent input[type="checkbox"]:checked::after {
  transform: rotate(-45deg) scale(1);
}

.consent.has-error input[type="checkbox"] {
  border-color: var(--zcg-signal);
}

.consent a {
  color: var(--zcg-lav-l);
}

/* ── Erfolgszustand ──────────────────────────────────────────────────────── */

.success {
  gap: 8px;
  align-items: center;
  text-align: center;
}

.success h2 {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--zcg-page);
}

.success p {
  margin: 0;
  font-weight: 350;
  font-size: 15px;
  color: rgba(245, 244, 242, 0.82);
}

/* ── Fuss ────────────────────────────────────────────────────────────────── */

.foot {
  grid-row: 5;
  position: relative;
  z-index: 4;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-weight: 200;
  font-size: 11.5px;
  color: rgba(245, 244, 242, 0.55);
}

.foot__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
}

.foot a {
  color: rgba(245, 244, 242, 0.75);
}

.noscript {
  position: relative;
  margin: 0;
  padding: 0 20px 20px;
  font-weight: 200;
  font-size: 13px;
  color: rgba(245, 244, 242, 0.75);
}

/* ── Groessere Screens ───────────────────────────────────────────────────── */

@media (min-width: 700px) {
  .overlay {
    padding: 40px;
    grid-template-rows: auto minmax(32px, 1fr) auto minmax(24px, 0.55fr) auto;
  }

  /* Inhaltsspalte mittig unter dem Roboter — sonst steht alles links und nur
     der Roboter in der Mitte. Die Fusszeile laeuft ueber die volle Breite,
     damit Links und Wortmarke in den Ecken sitzen. */
  .head,
  .panel {
    width: min(100%, 560px);
    margin-inline: auto;
  }

  /* Auf dem breiteren, flacheren Viewport sitzt der Kopf hoeher im Bild — hier
     braucht die Headline keinen zusaetzlichen Versatz, die Szene dafuer mehr. */
  .head {
    padding-top: 0;
  }

  .scene__spline,
  .scene__poster {
    transform: translateY(5%);
  }

  .foot {
    width: 100%;
  }

  h1 {
    font-size: clamp(2.75rem, 5vw, 3.75rem);
  }
}

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