/* =====================================================================
   BBF Baubüro Freiberg GmbH — DESIGN-SYSTEM
   ---------------------------------------------------------------------
   Diese Datei ist die EINZIGE Quelle für Farben, Schrift, Abstände und
   Animationszeiten. Alle anderen Stylesheets greifen nur auf die hier
   definierten Variablen zu.

   ÄNDERUNGEN AM ERSCHEINUNGSBILD:
   → Farbe ändern:      Block "FARBEN" anpassen, wirkt auf allen Seiten.
   → Schrift ändern:    Block "SCHRIFT", Variable --font-sans.
   → Abstände ändern:   Block "ABSTÄNDE".
   → Animationstempo:   Block "BEWEGUNG".

   Kein Build-Schritt, kein Framework: Datei speichern, hochladen, fertig.
   ===================================================================== */


/* ---------------------------------------------------------------------
   1. TOKENS (Variablen)
   --------------------------------------------------------------------- */
:root {

  /* FARBEN — exakt aus dem Logo ausgelesen ------------------------- */
  --bbf-blau:         #16417C;   /* Primärfarbe: "BBF", Ingenieurwesen, Infrastruktur */
  --bbf-blau-dunkel:  #0F2F5C;   /* Hover-/Aktiv-Zustand von Blau */
  --bbf-blau-hell:    #E8EEF6;   /* Zarte blaue Flächen (Hintergründe, Platzhalter) */

  --bbf-rot:          #8A1C2E;   /* Sekundärfarbe: Architektur-Kubus, Call-to-Action */
  --bbf-rot-dunkel:   #6E1524;   /* Hover-/Aktiv-Zustand von Rot */
  --bbf-rot-hell:     #F6E9EB;   /* Zarte rote Flächen */

  --weiss:            #FFFFFF;
  --grau-hell:        #F8F9FA;   /* Edler Weißraum, alternierende Sektionen */
  --grau-linie:       #E5E7EB;   /* Trennlinien, Rahmen */

  --text:             #1F2937;   /* Anthrazit — niemals reines Schwarz */
  --text-gedaempft:   #4B5563;   /* Nebentext; Kontrast 7,5:1 auf Weiß */
  --text-invers:      #FFFFFF;   /* Text auf Blau/Rot */

  /* SEMANTISCHE ROLLEN — hier NICHT die Hex-Werte ändern, sondern oben */
  --farbe-primaer:    var(--bbf-blau);
  --farbe-akzent:     var(--bbf-rot);
  --farbe-bereich:    var(--bbf-blau);   /* wird pro Seite überschrieben (siehe 3.) */
  --farbe-bereich-dunkel: var(--bbf-blau-dunkel);
  --farbe-bereich-hell:   var(--bbf-blau-hell);
  --hintergrund:      var(--weiss);
  --hintergrund-alt:  var(--grau-hell);
  --fokus-ring:       var(--bbf-rot);


  /* SCHRIFT ---------------------------------------------------------- */
  /* "Instrument Sans" wird selbst gehostet (assets/fonts/, SIL Open Font
     License) und sieht damit auf allen Geräten identisch aus. Die weiteren
     Einträge sind nur Rückfall, falls die Datei nicht lädt. */
  --font-sans: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --zeilenhoehe:      1.6;
  --zeilenhoehe-eng:  1.1;

  /* Fluide Schriftgrößen: wachsen mit dem Bildschirm (Smartphone → 4K),
     clamp(Minimum, bevorzugt, Maximum) */
  --schrift-xs:  0.8125rem;                                   /* 13px */
  --schrift-sm:  0.9375rem;                                   /* 15px */
  --schrift-md:  clamp(1.0625rem, 1rem + 0.25vw, 1.25rem);    /* 17–20px, Fließtext */
  --schrift-lg:  clamp(1.25rem,   1.1rem + 0.6vw, 1.625rem);  /* 20–26px, Lead-Text */
  --schrift-xl:  clamp(1.5rem,    1.2rem + 1.3vw, 2.25rem);   /* 24–36px, H3/H2 klein */
  --schrift-2xl: clamp(2rem,      1.5rem + 2.4vw, 3.75rem);   /* 32–60px, H2 */
  --schrift-3xl: clamp(2.5rem,    1.6rem + 3vw, 4.75rem);     /* 40–76px, H1 Hero */


  /* ABSTÄNDE — 8-Pixel-Raster --------------------------------------- */
  --abstand-1: 0.5rem;   /*  8px */
  --abstand-2: 1rem;     /* 16px */
  --abstand-3: 1.5rem;   /* 24px */
  --abstand-4: 2rem;     /* 32px */
  --abstand-5: 3rem;     /* 48px */
  --abstand-6: 4rem;     /* 64px */
  --abstand-7: 6rem;     /* 96px */

  --sektion-y:        clamp(4rem, 2.5rem + 5vw, 9rem);   /* vertikaler Abstand zwischen Sektionen */
  --seitenrand:       clamp(1.25rem, 4vw, 3.5rem);       /* Abstand zum Bildschirmrand */
  --inhalt-breite:    82rem;                              /* 1312px — Maximalbreite Inhalt (auch auf 4K) */
  --inhalt-schmal:    44rem;                              /* 704px  — Maximalbreite Lesetext */
  --header-hoehe:     4.5rem;                             /* 72px */


  /* GEOMETRIE — Kubus-Logik: scharfe Kanten, keine Rundungen ------- */
  --radius:  0;
  --schraege: 8%;   /* Neigung der diagonalen "Kubus-Kante" (Vorschaltseite, Hero-Bild) */
  --linie:   1px solid var(--grau-linie);


  /* BEWEGUNG --------------------------------------------------------- */
  --dauer-schnell:  160ms;
  --dauer-normal:   320ms;
  --dauer-langsam:  520ms;
  --easing:         cubic-bezier(0.22, 0.61, 0.36, 1);   /* weiches Ausrollen */
}


/* WEBFONT ------------------------------------------------------------
   Instrument Sans, zwei Schnitte (Normal 400, Fett 700), auf lateinische
   Zeichen reduziert (je ca. 20 KB). Halbfett (600) nutzt automatisch den
   fetten Schnitt. Schrift wechseln: neue .woff2-Dateien nach assets/fonts/,
   die zwei Blöcke hier und --font-sans oben anpassen.
   --------------------------------------------------------------------- */
@font-face {
  font-family: 'Instrument Sans';
  src: url('../fonts/instrument-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('../fonts/instrument-sans-700.woff2') format('woff2');
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}


/* ---------------------------------------------------------------------
   2. BASIS (Reset & Grundstile)
   --------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-hoehe) + 1rem);
  background: var(--hintergrund);
}

body {
  min-height: 100svh;
  font-family: var(--font-sans);
  font-size: var(--schrift-md);
  line-height: var(--zeilenhoehe);
  color: var(--text);
  background: var(--hintergrund);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  line-height: var(--zeilenhoehe-eng);
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
h1 { font-size: var(--schrift-3xl); }
h2 { font-size: var(--schrift-2xl); }
h3 { font-size: var(--schrift-xl); }
h4 { font-size: var(--schrift-lg); }

p, li {
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

/* Grundstil nur für Links OHNE Klasse (Fließtext). Komponenten-Links
   (.btn, .kachel, .gate__panel …) legen ihre Farben selbst fest;
   :where() hält die Spezifität niedrig, damit deren Hover-Regeln gewinnen. */
a:where(:not([class])) {
  color: var(--farbe-bereich);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:where(:not([class])):hover { color: var(--farbe-bereich-dunkel); }

img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button, a, label, summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

address { font-style: normal; }

/* Sichtbarer Tastaturfokus — auf allen Seiten identisch */
:focus-visible {
  outline: 3px solid var(--fokus-ring);
  outline-offset: 3px;
}

::selection {
  background: var(--farbe-bereich);
  color: var(--text-invers);
}

/* Bewegung reduzieren, wenn das Betriebssystem es verlangt */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Sanfter Seitenwechsel in modernen Browsern (progressive Verbesserung,
   ältere Browser ignorieren die Regel einfach) */
@view-transition {
  navigation: auto;
}


/* ---------------------------------------------------------------------
   3. BEREICHSFARBE — pro Seite im <body data-bereich="…"> gesetzt
   --------------------------------------------------------------------- */
body[data-bereich="unternehmen"] {
  --farbe-bereich:        var(--bbf-blau);
  --farbe-bereich-dunkel: var(--bbf-blau-dunkel);
  --farbe-bereich-hell:   var(--bbf-blau-hell);
}
body[data-bereich="karriere"] {
  --farbe-bereich:        var(--bbf-rot);
  --farbe-bereich-dunkel: var(--bbf-rot-dunkel);
  --farbe-bereich-hell:   var(--bbf-rot-hell);
}


/* ---------------------------------------------------------------------
   4. HILFSKLASSEN
   --------------------------------------------------------------------- */

/* Nur für Screenreader sichtbar */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* "Zum Inhalt springen" — erscheint nur bei Tastaturfokus */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
  padding: var(--abstand-2) var(--abstand-3);
  background: var(--bbf-rot);
  color: var(--text-invers);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-120%);
}
.skip-link:focus-visible {
  transform: none;
  outline-color: var(--weiss);
  outline-offset: -6px;
}

/* Zentrierter Inhaltscontainer */
.innen {
  width: 100%;
  max-width: var(--inhalt-breite);
  margin-inline: auto;
  padding-inline: var(--seitenrand);
}
.innen--schmal { max-width: var(--inhalt-schmal); }

/* Schlichte Meldeseiten von formular.php (Dank, Fehler, Sicherheitsabfrage).
   Sie laden nur dieses Stylesheet. Ein style-Attribut ginge nicht: die
   Content-Security-Policy in der .htaccess laesst keine zu. */
.seite--meldung { padding-block: var(--abstand-6); }

/* Lesetext */
.prosa > * + * { margin-top: var(--abstand-3); }
.prosa h2 { margin-top: var(--abstand-6); font-size: var(--schrift-xl); }
.prosa h3 { margin-top: var(--abstand-5); font-size: var(--schrift-lg); }
.prosa ul { padding-left: 1.25em; }


/* ---------------------------------------------------------------------
   5. BUTTONS — Füllung wandert bei Hover von links nach rechts
   --------------------------------------------------------------------- */
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--abstand-1);
  min-height: 3rem;                    /* ≥ 44px Touch-Ziel */
  padding: 0.85rem 1.6rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--schrift-sm);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color var(--dauer-schnell) var(--easing),
    color        var(--dauer-normal)  var(--easing),
    transform    var(--dauer-schnell) var(--easing);
}
/* Die wandernde Füllung */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dauer-normal) var(--easing);
}
.btn:hover::before,
.btn:focus-visible::before { transform: scaleX(1); }
.btn:active { transform: translateY(1px); }

/* Gefüllt in Bereichsfarbe */
.btn--primaer {
  background: var(--farbe-bereich);
  border-color: var(--farbe-bereich);
  color: var(--text-invers);
}
.btn--primaer::before { background: var(--farbe-bereich-dunkel); }
.btn--primaer:hover { border-color: var(--farbe-bereich-dunkel); color: var(--text-invers); }

/* Umrandet, transparent */
.btn--sekundaer {
  background: transparent;
  border-color: currentColor;
  color: var(--farbe-bereich);
}
.btn--sekundaer::before { background: var(--farbe-bereich); }
.btn--sekundaer:hover { color: var(--text-invers); }

/* Kompakt, z. B. in Kontaktkarten */
.btn--klein {
  min-height: 2.75rem;                 /* bleibt ≥ 44px Touch-Ziel */
  padding: 0.6rem 1.15rem;
  font-size: var(--schrift-xs);
}

/* Symbol im Knopf, z. B. die Kartennadel bei „Anfahrt“ */
.btn svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

/* Weiß auf farbigem Grund */
.btn--hell {
  background: var(--weiss);
  border-color: var(--weiss);
  color: var(--farbe-bereich);
}
.btn--hell::before { background: var(--farbe-bereich-dunkel); }
.btn--hell:hover { color: var(--text-invers); }


/* ---------------------------------------------------------------------
   6. BEWEGUNG — Einblenden beim Scrollen
   ---------------------------------------------------------------------
   Element mit data-reveal wird beim Erscheinen im Sichtfeld sanft
   eingeblendet (site.js setzt die Klasse .ist-sichtbar). Kinder eines
   data-reveal-gruppe-Containers erscheinen nacheinander.
   Ohne JavaScript oder mit "Bewegung reduzieren" ist alles sofort sichtbar.
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    translate: 0 28px;
    transition:
      opacity   700ms var(--easing) var(--verzoegerung, 0ms),
      translate 700ms var(--easing) var(--verzoegerung, 0ms);
  }
  .js [data-reveal].ist-sichtbar {
    opacity: 1;
    translate: 0 0;
  }
  /* Sprungziel (z. B. aktuelles.html#meldung) ohne Übergang sofort an seinem
     Platz. Sonst berechnet der Browser den Sprung am noch verschobenen Element
     und die Oberkante landet unter der Kopfzeile. */
  .js [data-reveal]:target {
    opacity: 1;
    translate: 0 0;
    transition: none;
  }
}

/* Wiederverwendbare Einblend-Animationen (Entrance nutzt translate/opacity,
   Hover-Effekte nutzen transform → beides stört sich nicht) */
@keyframes auf-blenden {
  from { opacity: 0; translate: 0 18px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes von-rechts {
  from { opacity: 0; translate: 40px 0; }
  to   { opacity: 1; translate: 0 0; }
}
