@font-face {
  font-family: "Sofia Sans";
  src: url("schrift/sofia-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "Sofia Sans Extra Condensed";
  src: url("schrift/sofia-sans-extra-condensed-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --blatt: #f3f5f6;
  --blatt-tief: #e4e8ea;
  --tusche: #12161a;
  --tusche-weich: #424c55;
  --wohnen: #f5c518;
  --schlafen: #2a4bd7;
  --bad: #14a896;
  --flur: #c5cbd0;
  --aussen: #63b23e;
  --fehler: #b3261e;
  --strich: 2px;
  --strich-dick: 6px;
  --text: "Sofia Sans", "Segoe UI", system-ui, sans-serif;
  --titel: "Sofia Sans Extra Condensed", "Sofia Sans", "Arial Narrow", sans-serif;
  --rand: clamp(1.1rem, 4vw, 3.5rem);
  --aus: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--blatt);
  color: var(--tusche);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  caret-color: var(--schlafen);
  -webkit-text-size-adjust: 100%;
}

::selection { background: var(--wohnen); color: var(--tusche); }

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

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--schlafen); }

h1, h2, h3 { font-family: var(--titel); font-weight: 800; line-height: 0.98; margin: 0; text-wrap: balance; letter-spacing: -0.005em; }
h1 { font-size: clamp(3rem, 7.2vw, 5.75rem); text-transform: uppercase; }
h2 { font-size: clamp(2.4rem, 5vw, 3.75rem); text-transform: uppercase; }
h3 { font-size: 1.75rem; }
p { margin: 0; max-width: 62ch; }

.blende { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sprung {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--tusche); color: var(--blatt); padding: 0.6rem 1rem;
}
.sprung:focus { top: 1rem; }

/* Kopfzeile */
.kopf {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1rem var(--rand);
  border-bottom: var(--strich) solid var(--tusche);
  font-weight: 600;
}
.kopf nav { display: flex; gap: clamp(0.9rem, 2.5vw, 2rem); flex-wrap: wrap; justify-content: flex-end; }
.kopf a { text-decoration: none; }
.kopf a:hover { text-decoration: underline; }
.kopf .ort { font-family: var(--titel); font-size: 1.5rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; }

/* Erster Blick: Plan und Schriftfeld */
.blatt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 1.1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  padding: clamp(1.5rem, 3.5vw, 3rem) var(--rand) clamp(2.5rem, 5vw, 4.5rem);
}
.blatt-text { display: grid; gap: 1.4rem; }
.blatt-text .lage { font-size: 1.2rem; max-width: 34ch; }

.plan-rahmen { margin: 0; }
.plan { display: block; width: 100%; height: auto; max-height: min(80vh, 46rem); overflow: visible; }
.plan .umfeld rect, .plan .umfeld path { fill: none; stroke: var(--tusche-weich); stroke-width: 1.5; }
.plan .umfeld text { fill: var(--tusche-weich); }
.plan .schraege { fill: none; stroke: #fff; stroke-width: 1.2; opacity: 0.55; }
.plan .wand { fill: none; stroke: var(--tusche); stroke-width: 7; stroke-linejoin: miter; stroke-linecap: square; }
.plan .innen { fill: none; stroke: var(--tusche); stroke-width: 4; stroke-linecap: square; }
.plan .fein { fill: none; stroke: var(--tusche); stroke-width: 1.5; }
.plan .fenster { stroke: var(--blatt); stroke-width: 3; }
.plan .luecke { stroke: var(--blatt); stroke-width: 8.5; stroke-linecap: butt; }
.plan text { font-family: var(--titel); font-weight: 800; font-size: 19px; text-transform: uppercase; letter-spacing: 0.02em; fill: var(--tusche); pointer-events: none; }
.plan text.klein { font-family: var(--text); font-weight: 600; font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.plan .hell text, .plan text.hell { fill: #fff; }
.plan .raum { cursor: pointer; }
.plan .raum .flaeche { transition: filter 0.25s var(--aus); }
.plan .raum:hover .flaeche { filter: brightness(1.08) saturate(1.1); }
.plan .raum .marke { fill: url(#schraff); color: var(--tusche); opacity: 0; transition: opacity 0.2s; }
.plan .raum[data-aktiv] .marke { opacity: 0.16; }
.plan .raum.hell .marke { color: #fff; }
.plan-hinweis { margin-top: 0.75rem; font-size: 0.95rem; color: var(--tusche-weich); max-width: none; }

@media (prefers-reduced-motion: no-preference) {
  .zeichnet .plan .wand, .zeichnet .plan .innen { stroke-dasharray: 1; animation: zeichnen 1.1s var(--aus) backwards; }
  .zeichnet .plan .innen { animation-delay: 0.25s; }
  .zeichnet .plan .raum .flaeche { animation: fuellen 0.6s var(--aus) backwards; }
  .zeichnet .plan .raum:nth-of-type(1) .flaeche { animation-delay: 0.35s; }
  .zeichnet .plan .raum:nth-of-type(2) .flaeche { animation-delay: 0.45s; }
  .zeichnet .plan .raum:nth-of-type(3) .flaeche { animation-delay: 0.55s; }
  .zeichnet .plan .raum:nth-of-type(4) .flaeche { animation-delay: 0.65s; }
  .zeichnet .plan .raum:nth-of-type(5) .flaeche { animation-delay: 0.75s; }
  @keyframes zeichnen { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes fuellen { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
}

/* Schriftfeld (Planstempel) */
.schriftfeld {
  border: var(--strich) solid var(--tusche);
  background: #fff;
  display: grid;
}
.schriftfeld dl { margin: 0; display: grid; grid-template-columns: 1fr auto; }
.schriftfeld dt, .schriftfeld dd { margin: 0; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--tusche); }
.schriftfeld dd { text-align: right; font-weight: 700; border-left: 1px solid var(--tusche); }
.schriftfeld .summe { font-weight: 800; background: var(--wohnen); border-bottom: var(--strich) solid var(--tusche); }
.schriftfeld dd.summe { font-family: var(--titel); font-size: 2.6rem; line-height: 1; padding-block: 0.5rem 0.35rem; }
.schriftfeld dt.summe { display: flex; align-items: center; }
.schriftfeld .frei { padding: 0.7rem 0.9rem; border-bottom: var(--strich) solid var(--tusche); }
.schriftfeld .frei strong { font-weight: 800; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  font: inherit; font-weight: 800; font-size: 1.15rem;
  background: var(--tusche); color: #fff;
  border: var(--strich) solid var(--tusche);
  padding: 0.95rem 1.4rem; min-height: 3.25rem;
  text-decoration: none; cursor: pointer;
  transition: background 0.2s var(--aus), color 0.2s var(--aus);
}
.knopf:hover { background: var(--schlafen); border-color: var(--schlafen); }
.knopf:active { transform: translateY(1px); }
.knopf[disabled] { background: var(--tusche-weich); border-color: var(--tusche-weich); cursor: progress; }
.knopf svg { width: 1.1em; height: 1.1em; }
.schriftfeld .knopf { border: 0; width: 100%; }

/* Raumbereich: Fläche in Raumfarbe */
.raeume {
  --raumfarbe: var(--wohnen);
  --raumtext: var(--tusche);
  background: var(--raumfarbe); color: var(--raumtext);
  border-block: var(--strich) solid var(--tusche);
  padding: clamp(2.5rem, 6vw, 5rem) var(--rand);
  transition: background 0.45s var(--aus), color 0.45s var(--aus);
}
.raeume[data-raum="schlafen"] { --raumfarbe: var(--schlafen); --raumtext: #fff; }
.raeume[data-raum="bad"] { --raumfarbe: var(--bad); }
.raeume[data-raum="diele"] { --raumfarbe: var(--flur); }
.raeume[data-raum="aussen"] { --raumfarbe: var(--aussen); }
.raeume[data-raum="keller"], .raeume[data-raum="garage"] { --raumfarbe: var(--blatt-tief); }
.raeume :focus-visible { outline-color: var(--raumtext); }

.raumwahl { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 2rem; }
.raumwahl button {
  font: inherit; font-weight: 700; color: inherit;
  background: transparent; border: var(--strich) solid currentColor;
  padding: 0.5rem 0.9rem; min-height: 2.75rem; cursor: pointer;
}
.raumwahl button:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.raumwahl button[aria-selected="true"] { background: var(--raumtext); color: var(--raumfarbe); border-color: var(--raumtext); }

.raum-ansicht { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(16rem, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.raum-bild { margin: 0; }
.bildflaeche {
  position: relative; aspect-ratio: 3 / 2;
  border: var(--strich) solid var(--tusche);
  background: #fff; color: var(--tusche); overflow: hidden;
}
.bildflaeche[data-hoch] { aspect-ratio: 3 / 4; max-width: min(100%, 34rem); }
.bildflaeche img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fotowahl { margin-right: 0.6rem; }
.bildflaeche .leer {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 0.3rem; padding: 1.5rem;
  background: repeating-linear-gradient(135deg, transparent 0 13px, rgba(18, 22, 26, 0.13) 13px 14.5px), #fff;
}
.bildflaeche .leer strong { font-family: var(--titel); font-size: 2rem; font-weight: 800; text-transform: uppercase; line-height: 1; }
.bildflaeche .leer span { background: #fff; padding: 0 0.4rem; }
.bildflaeche[data-geladen] .leer { display: none; }
.bildflaeche:not([data-geladen]) img { visibility: hidden; }
.bildart {
  position: absolute; left: 0; bottom: 0; background: var(--tusche); color: #fff;
  font-weight: 700; font-size: 0.9rem; padding: 0.3rem 0.7rem;
}
.bildflaeche:not([data-geladen]) .bildart { display: none; }

.umschalter { display: inline-grid; grid-auto-flow: column; margin-top: 0.9rem; border: var(--strich) solid currentColor; }
.umschalter button {
  font: inherit; font-weight: 700; color: inherit; background: transparent; border: 0;
  padding: 0.55rem 0.95rem; min-height: 2.75rem; cursor: pointer;
}
.umschalter button + button { border-left: var(--strich) solid currentColor; }
.umschalter button[aria-pressed="true"] { background: var(--raumtext); color: var(--raumfarbe); }
.umschalter[hidden] { display: none; }
.raum-text { display: grid; gap: 0.9rem; }
.raum-text h3 { font-size: clamp(2.2rem, 4vw, 3rem); text-transform: uppercase; }
.raum-text .vis-hinweis { font-size: 0.95rem; border-top: 1px solid currentColor; padding-top: 0.8rem; }

/* Allgemeine Abschnitte */
.abschnitt { padding: clamp(3rem, 7vw, 6rem) var(--rand) 0; }
.abschnitt:last-of-type { padding-bottom: clamp(3rem, 7vw, 6rem); }
.abschnitt > h2 { margin-bottom: 1.5rem; }
.zweispaltig { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 5rem); align-items: start; }

.legende { list-style: none; margin: 0; padding: 0; border-top: var(--strich) solid var(--tusche); }
.legende li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 0.9rem; align-items: start; padding: 0.8rem 0; border-bottom: 1px solid var(--tusche); }
.legende li::before { content: ""; width: 1.4rem; height: 1.4rem; margin-top: 0.15rem; border: var(--strich) solid var(--tusche); background: var(--k, #fff); }
.legende .schraffur::before { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--tusche) 4px 5.5px); }
.legende strong { font-weight: 800; }

/* Lage: Wegstrecke */
.wege { list-style: none; margin: 0; padding: 0; position: relative; }
.wege li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--tusche); align-items: baseline; }
.wege li:first-child { border-top: var(--strich) solid var(--tusche); }
.wege .zeit { font-family: var(--titel); font-weight: 800; font-size: 1.9rem; line-height: 1; text-transform: uppercase; }

/* Bedingungen und Ablauf */
.band { background: var(--tusche); color: #fff; margin-top: clamp(3rem, 7vw, 6rem); padding: clamp(2.5rem, 6vw, 5rem) var(--rand); }
.band ::selection { background: var(--wohnen); color: var(--tusche); }
.band :focus-visible { outline-color: #fff; }
.band h2 { margin-bottom: 1.5rem; }
.band ul, .band ol { margin: 0; padding: 0; list-style: none; border-top: var(--strich) solid #fff; }
.band li { padding: 0.8rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.45); }
.band ol { counter-reset: schritt; }
.band ol li { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.6rem; counter-increment: schritt; }
.band ol li::before { content: counter(schritt); font-family: var(--titel); font-weight: 800; font-size: 1.9rem; line-height: 1; color: var(--wohnen); }
.band h3 { margin: 0 0 0.9rem; color: var(--wohnen); text-transform: uppercase; }

/* Formular */
.formular { max-width: 52rem; }
.formular > p { margin-bottom: 2rem; }
fieldset { border: 0; border-top: var(--strich) solid var(--tusche); margin: 0 0 2.2rem; padding: 1.1rem 0 0; min-width: 0; }
legend { font-family: var(--titel); font-weight: 800; font-size: 1.9rem; text-transform: uppercase; padding: 0 0.8rem 0 0; line-height: 1; }
.felder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.4rem; margin-top: 0.4rem; }
.feld { display: grid; gap: 0.35rem; align-content: start; }
.feld.breit { grid-column: 1 / -1; }
.feld label, .frage > span, .frage > legend { font-weight: 700; }
.feld .hilfe, .frage .hilfe { font-size: 0.93rem; color: var(--tusche-weich); }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  font: inherit; color: var(--tusche); background: #fff;
  border: var(--strich) solid var(--tusche); border-radius: 0;
  padding: 0.7rem 0.8rem; min-height: 3rem; width: 100%;
}
textarea { min-height: 7.5rem; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #5b6670; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--schlafen); outline-offset: 0; }
.mit-einheit { display: grid; grid-template-columns: 1fr auto; }
.mit-einheit span { display: grid; place-items: center; padding: 0 0.9rem; border: var(--strich) solid var(--tusche); border-left: 0; background: var(--blatt-tief); font-weight: 700; }

.frage { border: 0; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.frage > legend { font-family: var(--text); font-size: inherit; text-transform: none; padding: 0; line-height: 1.4; margin-bottom: 0.45rem; }
.wahl { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.wahl label, .haken {
  display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer;
  border: var(--strich) solid var(--tusche); background: #fff; padding: 0.55rem 0.9rem; min-height: 2.9rem; font-weight: 600;
}
.wahl input, .haken input { appearance: none; width: 1.15rem; height: 1.15rem; margin: 0; border: var(--strich) solid var(--tusche); background: #fff; flex: none; display: grid; place-content: center; }
.wahl input[type="radio"] { border-radius: 50%; }
.wahl input:checked::before, .haken input:checked::before { content: ""; width: 0.55rem; height: 0.55rem; background: var(--tusche); border-radius: inherit; }
.wahl label:has(input:checked), .haken:has(input:checked) { background: var(--wohnen); }
.wahl label:has(:focus-visible), .haken:has(:focus-visible) { outline: 3px solid var(--schlafen); outline-offset: 2px; }
.wahl input:focus-visible, .haken input:focus-visible { outline: none; }
.haken { display: flex; align-items: flex-start; font-weight: 500; }
.haken input { margin-top: 0.2rem; }
.hakenliste { display: grid; gap: 0.5rem; }

.fehlertext { color: var(--fehler); font-weight: 700; font-size: 0.95rem; }
.fehlertext:empty { display: none; }
[aria-invalid="true"] { border-color: var(--fehler) !important; }
.meldung { border: var(--strich) solid var(--fehler); color: var(--fehler); background: #fff; padding: 0.9rem 1rem; font-weight: 700; margin-bottom: 1.2rem; }
.meldung[hidden] { display: none; }
.falle { position: absolute; left: -200vw; }

.danke { border: var(--strich) solid var(--tusche); background: var(--aussen); padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; gap: 0.8rem; max-width: 52rem; }
.danke[hidden] { display: none; }

/* Fuss */
.fuss { border-top: var(--strich) solid var(--tusche); padding: 1.5rem var(--rand) 2rem; display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; justify-content: space-between; font-size: 0.98rem; }
.fuss nav { display: flex; gap: 1.5rem; }

/* Textseiten */
.textseite { padding: clamp(2rem, 5vw, 4rem) var(--rand) clamp(3rem, 7vw, 6rem); max-width: 60rem; }
.textseite h1 { font-size: clamp(2.6rem, 6vw, 4.25rem); margin-bottom: 1.5rem; }
.textseite h2 { font-size: 2rem; margin: 2.4rem 0 0.7rem; }
.textseite p, .textseite ul { margin: 0 0 1rem; max-width: 68ch; }
.offen { background: var(--wohnen); padding: 0.05em 0.35em; font-weight: 700; }

@media (max-width: 62rem) {
  .raum-ansicht, .zweispaltig { grid-template-columns: 1fr; }
  /* Reihenfolge mobil: Titel, Plan, Schriftfeld */
  .blatt { display: flex; flex-direction: column; gap: 1.5rem; }
  .blatt-text { display: contents; }
  .blatt-text h1 { order: 1; }
  .blatt-text .lage { order: 2; }
  .plan-rahmen { order: 3; }
  .blatt-text .schriftfeld { order: 4; }
}
@media (max-width: 36rem) {
  body { font-size: 1rem; }
  .felder { grid-template-columns: 1fr; }
  .kopf nav a.neben { display: none; }
  .plan text { font-size: 21px; }
  .plan text.klein { font-size: 14px; }
  .wege li { grid-template-columns: 1fr; gap: 0.2rem; }
}
