/*--------------------------------------------------------------
# Raccoon Facility — anfrage.css
# Fokus-Layout für kostenlose-anfrage.html (und nur dafür).
# Baut auf den Tokens aus theme.css auf: ruhig, groß, eine Aufgabe
# pro Bildschirm. Klassen tragen das Präfix "af-" (Anfrageformular).
--------------------------------------------------------------*/

.page-anfrage {
  --af-canvas: #f3f6f7;
  --af-radius: 14px;
  --af-radius-lg: 24px;
  --af-field-h: 52px;
  --af-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--af-canvas);
}

/*--------------------------------------------------------------
# Kopfzeile — nur Logo und Telefon, keine Navigation
--------------------------------------------------------------*/
.af-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgb(255 255 255 / 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgb(16 48 59 / 0.06);
}

.af-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: 64px;
}

.af-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--rf-ink);
}

.af-logo:hover {
  color: var(--rf-ink);
}

.af-logo img {
  height: 38px;
  width: auto;
}

.af-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--rf-border);
  border-radius: var(--r-pill);
  background: #fff;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--rf-ink);
  white-space: nowrap;
}

.af-phone .bi {
  color: var(--rf-primary);
}

.af-phone:hover {
  border-color: var(--rf-primary-light);
  color: var(--rf-primary);
}

.af-phone-short {
  display: none;
}

@media (max-width: 480px) {
  .af-logo-text,
  .af-phone-number,
  .af-hide-sm {
    display: none;
  }

  .af-phone-short {
    display: inline;
  }
}

/*--------------------------------------------------------------
# Inhalt
--------------------------------------------------------------*/
.af-main {
  flex: 1;
  padding-block: clamp(32px, 6vw, 72px) clamp(48px, 8vw, 96px);
}

.af-container {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: 20px;
}

@media (max-width: 480px) {
  .af-container {
    padding-inline: 16px;
  }
}

.af-intro {
  margin-bottom: clamp(24px, 4vw, 40px);
  text-align: center;
}

.af-eyebrow {
  display: inline-block;
  margin-bottom: var(--sp-4);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--rf-primary-tint);
  font-family: var(--font-heading);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--rf-primary);
}

.af-intro h1 {
  margin: 0 0 var(--sp-3);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.af-intro p {
  margin: 0;
  font-size: clamp(1.0625rem, 2.2vw, 1.1875rem);
  line-height: 1.5;
  color: var(--rf-text-muted);
}

/*--------------------------------------------------------------
# Karte + Fortschritt
--------------------------------------------------------------*/
.af-card {
  padding: clamp(18px, 5vw, 44px);
  border-radius: var(--af-radius-lg);
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 48 59 / 0.04), 0 12px 40px rgb(16 48 59 / 0.07);
  scroll-margin-top: 88px;
}

.af-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.af-progress-bar {
  display: flex;
  flex: 1;
  gap: 6px;
}

.af-progress-seg {
  position: relative;
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--rf-border);
}

.af-progress-seg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--rf-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--af-ease);
}

.af-progress-seg.is-done::after {
  transform: scaleX(1);
}

.af-progress-label {
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--rf-text-muted);
  white-space: nowrap;
}

/*--------------------------------------------------------------
# Schritte
# Ohne JavaScript stehen beide Schritte untereinander und das
# Formular lässt sich trotzdem absenden.
--------------------------------------------------------------*/
html.js .af-step:not(.is-active) {
  display: none;
}

html.js .af-step.is-active {
  animation: af-step-in 0.35s var(--af-ease);
}

@keyframes af-step-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

html:not(.js) .af-step + .af-step {
  margin-top: var(--sp-7);
  padding-top: var(--sp-7);
  border-top: 1px solid var(--rf-border);
}

html:not(.js) .af-progress,
html:not(.js) .af-next,
html:not(.js) .af-back,
html:not(.js) .af-summary {
  display: none;
}

.af-step-title {
  margin: 0 0 var(--sp-2);
  font-size: clamp(1.375rem, 3.4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.af-step-title:focus {
  outline: none;
}

.af-step-lead {
  margin: 0 0 var(--sp-5);
  color: var(--rf-text-muted);
}

.af-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--sp-3);
  padding: 6px 0;
  border: 0;
  background: none;
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--rf-primary);
  cursor: pointer;
}

.af-back:hover {
  color: var(--rf-primary-dark);
}

/*--------------------------------------------------------------
# Leistungs-Kacheln (echte Checkboxen, per Tastatur bedienbar)
--------------------------------------------------------------*/
.af-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  margin: 0 0 var(--sp-2);
  padding: 0;
  border: 0;
}

.af-chip {
  position: relative;
  margin: 0;
}

.af-chip--wide {
  grid-column: 1 / -1;
}

.af-chip input,
.af-seg input,
.af-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.af-chip-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1.5px solid var(--rf-border);
  border-radius: var(--af-radius);
  background: #fff;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--rf-ink);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.af-chip-box > .bi {
  flex-shrink: 0;
  font-size: 1.2rem;
  color: var(--rf-primary);
}

/* Lange deutsche Komposita ("Hausmeisterservice") sauber trennen statt abschneiden */
.af-chip-label {
  min-width: 0;
  -webkit-hyphens: auto;
  hyphens: auto;
  overflow-wrap: break-word;
}

/* Häkchen als Badge an der Ecke — kostet keine Textbreite */
.af-chip-check {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--rf-primary);
  color: #fff;
  transform: scale(0);
  transition: transform 0.2s var(--af-ease);
}

/* SVG statt Icon-Font: Schriftmetriken verschieben Font-Glyphen um ~1px aus der Mitte */
.af-chip-check svg {
  display: block;
  width: 12px;
  height: 12px;
}

.af-chip:hover .af-chip-box {
  border-color: var(--rf-primary-light);
}

.af-chip:active .af-chip-box {
  transform: scale(0.98);
}

.af-chip input:checked + .af-chip-box {
  border-color: var(--rf-primary);
  background: var(--rf-primary-tint-2);
  box-shadow: inset 0 0 0 1px var(--rf-primary);
}

.af-chip input:checked + .af-chip-box .af-chip-check {
  transform: scale(1);
}

.af-chip input:focus-visible + .af-chip-box,
.af-seg input:focus-visible + span,
.af-pill input:focus-visible + span {
  outline: 3px solid var(--rf-primary-light);
  outline-offset: 2px;
}

/* Handy: Kacheln wie in Apples Home-App — Icon oben, Text darunter.
   So hat der Text die volle Kachelbreite; die weichen Trennstellen (&shy;)
   im Markup brechen lange Wörter an der Wortfuge. */
@media (max-width: 480px) {
  .af-chip-box {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    min-height: 0;
    padding: 12px;
    font-size: 0.875rem;
  }

  .af-chip-box > .bi {
    font-size: 1.15rem;
  }

  .af-chip--wide .af-chip-box {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
}

/*--------------------------------------------------------------
# Eingabefelder
--------------------------------------------------------------*/
.af-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-4);
  margin-top: var(--sp-5);
}

.af-row--plz {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}

@media (min-width: 576px) {
  .af-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.af-field label,
.af-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--rf-ink);
}

.af-optional {
  font-weight: 400;
  color: var(--rf-text-muted);
}

.af-input {
  display: block;
  width: 100%;
  height: var(--af-field-h);
  padding: 0 16px;
  border: 1.5px solid var(--rf-border);
  border-radius: 12px;
  background: #fff;
  font-family: var(--font-body);
  font-size: 1.0625rem; /* ≥ 16px: iOS zoomt beim Fokus nicht hinein */
  color: var(--rf-ink);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.af-input::placeholder {
  color: #93a5ab;
}

.af-input:hover {
  border-color: #c5d3d8;
}

.af-input:focus {
  outline: none;
  border-color: var(--rf-primary-light);
  box-shadow: 0 0 0 4px rgb(32 113 138 / 0.14);
}

.af-input:-webkit-autofill {
  -webkit-text-fill-color: var(--rf-ink);
  box-shadow: inset 0 0 0 1000px var(--rf-primary-tint-2);
}

.af-input:-webkit-autofill:focus {
  box-shadow: inset 0 0 0 1000px var(--rf-primary-tint-2), 0 0 0 4px rgb(32 113 138 / 0.14);
}

.af-input[aria-invalid="true"] {
  border-color: var(--rf-danger);
}

.af-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 4px rgb(180 35 24 / 0.12);
}

textarea.af-input {
  height: auto;
  min-height: 112px;
  padding: 14px 16px;
  line-height: 1.5;
  resize: vertical;
}

.af-error {
  margin: 6px 0 0;
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--rf-danger);
}

/*--------------------------------------------------------------
# Zusammenfassung von Schritt 1 (in Schritt 2)
--------------------------------------------------------------*/
.af-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--rf-border);
  border-radius: var(--af-radius);
  background: var(--rf-primary-tint-2);
}

.af-summary > .bi {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--rf-success);
}

.af-summary-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--rf-text);
}

.af-summary-text strong {
  display: block;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--rf-ink);
}

.af-summary-text span {
  display: block;
  color: var(--rf-text-muted);
}

.af-summary-edit {
  flex-shrink: 0;
  padding: 4px 2px;
  border: 0;
  background: none;
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--rf-primary);
  cursor: pointer;
}

.af-summary-edit:hover {
  color: var(--rf-primary-dark);
}

/*--------------------------------------------------------------
# Optionale Details (aufklappbar)
--------------------------------------------------------------*/
.af-details {
  margin-top: var(--sp-5);
  border-block: 1px solid var(--rf-border);
}

.af-details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  list-style: none;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--rf-ink);
  cursor: pointer;
}

.af-details > summary::-webkit-details-marker {
  display: none;
}

.af-details > summary .bi {
  color: var(--rf-primary);
  transition: transform 0.25s var(--af-ease);
}

.af-details[open] > summary .bi {
  transform: rotate(45deg);
}

.af-details-hint {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 400;
  color: var(--rf-text-muted);
  text-align: right;
}

.af-details-body {
  display: grid;
  gap: var(--sp-5);
  padding-bottom: var(--sp-5);
}

.af-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.af-group legend {
  float: none;
  width: auto;
  margin-bottom: 8px;
  padding: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.4;
  color: var(--rf-ink);
}

#af-subgroups {
  display: grid;
  gap: var(--sp-4);
}

#af-subgroups:empty {
  display: none;
}

/* Segment-Schalter: Einmalig | Regelmäßig */
.af-segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 4px;
  max-width: 360px;
  padding: 4px;
  border-radius: 12px;
  background: #eaf0f2;
}

.af-seg {
  position: relative;
  margin: 0;
}

.af-seg span {
  display: block;
  padding: 10px 12px;
  border-radius: 9px;
  font-family: var(--font-heading);
  font-size: var(--fs-small);
  font-weight: 600;
  text-align: center;
  color: var(--rf-text);
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.af-seg input:checked + span {
  background: #fff;
  color: var(--rf-ink);
  box-shadow: 0 1px 3px rgb(16 48 59 / 0.12), 0 1px 1px rgb(16 48 59 / 0.04);
}

/* Unterleistungen als Pillen */
.af-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.af-pill {
  position: relative;
  margin: 0;
}

.af-pill span {
  display: inline-block;
  padding: 8px 14px;
  border: 1.5px solid var(--rf-border);
  border-radius: var(--r-pill);
  background: #fff;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--rf-text);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.af-pill:hover span {
  border-color: var(--rf-primary-light);
}

.af-pill input:checked + span {
  border-color: var(--rf-primary);
  background: var(--rf-primary-tint);
  color: var(--rf-primary-dark);
}

/*--------------------------------------------------------------
# Buttons, Vertrauen, Datenschutz
--------------------------------------------------------------*/
.af-actions {
  margin-top: var(--sp-6);
}

.btn.af-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 14px 24px;
  border-radius: var(--af-radius);
  font-size: 1.0625rem;
  font-weight: 700;
}

.af-btn .bi {
  transition: transform 0.2s var(--af-ease);
}

.af-btn:hover .bi-arrow-right {
  transform: translateX(3px);
}

.af-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-top: var(--sp-4);
  font-size: var(--fs-small);
  color: var(--rf-text-muted);
}

.af-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.af-trust .bi {
  color: var(--rf-success);
}

.af-privacy {
  margin: var(--sp-4) 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
  color: var(--rf-text-muted);
}

.af-help {
  margin: var(--sp-6) 0 0;
  font-size: 0.9375rem;
  text-align: center;
  color: var(--rf-text-muted);
}

.af-help a {
  font-weight: 600;
}

.af-help a,
.af-help span {
  white-space: nowrap;
}

/* Honeypot gegen Bots — für Menschen unsichtbar */
.af-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/*--------------------------------------------------------------
# Fußzeile — nur Pflichtangaben
--------------------------------------------------------------*/
.af-footer {
  padding-block: var(--sp-5);
  border-top: 1px solid rgb(16 48 59 / 0.06);
  font-size: 0.8125rem;
  color: var(--rf-text-muted);
}

.af-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  max-width: 960px;
}

.af-footer a {
  color: var(--rf-text-muted);
}

.af-footer a:hover {
  color: var(--rf-primary);
}

@media (prefers-reduced-motion: reduce) {
  html.js .af-step.is-active {
    animation: none;
  }
}
