/* =====================================================================
   VORSCHALTSEITE (index.html) — interaktiver Split-Screen
   ---------------------------------------------------------------------
   Aufbau: Zwei große Link-Flächen (Blau: Unternehmen, Rot: Karriere),
   getrennt durch eine schräge weiße "Kubus-Kante" (Motiv aus dem Logo).
     · Mobil (< 768px):  zwei Kacheln übereinander, je halbe Bildschirmhöhe
     · Desktop:          nebeneinander; Hover/Fokus dehnt die Seite auf
                          ca. 60/40 aus, die andere Seite dunkelt ab.
   Beim Laden schieben sich beide Flächen von außen herein, der Inhalt
   blendet danach auf. Bei "Bewegung reduzieren" entfällt das alles.

   FARBEN DER FLÄCHEN: Block "Die beiden Flächen" — Variablen aus
   design-system.css verwenden (z. B. --bbf-blau für eine blaue Fläche).
   ===================================================================== */

.gate {
  --naht-oben:  54%;    /* Ruheposition der Kante am oberen Rand */
  --naht-unten: 46%;    /* … am unteren Rand (Differenz = Schräge) */
  --kante:      3px;    /* Stärke der weißen Kante */
  --schraege-mobil: 2.25rem;   /* mobil: Höhe der schrägen Unterkante von Fläche 1 */
  --logo-breite: 4.25rem;      /* Logo oben links; die Titelzeile richtet sich danach */

  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;          /* mobil: zwei gleich hohe Kacheln */
  min-height: 100svh;
  background: var(--bbf-rot);           /* füllt den Keil unter der schrägen Kante */
  isolation: isolate;
  overflow: hidden;
}

/* ---------- Die beiden Flächen ---------------------------------------- */
.gate__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--abstand-5) var(--seitenrand);
  color: var(--text-invers);
  text-decoration: none;
  outline: none;                        /* eigener Fokus-Stil, siehe unten */
  overflow: hidden;                     /* vergrößertes Foto nicht über die Fläche hinausragen lassen */
}
/* Schrift bleibt weiß, auch bei Hover (überschreibt den globalen Link-Hover) */
.gate__panel:hover { color: var(--text-invers); }

/* Abdunkelung der jeweils NICHT aktiven Fläche */
.gate__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dauer-normal) var(--easing);
}

/* FLÄCHE 1 — Unternehmen (Logo-Blau) */
.gate__panel--unternehmen {
  z-index: 3;
  background: var(--bbf-blau);
  /* mobil: schräge Unterkante, darunter scheint die weiße Kante durch */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--schraege-mobil)), 0 100%);
  padding-top: calc(var(--abstand-3) + 3.5rem + var(--abstand-4));   /* Platz für Logo */
}

/* FLÄCHE 2 — Karriere (Logo-Rot) */
.gate__panel--karriere {
  z-index: 1;
  background: var(--bbf-rot);
  /* mobil: reicht unter die schräge Kante von Fläche 1, damit Foto und Tönung
     auch den Keil füllen (sonst entsteht dort ein Streifen in flachem Rot) */
  margin-top: calc(-1 * var(--schraege-mobil));
  padding-top: calc(var(--abstand-5) + var(--schraege-mobil));
  /* Platz für die Fußzeile, die auf schmalen Handys bis zu drei Zeilen hat */
  padding-bottom: calc(var(--abstand-5) + 7rem + env(safe-area-inset-bottom));
}

/* Weiße Kante zwischen den Flächen (mobil: schmaler Streifen unter Fläche 1) */
.gate__kante {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: var(--weiss);
  pointer-events: none;
  clip-path: polygon(0 0, 100% 0, 100% calc(50% - var(--schraege-mobil) + var(--kante)), 0 calc(50% + var(--kante)));
}

/* ---------- Hintergrundbild + Farbtönung je Fläche -------------------- */
/* Das Foto liegt unter einer Farbtönung in der Flächenfarbe. Die Tönung ist
   auf der Textseite dichter (lesbar) und läuft zur Kante hin auf.
   Bei Hover zoomt das Foto leicht und die Tönung wird etwas durchsichtiger. */
.gate__panel picture { display: contents; }
.gate__bild {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform var(--dauer-langsam) var(--easing);
}
/* BILDAUSSCHNITT: object-position wählt, welcher Teil des Panoramas in der
   hohen Fläche sichtbar bleibt (0% = linker Rand, 100% = rechter Rand). */
.gate__panel--unternehmen .gate__bild { object-position: 100% 50%; }  /* rechter Bildrand: das Gebäude */
.gate__panel--karriere    .gate__bild { object-position: 40% 40%; }   /* die drei Personen */
.gate__toenung {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity var(--dauer-normal) var(--easing);
}
/* TÖNUNG: wie stark die Hausfarbe das Foto überdeckt (Kundenwunsch 06.11.2026:
   durchscheinender als vorher). Auf dem Handy liegen die Flächen übereinander
   und der Text reicht bis zum hellen Ende — dort bleibt der Verlauf deshalb
   flacher, damit weiße Schrift lesbar bleibt. Der steilere Verlauf für die
   Diagonale steht weiter unten im @media-Block. */
.gate__panel--unternehmen .gate__toenung {
  background: linear-gradient(to right, rgba(22, 65, 124, 0.86) 0%, rgba(22, 65, 124, 0.77) 50%, rgba(22, 65, 124, 0.68) 100%);
}
.gate__panel--karriere .gate__toenung {
  background: linear-gradient(to left, rgba(138, 28, 46, 0.86) 0%, rgba(138, 28, 46, 0.77) 50%, rgba(138, 28, 46, 0.68) 100%);
}
.gate__panel:hover .gate__bild   { transform: scale(1.06); }
.gate__panel:hover .gate__toenung { opacity: 0.88; }

/* ---------- Inhalt einer Fläche --------------------------------------- */
.gate__inhalt {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--abstand-2);
  max-width: 34rem;
  transition: transform var(--dauer-normal) var(--easing);
}

.gate__titel {
  font-size: var(--schrift-2xl);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: inherit;
}

.gate__text {
  font-size: var(--schrift-md);
  line-height: 1.5;
  opacity: 0.92;
  max-width: 30rem;
}

/* Handlungsaufforderung mit wachsender Linie */
.gate__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: var(--abstand-2);
  font-weight: 600;
  font-size: var(--schrift-sm);
}
.gate__cta::after {
  content: "";
  width: 2.5rem;
  height: 2px;
  background: currentColor;
  transform-origin: left center;
  transition: transform var(--dauer-normal) var(--easing);
}

/* Tastaturfokus: weißer Rahmen um den Inhaltsblock */
.gate__panel:focus-visible .gate__inhalt {
  outline: 3px solid var(--weiss);
  outline-offset: 1rem;
}

/* ---------- Logo & Fußzeile ------------------------------------------- */
/* Auf der dunklen Fläche wird die weiße Logo-Variante (logo-weiss.png)
   genutzt: Kubus weiß, Schrift ausgestanzt, kein Untergrund nötig. */
.gate__logo {
  position: absolute;
  z-index: 4;
  top: calc(var(--abstand-3) + env(safe-area-inset-top));
  left: calc(var(--seitenrand) + env(safe-area-inset-left));
  display: block;
  width: var(--logo-breite);
  transition: transform var(--dauer-normal) var(--easing);
}
.gate__logo img {
  width: 100%;
  height: auto;
  /* Die Frontfläche des Logos ist nur zu 75 % weiß (siehe
     werkzeuge/logo-farbvariante-bauen.py). Der Schatten hebt es trotzdem
     sauber vom Foto ab. */
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.40)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.28));
}
.gate__logo:hover { transform: translateY(-2px); }
.gate__logo:focus-visible {
  outline-color: var(--weiss);
  outline-offset: 4px;
}

/* Titelzeile rechts neben dem Logo (sichtbare Hauptüberschrift der Seite).
   Gleiche Höhe wie das Logo, Text vertikal mittig. Bricht auf schmalen
   Bildschirmen um, statt über die Fläche hinauszulaufen. */
.gate__titelzeile {
  --titel-links: calc(var(--seitenrand) + env(safe-area-inset-left) + var(--logo-breite) + var(--abstand-2));
  position: absolute;
  z-index: 4;
  top: calc(var(--abstand-3) + env(safe-area-inset-top));
  left: var(--titel-links);
  max-width: calc(100% - var(--titel-links) - var(--seitenrand));
  min-height: var(--logo-breite);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  color: var(--text-invers);
  font-size: var(--schrift-sm);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
  pointer-events: none;            /* Klicks gehen an die Fläche darunter */
}
.gate__titelzeile-name {
  font-size: var(--schrift-md);
  font-weight: 700;
  line-height: 1.15;
}
.gate__titelzeile-text { opacity: 0.88; }

/* Die Fußzeile hält Abstand zur Gestenleiste auf iPhone und Android
   (env(safe-area-inset-*) ist auf allen anderen Geräten 0). */
.gate__fuss {
  position: absolute;
  z-index: 4;
  left: calc(var(--seitenrand) + env(safe-area-inset-left));
  right: calc(var(--seitenrand) + env(safe-area-inset-right));
  bottom: calc(var(--abstand-2) + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--abstand-1) var(--abstand-3);
  font-size: var(--schrift-xs);
  color: rgba(255, 255, 255, 0.82);
}
.gate__fuss a {
  color: inherit;
  padding-block: 0.5rem;          /* Touch-Ziel ≥ 44px */
}
.gate__fuss a:hover { color: var(--weiss); }
.gate__fuss nav {
  display: flex;
  flex-wrap: wrap;                 /* auf schmalen Handys umbrechen statt abschneiden */
  align-items: center;
  gap: 0 var(--abstand-3);
}
.gate__fuss-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.gate__fuss-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

/* ---------- Einblenden beim Laden ------------------------------------- */
/* Nur mit JavaScript (html.js) und ohne "Bewegung reduzieren".
   Entrance nutzt translate/opacity, Hover nutzt transform → kein Konflikt. */
@media (prefers-reduced-motion: no-preference) {
  .js .gate__panel--unternehmen { animation: gate-von-links  800ms var(--easing) both; }
  .js .gate__panel--karriere    { animation: gate-von-rechts 800ms var(--easing) both; }
  .js .gate__kante              { animation: gate-auf 600ms var(--easing) 500ms both; }
  .js .gate__inhalt             { animation: gate-auf 700ms var(--easing) 450ms both; }
  .js .gate__logo,
  .js .gate__fuss               { animation: gate-auf 600ms var(--easing) 650ms both; }
  .js .gate__titelzeile         { animation: gate-auf 600ms var(--easing) 750ms both; }

  /* Beim Verlassen die Einblend-Animation freigeben, sonst blockiert sie
     das Ausblenden */
  .gate--verlaesst .gate__inhalt,
  .gate--verlaesst .gate__fuss,
  .gate--verlaesst .gate__logo,
  .gate--verlaesst .gate__titelzeile,
  .gate--verlaesst .gate__kante { animation: none; }
}
@keyframes gate-von-links  { from { translate: -10% 0; opacity: 0; } }
@keyframes gate-von-rechts { from { translate:  10% 0; opacity: 0; } }
@keyframes gate-auf        { from { translate: 0 18px; opacity: 0; } }

/* Beim Verlassen (Klick): nicht gewählte Fläche verblassen lassen */
.gate--verlaesst .gate__panel:not(.gate__panel--gewaehlt) .gate__inhalt,
.gate--verlaesst .gate__fuss,
.gate--verlaesst .gate__kante {
  opacity: 0;
  transition: opacity var(--dauer-normal) var(--easing);
}


/* =====================================================================
   DESKTOP / TABLET QUER: horizontaler Split mit schräger Kante
   (nur bei ausreichender Höhe, sonst bleibt die gestapelte Variante)
   ===================================================================== */
@media (min-width: 48em) and (min-height: 34em) {

  /* Breitbild: Die Flächen stehen nebeneinander, der Text sitzt jeweils am
     dunklen Ende. Dort darf das Foto zur Naht hin deutlich durchkommen. */
  .gate__panel--unternehmen .gate__toenung {
    background: linear-gradient(to right, rgba(22, 65, 124, 0.86) 0%, rgba(22, 65, 124, 0.70) 50%, rgba(22, 65, 124, 0.50) 100%);
  }
  .gate__panel--karriere .gate__toenung {
    background: linear-gradient(to left, rgba(138, 28, 46, 0.86) 0%, rgba(138, 28, 46, 0.70) 50%, rgba(138, 28, 46, 0.50) 100%);
  }

  .gate {
    display: block;
    height: 100svh;
  }

  .gate__panel {
    position: absolute;
    inset: 0;
    margin-top: 0;
    padding: 0 var(--seitenrand);
  }

  /* Fläche 1 liegt oben und wird entlang der Kante beschnitten */
  .gate__panel--unternehmen {
    clip-path: polygon(0 0, var(--naht-oben) 0, var(--naht-unten) 100%, 0 100%);
    transition: clip-path var(--dauer-normal) var(--easing);
    justify-content: flex-start;
    padding-top: clamp(7rem, 22vh, 14rem);
  }

  /* Fläche 2: Inhalt unten rechts — folgt der Diagonale */
  .gate__panel--karriere {
    justify-content: flex-end;
    align-items: flex-end;
    padding-bottom: clamp(5rem, 16vh, 11rem);
  }

  /* Weiße Kante folgt der Naht (etwas breiter als Fläche 1) */
  .gate__kante {
    clip-path: polygon(
      0 0,
      calc(var(--naht-oben) + var(--kante)) 0,
      calc(var(--naht-unten) + var(--kante)) 100%,
      0 100%
    );
    transition: clip-path var(--dauer-normal) var(--easing);
  }

  /* Inhalt bleibt stets außerhalb des Kanten-Bereichs */
  .gate__inhalt { width: min(34rem, 36vw); }

  /* Die Fotos decken nur den sichtbaren Teil jeder Fläche ab (links bzw.
     rechts der Kante), damit object-position den Ausschnitt dort wählt,
     wo er auch zu sehen ist. 66 % deckt auch den ausgedehnten Hover-Zustand. */
  .gate__panel--unternehmen .gate__bild { width: 66%; }
  .gate__panel--karriere    .gate__bild { left: auto; right: 0; width: 66%; object-position: 35% 40%; }

  .gate { --logo-breite: clamp(4.25rem, 6vw, 6rem); }
  /* Titelzeile bleibt links der Kante, auch wenn die rote Fläche sich ausdehnt */
  .gate__titelzeile { max-width: calc(44% - var(--titel-links)); }

  .gate__fuss {
    right: auto;                       /* nur unten links auf Fläche 1 */
    bottom: var(--abstand-3);
  }

  /* Hover: Fläche dehnt sich aus, die andere dunkelt ab
     (auf Touch-Geräten löst ein Tipp ohnehin sofort den Seitenwechsel aus) */
  .gate:has(.gate__panel--unternehmen:hover) { --naht-oben: 62%; --naht-unten: 54%; }
  .gate:has(.gate__panel--karriere:hover)    { --naht-oben: 46%; --naht-unten: 38%; }

  .gate:has(.gate__panel--unternehmen:hover) .gate__panel--karriere::after,
  .gate:has(.gate__panel--karriere:hover)    .gate__panel--unternehmen::after { opacity: 1; }

  .gate__panel:hover .gate__cta::after { transform: scaleX(1.8); }
  .gate__panel:hover .gate__inhalt     { transform: translateX(8px); }

  /* Tastaturfokus verhält sich wie Hover */
  .gate:has(.gate__panel--unternehmen:focus-visible) { --naht-oben: 62%; --naht-unten: 54%; }
  .gate:has(.gate__panel--karriere:focus-visible)    { --naht-oben: 46%; --naht-unten: 38%; }
  .gate__panel:focus-visible .gate__cta::after       { transform: scaleX(1.8); }

  /* Verlassen: gewählte Fläche füllt den Bildschirm, dann Seitenwechsel */
  .gate--verlaesst { pointer-events: none; }
  .gate--verlaesst .gate__panel--unternehmen,
  .gate--verlaesst .gate__kante { transition-duration: var(--dauer-langsam); }
  .gate--ziel-unternehmen { --naht-oben: 112%; --naht-unten: 112%; }
  .gate--ziel-karriere    { --naht-oben: -12%; --naht-unten: -12%; }
  .gate--verlaesst .gate__panel::after { opacity: 0; }
  .gate--verlaesst .gate__logo,
  .gate--verlaesst .gate__titelzeile {
    opacity: 0;
    transition: opacity var(--dauer-normal) var(--easing);
  }
}
