/* ──────────────────────────────────────────────────────────────────────────
   Widerrufsformular – Stylesheet
   WCAG 2.1 AA konform: Kontrast ≥ 4.5:1 (Text), ≥ 3:1 (UI-Komponenten)
   ────────────────────────────────────────────────────────────────────────── */

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

html {
  font-size: var(--base-font-size);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--body-text);
  background-color: var(--body-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Screenreader-Hilfstexte (sr-only) ───────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Skip-Link (Tastaturnavigation) ──────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 9999;
  background: var(--primary-bg);
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 0 0 4px 4px;
  font-size: 0.9rem;
  font-weight: bold;
  text-decoration: none;
  transition: top 0.1s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* ── Globale Links ───────────────────────────────────────────────────────── */
a {
  color: var(--link-color);
  text-decoration: underline;  /* sichtbar auch ohne Farbe */
}

a:hover {
  text-decoration: none;
}

a:focus-visible {
  outline: 3px solid var(--primary-bg);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  background: #ffffff;
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid #d1ccc7;  /* 3:1 auf weiß */
}

.site-header .inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--link-color);
  text-decoration: none;
}

.site-header .logo:focus-visible {
  outline: 3px solid var(--primary-bg);
  outline-offset: 4px;
  border-radius: 2px;
}

.site-header .logo img {
  height: var(--logo-height);
  width: auto;
}

.site-header .logo-text {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: bold;
  letter-spacing: 0.3px;
  white-space: nowrap;
  color: var(--link-color);
}

/* ── Akzentstreifen ──────────────────────────────────────────────────────── */
.accent-stripe {
  height: var(--accent-stripe-height);
  background: var(--accent-color);
}

/* ── Hauptinhalt ─────────────────────────────────────────────────────────── */
.site-main {
  flex: 1;
  padding: 40px 24px 60px;
}

.page-header {
  max-width: 760px;
  margin: 0 auto 32px;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--link-color);
  border-bottom: 2px solid var(--primary-bg);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.page-header .intro {
  font-size: 0.95rem;
  color: #454545;  /* 9.7:1 auf #f0ede8 */
  max-width: 640px;
}

/* ── Formular-Container ──────────────────────────────────────────────────── */
.form-card {
  background: var(--form-bg);
  border-radius: var(--form-border-radius);
  box-shadow: var(--form-shadow);
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 48px;
}

@media (max-width: 620px) {
  .form-card { padding: 24px 20px; }
}

/* ── Formular-Sektionen ──────────────────────────────────────────────────── */
.form-section {
  margin-bottom: 36px;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--primary-bg);
  border-bottom: 2px solid var(--primary-bg);
  padding-bottom: 6px;
  margin-bottom: 20px;
}

/* ── Empfänger-Box ───────────────────────────────────────────────────────── */
.recipient-box {
  background: var(--fieldset-bg);
  border: 1px solid var(--fieldset-border);
  border-radius: 3px;
  padding: 16px 20px;
  font-size: 0.9rem;
  line-height: 1.6;
}

.recipient-box .label {
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #3d3d3d;  /* 10.7:1 auch auf #f8f7f5 */
  margin-bottom: 6px;
}

/* ── Formular-Felder ─────────────────────────────────────────────────────── */
.field-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.field-group.two-col   { grid-template-columns: 1fr 1fr; }
.field-group.three-col { grid-template-columns: 2fr 1fr 2fr; }

@media (max-width: 560px) {
  .field-group.two-col,
  .field-group.three-col { grid-template-columns: 1fr; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 0.875rem;
  font-weight: bold;
  color: #1a1a1a;  /* 18:1 auf Weiß */
  line-height: 1.3;
}

label .required {
  color: var(--required-color);
  margin-left: 3px;
  /* Text-Alternative für Screenreader via aria-required – rein visuell */
}

label .optional {
  color: #2d2d2d;  /* 16.1:1 auf Weiß */
  font-weight: normal;
  font-size: 0.8rem;
  margin-left: 4px;
}

/* ── Eingabefelder ───────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--input-border);  /* 2px für bessere Sichtbarkeit */
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 1rem;    /* mind. 16px – verhindert Auto-Zoom auf iOS */
  color: var(--body-text);
  background: #ffffff;
  transition: border-color 0.15s, outline 0.1s;
  appearance: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--input-focus-border);
  outline-offset: 2px;
  border-color: var(--input-focus-border);
}

/* Fehlerzustand */
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error-border);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* ── Captcha-Slot ────────────────────────────────────────────────────────── */
.captcha-wrapper {
  margin-top: 4px;
}

/* ── Submit-Bereich ──────────────────────────────────────────────────────── */
.submit-area {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.privacy-note {
  font-size: 0.875rem;
  color: #2d2d2d;  /* 16.1:1 auf Weiß */
  line-height: 1.6;
}

.privacy-note a {
  color: var(--link-color);
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary-bg);
  color: var(--primary-text);
  border: none;
  border-radius: 3px;
  padding: 13px 32px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
  /* min. Zielgröße 44×44px per WCAG 2.5.5 */
  min-height: 44px;
}

.btn-submit:hover {
  background: var(--primary-hover-bg);
}

.btn-submit:focus-visible {
  outline: 3px solid var(--primary-bg);
  outline-offset: 4px;
  /* Kontrastrahmen bei dunklem Button-Hintergrund */
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.9), 0 0 0 9px var(--primary-bg);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-submit .spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.btn-submit.loading .spinner { display: inline-block; }
.btn-submit.loading .btn-label { margin-left: 4px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Rückmeldungen ───────────────────────────────────────────────────────── */
.alert {
  padding: 16px 20px;
  border-radius: 3px;
  border-left: 4px solid;
  font-size: 0.95rem;
  line-height: 1.5;
  display: none;
}

.alert.visible { display: block; }

.alert.success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);  /* 7:1 auf Hellgrün */
}

.alert.error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);    /* 7:1 auf Hellrot */
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 28px 24px;
  margin-top: auto;
  font-size: 0.875rem;
  text-align: center;
}

.site-footer .footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 0;
  margin-bottom: 16px;
}

.site-footer .footer-nav a {
  color: var(--footer-link-color);  /* #c8d8e8 – 8.6:1 auf #1a3559 */
  text-decoration: underline;
  padding: 4px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer .footer-nav a:last-child { border-right: none; }

.site-footer .footer-nav a:hover {
  color: var(--footer-link-hover-color);
}

.site-footer .footer-nav a:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  border-radius: 2px;
}

.site-footer .copyright {
  color: #c8d8e8;  /* 8.6:1 auf #1a3559 – kein opacity nötig */
  font-size: 0.8rem;
}
