/* Grundgestaltung „Wegweiser“: Tinte, Papier, Lila und Zitrone; Schrift Geist, Vazirmatn und Geist Mono.
   Regeln:
   - Zitrone ist der Textmarker: nur Hauptaktion, Termin und „Achtung“. Auf Weiß immer mit Tintenkontur,
     sonst verschwindet sie im Schwarz-Weiß-Druck.
   - Lila steht für Marke und Auswahl (aktiver Reiter, gewählte Stelle, Schalter an).
   - Kategorien nie nur über die Farbe: immer mit Symbol und Wort. Ihre Farben tragen weiße Schrift (mind. 5 : 1).
   Alle Textfarben erreichen mindestens 4,5 : 1, Ränder von Eingabefeldern mindestens 3 : 1. */

:root {
  --tinte: #030507;
  --papier: #f8f9f6;
  --flaeche: #ffffff;
  --text: var(--tinte);
  --text-leise: #5b6066; /* 6,0 : 1 auf Papier */
  --auf-akzent: #2b2f33; /* Nebentext auf Lila und Zitrone */
  --kopf-leise: #b9bcc2; /* Nebentext auf Tinte, 10,7 : 1 */
  --kopf-links: #d9dbdf;
  --rand: #7d8187; /* Eingabefelder und Zweitknöpfe, 3,9 : 1 auf Weiß */
  --linie: #e3e4de; /* Trennlinien, nur Schmuck */
  --lila: #ca9fff;
  --lila-hell: #f1e7ff;
  --zitrone: #fdff6d;
  --zitrone-dunkler: #f2f45a;
  --gut: #1f6b3a;
  --gut-grund: #e6f2ea;
  --gefahr: #a8231c;
  --gefahr-grund: #fbeceb;
  --karte-grund: #e9eae4;

  --radius-karte: 24px;
  --radius-feld: 14px;
  --radius-klein: 12px;
  --pille: 999px;
  --schatten: 0 1px 2px rgba(3, 5, 7, 0.06), 0 10px 30px rgba(3, 5, 7, 0.07);
  --schatten-hoch: 0 10px 40px rgba(3, 5, 7, 0.22);

  --schriftart: 'Geist Variable', 'Vazirmatn Variable', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --schriftart-mono: 'Geist Mono Variable', 'Geist Variable', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --kat-kinder: #2f6db5;
  --kat-gesundheit: #b23a48;
  --kat-migration: #127a72;
  --kat-existenz: #8f6400;
  --kat-wohnen: #b5521a;
  --kat-begegnung: #6a4c9c;
  --kat-sport: #3b7a3a;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--schriftart);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--papier);
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  margin: 0 0 0.5rem;
  color: var(--tinte);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Arabische Schrift: keine negative Laufweite, mehr Zeilenabstand */
:lang(ar),
:lang(fa) {
  letter-spacing: 0;
}

[dir='rtl'] h1,
[dir='rtl'] h2,
[dir='rtl'] h3 {
  line-height: 1.4;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--tinte);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--text-leise);
}

:focus-visible {
  outline: 3px solid var(--tinte);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

/* Nur für Screenreader, optisch ausgeblendet */
.visuell-versteckt {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.symbol {
  flex: none;
  vertical-align: -0.15em;
}

/* Marke: Wegweiser + Region --------------------------------------- */

.marke-wegweiser {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.marke-wegweiser:hover {
  color: inherit;
}

.marke-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--lila);
  color: var(--tinte);
  flex: none;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.marke-name {
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
}

.marke-region {
  font-family: var(--schriftart-mono);
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-leise);
}

/* Schwarze Kopfleiste (Register, Handy-Fassung, Beratung) */
.kopfband {
  background: var(--tinte);
  color: #fff;
}

.kopfband .marke-region {
  color: var(--kopf-leise);
}

.kopfband :focus-visible {
  outline-color: var(--lila);
}

/* Etiketten in Geist Mono – in arabischer Schrift ohne Sperrung und Versalien */
.etikett {
  font-family: var(--schriftart-mono);
  font-weight: 500;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-leise);
}

.etikett:lang(ar),
.etikett:lang(fa) {
  font-family: var(--schriftart);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
}

/* Knöpfe ----------------------------------------------------------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--rand);
  border-radius: var(--pille);
  background: var(--flaeche);
  color: var(--tinte);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.knopf:hover {
  background: var(--papier);
  color: var(--tinte);
}

.knopf:disabled,
.knopf[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hauptaktion: Zitrone mit Tintenkontur – höchstens eine je Ansicht oder Karte */
.knopf.haupt {
  background: var(--zitrone);
  border: 1.5px solid var(--tinte);
  color: var(--tinte);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.knopf.haupt:hover {
  background: var(--zitrone-dunkler);
}

.knopf.gefahr {
  color: var(--gefahr);
  border-color: #d9a5a1;
}

.knopf.gefahr:hover {
  background: var(--gefahr-grund);
  color: var(--gefahr);
}

.knopf.klein {
  min-height: 2.25rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.875rem;
}

.knopf.nur-symbol {
  min-width: 2.75rem;
  padding: 0.4rem;
}

.knopf.klein.nur-symbol {
  min-width: 2.25rem;
}

.knopfzeile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Formulare -------------------------------------------------------- */

label {
  font-weight: 600;
}

.feld {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.feld .hilfe {
  display: block;
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--text-leise);
}

input[type='text'],
input[type='password'],
input[type='search'],
input[type='email'],
input[type='url'],
input[type='tel'],
input[type='date'],
input[type='time'],
input[type='number'],
select,
textarea {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--rand);
  border-radius: var(--radius-feld);
  padding: 0.55rem 0.85rem;
  min-height: 2.75rem;
  width: 100%;
}

input[type='search'],
select {
  border-radius: var(--pille);
  padding-inline: 1.1rem;
}

textarea {
  min-height: 4.5rem;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--tinte);
  outline-offset: 1px;
  border-color: var(--tinte);
}

input[type='checkbox'],
input[type='radio'] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--tinte);
  margin: 0;
}

/* Schalter: echtes Kontrollkästchen mit role="switch". An = Lila mit Knopf in Tinte. */
input[type='checkbox'][role='switch'] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 2.75rem;
  height: 1.625rem;
  border-radius: var(--pille);
  cursor: pointer;
  background-color: #fff;
  background-image: radial-gradient(circle, var(--rand) 0 0.5rem, transparent calc(0.5rem + 0.5px));
  background-size: 1.625rem 1.625rem;
  background-repeat: no-repeat;
  background-position: left center;
  box-shadow: inset 0 0 0 1.5px var(--rand);
  transition:
    background-position 0.15s ease,
    background-color 0.15s ease;
}

input[type='checkbox'][role='switch']:checked {
  background-color: var(--lila);
  background-image: radial-gradient(circle, var(--tinte) 0 0.5625rem, transparent calc(0.5625rem + 0.5px));
  background-position: right center;
  box-shadow: none;
}

[dir='rtl'] input[type='checkbox'][role='switch'] {
  background-position: right center;
}

[dir='rtl'] input[type='checkbox'][role='switch']:checked {
  background-position: left center;
}

@media (prefers-reduced-motion: reduce) {
  input[type='checkbox'][role='switch'] {
    transition: none;
  }
}

.wahl {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 400;
  cursor: pointer;
}

.wahl input {
  margin-top: 0.2rem;
}

.wahl input[role='switch'] {
  margin-top: 0;
}

.schalter-wahl {
  align-items: center;
  font-weight: 500;
  white-space: nowrap;
}

fieldset {
  border: 1px solid var(--linie);
  border-radius: var(--radius-feld);
  padding: 0.75rem 1rem 0.5rem;
  margin: 0 0 1rem;
}

legend {
  font-weight: 600;
  color: var(--tinte);
  padding: 0 0.3rem;
}

/* Meldungen und Kennzeichen ---------------------------------------- */

.hinweisbox {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--linie);
  background: var(--flaeche);
  margin-bottom: 1rem;
}

.hinweisbox > .symbol {
  margin-top: 0.15rem;
}

/* Achtung: Zitrone mit Tintenkontur */
.hinweisbox.warn {
  background: var(--zitrone);
  border: 1.5px solid var(--tinte);
  color: var(--tinte);
}

.hinweisbox.gefahr {
  background: var(--gefahr-grund);
  border-color: #e3b4b1;
  color: #5c1410;
}

.hinweisbox.gut {
  background: var(--gut-grund);
  border-color: #a9d3b8;
  color: #133d24;
}

.hinweisbox p:last-child {
  margin-bottom: 0;
}

.marke {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.6rem;
  border-radius: var(--pille);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--linie);
  color: var(--auf-akzent);
  white-space: nowrap;
}

.marke.warn {
  background: var(--zitrone);
  box-shadow: inset 0 0 0 1px var(--tinte);
  color: var(--tinte);
}

.marke.gefahr {
  background: var(--gefahr-grund);
  box-shadow: inset 0 0 0 1px #e3b4b1;
  color: var(--gefahr);
}

.marke.gut {
  background: var(--gut-grund);
  box-shadow: inset 0 0 0 1px #a9d3b8;
  color: var(--gut);
}

.marke.info {
  background: var(--papier);
  box-shadow: inset 0 0 0 1px var(--linie);
  color: var(--auf-akzent);
}

.leise {
  color: var(--text-leise);
}

.klein {
  font-size: 0.875rem;
}

.ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

/* Filter-Chips (Beratung und Register) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--rand);
  background: #fff;
  border-radius: var(--pille);
  padding: 0.3rem 0.95rem;
  min-height: 2.375rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--tinte);
  white-space: nowrap;
}

.chip:hover {
  background: var(--papier);
}

.chip[aria-pressed='true'] {
  background: var(--tinte);
  border-color: var(--tinte);
  color: #fff;
  font-weight: 600;
}

.punkt {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--farbe, #999);
  flex: none;
}

.chip[aria-pressed='true'] .punkt {
  box-shadow: 0 0 0 1.5px #fff;
}

/* Kategorie: Pille mit Symbol und Wort auf heller Tönung */
.kat-pille {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  max-width: 100%;
  padding: 0.2rem 0.7rem 0.2rem 0.5rem;
  border-radius: var(--pille);
  background: var(--toenung, var(--papier));
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.kat-pille > .symbol {
  color: var(--farbe);
}

.kat-pille > .etikett {
  color: var(--auf-akzent);
  white-space: normal;
}

/* Kategorie als Kachel (Register) */
.kat-kachel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.875rem;
  height: 2.875rem;
  border-radius: 14px;
  background: var(--toenung, var(--papier));
  color: var(--farbe);
}

/* Nummer einer Stelle: Kategorienfarbe mit weißer Ziffer, ohne Rand */
.nummer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  background: var(--farbe);
  color: var(--schrift, #fff);
  font-weight: 600;
  font-size: 1.125rem;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* Termin: der Textmarker */
.termin-kasten {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.7rem 0.9rem;
  border-radius: 18px;
  background: var(--zitrone);
  border: 1.5px solid var(--tinte);
  color: var(--tinte);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.termin-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.termin-etiketten {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
}

.termin-kasten .etikett {
  color: var(--auf-akzent);
}

.termin-wann {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.termin-kasten .zw > .de:not(.nur) {
  color: var(--auf-akzent);
  font-size: 0.68em;
  font-weight: 400;
}

/* Zweisprachige Texte: Zielsprache groß, Deutsch klein darunter */
.zw {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1em;
}

.zw > .de:not(.nur) {
  font-size: 0.8em;
  color: var(--text-leise);
  font-weight: 400;
  letter-spacing: 0;
}

.zw [dir='rtl'] {
  text-align: right;
}

[dir='rtl'] .zw > .de {
  text-align: right;
}

/* Kartenrender für den Druck außerhalb des sichtbaren Bereichs */
.karte-unsichtbar {
  position: fixed;
  left: -20000px;
  top: 0;
}

/* Kartenfenster (MapLibre) im Stil der Karten */
.maplibregl-popup-content {
  font-family: var(--schriftart);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  box-shadow: var(--schatten-hoch);
}

.maplibregl-popup-close-button {
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}
