/* ==========================================================
   form-styles_v0.0.1.css

   ✨ Gesegnet und für gut befunden ✨
   Diese Styles wurden mit Bedacht, Klarheit und ohne unnötige
   Magie geschrieben.

   Prinzipien:
   - saubere HTML-Verträge
   - CSS regelt Darstellung, nicht Logik
   - progressive Enhancement (CSS → JS)
   - Erweiterbar ohne Refactor-Zwang

   Möge dieses Stylesheet stabil bleiben,
   gut altern und niemanden überraschen.

   Amen.
   ========================================================== */

/* Bitte hier die Segnung eintragen */
form {
  --gray-41: #414141;
  --gray-71: #717171;
  --gray-a1: #a1a1a1;
  --gray-c1: #c1c1c1;
  --input-font-size: var(--body-font-size);
  --input-line-height: 1.4;
  --input-padding-y: 0.5em;
  --input-padding-x: 0.75em;
  --input-width: 100%;
  --textarea-height: 6em;
  --input-border: 1px solid #717171;
  --input-border-radius: var(--border-radius);
  --input-text-color: var(--body-font-color);
  --input-background-color: var(--body-background);
  --input-placeholder-color: var(--gray-a1);
  --input-focus: var(--blue-hex);
  --input-error: var(--rot-5);
  --input-error-rgb: var(--rot-rgb);
  --input-disabled-background: var(--gray-c1);
  --input-disabled-text-color: var(--gray-71);
}

:where(
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  textarea,
  select
) {
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  font-size: var(--input-font-size);
  line-height: var(--input-line-height);
  width: var(--input-width);
  max-width: var(--input-width);
  padding: var(--input-padding-y) var(--input-padding-x);
  color: var(--input-text-color);
  background-color: var(--input-background-color);
  border: var(--input-border);
  border-radius: var(--input-border-radius);
  outline: none;
  box-shadow: none;
  transition: border-color 120ms linear, box-shadow 120ms linear, background-color 120ms linear;
}

:where(
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  textarea
)::placeholder {
  color: var(--gray-71);
  opacity: 1;
}

:where(
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  textarea,
  select
):focus-visible {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-focus), transparent 80%);
}

:where(
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  textarea,
  select
):user-invalid {
  border-color: var(--input-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-error), transparent 85%);;
}

textarea {
  min-height: var(--textarea-height);
  resize: vertical;
}

select {
  cursor: pointer;
}
/* checkbox radio ================================ */
:root {
  --control-size: 1.1rem;
  --control-border: #777;
  --control-bg: #fff;
  --control-checked: #4f46e5;
  --control-focus: #a5b4fc;
}

.control{
  display:inline-flex;
  align-items:center;
  gap:.5rem;
  cursor:pointer;
  user-select:none;
  position:relative;
}

/* input unsichtbar aber fokussierbar */
.control > input{
  position:absolute;
  opacity:0;
  width:1px;
  height:1px;
}

/* sichtbare Box */
.control > .box{
  width: var(--control-size);
  height: var(--control-size);
  border: 2px solid var(--control-border);
  background: var(--control-bg);
  display:inline-grid;
  place-items:center;
  transition: all .15s ease;
  flex: 0 0 auto;
}

/* Fokus */
.control > input:focus-visible + .box{
  outline: 3px solid var(--control-focus);
  outline-offset: 2px;
}

/* Checkbox */
.control.checkbox > .box{ border-radius:.25rem; }

.control.checkbox > .box::after{
  content:"";
  width:.35rem;
  height:.6rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity:0;
  transition: opacity .15s ease;
}

.control.checkbox > input:checked + .box{
  background: var(--control-checked);
  border-color: var(--control-checked);
}

.control.checkbox > input:checked + .box::after{
  opacity:1;
}

/* Radio */
.control.radio > .box{ border-radius:50%; }

.control.radio > .box::after{
  content:"";
  width:.55rem;
  height:.55rem;
  border-radius:50%;
  background: var(--control-checked);
  opacity:0;
  transition: opacity .15s ease;
}

.control.radio > input:checked + .box{
  border-color: var(--control-checked);
}

.control.radio > input:checked + .box::after{
  opacity:1;
}

/* Hover: Box wirkt "interaktiv" */
.control:hover > .box{
  border-color: color-mix(in srgb, var(--control-border), #000 25%);
}

/* Optional: leichte Aufhellung beim Hover, wenn nicht checked */
.control:hover > input:not(:checked) + .box{
  background: color-mix(in srgb, var(--control-bg), #000 5%);
}

/* Active: kleines "Drücken" */
.control:active > .box{
  transform: scale(0.96);
}

/* Error wenn etwas nicht ausgewählt wurde */
.form-controls.is-error .control > .box{
  border-color: #dc2626;
}

.form-controls.is-error .control > input:checked + .box{
  background: #dc2626;
  border-color: #dc2626;
}

.form-controls.is-error .control > input:focus-visible + .box{
  outline-color: #fecaca;
}

/* SWITCH ===================================== */

:root{
  --switch-w: 2.6rem;
  --switch-h: 1.4rem;
  --switch-pad: 2px;

  /* OFF-State: weißer Hintergrund */
  --switch-off-bg: #ffffff;
  --switch-off-border: #9ca3af;

  /* ON-State bleibt wie gehabt */
  --switch-on-bg: #4f46e5;
  --switch-on-border: #4f46e5;

  /* Knob-Farben */
  --switch-knob: #000000;        /* OFF: schwarzer Punkt */
  --switch-knob-on: #ffffff;     /* ON: weißer Punkt */

  --switch-focus: #a5b4fc;
}

.ui-switch{
  display: inline-block;
}

.ui-switch__label{
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  user-select: none;
}

.ui-switch__input{
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* Track (Schiene) */
.ui-switch__track{
  width: var(--switch-w);
  height: var(--switch-h);
  border: 2px solid var(--switch-off-border);
  background: var(--switch-off-bg);
  border-radius: 999px;
  box-sizing: border-box;
  position: relative;
  flex: 0 0 auto;
}

/* Knob (Knopf) */
.ui-switch__track::after{
  content: "";
  position: absolute;
  top: 50%;
  left: var(--switch-pad);
  width: calc(var(--switch-h) - 4px - (var(--switch-pad) * 2));
  height: calc(var(--switch-h) - 4px - (var(--switch-pad) * 2));
  background: var(--switch-knob);              /* OFF: schwarz */
  border-radius: 999px;
  transform: translateY(-50%);
}

/* ON-State */
.ui-switch__input:checked + .ui-switch__label .ui-switch__track{
  background: var(--switch-on-bg);
  border-color: var(--switch-on-border);
}

.ui-switch__input:checked + .ui-switch__label .ui-switch__track::after{
  left: calc(var(--switch-w) - var(--switch-h) + var(--switch-pad));
  background: var(--switch-knob-on);           /* ON: weiß */
}

/* Fokus (Tastatur) */
.ui-switch__input:focus-visible + .ui-switch__label .ui-switch__track{
  outline: 3px solid var(--switch-focus);
  outline-offset: 2px;
}

/* mögliches Beispiel */
.ui-switch__panel{
  display:none;
  margin-top:.75rem;
}

/* CSS-only Toggle:
   Zeigt alle Panels innerhalb derselben .ui-switch an.
   Feinere Steuerung erfolgt ggf. per JS (IDs / data-attributes). */
.ui-switch .ui-switch__input:checked ~ .ui-switch__panel{
  display:block;
}
/* ==========================================================
   Form Error Text
   ----------------------------------------------------------
   Aufgabe:
   - zeigt Fehlermeldungen unter Feldern
   - rein visuell (keine Logik)
   - reagiert auf JS-Zustand (.is-error)
   - ruhig, lesbar, nicht alarmistisch
   ========================================================== */

/* Grundzustand: Platz reservieren, aber nichts anzeigen */
.form-error {
  display: block;                 /* Block, damit Abstand sauber wirkt */
  min-height: 1.2em;              /* verhindert Layout-Jump bei Fehlern */
  margin-top: 0.35em;             /* Abstand zum Input */
	 font-size: 95%;
  line-height: 1.3;
  color: var(--input-error);      /* gleiche Fehlerfarbe wie Border */
  opacity: 0;                     /* standardmäßig unsichtbar */
  transition: opacity 120ms linear;
}

/* Sichtbar nur im Fehlerzustand des Wrappers */
.form-controls.is-error .form-error {
  opacity: 1;
}

/* Optional: Wenn du später mehrere Fehlertexte brauchst */
.form-error:empty {
  opacity: 0;
}

/* Optional (a11y / Fokus):
   Wenn ein Feld fokussiert ist und fehlerhaft,
   bleibt der Text sichtbar */
.form-controls.is-error :focus-visible + .form-error {
  opacity: 1;
}

			/* ==========================================================
   JS-driven Error State (passt zu deinem .is-error Vertrag)
   ========================================================== */

/* Variante A: über Wrapper-State */
.form-controls.is-error :where(input, textarea, select) {
  border-color: var(--input-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-error), transparent 85%);
}

/* Variante B: über aria-invalid (noch allgemeiner, auch ohne Wrapper) */
:where(input, textarea, select)[aria-invalid="true"] {
  border-color: var(--input-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--input-error), transparent 85%);
}

.form-controls.is-error .form-error::before {
	 font: var(--fa-font-regular);
  content: "\f071";
  color: var(--input-error);
	 font-size: inherit;
	 margin-right: 0.4em;
}
/* Erweitert für das versenden von Kontaktformular */

.hp-field{
  position:absolute;
  left:-9999px;
  width:1px;
  height:1px;
  overflow:hidden;
}
			#sendDialog {
			padding: 1.5rem;
				border-radius: 12px;
				border: none;
			}
			
			#sendDialog::backdrop {
  background: color-mix(in srgb, var(--trust), transparent 85%);
}
#sendDialog {
  animation: dialog-pop 160ms ease-out;
}

@keyframes dialog-pop {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}