/**
 * UTILITIES — Layout- und Typo-Helfer auf Token-Basis
 *
 * Präfix `u-` kennzeichnet Utilities. Sie kapseln wiederkehrende
 * Patterns (Container, Section, Text-Stile), damit Komponenten schlank
 * bleiben und Rebranding zentral wirkt.
 */

/* ==========================================================================
   LAYOUT
   ========================================================================== */

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

.u-container--narrow {
  max-width: calc(var(--container-narrow) + var(--grid-margin) * 2);
}

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

.u-section--tight {
  padding-block: var(--section-padding-block-sm);
}

.u-section--flush-top {
  padding-block-start: 0;
}

/**
 * Erste Section einer Seite ohne eigenen Kopfbereich.
 *
 * Die Kopfzeile ist `position: fixed` und liegt damit über dem Inhalt. Der
 * Hero bringt seinen Abstand selbst mit, die Event-Detailseite über den
 * Rücklink — schlichte Seiten hatten keinen. Bei 5,5rem Kopfzeile und 6rem
 * Section-Abstand blieben 0,5rem: Der Seitentitel stand praktisch an der
 * Navigation.
 */
.u-section--below-nav {
  padding-block-start: calc(var(--section-padding-block) + var(--theme-nav-height));
}

/**
 * Führender Titel eines schlichten Inhaltsbereichs — Rechtstexte,
 * Suchergebnisse, 404, freier Textbaustein.
 *
 * Die Klasse trägt NUR den Abstand nach unten. Die Größe kommt aus dem Tag:
 * `h1` ergibt 48px, `h2` ergibt 36px. Der Abstand muss hier stehen, weil das
 * Reset in base.css alle Margins entfernt — ohne ihn klebt der erste Absatz
 * am Titel.
 */
.u-page-title {
  margin-block-end: var(--spacing-8);
}

/* Section-Hintergründe */
.u-bg-primary {
  background-color: var(--background-primary);
}
.u-bg-secondary {
  background-color: var(--background-secondary);
}
.u-bg-brand {
  background-color: var(--background-brand);
}
.u-bg-inverted {
  background-color: var(--background-inverted);
}

/* ==========================================================================
   TYPOGRAFIE
   ========================================================================== */

/**
 * DISPLAY — 96px, die größte Stufe.
 *
 * Reserviert für den Hero der Startseite und das Vollbild-Menü. Beide setzen
 * sie über ihre eigenen Klassen (`.hero__headline`, `--theme-menu-font-size`),
 * diese Utility hat deshalb aktuell keine Verwender.
 *
 * ► Nicht für Seitentitel nehmen. Sie stand auf den Rechtstexten, dem
 *   404-Kopf und dem freien Textbaustein — „DATENSCHUTZERKLÄRUNG" brach dort
 *   mitten im Wort um und erschlug die Seite, um die es ging. Seitentitel
 *   nehmen `h1` (48px), Abschnittstitel `h2` (36px).
 */
.u-display {
  font-family: var(--brand-font-title);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-display);
  line-height: var(--line-height-display-computed);
  letter-spacing: var(--brand-title-letter-spacing);
  text-transform: var(--brand-title-transform);
}

.u-lead {
  font-family: var(--brand-font-body);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-lead);
  line-height: var(--line-height-lead-computed);
}

.u-body {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body-computed);
}

.u-small {
  font-size: var(--font-size-small);
  line-height: var(--line-height-normal);
}

.u-tiny {
  font-size: var(--font-size-tiny);
  line-height: var(--line-height-normal);
}

.u-eyebrow {
  font-family: var(--brand-font-title);
  font-size: var(--font-size-tiny);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wider);
  text-transform: uppercase;
  color: var(--text-brand);
}

.u-text-muted {
  color: var(--text-muted);
}

.u-text-brand {
  color: var(--text-brand);
}

.u-balance {
  text-wrap: balance;
}

/* Zeilenbegrenzung */
.u-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.u-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   SECTION-KOPF — wiederkehrendes Muster: Titel links, "mehr zeigen" unten
   ========================================================================== */

.u-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--spacing-6);
  margin-block-end: var(--spacing-8);
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

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

/* Skip-Link */
.u-skip-link {
  position: absolute;
  top: var(--spacing-2);
  left: var(--spacing-2);
  z-index: var(--z-modal);
  padding: var(--spacing-3) var(--spacing-4);
  background-color: var(--color-white);
  color: var(--text-primary);
  font-weight: var(--font-weight-bold);
  border-radius: var(--brand-radius);
  transform: translateY(-200%);
  transition: transform var(--motion-duration-fast) var(--motion-ease);
}

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

/* ==========================================================================
   MEDIA
   ========================================================================== */

.u-media {
  position: relative;
  overflow: hidden;
  background-color: var(--theme-media-bg);
  border-radius: var(--theme-media-radius);
}

.u-media > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.u-aspect-video {
  aspect-ratio: 16 / 9;
}
.u-aspect-square {
  aspect-ratio: 1 / 1;
}
.u-aspect-portrait {
  aspect-ratio: 3 / 4;
}
.u-aspect-wide {
  aspect-ratio: 21 / 9;
}

/* ==========================================================================
   FILTERTRÄGER

   Das SVG mit den Waber-Filtern trägt nur Definitionen und zeigt selbst
   nichts. `display: none` wäre falsch — daraus referenzierte Filter greifen
   in Firefox dann nicht mehr.
   ========================================================================== */

.u-liquid-filters {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
