/* ==========================================================================
   corelay - Basis (Reset, Typografie, Flaechen, Buttons, Helfer)
   --------------------------------------------------------------------------
   Setzt auf css/tokens.css auf. Enthaelt ausschliesslich globale Grundlagen,
   keine Sektionslogik - die liegt in css/layout.css und css/sections/*.css.

   Inhalt
     1. Reset
     2. Dokument und Scroll-Verhalten
     3. Fokus-Sichtbarkeit
     4. Basistypografie
     5. Typo-Skala als Klassen
     6. Textfarben-Helfer
     7. Inhaltsbreite und Sektionen
     8. Flaechenklassen
     9. Hintergrund-Effekte (Punktraster, Schein, Rauschen)
    10. Buttons
    11. Icons
    12. Sichtbarkeits-Helfer
    13. Einblenden beim Scrollen
    14. Reduzierte Bewegung
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

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

html,
body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

img,
svg,
video,
canvas,
picture {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

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

button {
  background: none;
  border: 0;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--paper-200);
  margin: var(--sp-8) 0;
}

::selection {
  background: var(--blue-500);
  color: #fff;
}


/* --------------------------------------------------------------------------
   2. Dokument und Scroll-Verhalten
   -------------------------------------------------------------------------- */

html {
  scroll-behavior: smooth;
  /* Anker enden nicht unter dem klebenden Header */
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background-color: var(--paper);
  color: var(--t-on-light);
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Auffangnetz: kein einzelnes langes Wort sprengt die Flaeche */
  overflow-wrap: break-word;
  /* verhindert horizontales Scrollen ab 320px */
  overflow-x: hidden;
}

/* Body-Scroll-Sperre, gesetzt vom mobilen Menue in js/main.js */
body.is-locked {
  overflow: hidden;
}


/* --------------------------------------------------------------------------
   3. Fokus-Sichtbarkeit (Qualitaetsanforderung Abschnitt 8)
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Maus-Fokus bleibt ruhig, Tastatur-Fokus wird oben ausgezeichnet */
:focus:not(:focus-visible) {
  outline: none;
}


/* --------------------------------------------------------------------------
   4. Basistypografie
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h2);
  text-wrap: balance;
}

/* Lange deutsche Komposita brauchen eine Umbruchmoeglichkeit: text-wrap
   balance verteilt nur vorhandene Wortluecken und hilft bei einem einzigen
   langen Wort nicht. Da jede Seite lang="de" traegt, trennt der Browser an
   sinnvollen Stellen (z. B. „Daten-schutz-erklaerung“); break-word greift als
   Notbremse, wenn keine Trennstelle bekannt ist. Ohne diese Regel laufen
   Ueberschriften wie „Datenschutzerklaerung“ oder
   „Allgemeine Geschaeftsbedingungen“ unter ca. 430px aus der Spalte heraus
   und werden von body { overflow-x: hidden } abgeschnitten. */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .card-title {
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

strong,
b {
  font-weight: var(--fw-bold);
}

small {
  font-size: var(--fs-micro);
}

code,
kbd,
samp {
  font-family: ui-monospace, 'Cascadia Mono', 'Segoe UI Mono', Menlo, monospace;
  font-size: .9em;
}


/* --------------------------------------------------------------------------
   5. Typo-Skala als Klassen (Abschnitt 2 der Spezifikation)
   -------------------------------------------------------------------------- */

.h1 {
  font-family: var(--ff-display);
  font-size: var(--fs-h1);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-h1);
  letter-spacing: var(--ls-h1);
}

.h2 {
  font-family: var(--ff-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-extrabold);
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
}

.h3 {
  font-family: var(--ff-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h3);
}

.card-title {
  font-family: var(--ff-display);
  font-size: var(--fs-card-title);
  font-weight: var(--fw-bold);
  line-height: var(--lh-card-title);
  letter-spacing: var(--ls-card-title);
}

.eyebrow {
  display: block;
  font-family: var(--ff-body);
  font-size: var(--fs-eyebrow);
  font-weight: var(--fw-bold);
  line-height: var(--lh-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
}

/* Variante ohne Versalien - z. B. „Warum corelay?“, 15px/600 */
.eyebrow--plain {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  text-transform: none;
}

.lead {
  font-size: clamp(.9375rem, 1.1vw, 1.0625rem);
  line-height: var(--lh-body);
  font-weight: var(--fw-regular);
}

.body-sm {
  font-size: var(--fs-body-sm);
  line-height: var(--lh-body-sm);
}

.micro {
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  line-height: var(--lh-micro);
}

.script {
  font-family: var(--ff-script);
  font-size: var(--fs-script);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-script);
  letter-spacing: 0;
}

/* Zweite Headline-Zeile: harter Umbruch, unter 640px darf frei umbrochen
   werden - dort wird aus dem Block wieder ein Inline-Element. */
.ln {
  display: block;
}

@media (max-width: 639.98px) {
  .ln {
    display: inline;
  }
}

/* Farbige Zweitzeile: auf dunklem Grund heller, auf hellem Grund kraeftiger */
.accent {
  color: var(--blue-400);
}

.accent-on-light {
  color: var(--blue-500);
}


/* --------------------------------------------------------------------------
   6. Textfarben-Helfer
   -------------------------------------------------------------------------- */

.t-on-dark { color: var(--t-on-dark); }
.t-on-dark-soft { color: var(--t-on-dark-soft); }
.t-on-dark-mute { color: var(--t-on-dark-mute); }
.t-on-light { color: var(--t-on-light); }
.t-on-light-soft { color: var(--t-on-light-soft); }
.t-on-light-mute { color: var(--t-on-light-mute); }


/* --------------------------------------------------------------------------
   7. Inhaltsbreite und Sektionen
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--wrap-pad));
  margin-inline: auto;
  padding-inline: var(--wrap-pad);
}

@media (max-width: 639.98px) {
  .wrap {
    padding-inline: var(--wrap-pad-sm);
  }
}

/* Randlose Variante fuer geteilte Sektionen ueber die volle Breite */
.wrap-full {
  width: 100%;
  margin-inline: auto;
  padding-inline: 0;
}

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: calc(var(--section-y) * .62);
}


/* --------------------------------------------------------------------------
   8. Flaechenklassen
   -------------------------------------------------------------------------- */

.bg-dark {
  background-color: var(--ink-900);
  color: var(--t-on-dark);
}

.bg-darker {
  background-color: var(--ink-950);
  color: var(--t-on-dark);
}

.bg-paper {
  background-color: var(--paper);
  color: var(--t-on-light);
}

.bg-paper-50 {
  background-color: var(--paper-50);
  color: var(--t-on-light);
}

.bg-paper-100 {
  background-color: var(--paper-100);
  color: var(--t-on-light);
}


/* --------------------------------------------------------------------------
   9. Hintergrund-Effekte
   --------------------------------------------------------------------------
   .dot-grid liegt im ::before, .glow im ::after - beide Klassen lassen sich
   deshalb gefahrlos am selben Element kombinieren. Der Inhalt bleibt oben,
   weil das Element per isolation einen eigenen Stapelkontext bildet.
   -------------------------------------------------------------------------- */

.dot-grid,
.glow {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* Sehr feines Punktraster, Opazitaet max. 4 % */
.dot-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .28) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
  opacity: .14; /* ergibt effektiv knapp 4 % Deckung */
}

/* Punktraster auf hellem Grund */
.dot-grid--light::before {
  background-image: radial-gradient(rgba(11, 17, 32, .30) 1px, transparent 1px);
  opacity: .12;
}

/* Weicher blauer Schein, Position ueber Custom Properties steuerbar */
.glow::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  top: var(--glow-y, 6%);
  left: var(--glow-x, 58%);
  width: var(--glow-size, 780px);
  height: var(--glow-size, 780px);
  transform: translate(-50%, -12%);
  background: radial-gradient(closest-side, var(--blue-glow), rgba(47, 128, 255, 0) 72%);
  filter: blur(6px);
}

/* Feines Rauschen als Overlay - die Deckkraft steckt in der SVG-Datei */
.noise {
  background-image: url('../img/noise.svg');
  background-repeat: repeat;
  background-size: 160px 160px;
}

/* Vignette zu den Raendern dunkler Sektionen */
.vignette {
  position: relative;
  isolation: isolate;
}

.vignette::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(8, 12, 22, 0) 40%, rgba(8, 12, 22, .55) 100%);
}


/* --------------------------------------------------------------------------
   10. Buttons (Abschnitt 3 der Spezifikation)
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--ff-body);
  font-size: var(--fs-btn);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: var(--ls-btn);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.btn .ico {
  width: 16px;
  height: 16px;
}

/* --- 10.1 Primaer ---------------------------------------------------------- */
.btn-primary {
  background-color: var(--blue-500);
  color: #fff;
  border-color: var(--blue-500);
}

.btn-primary:hover {
  background-color: var(--blue-600);
  border-color: var(--blue-600);
  transform: translateY(-2px);
  box-shadow: var(--sh-blue);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
  background-color: var(--blue-600);
}

/* --- 10.2 Sekundaer auf Dunkel --------------------------------------------- */
.btn-ghost-dark {
  background-color: transparent;
  border-color: rgba(255, 255, 255, .18);
  color: var(--t-on-dark);
}

.btn-ghost-dark:hover {
  background-color: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .30);
}

.btn-ghost-dark:active {
  background-color: rgba(255, 255, 255, .12);
}

/* Kreisfoermiges Icon links (Play/Pfeil), 22px */
.btn-ghost-dark .btn-circle {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: var(--r-pill);
  background-color: rgba(255, 255, 255, .12);
  transition: background-color var(--dur) var(--ease);
}

.btn-ghost-dark .btn-circle .ico {
  width: 10px;
  height: 10px;
}

.btn-ghost-dark:hover .btn-circle {
  background-color: var(--blue-500);
}

/* --- 10.3 Sekundaer auf Hell ------------------------------------------------ */
.btn-ghost-light {
  background-color: var(--paper);
  border-color: var(--paper-200);
  color: var(--t-on-light);
}

.btn-ghost-light:hover {
  background-color: var(--paper-100);
  border-color: var(--paper-200);
}

.btn-ghost-light:active {
  background-color: var(--paper-200);
}

/* --- 10.4 Rund -------------------------------------------------------------- */
.btn-round {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background-color: var(--ink-900);
  color: #fff;
  cursor: pointer;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.btn-round .ico {
  width: 15px;
  height: 15px;
}

.btn-round:hover {
  background-color: var(--blue-500);
}

.btn-round:active {
  transform: scale(.94);
}

/* --- 10.5 Block-Variante und Zustaende -------------------------------------- */
.btn-block {
  display: flex;
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"],
.btn-round[disabled] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}


/* --------------------------------------------------------------------------
   11. Icons
   --------------------------------------------------------------------------
   Alle Icons kommen aus der SVG-Sprite und erben die Textfarbe.
   -------------------------------------------------------------------------- */

.ico {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  vertical-align: middle;
  pointer-events: none;
}

/* Variante fuer flaechige Icons (z. B. Social-Glyphen) */
.ico--fill {
  fill: currentColor;
  stroke: none;
}

/* Sprite-Datei selbst wird nie gerendert */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}


/* --------------------------------------------------------------------------
   12. Sichtbarkeits-Helfer
   -------------------------------------------------------------------------- */

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: var(--z-skip);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background-color: var(--blue-500);
  color: #fff;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus-visible,
.skip-link:focus {
  transform: translateY(0);
}


/* --------------------------------------------------------------------------
   13. Einblenden beim Scrollen
   --------------------------------------------------------------------------
   js/main.js setzt .is-visible per IntersectionObserver. Die Staffelung je
   Karte laeuft ueber --reveal-delay (inline gesetzt oder per nth-child).
   -------------------------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity var(--dur-reveal) var(--ease),
    transform var(--dur-reveal) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Ohne aktives JavaScript setzt niemand .is-visible - dann darf der Inhalt
   nicht dauerhaft ausgeblendet bleiben. Die Abfrage kehrt den Startzustand
   um, sobald der Browser meldet, dass Skripte nicht ausgefuehrt werden. */
@media (scripting: none) {

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* --------------------------------------------------------------------------
   14. Reduzierte Bewegung
   --------------------------------------------------------------------------
   Schaltet saemtliche Animationen ab (Spezifikation 7.9).
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
