/* Impressum: one stylesheet for /impressum/ (standalone) and the in-app view
   (#legal-view, loaded on first open). Same look as Einstellungen/Warum:
   dark paper, cards with --set-radius, uppercase group titles, 44 px targets,
   safe areas. Phone first; on wide screens a centred 40rem column.
   The tokens fall back to the app's values when app.css is not loaded. */

.legal-page {
  --lg-paper: var(--paper, #000);
  --lg-ink: var(--ink, #f2f2f2);
  --lg-muted: var(--muted, #a8a8a8);
  --lg-card: var(--set-card, color-mix(in srgb, #f2f2f2 10%, #000));
  --lg-line: var(--set-line, color-mix(in srgb, #f2f2f2 12%, transparent));
  --lg-accent: var(--set-accent, oklch(72% 0.15 150));
  --lg-radius: var(--set-radius, 12px);
  box-sizing: border-box;
  width: 100%;
  max-width: calc(40rem + 32px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(40px, calc(env(safe-area-inset-bottom, 0px) + 24px)) max(16px, env(safe-area-inset-left, 0px));
  color: var(--lg-ink);
  font-family: var(--font-ui, "Manrope", "Noto Sans", "Segoe UI", system-ui, sans-serif);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

.legal-page a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--lg-ink) 40%, transparent);
  text-underline-offset: 0.18em;
}

.legal-page a:focus-visible {
  outline: 2px solid var(--lg-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Back: a 44 px target, not a tiny text link. */
.legal-page .back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: -8px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--lg-muted);
  font-size: 0.875rem;
  text-decoration: none;
}

@media (hover: hover) {
  .legal-page .back:hover {
    color: var(--lg-ink);
    background: color-mix(in srgb, var(--lg-ink) 6%, transparent);
  }
}

.legal-page h1 {
  margin: 16px 0 4px;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.legal-page .lead {
  margin: 0 0 8px;
  color: var(--lg-muted);
  font-size: 0.875rem;
}

.legal-page h1:focus,
.legal-page h2:focus {
  outline: none;
}

/* Section titles: like the settings group titles. */
.legal-page h2 {
  margin: 28px 0 8px;
  padding: 0 4px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lg-muted);
  scroll-margin-top: 16px;
}

.legal-page .legal-section {
  scroll-margin-top: 16px;
}

.legal-card {
  margin: 0;
  padding: 0;
  border-radius: var(--lg-radius);
  background: var(--lg-card);
  list-style: none;
  overflow: hidden;
}

/* Legal text block (provider, links): text rows inside one card. */
.legal-card.legal-text {
  padding: 12px 16px;
}

.legal-page address {
  font-style: normal;
}

.legal-page p {
  margin: 0;
}

.legal-page .legal-text p + p,
.legal-page .legal-text address + p {
  margin-top: 8px;
}

.legal-page .contact {
  display: grid;
}

/* Mail / phone: 44 px rows. */
.legal-page p.contact {
  margin-top: 4px;
}

.legal-page p.contact a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.legal-page .legal-note {
  margin: 0 0 12px;
  padding: 0 4px;
  color: var(--lg-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* Sources: group title + card of rows. */
.legal-page .legal-group {
  margin: 20px 0 8px;
  padding: 0 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--lg-ink);
}

.legal-src {
  margin: 0;
  padding: 2px 16px 12px;
}

.legal-src + .legal-src {
  border-top: 1px solid var(--lg-line);
}

.legal-src-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 12px;
}

.legal-src-name,
.legal-src-lic {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.legal-src-name {
  font-weight: 600;
}

.legal-src-lic {
  color: var(--lg-muted);
  font-size: 0.8125rem;
  text-align: right;
}

.legal-src-credit {
  color: var(--lg-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.legal-src-langs {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  border: 1px solid color-mix(in srgb, var(--lg-muted) 55%, transparent);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.5;
  white-space: nowrap;
}

@media (min-width: 720px) {
  .legal-page {
    padding-top: max(32px, env(safe-area-inset-top, 0px));
  }
  .legal-page h1 {
    margin-top: 24px;
    font-size: 1.75rem;
  }
}
