/* Clever Homes: Angebotsformular (/angebot/ und /angebot/danke/)
   Ergänzt site.css (Klassen .form, .field, .row, .check, .hint, .btn …), nur auf diesen Seiten geladen.
   Ohne JavaScript stehen alle vier Schritte untereinander; form.js setzt .is-stepper. */

:root {
  --error: #b42318;        /* eigenes Fehlerrot (6,6:1 auf Weiß), Weinrot bleibt Markenfarbe */
  --error-tint: #fef3f2;
  --choice-line: #aab1b5;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

/* hidden-Attribut hat hier immer Vorrang vor display-Regeln */
.angebot-section [hidden], .angebot-hero [hidden], .danke-section [hidden] { display: none !important; }

/* ---------- Seitenkopf ---------- */
.angebot-hero { padding-block: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2.25rem); }
.angebot-hero h1 { max-width: none; margin-bottom: .3em; }
.angebot-hero .lead { max-width: 50rem; margin-bottom: .5em; }
.angebot-hero__text { max-width: 50rem; color: var(--slate); font-size: 1.05rem; }
.trust-row {
  list-style: none; margin: 1.3rem 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .55rem 1.6rem;
  font-family: var(--font-ui); font-stretch: 92%; font-weight: 580; font-size: 1rem; color: var(--ink);
}
.trust-row li, .checklist li { display: flex; align-items: baseline; gap: .6rem; }
.trust-row li::before, .checklist li::before {
  content: ""; flex: none; width: .8rem; height: .42rem; margin-bottom: .18rem;
  border-left: 2px solid var(--wine); border-bottom: 2px solid var(--wine);
  transform: rotate(-45deg);
}

/* ---------- Layout: Formular + Seitenspalte ---------- */
.angebot-section { padding-block: clamp(1.5rem, 3vw, 2.25rem) clamp(3.5rem, 8vw, 6rem); }
.angebot-layout {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 4.5vw, 4.5rem); align-items: start;
}
.angebot-main { min-width: 0; }
.angebot-aside { position: sticky; top: calc(var(--header-h) + 1.5rem); display: grid; gap: 1.5rem; }
@media (max-width: 960px) {
  .angebot-layout { grid-template-columns: minmax(0, 1fr); }
  .angebot-aside { position: static; max-width: 40rem; }
}
@media (max-height: 760px) { .angebot-aside { position: static; } }

.form-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: clamp(1.15rem, 4vw, 2.6rem);
  box-shadow: 0 1px 2px rgba(30, 36, 39, .04), 0 18px 40px -24px rgba(30, 36, 39, .18);
}
.form.angebot { gap: 1.4rem; container-type: inline-size; container-name: angebot; }

/* Kopf des Formulars */
.form-head { display: grid; gap: .35rem; }
.form-head h2.form-kicker {
  margin: 0; font-family: var(--font-ui); font-size: .8rem; font-weight: 680; font-stretch: 100%;
  line-height: 1.3; letter-spacing: .1em; text-transform: uppercase; color: var(--wine);
}
.form-intro { margin: 0; font-family: var(--font-ui); font-weight: 640; font-stretch: 86%; font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem); line-height: 1.25; }
.form-intro__time { color: var(--slate); font-weight: 520; font-size: .8em; white-space: nowrap; }
.form-head .note { margin: .15rem 0 0; }

/* ---------- Fortschritt ---------- */
.stepper-count { margin: 0 0 .7rem; font-family: var(--font-ui); font-weight: 620; font-stretch: 92%; font-size: .98rem; color: var(--slate); display: none; }
.stepper-progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.stepper-progress li { position: relative; min-width: 0; }
.stepper-progress li::before, .stepper-progress li::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; border-radius: 2px; background: var(--line);
}
.stepper-progress li::after { background: var(--wine); transform: scaleX(0); transform-origin: left center; transition: transform .45s var(--ease-out); }
.stepper-progress li.is-done::after, .stepper-progress li[aria-current]::after { transform: scaleX(1); }
.stepper-progress button {
  position: relative; z-index: 1; display: block; width: 100%; min-height: 2.75rem; margin: 0; padding: .85rem 0 .2rem;
  background: none; border: 0; text-align: left; cursor: default;
  font: 600 .9rem/1.25 var(--font-ui); font-stretch: 92%; color: var(--slate);
}
.stepper-progress button:not(:disabled) { cursor: pointer; }
.stepper-progress button:not(:disabled) .stepper-label { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; }
.stepper-progress button:not(:disabled):hover { color: var(--wine); }
.stepper-progress button:focus-visible { outline: 3px solid var(--wine); outline-offset: 2px; border-radius: 2px; }
.stepper-progress li[aria-current] button { color: var(--ink); }
@container angebot (max-width: 34rem) {
  .stepper-count { display: block; }
  .stepper-progress .stepper-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stepper-progress button { min-height: 1.5rem; padding: .5rem 0 0; }
}

/* ---------- Schritte ---------- */
.form-step { display: grid; gap: 1.5rem; min-width: 0; }
.form-step + .form-step { margin-top: 1.25rem; padding-top: 2.25rem; border-top: 1px solid var(--line); }   /* ohne JS: untereinander */
.form.is-stepper .form-step + .form-step { margin-top: 0; padding-top: 0; border-top: 0; }
.step-head { display: grid; gap: .35rem; }
.step-title {
  display: flex; align-items: center; gap: .65rem; margin: 0;
  font-size: clamp(1.55rem, 1.25rem + 1vw, 2.05rem); font-weight: 680; font-stretch: 78%; line-height: 1.1;
}
.step-title:focus { outline: none; }
.step-title:focus-visible { outline: 3px solid var(--wine); outline-offset: 4px; }
.step-no {
  flex: none; display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem;
  border: 2px solid var(--wine); border-radius: 50%;
  font-size: .95rem; font-weight: 700; font-stretch: 100%; color: var(--wine); line-height: 1;
}
.step-intro { margin: 0; color: var(--slate); }
.step-note { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .form-step.is-entering { animation: step-in .32s var(--ease-out) both; }
  @keyframes step-in { from { opacity: 0; transform: translateY(10px); } }
}

/* ---------- Felder (Ergänzungen zu site.css) ---------- */
.form.angebot .field { min-width: 0; }
.form.angebot .field label, .form.angebot .field legend { margin-bottom: .45rem; }
.form.angebot .hint, .form.angebot .field .hint { margin: .4rem 0 0; font-size: .92rem; line-height: 1.45; color: var(--slate); }
.form.angebot .hint + .hint { margin-top: .25rem; }
.form.angebot select { appearance: auto; min-height: 3rem; }
.form.angebot input:not([type="radio"]):not([type="checkbox"]) { min-height: 3rem; }
.field--short input { max-width: 11rem; }
.field--sub { padding-left: 1rem; border-left: 3px solid var(--wine-tint); }
.opt { font-weight: 500; color: var(--slate); font-size: .92em; }
.req { color: var(--wine); }
.form.is-stepper .nojs-only { display: none; }
.stack-fields { display: grid; gap: 1.1rem; }
.char-count { display: inline-block; margin-left: .35rem; font-variant-numeric: tabular-nums; color: var(--ink); }

/* Radios und Checkboxen: die breite Eingaberegel aus site.css zurücksetzen */
.form.angebot .field input[type="radio"], .form.angebot .field input[type="checkbox"],
.form.angebot .check input[type="checkbox"] {
  width: 1.2rem; height: 1.2rem; min-height: 0; padding: 0; margin: .2rem 0 0; border: 0; flex: none; accent-color: var(--wine);
}
.form.angebot .check { align-items: flex-start; }
.form.angebot .check label { display: block; margin: 0; font-family: var(--font-text); font-weight: 400; font-size: 1rem; line-height: 1.5; cursor: pointer; }

/* Gruppen */
.form.angebot .group { border: 0; padding: 0; margin: 0; min-width: 0; }
.form.angebot .group > legend {
  display: block; padding: 0; margin: 0 0 .6rem; float: none; width: 100%;
  font-family: var(--font-ui); font-weight: 650; font-stretch: 92%; font-size: 1.02rem; line-height: 1.35; color: var(--ink);
}
.form.angebot .group > .legend-hint { margin: -.3rem 0 .7rem; }
/* Zahlenpaare und PLZ/Ort nebeneinander; Fehlermeldungen darunter über die volle Breite (display: contents) */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: .9rem; row-gap: 0; max-width: 30rem; }
.addr { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); column-gap: .9rem; row-gap: 0; }
.addr__street { grid-column: 1 / -1; grid-row: 1; margin-bottom: 1.1rem; }
.pair > .field, .addr > .field:not(.addr__street) { display: contents; }
.pair > .field:nth-child(1) > label { grid-area: 1 / 1; }
.pair > .field:nth-child(1) > input { grid-area: 2 / 1; }
.pair > .field:nth-child(1) > .field-error { grid-area: 3 / 1 / 4 / 3; }
.pair > .field:nth-child(2) > label { grid-area: 1 / 2; }
.pair > .field:nth-child(2) > input { grid-area: 2 / 2; }
.pair > .field:nth-child(2) > .field-error { grid-area: 4 / 1 / 5 / 3; }
.addr > .field:nth-child(2) > label { grid-area: 2 / 1; }
.addr > .field:nth-child(2) > input { grid-area: 3 / 1; }
.addr > .field:nth-child(2) > .field-error { grid-area: 4 / 1 / 5 / 3; }
.addr > .field:nth-child(3) > label { grid-area: 2 / 2; }
.addr > .field:nth-child(3) > input { grid-area: 3 / 2; }
.addr > .field:nth-child(3) > .field-error { grid-area: 5 / 1 / 6 / 3; }
.form.angebot .pair label, .form.angebot .addr label { font-weight: 520; color: var(--slate); font-size: .95rem; }

/* Auswahlkarten */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.choice-list { display: grid; gap: .5rem; }
.choice-inline { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice--wide { grid-column: 1 / -1; }
@container angebot (max-width: 30rem) {
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .choice--wide { grid-column: auto; }
}
.form.angebot .group .choice {
  display: grid; grid-template-columns: 1.2rem minmax(0, 1fr); column-gap: .75rem; align-items: start; align-content: start;
  margin: 0; padding: .95rem 1.05rem; min-height: 44px;
  font-family: var(--font-text); font-weight: 400; font-size: 1rem;
  border: 1px solid var(--choice-line); border-radius: var(--radius-m); background: var(--white); cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.form.angebot .group .choice--compact { padding: .7rem .95rem; }
.form.angebot .group .choice:hover { border-color: var(--ink); }
.choice-title { font-family: var(--font-ui); font-weight: 620; font-stretch: 92%; font-size: 1.02rem; line-height: 1.3; color: var(--ink); }
.choice-text { grid-column: 2; margin-top: .15rem; color: var(--slate); font-size: .93rem; line-height: 1.4; hyphens: auto; overflow-wrap: break-word; }
.choice-title { overflow-wrap: break-word; hyphens: auto; }
.form.angebot .group .choice:has(input:checked) { border-color: var(--wine); background: var(--wine-tint); box-shadow: inset 0 0 0 1px var(--wine); }
.form.angebot .group .choice:has(input:focus-visible) { outline: 3px solid var(--wine); outline-offset: 2px; }
.form.angebot .group .choice input:focus-visible { outline: none; }

/* ---------- Fehler ---------- */
.form.angebot .field.has-error input:not([type="radio"]):not([type="checkbox"]),
.form.angebot .field.has-error select,
.form.angebot .field.has-error textarea { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.form.angebot .group.has-error .choice { border-color: var(--error); }
.field--consent.has-error .check input { outline: 2px solid var(--error); outline-offset: 2px; }
.field-error {
  display: flex; gap: .5rem; align-items: flex-start; margin: .45rem 0 0;
  font: 600 .95rem/1.4 var(--font-ui); font-stretch: 96%; color: var(--error);
}
.field-error::before {
  content: "!"; flex: none; display: grid; place-items: center; width: 1.15rem; height: 1.15rem; margin-top: .1rem;
  border-radius: 50%; background: var(--error); color: var(--white); font-size: .75rem; font-weight: 800; line-height: 1;
}

/* Hinweisbox bei Versandfehlern (mit JS) und Hinweise nach der Weiterleitung (ohne JS, per :target) */
.form-alert, .form-notice {
  padding: 1rem 1.2rem 1.1rem; border-left: 4px solid var(--error); border-radius: var(--radius-s);
  background: var(--error-tint); font-size: 1rem;
}
.form-alert__title, .form-notice__title { margin: 0 0 .3rem; font: 680 1.08rem/1.3 var(--font-ui); font-stretch: 92%; color: var(--error); }
.form-alert p, .form-notice p { margin-bottom: .4rem; }
.form-alert__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-top: .8rem; }
.form-notice { display: none; margin-bottom: 1.2rem; }
.form-notice:target, .form-notice.is-visible { display: block; }
.form-notice:focus { outline: none; }

/* ---------- Aktionen ---------- */
.step-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-top: .6rem; padding-top: 1.4rem; border-top: 1px solid var(--line);
}
.step-actions--final { justify-content: flex-end; }
.form.is-stepper .step-actions--final { justify-content: space-between; }
.step-actions .btn { min-width: 12rem; }
button.text-link {
  background: none; border: 0; padding: .6rem .1rem; min-height: 44px; cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-stretch: 95%; font-size: 1rem; color: var(--wine);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .25em;
}
button.text-link:hover { color: var(--wine-deep); text-decoration-thickness: 2px; }
.suggest-btn { min-height: 0; padding: 0; font-size: inherit; }
/* Pfeil der Textlinks (motion.css): bei „Zurück“ nach links, bei Inline-Schaltern keiner */
.step-back::after, .suggest-btn::after, .summary button.text-link::after { content: none; }
.step-back::before {
  content: ""; display: inline-block; width: .42em; height: .42em; margin-right: .5em;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-.1em) rotate(45deg);
}
.submit-note { margin: -.4rem 0 0; text-align: right; }
.form.is-stepper .submit-note { text-align: right; }
@container angebot (max-width: 30rem) {
  .step-actions { flex-direction: column-reverse; align-items: stretch; }
  .step-actions .btn { width: 100%; min-width: 0; white-space: normal; }
  .step-actions > span:empty { display: none; }
  .step-back { align-self: center; }
  .submit-note, .form.is-stepper .submit-note { text-align: center; }
}

/* Senden */
.btn .spinner { display: none; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.form.is-sending .btn--submit .spinner { display: inline-block; animation: spin .8s linear infinite; }
.btn[aria-disabled="true"] { opacity: .8; cursor: progress; }
.form.is-sending .form-step > :not(.step-actions):not(.form-alert) { opacity: .55; pointer-events: none; transition: opacity .2s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Übersicht ---------- */
.summary { border: 1px solid var(--line); border-radius: var(--radius-m); padding: .9rem 1.15rem; background: var(--mist); }
.summary > summary { cursor: pointer; font: 650 1.02rem/1.4 var(--font-ui); font-stretch: 92%; padding: .15rem 0; }
.summary [data-summary] section { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: .1rem 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.summary [data-summary] section:first-child { margin-top: .6rem; }
.summary h4 { margin: 0; font-size: 1rem; font-stretch: 92%; }
.summary button.text-link { min-height: 0; padding: .2rem 0; font-size: .95rem; }
.summary dl { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(7.5rem, 36%) minmax(0, 1fr); gap: .25rem 1rem; margin: .35rem 0 0; font-size: .96rem; line-height: 1.45; }
.summary dt { color: var(--slate); }
.summary dd { margin: 0; overflow-wrap: anywhere; }
@container angebot (max-width: 30rem) {
  .summary dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .summary dd + dt { margin-top: .4rem; }
}

/* Honeypot (für Menschen unsichtbar, aber nicht display:none) */
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Erfolg ---------- */
.form-success { display: grid; gap: .2rem; }
.form-success h2 { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem); margin: .6rem 0 .35rem; }
.form-success h2:focus { outline: none; }
.form-success .lead { margin-bottom: .6rem; }
.success-mark svg { display: block; width: 72px; height: 72px; overflow: visible; }
.success-mark path { fill: none; stroke: var(--wine); stroke-linecap: square; }
.success-frame { stroke-width: 3.5; }
.success-check { stroke-width: 5; stroke-linejoin: miter; }
.next-title { margin: 1.4rem 0 .6rem; font-size: 1.3rem; }
.next-steps { list-style: none; counter-reset: step; margin: 0 0 1.2rem; padding: 0; display: grid; gap: .75rem; }
.next-steps li { counter-increment: step; display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .8rem; align-items: baseline; }
.next-steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; transform: translateY(-.1rem);
  border: 2px solid var(--wine); border-radius: 50%; font: 700 .9rem/1 var(--font-ui); color: var(--wine);
}
.form-success .btn-row { margin-top: 1.4rem; }
@media (prefers-reduced-motion: no-preference) {
  .success-mark path { stroke-dasharray: 1; stroke-dashoffset: 1; }
  .is-in .success-frame, .danke-mark .success-frame { animation: draw .9s cubic-bezier(.6, 0, .2, 1) .15s forwards; }
  .is-in .success-check, .danke-mark .success-check { animation: draw .45s var(--ease-out) .95s forwards; }
  .form-success.is-in > :not(.success-mark) { animation: step-in .5s var(--ease-out) both; }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

/* ---------- Seitenspalte ---------- */
.aside-block { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.aside-title { font-size: 1.3rem; font-weight: 660; font-stretch: 84%; line-height: 1.2; margin-bottom: .85rem; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; font-family: var(--font-ui); font-stretch: 94%; font-size: 1.02rem; line-height: 1.35; }
.aside-person { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.aside-person__img { width: 5.5rem; height: 6.9rem; object-fit: cover; object-position: center 12%; border-radius: var(--radius-s); background: var(--mist); }
.aside-person p { margin: 0; }
.aside-person__label { font: 600 .82rem/1.3 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--wine); margin-bottom: .3rem !important; }
.aside-person__name { font: 650 1.1rem/1.25 var(--font-ui); font-stretch: 88%; }
.aside-person__role { color: var(--slate); font-size: .98rem; }
.aside-person__contact { margin-top: .55rem !important; font-family: var(--font-ui); font-stretch: 94%; font-weight: 600; font-size: 1rem; line-height: 1.6; }
.aside-person__contact a { text-decoration: none; }
.aside-person__contact a:hover { text-decoration: underline; }
.aside-privacy { margin: 0; }

/* ---------- Kontaktband ---------- */
.angebot-contact__inner { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; }
@media (max-width: 860px) { .angebot-contact__inner { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Danke-Seite ---------- */
.danke-hero .danke-mark { margin-bottom: 1.2rem; }
.danke-section { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3.5rem, 8vw, 6rem); }
.danke-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
@media (max-width: 860px) { .danke-grid { grid-template-columns: minmax(0, 1fr); } }
.danke-links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.danke-links li { border-bottom: 1px solid var(--line); }
.danke-links a { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; text-decoration: none; color: var(--ink); font: 600 1.08rem/1.35 var(--font-ui); font-stretch: 92%; }
.danke-links a::after { content: "→"; color: var(--wine); }
.danke-links a:hover { color: var(--wine); }

@media (prefers-reduced-motion: reduce) {
  .stepper-progress li::after, .form.angebot .group .choice { transition: none; }
  .form.is-sending .btn--submit .spinner { animation: none; border-right-color: currentColor; opacity: .6; }
}

@media print {
  .angebot-aside, .stepper-head, .step-actions, .form-alert, .angebot-contact { display: none !important; }
  .form.is-stepper .form-step[hidden] { display: grid !important; }
}

/* ---------- Mailto-Modus: Hinweis vor dem Absenden, Bestätigung mit Rückfall zum Kopieren ---------- */
.send-note { margin: 1rem 0 .2rem; }
.mail-cut p { margin: 0 0 .6rem; }
.mail-cut { margin: .2rem 0 .6rem; padding: .8rem 1rem; border-left: 3px solid var(--wine); background: var(--wine-tint, var(--mist)); border-radius: 2px; }
.mail-fallback { margin: 1rem 0 .4rem; padding: 1.1rem 1.2rem 1.2rem; background: var(--mist); border-radius: var(--radius-m); }
.mail-fallback .next-title { margin-top: 0; }
.mail-fallback .btn-row { align-items: center; margin: .8rem 0 .2rem; }
.copy-status { min-height: 1.4em; margin: .2rem 0 .6rem; }
.mail-text {
  width: 100%; resize: vertical; margin: 0;
  font: .92rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink);
  background: var(--white); border: 1px solid #7d858a; border-radius: var(--radius-s); padding: .7rem .8rem;
}
.mail-text:focus-visible { outline: 3px solid var(--wine); outline-offset: 2px; }
