/* ============================================================
   Handwerksvermittlung
   Gestaltung aus der Welt des Fachs: das Aufmassblatt.
   Millimeterraster, Tinte, Masse in Monospace.
   ============================================================ */

:root {
  --papier:   #f0f2ef;
  --blatt:    #fbfcfb;
  --karo:     #dce1dc;
  --karo-fein:#e6eae5;
  --tinte:    #14201d;
  --grau:     #5e6b66;
  --leise:    #8a958f;
  --linie:    #d3d9d3;

  --gruen:    #1f6f5c;   /* Aktion */
  --gruen-hell:#e6f0ec;
  --gelb:     #a97400;   /* offen, wartend */
  --gelb-hell:#fbf3e0;
  --rot:      #a8392b;
  --rot-hell: #fbeeeb;

  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mass: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --bahn: 68rem;
  --radius: 3px;   /* Zeichnungen haben keine runden Ecken */
}

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

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

body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: var(--schrift);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Millimeterraster - nur dort, wo gezeichnet wird */
body.raster {
  background-image:
    linear-gradient(var(--karo-fein) 1px, transparent 1px),
    linear-gradient(90deg, var(--karo-fein) 1px, transparent 1px),
    linear-gradient(var(--karo) 1px, transparent 1px),
    linear-gradient(90deg, var(--karo) 1px, transparent 1px);
  background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
  background-position: -1px -1px;
}

.bahn { max-width: var(--bahn); margin: 0 auto; padding: 0 1.25rem; }
.bahn.schmal { max-width: 38rem; }

.skip {
  position: absolute; left: -9999px;
  background: var(--tinte); color: var(--papier); padding: .6rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 100; }

/* ------------------------------------------------------------- Kopf */

.kopf {
  background: rgba(240, 242, 239, .92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 20;
}
.kopf-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 62px;
}
.marke {
  font-weight: 650; letter-spacing: -.015em; font-size: 1.05rem;
  color: var(--tinte); text-decoration: none;
}
.nav { display: flex; align-items: center; gap: 1.15rem; flex-wrap: wrap; }
.nav a, .linkbtn {
  color: var(--grau); text-decoration: none; font-size: .94rem; font-weight: 500;
}
.nav a:hover, .linkbtn:hover { color: var(--tinte); }
.nav a.cta {
  background: var(--gruen); color: #fff; padding: .48rem 1rem;
  border-radius: var(--radius); font-weight: 600;
}
.nav a.cta:hover { background: #185746; color: #fff; }
.inline { display: inline; }
.linkbtn { background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }

/* ------------------------------------------------------------ Typo */

h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); line-height: 1.15;
     letter-spacing: -.025em; font-weight: 650; margin: 0 0 .75rem; }
h2 { font-size: 1.35rem; letter-spacing: -.015em; font-weight: 620; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.05rem; font-weight: 620; margin: 0 0 .25rem; }
h2.klein { font-size: .8rem; text-transform: uppercase; letter-spacing: .11em;
           color: var(--leise); font-weight: 620; margin: 2rem 0 .7rem; }

.eyebrow {
  font-family: var(--mass); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .16em; color: var(--gruen); margin: 0 0 .9rem;
}
.lead { font-size: 1.12rem; color: var(--grau); max-width: 44rem; margin: 0 0 1.6rem; }
.lead.klein { font-size: 1rem; margin-bottom: 1.5rem; }
.mass { font-family: var(--mass); font-variant-numeric: tabular-nums; font-size: .93em; }
.opt { font-weight: 400; color: var(--leise); font-size: .84em; }
.fussnote { font-size: .88rem; color: var(--grau); margin-top: 1.4rem; }
.fussnote a, .beschreibung a { color: var(--gruen); }

/* ------------------------------------------------------------- Hero */

.hero { padding: 4.5rem 0 3rem; max-width: 44rem; }
.hero h1 { margin-bottom: 1.1rem; }
.knopfreihe { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2rem; }

/* ------------------------------------------------------------ Knopf */

.knopf {
  display: inline-block; background: var(--gruen); color: #fff;
  padding: .72rem 1.5rem; border: 1px solid var(--gruen); border-radius: var(--radius);
  font: inherit; font-weight: 600; font-size: .97rem; text-decoration: none; cursor: pointer;
  transition: background .12s ease;
}
.knopf:hover { background: #185746; }
.knopf.zweit { background: transparent; color: var(--tinte); border-color: var(--linie); }
.knopf.zweit:hover { background: var(--blatt); border-color: var(--grau); }
.knopf.breit { width: 100%; margin-top: 1.2rem; }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--gruen); outline-offset: 2px;
}

/* ---------------------------------------------------------- Ablauf */

.ablauf { padding: 2.5rem 0; border-top: 1px solid var(--linie); }
.schritte { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.6rem;
            grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.schritte li { display: flex; gap: .9rem; align-items: flex-start; }
/* Nummerierung, weil die Schritte tatsaechlich eine Reihenfolge haben */
.nr {
  flex: none; width: 1.7rem; height: 1.7rem; border: 1px solid var(--gruen);
  border-radius: 50%; display: grid; place-items: center;
  font-family: var(--mass); font-size: .8rem; color: var(--gruen); margin-top: .15rem;
}
.schritte p { margin: 0; color: var(--grau); font-size: .94rem; }

/* --------------------------------------------------------- Gewerke */

.gewerke { padding: 2.5rem 0; border-top: 1px solid var(--linie); }
.gewerkliste { list-style: none; padding: 0; margin: 0;
               display: flex; flex-wrap: wrap; gap: .45rem; }
.gewerkliste li {
  background: var(--blatt); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: .3rem .75rem; font-size: .88rem; color: var(--grau);
}

.fuerbetriebe {
  margin: 3rem 0 4rem; padding: 2.2rem; background: var(--blatt);
  border: 1px solid var(--linie); border-radius: var(--radius);
}
.fuerbetriebe h2 { margin-top: 0; }
.fuerbetriebe p { color: var(--grau); max-width: 40rem; }

/* ----------------------------------------------------------- Blatt */

.blatt {
  background: var(--blatt); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 2.2rem; margin: 2.5rem 0 4rem;
  box-shadow: 0 1px 2px rgba(20, 32, 29, .04);
}
/* Signatur: das Anfrageformular ist ein Aufmassblatt mit Heftrand */
.blatt.aufmass { border-left: 3px double var(--gruen); }
.blattkopf { border-bottom: 1px solid var(--linie); padding-bottom: 1.1rem; margin-bottom: 1.6rem; }
.blattkopf h1 { margin: 0; }

/* -------------------------------------------------------- Formular */

.feld { margin-bottom: 1.25rem; }
.feld label, fieldset legend {
  display: block; font-size: .84rem; font-weight: 620; letter-spacing: .01em;
  margin-bottom: .3rem; color: var(--tinte);
}
.hinweis { font-size: .85rem; color: var(--grau); margin: 0 0 .45rem; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], select, textarea {
  width: 100%; background: #fff; border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .62rem .75rem;
  font: inherit; font-size: 1rem; color: var(--tinte);
}
input.mass, select, input[type=date], input[type=number] { font-family: var(--mass); }
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--gruen); }
input[type=file] { font-size: .92rem; }

.reihe { display: grid; grid-template-columns: 8rem 1fr; gap: .9rem; }
.reihe .feld { margin-bottom: 1.25rem; }

fieldset { border: 1px solid var(--linie); border-radius: var(--radius);
           padding: 1.2rem 1.2rem .2rem; margin: 0 0 1.5rem; }
fieldset.rahmenlos { border: 0; padding: 0; }
fieldset legend { padding: 0 .4rem; }
fieldset.rahmenlos legend { padding: 0; }
legend.klein { font-size: .84rem; }

.kaestchen { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .1rem; }
.kaestchen-zeile { display: flex; align-items: center; gap: .55rem; padding: .32rem 0;
                   font-size: .94rem; font-weight: 400; cursor: pointer; margin: 0; }
.kaestchen-zeile input { width: auto; accent-color: var(--gruen); }

.zaehler { font-family: var(--mass); font-size: .78rem; color: var(--leise);
           text-align: right; margin: .25rem 0 0; }
.zaehler.knapp { color: var(--rot); }

.vorschau { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.vorschau img {
  width: 74px; height: 74px; object-fit: cover;
  border: 1px solid var(--linie); border-radius: var(--radius);
}

/* -------------------------------------------------------- Meldungen */

.meldung { padding: .8rem 1rem; border-radius: var(--radius); font-size: .93rem; margin: 0 0 1.4rem; }
.meldung.fehler { background: var(--rot-hell); border-left: 3px solid var(--rot); color: #6f2418; }
.meldung.gut    { background: var(--gruen-hell); border-left: 3px solid var(--gruen); color: #15503f; }

/* ---------------------------------------------------------- Karten */

.karten, .zettel-liste, .betriebe { list-style: none; padding: 0; margin: 1.6rem 0 4rem; display: grid; gap: .8rem; }

.karte, .zettel { background: var(--blatt); border: 1px solid var(--linie); border-radius: var(--radius); }
.karte-link, .zettel-link { display: block; padding: 1.15rem 1.3rem; text-decoration: none; color: inherit; }
.karte:hover, .zettel:hover { border-color: var(--grau); }
.karte-kopf, .zettel-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.karte h2, .zettel h2 { font-size: 1.08rem; margin: 0; }
.karte-meta, .karte-zahlen { margin: .35rem 0 0; font-size: .88rem; color: var(--grau); }
.karte-zahlen strong { color: var(--tinte); font-weight: 620; }

/* Signatur: Anfragen im Posteingang sind Auftragszettel mit perforierter Kante */
.zettel { position: relative; padding-left: 14px; }
.zettel::before {
  content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 2px;
  background-image: radial-gradient(circle, var(--karo) 1px, transparent 1.2px);
  background-size: 2px 7px;
}
.zettel.neu { border-left-color: var(--gruen); }
.zettel-daten { display: flex; flex-wrap: wrap; gap: 0 1.6rem; margin: .7rem 0 .6rem; }
.zettel-daten div { min-width: 0; }
.zettel-daten dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--leise); }
.zettel-daten dd { margin: 0; font-size: .93rem; }
.zettel-text { margin: 0; color: var(--grau); font-size: .92rem; }
.zettel-bilder { margin: .5rem 0 0; color: var(--leise); font-size: .82rem; }

/* --------------------------------------------------------- Marker */

.marker {
  flex: none; font-family: var(--mass); font-size: .72rem; text-transform: uppercase;
  letter-spacing: .07em; padding: .18rem .55rem; border-radius: var(--radius);
}
.marker.open, .marker.neu-marker { background: var(--gelb-hell); color: var(--gelb); }
.marker.gemeldet, .marker.closed { background: var(--gruen-hell); color: var(--gruen); }
.marker.blocked { background: var(--rot-hell); color: var(--rot); }

/* ---------------------------------------------------------- Detail */

.zurueck { margin: 1.8rem 0 .5rem; font-size: .9rem; }
.zurueck a { color: var(--grau); text-decoration: none; }
.zurueck a:hover { color: var(--tinte); }

.detail { background: var(--blatt); border: 1px solid var(--linie); border-radius: var(--radius);
          padding: 2rem; margin-bottom: 2rem; }
.detail-kopf { display: flex; justify-content: space-between; align-items: flex-start;
               gap: 1rem; margin-bottom: 1.4rem; }
.detail-kopf h1 { margin: 0; font-size: 1.7rem; }

.datenblatt { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
              gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--linie);
              border-bottom: 1px solid var(--linie); margin: 0; }
.datenblatt dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--leise); }
.datenblatt dd { margin: .15rem 0 0; font-size: .96rem; }

.beschreibung { white-space: pre-wrap; margin: 0; }

.bilder { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
          gap: .6rem; margin-top: .8rem; }
.bilder img { width: 100%; height: 9rem; object-fit: cover;
              border: 1px solid var(--linie); border-radius: var(--radius); display: block; }

/* --------------------------------------------------- Interessenten */

.interessenten { margin-bottom: 4rem; }
.interessenten .zahl { color: var(--leise); font-weight: 400; }
.betrieb { background: var(--blatt); border: 1px solid var(--linie);
           border-left: 3px solid var(--gruen); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.betrieb h3 { font-size: 1.05rem; }
.kontakt { display: grid; grid-template-columns: 6rem 1fr; gap: .2rem .8rem; margin: .6rem 0 0; }
.kontakt dt { font-size: .78rem; color: var(--leise); }
.kontakt dd { margin: 0; font-size: .94rem; }
.kontakt a { color: var(--gruen); }

.reagieren { background: var(--blatt); border: 1px solid var(--linie);
             border-radius: var(--radius); padding: 1.8rem; margin-bottom: 4rem; }
.reagieren h2 { margin-top: 0; }
.reagieren p { color: var(--grau); max-width: 40rem; }
.gemeldet-kasten h2 { color: var(--gruen); }

.pruefung { background: var(--gelb-hell); border-left: 3px solid var(--gelb);
            border-radius: var(--radius); padding: 1.6rem 1.8rem; margin: 2rem 0 4rem; }
.pruefung h2 { margin-top: 0; }
.pruefung p { margin-bottom: 0; color: #6b4c00; }

/* Leere Zustaende sind eine Einladung zu handeln, keine Entschuldigung */
.leer { text-align: center; padding: 4rem 1rem; border: 1px dashed var(--linie);
        border-radius: var(--radius); margin: 2rem 0 4rem; }
.leer h2 { margin-top: 0; }
.leer p { color: var(--grau); max-width: 30rem; margin: 0 auto 1.4rem; }
.leer-text { color: var(--grau); }

/* ------------------------------------------------------------ Fuss */

.fuss { border-top: 1px solid var(--linie); background: var(--blatt); margin-top: auto; }
.fuss-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .8rem;
              padding-top: 1.4rem; padding-bottom: 1.4rem; font-size: .88rem; color: var(--grau); }
.fuss-links { display: flex; gap: 1.2rem; }
.fuss a { color: var(--grau); text-decoration: none; }
.fuss a:hover { color: var(--tinte); text-decoration: underline; }

body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* ----------------------------------------------------------- Klein */

@media (max-width: 34rem) {
  body { font-size: 16px; }
  .blatt, .detail, .reagieren, .fuerbetriebe { padding: 1.3rem; }
  .hero { padding: 3rem 0 2rem; }
  .reihe { grid-template-columns: 1fr; gap: 0; }
  .kontakt { grid-template-columns: 1fr; }
  .kontakt dt { margin-top: .5rem; }
  .knopfreihe .knopf { flex: 1 1 100%; text-align: center; }
}

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

/* ----------------------------------------------------- Rechtstexte */

.text { max-width: 42rem; margin: 2.5rem 0 4rem; }
.text h2.klein { margin-top: 2.4rem; }
.text h3 { margin: 1.5rem 0 .2rem; font-size: .98rem; }
.text p { margin: 0 0 .9rem; }
.text a { color: var(--gruen); }
.text .anschrift { font-style: normal; line-height: 1.9; }
.text .kontakt { grid-template-columns: 5.5rem 1fr; }
.stand { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--linie);
         font-size: .86rem; color: var(--leise); }

.rechtstabelle { width: 100%; border-collapse: collapse; margin: .6rem 0 1.4rem; font-size: .93rem; }
.rechtstabelle th { text-align: left; font-size: .74rem; text-transform: uppercase;
                    letter-spacing: .09em; color: var(--leise); font-weight: 620;
                    padding: .4rem .8rem .4rem 0; border-bottom: 1px solid var(--linie); }
.rechtstabelle td { padding: .6rem .8rem .6rem 0; border-bottom: 1px solid var(--karo);
                    vertical-align: top; }
.rechtstabelle tr:last-child td { border-bottom: 0; }
.rechtstabelle td:first-child { width: 45%; }

@media (max-width: 34rem) {
  .rechtstabelle, .rechtstabelle tbody, .rechtstabelle tr, .rechtstabelle td { display: block; width: 100%; }
  .rechtstabelle thead { display: none; }
  .rechtstabelle tr { border-bottom: 1px solid var(--linie); padding: .5rem 0; }
  .rechtstabelle td { border: 0; padding: .15rem 0; }
  .rechtstabelle td:first-child { font-weight: 620; width: auto; }
}

/* ----------------------------------------------------------------- Diktat
   Die Knoepfe werden von public/app.js erzeugt und existieren nur, wenn der
   Browser Spracherkennung beherrscht. Ohne JavaScript gibt es sie nicht. */

.diktat {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; margin-top: .4rem;
  border: 1px solid var(--linie); border-radius: 50%;
  background: var(--blatt); color: var(--tinte);
  font-size: 1rem; line-height: 1; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.diktat:hover  { border-color: var(--gruen); background: var(--gruen-hell); }
.diktat:focus-visible { outline: 2px solid var(--gruen); outline-offset: 2px; }

.diktat.hoert {
  border-color: var(--rot); background: var(--rot-hell);
  animation: diktat-puls 1.1s ease-in-out infinite;
}
@keyframes diktat-puls {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 57, 43, .45); }
  50%      { box-shadow: 0 0 0 .35rem rgba(168, 57, 43, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .diktat.hoert { animation: none; }
}

.diktat-hinweis {
  margin: .35rem 0 0; font-size: .85rem; color: var(--rot);
}
.diktat-datenschutz {
  margin: 0 0 1.5rem; padding: .6rem .8rem;
  background: var(--karo-fein); border-left: 3px solid var(--linie);
}

/* ------------------------------------------------------- Bildfelder
   Zwei Dateifelder (Galerie, Kamera) hinter je einem Knopf-Label.
   Nicht display:none - das Feld muss mit der Tastatur erreichbar bleiben. */

.bildfelder { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .8rem; }
.bildfelder .knopf { cursor: pointer; }

.versteckt {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
/* Das Label steht vor dem Feld - deshalb :has(+ ...), nicht der Nachbarselektor. */
.knopf:has(+ .versteckt:focus-visible) { outline: 2px solid var(--gruen); outline-offset: 2px; }

/* ------------------------------------------------ Konto löschen */

.liste { margin: .4rem 0 1.4rem; padding-left: 1.1rem; color: var(--grau); }
.liste li { margin-bottom: .35rem; }

/* Rote Variante des Hauptknopfs. Nur dort, wo etwas unwiederbringlich endet. */
.knopf.gefahr { background: var(--rot); border-color: var(--rot); color: var(--papier); }
.knopf.gefahr:hover { background: #8f3025; border-color: #8f3025; }

/* ------------------------------------ Abschließen / Ablehnen */

/* Zwei Formulare nebeneinander. Getrennte <form>, weil sie an verschiedene
   Routen gehen - ein Formular mit zwei Knöpfen bräuchte JavaScript. */
.aktionen { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }

.filter { margin: -.4rem 0 1.2rem; font-size: .95rem; }
.filter a { color: var(--grau); }
.filter a:hover { color: var(--tinte); }

.abschluss {
  margin-top: 2.4rem; padding-top: 1.6rem;
  border-top: 1px solid var(--linie);
}
.abschluss .leer-text { margin-bottom: 1rem; }
