/* ==========================================================================
   Am Meisenbruch – Stylesheet
   Aufbau:  1. Reset  2. Design-Tokens  3. Basis  4. Layout  5. Komponenten
            6. Abschnitte  7. Formular  8. Blazor-Standards
   ========================================================================== */


/* 1. Reset ================================================================= */

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

html { -webkit-text-size-adjust: 100%; }

body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol {
    margin: 0;
    padding: 0;
}

ul[class], ol[class] { list-style: none; }

img, picture, svg { max-width: 100%; display: block; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; }


/* 2. Design-Tokens ========================================================= */

:root {
    /* Farben aus dem Rendering: Sandputz, Anthrazit, Holzakzent */
    --sand-50:  #faf7f2;
    --sand-100: #f3ece1;
    --sand-200: #e8ddcc;
    --sand-300: #d8c9b2;

    --ink-900: #22282a;
    --ink-800: #2f3638;
    --ink-600: #5a6467;
    --ink-400: #869093;

    --holz:      #a86d1e;
    --holz-tief: #8a5817;
    --holz-hell: #f6ecdb;

    --weiss: #ffffff;
    --fehler: #b3261e;
    --erfolg: #2f6b3a;

    /* Typografie */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Abstände */
    --raum-abschnitt: 5rem;
    --raum-inhalt: 1.25rem;
    --breite: 1180px;

    /* Formen */
    --radius: 14px;
    --radius-klein: 8px;
    --schatten: 0 1px 2px rgb(34 40 42 / .05), 0 8px 24px -12px rgb(34 40 42 / .18);
    /* Deutlich stärkere Anmutung – nur für das Anfrageformular, damit es
       als wichtigstes Element der Seite aus der Fläche heraustritt. */
    --schatten-hoch: 0 2px 4px rgb(34 40 42 / .04), 0 28px 56px -24px rgb(34 40 42 / .28);
    --rahmen: 1px solid var(--sand-200);
}

@media (min-width: 768px) {
    :root {
        --raum-abschnitt: 7rem;
        --raum-inhalt: 2rem;
    }
}


/* 3. Basis ================================================================= */

body {
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink-800);
    background: var(--weiss);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    color: var(--ink-900);
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
    font-weight: 600;
}

h1 { font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 1.25rem + 2vw, 2.5rem); }
h3 { font-size: 1.1875rem; font-weight: 600; }

p { text-wrap: pretty; }

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

/* Sprungmarken sollen nicht unter dem Sticky-Header landen */
:target,
section[id] { scroll-margin-top: 5.5rem; }

/* Bewusst KEIN scroll-behavior: smooth.
   Die Seite ist rund 5000 px hoch, die Sprungmarken überbrücken bis zu 3700 px.
   Als weiches Scrollen dauert das ~700 ms, in denen die halbe Seite am Auge
   vorbeirauscht – das wirkt hektisch. Ein direkter Sprung ist hier angenehmer. */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- Fade-in-down beim Laden der Seite --------------------------------
   Ein einziger, einmaliger Effekt: Die Inhalte kommen von oben leicht
   herabgleitend ins Bild. Läuft genau einmal beim Seitenaufbau und ist
   nach gut einer halben Sekunde vorbei – danach passiert beim Scrollen
   nichts mehr.

   Nur ganz wenige, grosse Blöcke werden bewegt (nicht jedes einzelne
   Element), damit die Seite ruhig aufbaut und nicht flimmert.
   -------------------------------------------------------------------- */

@keyframes einblenden-von-oben {
    from { opacity: 0; transform: translateY(-1.5rem); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {

    /* Angesprochen werden konsequent die INHALTS-Container, nie die Elemente,
       die Rahmen oder Flächen tragen. Die Trennlinie unter dem Seitenkopf, die
       Rasterlinien der Eckdaten-Kacheln und die farbigen Abschnittsflächen
       stehen dadurch von der ersten Millisekunde an ruhig – es bewegt sich
       nur, was darin liegt.

       Keine animation-delay-Werte: alles startet gleichzeitig und ist
       gleich schnell fertig. */

    .seitenkopf__innen,
    .hero__raster,
    .eckdaten__zelle > *,
    .abschnitt > .behaelter,
    .seitenfuss__innen {
        /* backwards statt both: Nach der Animation fällt das Element auf seine
           normalen Werte zurück. Mit "both" bliebe dauerhaft eine (neutrale)
           Transform stehen – die macht jedes Element zum Containing Block und
           stört position: sticky beim Seitenkopf. */
        animation: einblenden-von-oben .55s ease-out backwards;
    }
}


/* 4. Layout ================================================================ */

.behaelter {
    width: 100%;
    max-width: var(--breite);
    margin-inline: auto;
    padding-inline: var(--raum-inhalt);
}

.abschnitt { padding-block: var(--raum-abschnitt); }

.abschnitt--sand   { background: var(--sand-50); }
.abschnitt--dunkel { background: var(--ink-900); color: var(--sand-100); }
.abschnitt--dunkel h2 { color: var(--weiss); }

/* Einleitung über einem Abschnitt */
.kopfzeile { max-width: 46rem; margin-bottom: 3rem; }
.kopfzeile p { margin-top: 1rem; color: var(--ink-600); font-size: 1.125rem; }
.abschnitt--dunkel .kopfzeile p { color: var(--sand-300); }

.augenbraue {
    display: inline-block;
    margin-bottom: .875rem;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--holz);
}

.abschnitt--dunkel .augenbraue { color: var(--sand-300); }

.nur-fuer-screenreader {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* 5. Komponenten =========================================================== */

/* --- Buttons --- */

.knopf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .8125rem 1.75rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.knopf:active { transform: translateY(1px); }

.knopf--haupt {
    background: var(--ink-900);
    color: var(--weiss);
}
.knopf--haupt:hover { background: var(--holz-tief); }

.knopf--rand {
    border: 1.5px solid var(--ink-900);
    color: var(--ink-900);
}
.knopf--rand:hover { background: var(--ink-900); color: var(--weiss); }

.knopf[disabled] { opacity: .55; cursor: progress; }


/* --- Kopfzeile der Seite --- */

.seitenkopf {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgb(255 255 255 / .88);
    backdrop-filter: blur(10px);
    border-bottom: var(--rahmen);
}

.seitenkopf__innen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4.25rem;
}

.marke {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    line-height: 1.15;
}
.marke__name {
    font-weight: 600;
    font-size: 1.0625rem;
    letter-spacing: -0.01em;
    color: var(--ink-900);
}
.marke__ort {
    font-size: .75rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--holz);
}

/* Auf kleinen Bildschirmen bleibt nur die Handlungsschaltfläche stehen –
   die Abschnittslinks würden auf einer One-Pager-Seite nur Platz kosten. */
.navigation {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.navigation a {
    text-decoration: none;
    font-size: .9375rem;
    color: var(--ink-600);
    transition: color .15s ease;
}
.navigation a:hover { color: var(--ink-900); }

.navigation a:not(.knopf) { display: none; }

.navigation .knopf {
    padding: .5rem 1.125rem;
    font-size: .9375rem;
    color: var(--weiss);
}
.navigation .knopf:hover { color: var(--weiss); }

@media (min-width: 900px) {
    .navigation a:not(.knopf) { display: inline; }
    .navigation .knopf { padding: .5rem 1.25rem; }
}


/* --- Hero --- */

.hero { background: var(--sand-50); border-bottom: var(--rahmen); }

.hero__raster {
    display: grid;
    gap: 2.5rem;
    padding-block: 2.5rem 3.5rem;
}

.hero__bild {
    order: -1;             /* Mobil: Bild zuerst */
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--schatten);
}
.hero__bild img { width: 100%; height: 100%; object-fit: cover; }

.hero__text { align-self: center; }
.hero__text p {
    margin-top: 1.25rem;
    font-size: 1.125rem;
    color: var(--ink-600);
    max-width: 34rem;
}

.hero__status {
    display: inline-flex;
    /* flex-start, damit der Punkt bei zweizeiligem Umbruch (Mobil)
       an der ersten Zeile bleibt statt in der Mitte zu schweben. */
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: 1.25rem;
    padding: .375rem .875rem;
    border-radius: 999px;
    background: var(--holz-hell);
    color: var(--holz-tief);
    font-size: .8125rem;
    font-weight: 600;
}
.hero__status::before {
    content: "";
    flex: none;
    width: .5rem; height: .5rem;
    margin-top: .5em;
    border-radius: 50%;
    background: var(--holz);
}

.hero__aktionen {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 2rem;
}

@media (min-width: 900px) {
    .hero__raster {
        grid-template-columns: 1fr 1.15fr;
        gap: 4rem;
        padding-block: 4rem 5rem;
        align-items: center;
    }
    .hero__bild { order: 0; }
}

/* Eckdaten-Leiste unter dem Hero */
.eckdaten {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--sand-200);
    border-block: 1px solid var(--sand-200);
}
.eckdaten__zelle {
    background: var(--weiss);
    padding: 1.5rem var(--raum-inhalt);
    text-align: center;
}
.eckdaten__wert {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink-900);
}
.eckdaten__bezeichnung {
    /* block, damit die Einblendung greift: transform wirkt nicht auf
       nicht-ersetzte Inline-Elemente – die Bezeichnung würde sonst faden,
       aber nicht mitgleiten. */
    display: block;
    font-size: .875rem;
    color: var(--ink-600);
}

@media (min-width: 768px) {
    .eckdaten { grid-template-columns: repeat(4, 1fr); }
}


/* --- Merkmal-Karten (Ausstattung) --- */

.merkmale {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 620px) { .merkmale { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .merkmale { grid-template-columns: repeat(4, 1fr); } }

.merkmal__symbol {
    display: grid;
    place-items: center;
    width: 2.75rem; height: 2.75rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-klein);
    background: var(--holz-hell);
    color: var(--holz-tief);
}
.merkmal__symbol svg { width: 1.375rem; height: 1.375rem; }

.merkmal p {
    margin-top: .5rem;
    font-size: .9375rem;
    color: var(--ink-600);
}


/* --- Wohnungskarten --- */

.wohnungen {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px)  { .wohnungen { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .wohnungen { grid-template-columns: repeat(3, 1fr); } }

.wohnung {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--weiss);
    border: var(--rahmen);
    border-radius: var(--radius);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.wohnung:hover {
    border-color: var(--sand-300);
    box-shadow: var(--schatten);
}

.wohnung__kopf {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.wohnung__nummer {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: var(--holz);
}
.wohnung__lage { font-size: .875rem; color: var(--ink-600); text-align: right; }

.wohnung__flaeche {
    font-size: 2.25rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ink-900);
    line-height: 1;
}
.wohnung__zimmer {
    margin-top: .375rem;
    font-size: .9375rem;
    color: var(--ink-600);
}

.wohnung__aussen {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: var(--rahmen);
    font-size: .9375rem;
    color: var(--ink-600);
}
.wohnung__aussen svg {
    flex: none;
    width: 1.125rem; height: 1.125rem;
    margin-top: .18rem;
    color: var(--holz);
}

.wohnung__aktion {
    margin-top: auto;
    padding-top: 1.25rem;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--ink-900);
    text-align: left;
    text-decoration: none;
    transition: color .15s ease;
}
.wohnung__aktion:hover { color: var(--holz-tief); }
.wohnung__aktion::after { content: " →"; }


/* --- Zweispaltiger Textabschnitt --- */

.text-zwei-spalten { display: grid; gap: 1.5rem; }
.text-zwei-spalten p { color: var(--ink-600); }

@media (min-width: 900px) {
    .text-zwei-spalten {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
}

/* --- Hervorgehobener Block (E-Mobilität) --- */

.hinweisblock {
    display: grid;
    gap: 1.5rem;
    align-items: center;
}
.hinweisblock p { color: var(--sand-300); font-size: 1.0625rem; max-width: 40rem; }
.hinweisblock__symbol {
    display: grid;
    place-items: center;
    width: 3.5rem; height: 3.5rem;
    border-radius: var(--radius-klein);
    background: rgb(255 255 255 / .08);
    color: var(--sand-200);
}
.hinweisblock__symbol svg { width: 1.75rem; height: 1.75rem; }

@media (min-width: 768px) {
    .hinweisblock { grid-template-columns: auto 1fr; gap: 2rem; }
}


/* 6. Fusszeile ============================================================= */

.seitenfuss {
    padding-block: 3rem;
    background: var(--ink-900);
    color: var(--sand-300);
    font-size: .9375rem;
}
.seitenfuss__innen {
    display: grid;
    gap: 1.5rem;
}
.seitenfuss strong { color: var(--weiss); font-weight: 600; }
.seitenfuss a { color: var(--sand-200); text-decoration-color: var(--ink-600); }
.seitenfuss a:hover { color: var(--weiss); }

.seitenfuss__links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .seitenfuss__innen {
        grid-template-columns: 1fr auto;
        align-items: end;
    }
    .seitenfuss__links { justify-content: flex-end; }
}


/* 7. Formular ============================================================== */

/* Die Karte steht auf weissem Grund und ist deshalb sandfarben getönt –
   die Eingabefelder darin sind umgekehrt weiss (siehe unten).
   Holzfarbene Oberkante und kräftiger Schatten heben sie als
   wichtigstes Element der Seite hervor. */
.formular {
    padding: clamp(1.75rem, 4vw, 3rem);
    background: var(--sand-50);
    border: var(--rahmen);
    border-top: 3px solid var(--holz);
    border-radius: var(--radius);
    box-shadow: var(--schatten-hoch);
}

/* Wer über „WE 3 anfragen" oder „Vormerken" hierher springt, sieht kurz,
   wo er gelandet ist: solange #anfrage in der Adresse steht, trägt die
   Karte einen hellen Ring. */
#anfrage:target .formular {
    box-shadow: 0 0 0 4px var(--holz-hell), var(--schatten-hoch);
}

/* Der Absende-Knopf ist der Zielpunkt der ganzen Seite und darf grösser sein. */
.formular .knopf {
    padding: 1rem 2.25rem;
    font-size: 1.0625rem;
}

@media (max-width: 480px) {
    .formular .knopf { width: 100%; }
}

.feldpaar { display: grid; gap: 1.25rem; }
@media (min-width: 620px) { .feldpaar { grid-template-columns: 1fr 1fr; } }

.feld { margin-bottom: 1.25rem; }
.feld label {
    display: block;
    margin-bottom: .375rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink-800);
}
.feld__optional { font-weight: 400; color: var(--ink-400); }

/* Bewusst ohne [type="..."]: Blazors <InputText> rendert ein <input> ganz
   ohne type-Attribut, wenn man keins angibt – ein Selektor wie
   input[type="text"] greift dort nicht (Attributselektoren prüfen das
   Attribut, nicht den Standardwert). Das Namensfeld blieb dadurch unstyled. */
.feld input,
.feld select,
.feld textarea {
    width: 100%;
    padding: .75rem .875rem;
    background: var(--weiss);
    border: 1.5px solid var(--sand-200);
    border-radius: var(--radius-klein);
    transition: border-color .15s ease;
}

.feld input:focus,
.feld select:focus,
.feld textarea:focus {
    outline: none;
    border-color: var(--holz);
}

.feld textarea { resize: vertical; min-height: 7rem; }

.feld select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235a6467' stroke-width='1.75'%3E%3Cpath d='M4 6.5l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Zustimmung */
.zustimmung {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1.5rem;
    /* Die Karte ist auf dem Desktop rund 1100 px breit. Ohne Begrenzung
       liefe dieser Satz über ~135 Zeichen in einer Zeile – für Fliesstext
       zu lang. Die Karte selbst bleibt in voller Breite. */
    max-width: 75ch;
}
.zustimmung input { flex: none; width: 1.125rem; height: 1.125rem; margin-top: .28rem; accent-color: var(--holz); }
.zustimmung label { font-size: .9375rem; font-weight: 400; color: var(--ink-600); margin: 0; }

/* Honeypot – für Menschen unsichtbar, für Bots verlockend */
.honigtopf {
    position: absolute;
    left: -9999px;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* Rückmeldungen */
.meldung {
    padding: 1rem 1.125rem;
    border-radius: var(--radius-klein);
    font-size: .9375rem;
    margin-bottom: 1.5rem;
}
.meldung--erfolg { background: #eef5ef; color: var(--erfolg); border: 1px solid #cfe3d4; }
.meldung--fehler { background: #fbeeed; color: var(--fehler); border: 1px solid #f0d4d2; }

.formular__hinweis {
    margin-top: 1rem;
    font-size: .8125rem;
    color: var(--ink-400);
    max-width: 75ch;
}

/* Der Kontaktbereich steht auf allen Bildschirmgrössen untereinander:
   erst die Überschrift, darunter das Formular über die volle Breite.
   (Früher standen sie ab 900px nebeneinander.) */


/* 8. Rechtstexte =========================================================== */

.rechtstext { max-width: 46rem; }
.rechtstext h2 { font-size: 1.375rem; margin-top: 2.5rem; }
.rechtstext h3 { margin-top: 1.75rem; }
.rechtstext p, .rechtstext ul { margin-top: .875rem; color: var(--ink-600); }
.rechtstext ul { padding-left: 1.25rem; list-style: disc; }
.rechtstext li { margin-top: .375rem; }
.rechtstext address { font-style: normal; margin-top: .875rem; color: var(--ink-600); }


/* 9. Blazor-Standards ====================================================== */

h1:focus { outline: none; }

.invalid {
    border-color: var(--fehler) !important;
}

.validation-message {
    display: block;
    margin-top: .375rem;
    font-size: .8125rem;
    color: var(--fehler);
}

.blazor-error-boundary {
    padding: 1rem 1.25rem;
    background: var(--fehler);
    color: var(--weiss);
}
.blazor-error-boundary::after { content: "Es ist ein Fehler aufgetreten."; }
